1 | /* A Bison parser, made by GNU Bison 3.0.4. */ |
2 | |
3 | /* Bison implementation for Yacc-like parsers in C |
4 | |
5 | Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. |
6 | |
7 | This program is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation, either version 3 of the License, or |
10 | (at your option) any later version. |
11 | |
12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. |
16 | |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | |
20 | /* As a special exception, you may create a larger work that contains |
21 | part or all of the Bison parser skeleton and distribute that work |
22 | under terms of your choice, so long as that work isn't itself a |
23 | parser generator using the skeleton or a modified version thereof |
24 | as a parser skeleton. Alternatively, if you modify or redistribute |
25 | the parser skeleton itself, you may (at your option) remove this |
26 | special exception, which will cause the skeleton and the resulting |
27 | Bison output files to be licensed under the GNU General Public |
28 | License without this special exception. |
29 | |
30 | This special exception was added by the Free Software Foundation in |
31 | version 2.2 of Bison. */ |
32 | |
33 | /* C LALR(1) parser skeleton written by Richard Stallman, by |
34 | simplifying the original so-called "semantic" parser. */ |
35 | |
36 | /* All symbols defined below should begin with html or YY, to avoid |
37 | infringing on user name space. This should be done even for local |
38 | variables, as they might otherwise be expanded by user macros. |
39 | There are some unavoidable exceptions within include files to |
40 | define necessary library symbols; they are noted "INFRINGES ON |
41 | USER NAME SPACE" below. */ |
42 | |
43 | /* Identify Bison output. */ |
44 | #define YYBISON 1 |
45 | |
46 | /* Bison version. */ |
47 | #define YYBISON_VERSION "3.0.4" |
48 | |
49 | /* Skeleton name. */ |
50 | #define YYSKELETON_NAME "yacc.c" |
51 | |
52 | /* Pure parsers. */ |
53 | #define YYPURE 0 |
54 | |
55 | /* Push parsers. */ |
56 | #define YYPUSH 0 |
57 | |
58 | /* Pull parsers. */ |
59 | #define YYPULL 1 |
60 | |
61 | |
62 | |
63 | |
64 | /* Copy the first part of user declarations. */ |
65 | #line 14 "htmlparse.y" /* yacc.c:339 */ |
66 | |
67 | |
68 | #include "render.h" |
69 | #include "htmltable.h" |
70 | #include "htmllex.h" |
71 | |
72 | extern int htmlparse(void); |
73 | |
74 | typedef struct sfont_t { |
75 | textfont_t *cfont; |
76 | struct sfont_t *pfont; |
77 | } sfont_t; |
78 | |
79 | static struct { |
80 | htmllabel_t* lbl; /* Generated label */ |
81 | htmltbl_t* tblstack; /* Stack of tables maintained during parsing */ |
82 | Dt_t* fitemList; /* Dictionary for font text items */ |
83 | Dt_t* fspanList; |
84 | agxbuf* str; /* Buffer for text */ |
85 | sfont_t* fontstack; |
86 | GVC_t* gvc; |
87 | } HTMLstate; |
88 | |
89 | /* free_ritem: |
90 | * Free row. This closes and frees row's list, then |
91 | * the pitem itself is freed. |
92 | */ |
93 | static void |
94 | free_ritem(Dt_t* d, pitem* p,Dtdisc_t* ds) |
95 | { |
96 | dtclose (p->u.rp); |
97 | free (p); |
98 | } |
99 | |
100 | /* free_item: |
101 | * Generic Dt free. Only frees container, assuming contents |
102 | * have been copied elsewhere. |
103 | */ |
104 | static void |
105 | free_item(Dt_t* d, void* p,Dtdisc_t* ds) |
106 | { |
107 | free (p); |
108 | } |
109 | |
110 | /* cleanTbl: |
111 | * Clean up table if error in parsing. |
112 | */ |
113 | static void |
114 | cleanTbl (htmltbl_t* tp) |
115 | { |
116 | dtclose (tp->u.p.rows); |
117 | free_html_data (&tp->data); |
118 | free (tp); |
119 | } |
120 | |
121 | /* cleanCell: |
122 | * Clean up cell if error in parsing. |
123 | */ |
124 | static void |
125 | cleanCell (htmlcell_t* cp) |
126 | { |
127 | if (cp->child.kind == HTML_TBL) cleanTbl (cp->child.u.tbl); |
128 | else if (cp->child.kind == HTML_TEXT) free_html_text (cp->child.u.txt); |
129 | free_html_data (&cp->data); |
130 | free (cp); |
131 | } |
132 | |
133 | /* free_citem: |
134 | * Free cell item during parsing. This frees cell and pitem. |
135 | */ |
136 | static void |
137 | free_citem(Dt_t* d, pitem* p,Dtdisc_t* ds) |
138 | { |
139 | cleanCell (p->u.cp); |
140 | free (p); |
141 | } |
142 | |
143 | static Dtdisc_t rowDisc = { |
144 | offsetof(pitem,u), |
145 | sizeof(void*), |
146 | offsetof(pitem,link), |
147 | NIL(Dtmake_f), |
148 | (Dtfree_f)free_ritem, |
149 | NIL(Dtcompar_f), |
150 | NIL(Dthash_f), |
151 | NIL(Dtmemory_f), |
152 | NIL(Dtevent_f) |
153 | }; |
154 | static Dtdisc_t cellDisc = { |
155 | offsetof(pitem,u), |
156 | sizeof(void*), |
157 | offsetof(pitem,link), |
158 | NIL(Dtmake_f), |
159 | (Dtfree_f)free_item, |
160 | NIL(Dtcompar_f), |
161 | NIL(Dthash_f), |
162 | NIL(Dtmemory_f), |
163 | NIL(Dtevent_f) |
164 | }; |
165 | |
166 | typedef struct { |
167 | Dtlink_t link; |
168 | textspan_t ti; |
169 | } fitem; |
170 | |
171 | typedef struct { |
172 | Dtlink_t link; |
173 | htextspan_t lp; |
174 | } fspan; |
175 | |
176 | static void |
177 | free_fitem(Dt_t* d, fitem* p, Dtdisc_t* ds) |
178 | { |
179 | if (p->ti.str) |
180 | free (p->ti.str); |
181 | free (p); |
182 | } |
183 | |
184 | static void |
185 | free_fspan(Dt_t* d, fspan* p, Dtdisc_t* ds) |
186 | { |
187 | textspan_t* ti; |
188 | |
189 | if (p->lp.nitems) { |
190 | int i; |
191 | ti = p->lp.items; |
192 | for (i = 0; i < p->lp.nitems; i++) { |
193 | if (ti->str) free (ti->str); |
194 | ti++; |
195 | } |
196 | free (p->lp.items); |
197 | } |
198 | free (p); |
199 | } |
200 | |
201 | static Dtdisc_t fstrDisc = { |
202 | 0, |
203 | 0, |
204 | offsetof(fitem,link), |
205 | NIL(Dtmake_f), |
206 | (Dtfree_f)free_item, |
207 | NIL(Dtcompar_f), |
208 | NIL(Dthash_f), |
209 | NIL(Dtmemory_f), |
210 | NIL(Dtevent_f) |
211 | }; |
212 | |
213 | |
214 | static Dtdisc_t fspanDisc = { |
215 | 0, |
216 | 0, |
217 | offsetof(fspan,link), |
218 | NIL(Dtmake_f), |
219 | (Dtfree_f)free_item, |
220 | NIL(Dtcompar_f), |
221 | NIL(Dthash_f), |
222 | NIL(Dtmemory_f), |
223 | NIL(Dtevent_f) |
224 | }; |
225 | |
226 | /* appendFItemList: |
227 | * Append a new fitem to the list. |
228 | */ |
229 | static void |
230 | appendFItemList (agxbuf *ag) |
231 | { |
232 | fitem *fi = NEW(fitem); |
233 | |
234 | fi->ti.str = strdup(agxbuse(ag)); |
235 | fi->ti.font = HTMLstate.fontstack->cfont; |
236 | dtinsert(HTMLstate.fitemList, fi); |
237 | } |
238 | |
239 | /* appendFLineList: |
240 | */ |
241 | static void |
242 | appendFLineList (int v) |
243 | { |
244 | int cnt; |
245 | fspan *ln = NEW(fspan); |
246 | fitem *fi; |
247 | Dt_t *ilist = HTMLstate.fitemList; |
248 | |
249 | cnt = dtsize(ilist); |
250 | ln->lp.just = v; |
251 | if (cnt) { |
252 | int i = 0; |
253 | ln->lp.nitems = cnt; |
254 | ln->lp.items = N_NEW(cnt, textspan_t); |
255 | |
256 | fi = (fitem*)dtflatten(ilist); |
257 | for (; fi; fi = (fitem*)dtlink(fitemList,(Dtlink_t*)fi)) { |
258 | /* NOTE: When fitemList is closed, it uses free_item, which only frees the container, |
259 | * not the contents, so this copy is safe. |
260 | */ |
261 | ln->lp.items[i] = fi->ti; |
262 | i++; |
263 | } |
264 | } |
265 | else { |
266 | ln->lp.items = NEW(textspan_t); |
267 | ln->lp.nitems = 1; |
268 | ln->lp.items[0].str = strdup("" ); |
269 | ln->lp.items[0].font = HTMLstate.fontstack->cfont; |
270 | } |
271 | |
272 | dtclear(ilist); |
273 | |
274 | dtinsert(HTMLstate.fspanList, ln); |
275 | } |
276 | |
277 | static htmltxt_t* |
278 | mkText(void) |
279 | { |
280 | int cnt; |
281 | Dt_t * ispan = HTMLstate.fspanList; |
282 | fspan *fl ; |
283 | htmltxt_t *hft = NEW(htmltxt_t); |
284 | |
285 | if (dtsize (HTMLstate.fitemList)) |
286 | appendFLineList (UNSET_ALIGN); |
287 | |
288 | cnt = dtsize(ispan); |
289 | hft->nspans = cnt; |
290 | |
291 | if (cnt) { |
292 | int i = 0; |
293 | hft->spans = N_NEW(cnt,htextspan_t); |
294 | for(fl=(fspan *)dtfirst(ispan); fl; fl=(fspan *)dtnext(ispan,fl)) { |
295 | hft->spans[i] = fl->lp; |
296 | i++; |
297 | } |
298 | } |
299 | |
300 | dtclear(ispan); |
301 | |
302 | return hft; |
303 | } |
304 | |
305 | static pitem* lastRow (void) |
306 | { |
307 | htmltbl_t* tbl = HTMLstate.tblstack; |
308 | pitem* sp = dtlast (tbl->u.p.rows); |
309 | return sp; |
310 | } |
311 | |
312 | /* addRow: |
313 | * Add new cell row to current table. |
314 | */ |
315 | static pitem* addRow (void) |
316 | { |
317 | Dt_t* dp = dtopen(&cellDisc, Dtqueue); |
318 | htmltbl_t* tbl = HTMLstate.tblstack; |
319 | pitem* sp = NEW(pitem); |
320 | sp->u.rp = dp; |
321 | if (tbl->flags & HTML_HRULE) |
322 | sp->ruled = 1; |
323 | dtinsert (tbl->u.p.rows, sp); |
324 | return sp; |
325 | } |
326 | |
327 | /* setCell: |
328 | * Set cell body and type and attach to row |
329 | */ |
330 | static void setCell (htmlcell_t* cp, void* obj, int kind) |
331 | { |
332 | pitem* sp = NEW(pitem); |
333 | htmltbl_t* tbl = HTMLstate.tblstack; |
334 | pitem* rp = (pitem*)dtlast (tbl->u.p.rows); |
335 | Dt_t* row = rp->u.rp; |
336 | sp->u.cp = cp; |
337 | dtinsert (row, sp); |
338 | cp->child.kind = kind; |
339 | if (tbl->flags & HTML_VRULE) |
340 | cp->ruled = HTML_VRULE; |
341 | |
342 | if(kind == HTML_TEXT) |
343 | cp->child.u.txt = (htmltxt_t*)obj; |
344 | else if (kind == HTML_IMAGE) |
345 | cp->child.u.img = (htmlimg_t*)obj; |
346 | else |
347 | cp->child.u.tbl = (htmltbl_t*)obj; |
348 | } |
349 | |
350 | /* mkLabel: |
351 | * Create label, given body and type. |
352 | */ |
353 | static htmllabel_t* mkLabel (void* obj, int kind) |
354 | { |
355 | htmllabel_t* lp = NEW(htmllabel_t); |
356 | |
357 | lp->kind = kind; |
358 | if (kind == HTML_TEXT) |
359 | lp->u.txt = (htmltxt_t*)obj; |
360 | else |
361 | lp->u.tbl = (htmltbl_t*)obj; |
362 | return lp; |
363 | } |
364 | |
365 | /* freeFontstack: |
366 | * Free all stack items but the last, which is |
367 | * put on artificially during in parseHTML. |
368 | */ |
369 | static void |
370 | freeFontstack(void) |
371 | { |
372 | sfont_t* s; |
373 | sfont_t* next; |
374 | |
375 | for (s = HTMLstate.fontstack; (next = s->pfont); s = next) { |
376 | free(s); |
377 | } |
378 | } |
379 | |
380 | /* cleanup: |
381 | * Called on error. Frees resources allocated during parsing. |
382 | * This includes a label, plus a walk down the stack of |
383 | * tables. Note that we use the free_citem function to actually |
384 | * free cells. |
385 | */ |
386 | static void cleanup (void) |
387 | { |
388 | htmltbl_t* tp = HTMLstate.tblstack; |
389 | htmltbl_t* next; |
390 | |
391 | if (HTMLstate.lbl) { |
392 | free_html_label (HTMLstate.lbl,1); |
393 | HTMLstate.lbl = NULL; |
394 | } |
395 | cellDisc.freef = (Dtfree_f)free_citem; |
396 | while (tp) { |
397 | next = tp->u.p.prev; |
398 | cleanTbl (tp); |
399 | tp = next; |
400 | } |
401 | cellDisc.freef = (Dtfree_f)free_item; |
402 | |
403 | fstrDisc.freef = (Dtfree_f)free_fitem; |
404 | dtclear (HTMLstate.fitemList); |
405 | fstrDisc.freef = (Dtfree_f)free_item; |
406 | |
407 | fspanDisc.freef = (Dtfree_f)free_fspan; |
408 | dtclear (HTMLstate.fspanList); |
409 | fspanDisc.freef = (Dtfree_f)free_item; |
410 | |
411 | freeFontstack(); |
412 | } |
413 | |
414 | /* nonSpace: |
415 | * Return 1 if s contains a non-space character. |
416 | */ |
417 | static int nonSpace (char* s) |
418 | { |
419 | char c; |
420 | |
421 | while ((c = *s++)) { |
422 | if (c != ' ') return 1; |
423 | } |
424 | return 0; |
425 | } |
426 | |
427 | /* pushFont: |
428 | * Fonts are allocated in the lexer. |
429 | */ |
430 | static void |
431 | pushFont (textfont_t *fp) |
432 | { |
433 | sfont_t *ft = NEW(sfont_t); |
434 | textfont_t* curfont = HTMLstate.fontstack->cfont; |
435 | textfont_t f = *fp; |
436 | |
437 | if (curfont) { |
438 | if (!f.color && curfont->color) |
439 | f.color = curfont->color; |
440 | if ((f.size < 0.0) && (curfont->size >= 0.0)) |
441 | f.size = curfont->size; |
442 | if (!f.name && curfont->name) |
443 | f.name = curfont->name; |
444 | if (curfont->flags) |
445 | f.flags |= curfont->flags; |
446 | } |
447 | |
448 | ft->cfont = dtinsert(HTMLstate.gvc->textfont_dt, &f); |
449 | ft->pfont = HTMLstate.fontstack; |
450 | HTMLstate.fontstack = ft; |
451 | } |
452 | |
453 | /* popFont: |
454 | */ |
455 | static void |
456 | popFont (void) |
457 | { |
458 | sfont_t* curfont = HTMLstate.fontstack; |
459 | sfont_t* prevfont = curfont->pfont; |
460 | |
461 | free (curfont); |
462 | HTMLstate.fontstack = prevfont; |
463 | } |
464 | |
465 | |
466 | #line 467 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:339 */ |
467 | |
468 | # ifndef YY_NULLPTR |
469 | # if defined __cplusplus && 201103L <= __cplusplus |
470 | # define YY_NULLPTR nullptr |
471 | # else |
472 | # define YY_NULLPTR 0 |
473 | # endif |
474 | # endif |
475 | |
476 | /* Enabling verbose error messages. */ |
477 | #ifdef YYERROR_VERBOSE |
478 | # undef YYERROR_VERBOSE |
479 | # define YYERROR_VERBOSE 1 |
480 | #else |
481 | # define YYERROR_VERBOSE 0 |
482 | #endif |
483 | |
484 | /* In a future release of Bison, this section will be replaced |
485 | by #include "htmlparse.h". */ |
486 | #ifndef YY_YY_WORKSPACE_GRAPHVIZ_BUILD_LIB_COMMON_HTMLPARSE_H_INCLUDED |
487 | # define YY_YY_WORKSPACE_GRAPHVIZ_BUILD_LIB_COMMON_HTMLPARSE_H_INCLUDED |
488 | /* Debug traces. */ |
489 | #ifndef YYDEBUG |
490 | # define YYDEBUG 0 |
491 | #endif |
492 | #if YYDEBUG |
493 | extern int htmldebug; |
494 | #endif |
495 | |
496 | /* Token type. */ |
497 | #ifndef YYTOKENTYPE |
498 | # define YYTOKENTYPE |
499 | enum htmltokentype |
500 | { |
501 | T_end_br = 258, |
502 | T_end_img = 259, |
503 | T_row = 260, |
504 | T_end_row = 261, |
505 | T_html = 262, |
506 | T_end_html = 263, |
507 | T_end_table = 264, |
508 | T_end_cell = 265, |
509 | T_end_font = 266, |
510 | T_string = 267, |
511 | T_error = 268, |
512 | T_n_italic = 269, |
513 | T_n_bold = 270, |
514 | T_n_underline = 271, |
515 | T_n_overline = 272, |
516 | T_n_sup = 273, |
517 | T_n_sub = 274, |
518 | T_n_s = 275, |
519 | T_HR = 276, |
520 | T_hr = 277, |
521 | T_end_hr = 278, |
522 | T_VR = 279, |
523 | T_vr = 280, |
524 | T_end_vr = 281, |
525 | T_BR = 282, |
526 | T_br = 283, |
527 | T_IMG = 284, |
528 | T_img = 285, |
529 | T_table = 286, |
530 | T_cell = 287, |
531 | T_font = 288, |
532 | T_italic = 289, |
533 | T_bold = 290, |
534 | T_underline = 291, |
535 | T_overline = 292, |
536 | T_sup = 293, |
537 | T_sub = 294, |
538 | T_s = 295 |
539 | }; |
540 | #endif |
541 | |
542 | /* Value type. */ |
543 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
544 | |
545 | union YYSTYPE |
546 | { |
547 | #line 415 "htmlparse.y" /* yacc.c:355 */ |
548 | |
549 | int i; |
550 | htmltxt_t* txt; |
551 | htmlcell_t* cell; |
552 | htmltbl_t* tbl; |
553 | textfont_t* font; |
554 | htmlimg_t* img; |
555 | pitem* p; |
556 | |
557 | #line 558 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:355 */ |
558 | }; |
559 | |
560 | typedef union YYSTYPE YYSTYPE; |
561 | # define YYSTYPE_IS_TRIVIAL 1 |
562 | # define YYSTYPE_IS_DECLARED 1 |
563 | #endif |
564 | |
565 | |
566 | extern YYSTYPE htmllval; |
567 | |
568 | int htmlparse (void); |
569 | |
570 | #endif /* !YY_YY_WORKSPACE_GRAPHVIZ_BUILD_LIB_COMMON_HTMLPARSE_H_INCLUDED */ |
571 | |
572 | /* Copy the second part of user declarations. */ |
573 | |
574 | #line 575 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:358 */ |
575 | |
576 | #ifdef short |
577 | # undef short |
578 | #endif |
579 | |
580 | #ifdef YYTYPE_UINT8 |
581 | typedef YYTYPE_UINT8 htmltype_uint8; |
582 | #else |
583 | typedef unsigned char htmltype_uint8; |
584 | #endif |
585 | |
586 | #ifdef YYTYPE_INT8 |
587 | typedef YYTYPE_INT8 htmltype_int8; |
588 | #else |
589 | typedef signed char htmltype_int8; |
590 | #endif |
591 | |
592 | #ifdef YYTYPE_UINT16 |
593 | typedef YYTYPE_UINT16 htmltype_uint16; |
594 | #else |
595 | typedef unsigned short int htmltype_uint16; |
596 | #endif |
597 | |
598 | #ifdef YYTYPE_INT16 |
599 | typedef YYTYPE_INT16 htmltype_int16; |
600 | #else |
601 | typedef short int htmltype_int16; |
602 | #endif |
603 | |
604 | #ifndef YYSIZE_T |
605 | # ifdef __SIZE_TYPE__ |
606 | # define YYSIZE_T __SIZE_TYPE__ |
607 | # elif defined size_t |
608 | # define YYSIZE_T size_t |
609 | # elif ! defined YYSIZE_T |
610 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
611 | # define YYSIZE_T size_t |
612 | # else |
613 | # define YYSIZE_T unsigned int |
614 | # endif |
615 | #endif |
616 | |
617 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
618 | |
619 | #ifndef YY_ |
620 | # if defined YYENABLE_NLS && YYENABLE_NLS |
621 | # if ENABLE_NLS |
622 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
623 | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
624 | # endif |
625 | # endif |
626 | # ifndef YY_ |
627 | # define YY_(Msgid) Msgid |
628 | # endif |
629 | #endif |
630 | |
631 | #ifndef YY_ATTRIBUTE |
632 | # if (defined __GNUC__ \ |
633 | && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ |
634 | || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C |
635 | # define YY_ATTRIBUTE(Spec) __attribute__(Spec) |
636 | # else |
637 | # define YY_ATTRIBUTE(Spec) /* empty */ |
638 | # endif |
639 | #endif |
640 | |
641 | #ifndef YY_ATTRIBUTE_PURE |
642 | # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) |
643 | #endif |
644 | |
645 | #ifndef YY_ATTRIBUTE_UNUSED |
646 | # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) |
647 | #endif |
648 | |
649 | #if !defined _Noreturn \ |
650 | && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) |
651 | # if defined _MSC_VER && 1200 <= _MSC_VER |
652 | # define _Noreturn __declspec (noreturn) |
653 | # else |
654 | # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) |
655 | # endif |
656 | #endif |
657 | |
658 | /* Suppress unused-variable warnings by "using" E. */ |
659 | #if ! defined lint || defined __GNUC__ |
660 | # define YYUSE(E) ((void) (E)) |
661 | #else |
662 | # define YYUSE(E) /* empty */ |
663 | #endif |
664 | |
665 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ |
666 | /* Suppress an incorrect diagnostic about htmllval being uninitialized. */ |
667 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
668 | _Pragma ("GCC diagnostic push") \ |
669 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ |
670 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
671 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
672 | _Pragma ("GCC diagnostic pop") |
673 | #else |
674 | # define YY_INITIAL_VALUE(Value) Value |
675 | #endif |
676 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
677 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
678 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
679 | #endif |
680 | #ifndef YY_INITIAL_VALUE |
681 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
682 | #endif |
683 | |
684 | |
685 | #if ! defined htmloverflow || YYERROR_VERBOSE |
686 | |
687 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
688 | |
689 | # ifdef YYSTACK_USE_ALLOCA |
690 | # if YYSTACK_USE_ALLOCA |
691 | # ifdef __GNUC__ |
692 | # define YYSTACK_ALLOC __builtin_alloca |
693 | # elif defined __BUILTIN_VA_ARG_INCR |
694 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
695 | # elif defined _AIX |
696 | # define YYSTACK_ALLOC __alloca |
697 | # elif defined _MSC_VER |
698 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
699 | # define alloca _alloca |
700 | # else |
701 | # define YYSTACK_ALLOC alloca |
702 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
703 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
704 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
705 | # ifndef EXIT_SUCCESS |
706 | # define EXIT_SUCCESS 0 |
707 | # endif |
708 | # endif |
709 | # endif |
710 | # endif |
711 | # endif |
712 | |
713 | # ifdef YYSTACK_ALLOC |
714 | /* Pacify GCC's 'empty if-body' warning. */ |
715 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
716 | # ifndef YYSTACK_ALLOC_MAXIMUM |
717 | /* The OS might guarantee only one guard page at the bottom of the stack, |
718 | and a page size can be as small as 4096 bytes. So we cannot safely |
719 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
720 | to allow for a few compiler-allocated temporary stack slots. */ |
721 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
722 | # endif |
723 | # else |
724 | # define YYSTACK_ALLOC YYMALLOC |
725 | # define YYSTACK_FREE YYFREE |
726 | # ifndef YYSTACK_ALLOC_MAXIMUM |
727 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
728 | # endif |
729 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
730 | && ! ((defined YYMALLOC || defined malloc) \ |
731 | && (defined YYFREE || defined free))) |
732 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
733 | # ifndef EXIT_SUCCESS |
734 | # define EXIT_SUCCESS 0 |
735 | # endif |
736 | # endif |
737 | # ifndef YYMALLOC |
738 | # define YYMALLOC malloc |
739 | # if ! defined malloc && ! defined EXIT_SUCCESS |
740 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
741 | # endif |
742 | # endif |
743 | # ifndef YYFREE |
744 | # define YYFREE free |
745 | # if ! defined free && ! defined EXIT_SUCCESS |
746 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
747 | # endif |
748 | # endif |
749 | # endif |
750 | #endif /* ! defined htmloverflow || YYERROR_VERBOSE */ |
751 | |
752 | |
753 | #if (! defined htmloverflow \ |
754 | && (! defined __cplusplus \ |
755 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
756 | |
757 | /* A type that is properly aligned for any stack member. */ |
758 | union htmlalloc |
759 | { |
760 | htmltype_int16 htmlss_alloc; |
761 | YYSTYPE htmlvs_alloc; |
762 | }; |
763 | |
764 | /* The size of the maximum gap between one aligned stack and the next. */ |
765 | # define YYSTACK_GAP_MAXIMUM (sizeof (union htmlalloc) - 1) |
766 | |
767 | /* The size of an array large to enough to hold all stacks, each with |
768 | N elements. */ |
769 | # define YYSTACK_BYTES(N) \ |
770 | ((N) * (sizeof (htmltype_int16) + sizeof (YYSTYPE)) \ |
771 | + YYSTACK_GAP_MAXIMUM) |
772 | |
773 | # define YYCOPY_NEEDED 1 |
774 | |
775 | /* Relocate STACK from its old location to the new one. The |
776 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
777 | elements in the stack, and YYPTR gives the new location of the |
778 | stack. Advance YYPTR to a properly aligned location for the next |
779 | stack. */ |
780 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
781 | do \ |
782 | { \ |
783 | YYSIZE_T htmlnewbytes; \ |
784 | YYCOPY (&htmlptr->Stack_alloc, Stack, htmlsize); \ |
785 | Stack = &htmlptr->Stack_alloc; \ |
786 | htmlnewbytes = htmlstacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
787 | htmlptr += htmlnewbytes / sizeof (*htmlptr); \ |
788 | } \ |
789 | while (0) |
790 | |
791 | #endif |
792 | |
793 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
794 | /* Copy COUNT objects from SRC to DST. The source and destination do |
795 | not overlap. */ |
796 | # ifndef YYCOPY |
797 | # if defined __GNUC__ && 1 < __GNUC__ |
798 | # define YYCOPY(Dst, Src, Count) \ |
799 | __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) |
800 | # else |
801 | # define YYCOPY(Dst, Src, Count) \ |
802 | do \ |
803 | { \ |
804 | YYSIZE_T htmli; \ |
805 | for (htmli = 0; htmli < (Count); htmli++) \ |
806 | (Dst)[htmli] = (Src)[htmli]; \ |
807 | } \ |
808 | while (0) |
809 | # endif |
810 | # endif |
811 | #endif /* !YYCOPY_NEEDED */ |
812 | |
813 | /* YYFINAL -- State number of the termination state. */ |
814 | #define YYFINAL 31 |
815 | /* YYLAST -- Last index in YYTABLE. */ |
816 | #define YYLAST 271 |
817 | |
818 | /* YYNTOKENS -- Number of terminals. */ |
819 | #define YYNTOKENS 41 |
820 | /* YYNNTS -- Number of nonterminals. */ |
821 | #define YYNNTS 39 |
822 | /* YYNRULES -- Number of rules. */ |
823 | #define YYNRULES 69 |
824 | /* YYNSTATES -- Number of states. */ |
825 | #define YYNSTATES 116 |
826 | |
827 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned |
828 | by htmllex, with out-of-bounds checking. */ |
829 | #define YYUNDEFTOK 2 |
830 | #define YYMAXUTOK 295 |
831 | |
832 | #define YYTRANSLATE(YYX) \ |
833 | ((unsigned int) (YYX) <= YYMAXUTOK ? htmltranslate[YYX] : YYUNDEFTOK) |
834 | |
835 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
836 | as returned by htmllex, without out-of-bounds checking. */ |
837 | static const htmltype_uint8 htmltranslate[] = |
838 | { |
839 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
840 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
841 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
842 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
843 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
844 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
845 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
846 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
847 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
848 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
849 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
850 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
851 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
852 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
853 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
854 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
855 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
856 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
857 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
858 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
859 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
860 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
861 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
862 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
863 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
864 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
865 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
866 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
867 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
868 | 35, 36, 37, 38, 39, 40 |
869 | }; |
870 | |
871 | #if YYDEBUG |
872 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
873 | static const htmltype_uint16 htmlrline[] = |
874 | { |
875 | 0, 447, 447, 448, 449, 452, 455, 456, 459, 460, |
876 | 461, 462, 463, 464, 465, 466, 467, 468, 471, 474, |
877 | 477, 480, 483, 486, 489, 492, 495, 498, 501, 504, |
878 | 507, 510, 513, 516, 519, 520, 523, 524, 527, 527, |
879 | 548, 549, 550, 551, 552, 553, 556, 557, 560, 561, |
880 | 562, 565, 565, 568, 569, 570, 573, 573, 574, 574, |
881 | 575, 575, 576, 576, 579, 580, 583, 584, 587, 588 |
882 | }; |
883 | #endif |
884 | |
885 | #if YYDEBUG || YYERROR_VERBOSE || 0 |
886 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
887 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
888 | static const char *const htmltname[] = |
889 | { |
890 | "$end" , "error" , "$undefined" , "T_end_br" , "T_end_img" , "T_row" , |
891 | "T_end_row" , "T_html" , "T_end_html" , "T_end_table" , "T_end_cell" , |
892 | "T_end_font" , "T_string" , "T_error" , "T_n_italic" , "T_n_bold" , |
893 | "T_n_underline" , "T_n_overline" , "T_n_sup" , "T_n_sub" , "T_n_s" , "T_HR" , |
894 | "T_hr" , "T_end_hr" , "T_VR" , "T_vr" , "T_end_vr" , "T_BR" , "T_br" , "T_IMG" , |
895 | "T_img" , "T_table" , "T_cell" , "T_font" , "T_italic" , "T_bold" , |
896 | "T_underline" , "T_overline" , "T_sup" , "T_sub" , "T_s" , "$accept" , "html" , |
897 | "fonttext" , "text" , "textitem" , "font" , "n_font" , "italic" , "n_italic" , |
898 | "bold" , "n_bold" , "strike" , "n_strike" , "underline" , "n_underline" , |
899 | "overline" , "n_overline" , "sup" , "n_sup" , "sub" , "n_sub" , "br" , "string" , |
900 | "table" , "@1" , "fonttable" , "opt_space" , "rows" , "row" , "$@2" , "cells" , |
901 | "cell" , "$@3" , "$@4" , "$@5" , "$@6" , "image" , "HR" , "VR" , YY_NULLPTR |
902 | }; |
903 | #endif |
904 | |
905 | # ifdef YYPRINT |
906 | /* YYTOKNUM[NUM] -- (External) token number corresponding to the |
907 | (internal) symbol number NUM (which must be that of a token). */ |
908 | static const htmltype_uint16 htmltoknum[] = |
909 | { |
910 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
911 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
912 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
913 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
914 | 295 |
915 | }; |
916 | # endif |
917 | |
918 | #define YYPACT_NINF -82 |
919 | |
920 | #define htmlpact_value_is_default(Yystate) \ |
921 | (!!((Yystate) == (-82))) |
922 | |
923 | #define YYTABLE_NINF -63 |
924 | |
925 | #define htmltable_value_is_error(Yytable_value) \ |
926 | 0 |
927 | |
928 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
929 | STATE-NUM. */ |
930 | static const htmltype_int16 htmlpact[] = |
931 | { |
932 | 8, -82, 209, 10, -82, -82, 11, -82, -82, -82, |
933 | -82, -82, -82, -82, -82, 5, 209, -82, 209, 209, |
934 | 209, 209, 209, 209, 209, 209, -82, -5, -82, 14, |
935 | -20, -82, -82, -82, -82, 209, 209, 209, 209, 209, |
936 | 13, 37, 12, 66, 16, 80, 19, 109, 123, 20, |
937 | 152, 15, 166, 195, -82, -82, -82, -82, -82, -82, |
938 | -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, |
939 | -82, -82, -82, -82, -82, -82, -82, -82, 23, -82, |
940 | 119, -82, 7, 46, -82, 38, -82, 23, 17, 35, |
941 | -82, 13, -82, -82, -82, -82, 58, -82, -82, 53, |
942 | -82, -82, -82, 40, -82, 7, -82, 59, 69, -82, |
943 | 72, -82, -82, -82, -82, -82 |
944 | }; |
945 | |
946 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
947 | Performed when YYTABLE does not specify something else to do. Zero |
948 | means the default is an error. */ |
949 | static const htmltype_uint8 htmldefact[] = |
950 | { |
951 | 0, 4, 47, 0, 36, 35, 0, 18, 20, 22, |
952 | 26, 28, 30, 32, 24, 0, 5, 7, 47, 47, |
953 | 47, 0, 47, 47, 0, 0, 9, 8, 40, 0, |
954 | 0, 1, 34, 2, 6, 0, 0, 0, 0, 0, |
955 | 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
956 | 0, 0, 0, 0, 37, 3, 38, 19, 10, 41, |
957 | 21, 11, 42, 23, 14, 45, 25, 17, 27, 12, |
958 | 43, 29, 13, 44, 31, 15, 33, 16, 0, 51, |
959 | 0, 48, 0, 47, 67, 0, 49, 0, 47, 0, |
960 | 53, 46, 39, 66, 50, 65, 0, 58, 56, 0, |
961 | 60, 52, 69, 0, 54, 0, 64, 0, 0, 63, |
962 | 0, 68, 55, 59, 57, 61 |
963 | }; |
964 | |
965 | /* YYPGOTO[NTERM-NUM]. */ |
966 | static const htmltype_int16 htmlpgoto[] = |
967 | { |
968 | -82, -82, -4, 232, -10, -1, 26, 0, 39, 1, |
969 | 50, -82, -82, 2, 36, 3, 47, -82, -82, -82, |
970 | -82, -82, -2, 148, -82, 9, 27, -82, -68, -82, |
971 | -82, -81, -82, -82, -82, -82, -82, -82, -82 |
972 | }; |
973 | |
974 | /* YYDEFGOTO[NTERM-NUM]. */ |
975 | static const htmltype_int8 htmldefgoto[] = |
976 | { |
977 | -1, 3, 15, 16, 17, 35, 58, 36, 61, 37, |
978 | 64, 21, 67, 38, 69, 39, 72, 24, 75, 25, |
979 | 77, 26, 40, 28, 78, 29, 30, 80, 81, 82, |
980 | 89, 90, 108, 107, 110, 99, 100, 87, 105 |
981 | }; |
982 | |
983 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
984 | positive, shift that token. If negative, reduce the rule whose |
985 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
986 | static const htmltype_int8 htmltable[] = |
987 | { |
988 | 27, 18, 19, 20, 22, 23, 34, 54, 104, 1, |
989 | 31, 56, 86, 33, 32, 2, 27, 27, 27, 94, |
990 | 27, 27, 55, 57, 112, 54, -46, -62, 79, 4, |
991 | 60, 34, 71, 34, 63, 34, 68, 34, 34, 88, |
992 | 34, 101, 34, 34, 5, 6, 95, 96, 57, 4, |
993 | 7, 8, 9, 10, 11, 12, 13, 14, 4, 102, |
994 | 103, 93, 106, 109, 5, 6, 111, 88, 59, 113, |
995 | 7, 8, 9, 10, 11, 12, 13, 14, 4, 114, |
996 | 60, 91, 115, 62, 97, 70, 27, 18, 19, 20, |
997 | 22, 23, 4, 5, 6, 63, 65, 98, 73, 7, |
998 | 8, 9, 10, 11, 12, 13, 14, 5, 6, 0, |
999 | 92, 0, 0, 7, 8, 9, 10, 11, 12, 13, |
1000 | 14, 4, 0, 0, 79, 0, 0, 0, 83, 66, |
1001 | 0, 0, 0, 0, 0, 4, 5, 6, 0, 68, |
1002 | 84, 85, 7, 8, 9, 10, 11, 12, 13, 14, |
1003 | 5, 6, 0, 0, 0, 0, 7, 8, 9, 10, |
1004 | 11, 12, 13, 14, 4, 0, 42, 44, 46, 71, |
1005 | 49, 51, 0, 0, 0, 0, 0, 0, 4, 5, |
1006 | 6, 0, 0, 0, 74, 7, 8, 9, 10, 11, |
1007 | 12, 13, 14, 5, 6, 0, 0, 0, 0, 7, |
1008 | 8, 9, 10, 11, 12, 13, 14, 4, 0, 0, |
1009 | 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, |
1010 | 0, 4, 5, 6, 0, 0, 0, 0, 7, 8, |
1011 | 9, 10, 11, 12, 13, 14, 5, 6, 0, 0, |
1012 | 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, |
1013 | 41, 43, 45, 47, 48, 50, 52, 53, 0, 0, |
1014 | 0, 0, 0, 0, 0, 0, 0, 41, 43, 45, |
1015 | 48, 50 |
1016 | }; |
1017 | |
1018 | static const htmltype_int8 htmlcheck[] = |
1019 | { |
1020 | 2, 2, 2, 2, 2, 2, 16, 12, 89, 1, |
1021 | 0, 31, 80, 8, 3, 7, 18, 19, 20, 87, |
1022 | 22, 23, 8, 11, 105, 12, 31, 10, 5, 12, |
1023 | 14, 41, 17, 43, 15, 45, 16, 47, 48, 32, |
1024 | 50, 6, 52, 53, 27, 28, 29, 30, 11, 12, |
1025 | 33, 34, 35, 36, 37, 38, 39, 40, 12, 24, |
1026 | 25, 23, 4, 10, 27, 28, 26, 32, 42, 10, |
1027 | 33, 34, 35, 36, 37, 38, 39, 40, 12, 10, |
1028 | 14, 83, 10, 44, 88, 49, 88, 88, 88, 88, |
1029 | 88, 88, 12, 27, 28, 15, 46, 88, 51, 33, |
1030 | 34, 35, 36, 37, 38, 39, 40, 27, 28, -1, |
1031 | 83, -1, -1, 33, 34, 35, 36, 37, 38, 39, |
1032 | 40, 12, -1, -1, 5, -1, -1, -1, 9, 20, |
1033 | -1, -1, -1, -1, -1, 12, 27, 28, -1, 16, |
1034 | 21, 22, 33, 34, 35, 36, 37, 38, 39, 40, |
1035 | 27, 28, -1, -1, -1, -1, 33, 34, 35, 36, |
1036 | 37, 38, 39, 40, 12, -1, 18, 19, 20, 17, |
1037 | 22, 23, -1, -1, -1, -1, -1, -1, 12, 27, |
1038 | 28, -1, -1, -1, 18, 33, 34, 35, 36, 37, |
1039 | 38, 39, 40, 27, 28, -1, -1, -1, -1, 33, |
1040 | 34, 35, 36, 37, 38, 39, 40, 12, -1, -1, |
1041 | -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, |
1042 | -1, 12, 27, 28, -1, -1, -1, -1, 33, 34, |
1043 | 35, 36, 37, 38, 39, 40, 27, 28, -1, -1, |
1044 | -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, |
1045 | 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, |
1046 | -1, -1, -1, -1, -1, -1, -1, 35, 36, 37, |
1047 | 38, 39 |
1048 | }; |
1049 | |
1050 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
1051 | symbol of state STATE-NUM. */ |
1052 | static const htmltype_uint8 htmlstos[] = |
1053 | { |
1054 | 0, 1, 7, 42, 12, 27, 28, 33, 34, 35, |
1055 | 36, 37, 38, 39, 40, 43, 44, 45, 46, 48, |
1056 | 50, 52, 54, 56, 58, 60, 62, 63, 64, 66, |
1057 | 67, 0, 3, 8, 45, 46, 48, 50, 54, 56, |
1058 | 63, 44, 64, 44, 64, 44, 64, 44, 44, 64, |
1059 | 44, 64, 44, 44, 12, 8, 31, 11, 47, 47, |
1060 | 14, 49, 49, 15, 51, 51, 20, 53, 16, 55, |
1061 | 55, 17, 57, 57, 18, 59, 19, 61, 65, 5, |
1062 | 68, 69, 70, 9, 21, 22, 69, 78, 32, 71, |
1063 | 72, 63, 67, 23, 69, 29, 30, 43, 66, 76, |
1064 | 77, 6, 24, 25, 72, 79, 4, 74, 73, 10, |
1065 | 75, 26, 72, 10, 10, 10 |
1066 | }; |
1067 | |
1068 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
1069 | static const htmltype_uint8 htmlr1[] = |
1070 | { |
1071 | 0, 41, 42, 42, 42, 43, 44, 44, 45, 45, |
1072 | 45, 45, 45, 45, 45, 45, 45, 45, 46, 47, |
1073 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
1074 | 58, 59, 60, 61, 62, 62, 63, 63, 65, 64, |
1075 | 66, 66, 66, 66, 66, 66, 67, 67, 68, 68, |
1076 | 68, 70, 69, 71, 71, 71, 73, 72, 74, 72, |
1077 | 75, 72, 76, 72, 77, 77, 78, 78, 79, 79 |
1078 | }; |
1079 | |
1080 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
1081 | static const htmltype_uint8 htmlr2[] = |
1082 | { |
1083 | 0, 2, 3, 3, 1, 1, 2, 1, 1, 1, |
1084 | 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, |
1085 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
1086 | 1, 1, 1, 1, 2, 1, 1, 2, 0, 6, |
1087 | 1, 3, 3, 3, 3, 3, 1, 0, 1, 2, |
1088 | 3, 0, 4, 1, 2, 3, 0, 4, 0, 4, |
1089 | 0, 4, 0, 3, 2, 1, 2, 1, 2, 1 |
1090 | }; |
1091 | |
1092 | |
1093 | #define htmlerrok (htmlerrstatus = 0) |
1094 | #define htmlclearin (htmlchar = YYEMPTY) |
1095 | #define YYEMPTY (-2) |
1096 | #define YYEOF 0 |
1097 | |
1098 | #define YYACCEPT goto htmlacceptlab |
1099 | #define YYABORT goto htmlabortlab |
1100 | #define YYERROR goto htmlerrorlab |
1101 | |
1102 | |
1103 | #define YYRECOVERING() (!!htmlerrstatus) |
1104 | |
1105 | #define YYBACKUP(Token, Value) \ |
1106 | do \ |
1107 | if (htmlchar == YYEMPTY) \ |
1108 | { \ |
1109 | htmlchar = (Token); \ |
1110 | htmllval = (Value); \ |
1111 | YYPOPSTACK (htmllen); \ |
1112 | htmlstate = *htmlssp; \ |
1113 | goto htmlbackup; \ |
1114 | } \ |
1115 | else \ |
1116 | { \ |
1117 | htmlerror (YY_("syntax error: cannot back up")); \ |
1118 | YYERROR; \ |
1119 | } \ |
1120 | while (0) |
1121 | |
1122 | /* Error token number */ |
1123 | #define YYTERROR 1 |
1124 | #define YYERRCODE 256 |
1125 | |
1126 | |
1127 | |
1128 | /* Enable debugging if requested. */ |
1129 | #if YYDEBUG |
1130 | |
1131 | # ifndef YYFPRINTF |
1132 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
1133 | # define YYFPRINTF fprintf |
1134 | # endif |
1135 | |
1136 | # define YYDPRINTF(Args) \ |
1137 | do { \ |
1138 | if (htmldebug) \ |
1139 | YYFPRINTF Args; \ |
1140 | } while (0) |
1141 | |
1142 | /* This macro is provided for backward compatibility. */ |
1143 | #ifndef YY_LOCATION_PRINT |
1144 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
1145 | #endif |
1146 | |
1147 | |
1148 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
1149 | do { \ |
1150 | if (htmldebug) \ |
1151 | { \ |
1152 | YYFPRINTF (stderr, "%s ", Title); \ |
1153 | html_symbol_print (stderr, \ |
1154 | Type, Value); \ |
1155 | YYFPRINTF (stderr, "\n"); \ |
1156 | } \ |
1157 | } while (0) |
1158 | |
1159 | |
1160 | /*----------------------------------------. |
1161 | | Print this symbol's value on YYOUTPUT. | |
1162 | `----------------------------------------*/ |
1163 | |
1164 | static void |
1165 | html_symbol_value_print (FILE *htmloutput, int htmltype, YYSTYPE const * const htmlvaluep) |
1166 | { |
1167 | FILE *htmlo = htmloutput; |
1168 | YYUSE (htmlo); |
1169 | if (!htmlvaluep) |
1170 | return; |
1171 | # ifdef YYPRINT |
1172 | if (htmltype < YYNTOKENS) |
1173 | YYPRINT (htmloutput, htmltoknum[htmltype], *htmlvaluep); |
1174 | # endif |
1175 | YYUSE (htmltype); |
1176 | } |
1177 | |
1178 | |
1179 | /*--------------------------------. |
1180 | | Print this symbol on YYOUTPUT. | |
1181 | `--------------------------------*/ |
1182 | |
1183 | static void |
1184 | html_symbol_print (FILE *htmloutput, int htmltype, YYSTYPE const * const htmlvaluep) |
1185 | { |
1186 | YYFPRINTF (htmloutput, "%s %s (" , |
1187 | htmltype < YYNTOKENS ? "token" : "nterm" , htmltname[htmltype]); |
1188 | |
1189 | html_symbol_value_print (htmloutput, htmltype, htmlvaluep); |
1190 | YYFPRINTF (htmloutput, ")" ); |
1191 | } |
1192 | |
1193 | /*------------------------------------------------------------------. |
1194 | | html_stack_print -- Print the state stack from its BOTTOM up to its | |
1195 | | TOP (included). | |
1196 | `------------------------------------------------------------------*/ |
1197 | |
1198 | static void |
1199 | html_stack_print (htmltype_int16 *htmlbottom, htmltype_int16 *htmltop) |
1200 | { |
1201 | YYFPRINTF (stderr, "Stack now" ); |
1202 | for (; htmlbottom <= htmltop; htmlbottom++) |
1203 | { |
1204 | int htmlbot = *htmlbottom; |
1205 | YYFPRINTF (stderr, " %d" , htmlbot); |
1206 | } |
1207 | YYFPRINTF (stderr, "\n" ); |
1208 | } |
1209 | |
1210 | # define YY_STACK_PRINT(Bottom, Top) \ |
1211 | do { \ |
1212 | if (htmldebug) \ |
1213 | html_stack_print ((Bottom), (Top)); \ |
1214 | } while (0) |
1215 | |
1216 | |
1217 | /*------------------------------------------------. |
1218 | | Report that the YYRULE is going to be reduced. | |
1219 | `------------------------------------------------*/ |
1220 | |
1221 | static void |
1222 | html_reduce_print (htmltype_int16 *htmlssp, YYSTYPE *htmlvsp, int htmlrule) |
1223 | { |
1224 | uint_64_t htmllno = htmlrline[htmlrule]; |
1225 | int htmlnrhs = htmlr2[htmlrule]; |
1226 | int htmli; |
1227 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n" , |
1228 | htmlrule - 1, htmllno); |
1229 | /* The symbols being reduced. */ |
1230 | for (htmli = 0; htmli < htmlnrhs; htmli++) |
1231 | { |
1232 | YYFPRINTF (stderr, " $%d = " , htmli + 1); |
1233 | html_symbol_print (stderr, |
1234 | htmlstos[htmlssp[htmli + 1 - htmlnrhs]], |
1235 | &(htmlvsp[(htmli + 1) - (htmlnrhs)]) |
1236 | ); |
1237 | YYFPRINTF (stderr, "\n" ); |
1238 | } |
1239 | } |
1240 | |
1241 | # define YY_REDUCE_PRINT(Rule) \ |
1242 | do { \ |
1243 | if (htmldebug) \ |
1244 | html_reduce_print (htmlssp, htmlvsp, Rule); \ |
1245 | } while (0) |
1246 | |
1247 | /* Nonzero means print parse trace. It is left uninitialized so that |
1248 | multiple parsers can coexist. */ |
1249 | int htmldebug; |
1250 | #else /* !YYDEBUG */ |
1251 | # define YYDPRINTF(Args) |
1252 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
1253 | # define YY_STACK_PRINT(Bottom, Top) |
1254 | # define YY_REDUCE_PRINT(Rule) |
1255 | #endif /* !YYDEBUG */ |
1256 | |
1257 | |
1258 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
1259 | #ifndef YYINITDEPTH |
1260 | # define YYINITDEPTH 200 |
1261 | #endif |
1262 | |
1263 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
1264 | if the built-in stack extension method is used). |
1265 | |
1266 | Do not make this value too large; the results are undefined if |
1267 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
1268 | evaluated with infinite-precision integer arithmetic. */ |
1269 | |
1270 | #ifndef YYMAXDEPTH |
1271 | # define YYMAXDEPTH 10000 |
1272 | #endif |
1273 | |
1274 | |
1275 | #if YYERROR_VERBOSE |
1276 | |
1277 | # ifndef htmlstrlen |
1278 | # if defined __GLIBC__ && defined _STRING_H |
1279 | # define htmlstrlen strlen |
1280 | # else |
1281 | /* Return the length of YYSTR. */ |
1282 | static YYSIZE_T |
1283 | htmlstrlen (const char *htmlstr) |
1284 | { |
1285 | YYSIZE_T htmllen; |
1286 | for (htmllen = 0; htmlstr[htmllen]; htmllen++) |
1287 | continue; |
1288 | return htmllen; |
1289 | } |
1290 | # endif |
1291 | # endif |
1292 | |
1293 | # ifndef htmlstpcpy |
1294 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
1295 | # define htmlstpcpy stpcpy |
1296 | # else |
1297 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
1298 | YYDEST. */ |
1299 | static char * |
1300 | htmlstpcpy (char *htmldest, const char *htmlsrc) |
1301 | { |
1302 | char *htmld = htmldest; |
1303 | const char *htmls = htmlsrc; |
1304 | |
1305 | while ((*htmld++ = *htmls++) != '\0') |
1306 | continue; |
1307 | |
1308 | return htmld - 1; |
1309 | } |
1310 | # endif |
1311 | # endif |
1312 | |
1313 | # ifndef htmltnamerr |
1314 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
1315 | quotes and backslashes, so that it's suitable for htmlerror. The |
1316 | heuristic is that double-quoting is unnecessary unless the string |
1317 | contains an apostrophe, a comma, or backslash (other than |
1318 | backslash-backslash). YYSTR is taken from htmltname. If YYRES is |
1319 | null, do not copy; instead, return the length of what the result |
1320 | would have been. */ |
1321 | static YYSIZE_T |
1322 | htmltnamerr (char *htmlres, const char *htmlstr) |
1323 | { |
1324 | if (*htmlstr == '"') |
1325 | { |
1326 | YYSIZE_T htmln = 0; |
1327 | char const *htmlp = htmlstr; |
1328 | |
1329 | for (;;) |
1330 | switch (*++htmlp) |
1331 | { |
1332 | case '\'': |
1333 | case ',': |
1334 | goto do_not_strip_quotes; |
1335 | |
1336 | case '\\': |
1337 | if (*++htmlp != '\\') |
1338 | goto do_not_strip_quotes; |
1339 | /* Fall through. */ |
1340 | default: |
1341 | if (htmlres) |
1342 | htmlres[htmln] = *htmlp; |
1343 | htmln++; |
1344 | break; |
1345 | |
1346 | case '"': |
1347 | if (htmlres) |
1348 | htmlres[htmln] = '\0'; |
1349 | return htmln; |
1350 | } |
1351 | do_not_strip_quotes: ; |
1352 | } |
1353 | |
1354 | if (! htmlres) |
1355 | return htmlstrlen (htmlstr); |
1356 | |
1357 | return htmlstpcpy (htmlres, htmlstr) - htmlres; |
1358 | } |
1359 | # endif |
1360 | |
1361 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
1362 | about the unexpected token YYTOKEN for the state stack whose top is |
1363 | YYSSP. |
1364 | |
1365 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
1366 | not large enough to hold the message. In that case, also set |
1367 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
1368 | required number of bytes is too large to store. */ |
1369 | static int |
1370 | htmlsyntax_error (YYSIZE_T *htmlmsg_alloc, char **htmlmsg, |
1371 | htmltype_int16 *htmlssp, int htmltoken) |
1372 | { |
1373 | YYSIZE_T htmlsize0 = htmltnamerr (YY_NULLPTR, htmltname[htmltoken]); |
1374 | YYSIZE_T htmlsize = htmlsize0; |
1375 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
1376 | /* Internationalized format string. */ |
1377 | const char *htmlformat = YY_NULLPTR; |
1378 | /* Arguments of htmlformat. */ |
1379 | char const *htmlarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
1380 | /* Number of reported tokens (one for the "unexpected", one per |
1381 | "expected"). */ |
1382 | int htmlcount = 0; |
1383 | |
1384 | /* There are many possibilities here to consider: |
1385 | - If this state is a consistent state with a default action, then |
1386 | the only way this function was invoked is if the default action |
1387 | is an error action. In that case, don't check for expected |
1388 | tokens because there are none. |
1389 | - The only way there can be no lookahead present (in htmlchar) is if |
1390 | this state is a consistent state with a default action. Thus, |
1391 | detecting the absence of a lookahead is sufficient to determine |
1392 | that there is no unexpected or expected token to report. In that |
1393 | case, just report a simple "syntax error". |
1394 | - Don't assume there isn't a lookahead just because this state is a |
1395 | consistent state with a default action. There might have been a |
1396 | previous inconsistent state, consistent state with a non-default |
1397 | action, or user semantic action that manipulated htmlchar. |
1398 | - Of course, the expected token list depends on states to have |
1399 | correct lookahead information, and it depends on the parser not |
1400 | to perform extra reductions after fetching a lookahead from the |
1401 | scanner and before detecting a syntax error. Thus, state merging |
1402 | (from LALR or IELR) and default reductions corrupt the expected |
1403 | token list. However, the list is correct for canonical LR with |
1404 | one exception: it will still contain any token that will not be |
1405 | accepted due to an error action in a later state. |
1406 | */ |
1407 | if (htmltoken != YYEMPTY) |
1408 | { |
1409 | int htmln = htmlpact[*htmlssp]; |
1410 | htmlarg[htmlcount++] = htmltname[htmltoken]; |
1411 | if (!htmlpact_value_is_default (htmln)) |
1412 | { |
1413 | /* Start YYX at -YYN if negative to avoid negative indexes in |
1414 | YYCHECK. In other words, skip the first -YYN actions for |
1415 | this state because they are default actions. */ |
1416 | int htmlxbegin = htmln < 0 ? -htmln : 0; |
1417 | /* Stay within bounds of both htmlcheck and htmltname. */ |
1418 | int htmlchecklim = YYLAST - htmln + 1; |
1419 | int htmlxend = htmlchecklim < YYNTOKENS ? htmlchecklim : YYNTOKENS; |
1420 | int htmlx; |
1421 | |
1422 | for (htmlx = htmlxbegin; htmlx < htmlxend; ++htmlx) |
1423 | if (htmlcheck[htmlx + htmln] == htmlx && htmlx != YYTERROR |
1424 | && !htmltable_value_is_error (htmltable[htmlx + htmln])) |
1425 | { |
1426 | if (htmlcount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
1427 | { |
1428 | htmlcount = 1; |
1429 | htmlsize = htmlsize0; |
1430 | break; |
1431 | } |
1432 | htmlarg[htmlcount++] = htmltname[htmlx]; |
1433 | { |
1434 | YYSIZE_T htmlsize1 = htmlsize + htmltnamerr (YY_NULLPTR, htmltname[htmlx]); |
1435 | if (! (htmlsize <= htmlsize1 |
1436 | && htmlsize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1437 | return 2; |
1438 | htmlsize = htmlsize1; |
1439 | } |
1440 | } |
1441 | } |
1442 | } |
1443 | |
1444 | switch (htmlcount) |
1445 | { |
1446 | # define YYCASE_(N, S) \ |
1447 | case N: \ |
1448 | htmlformat = S; \ |
1449 | break |
1450 | YYCASE_(0, YY_("syntax error" )); |
1451 | YYCASE_(1, YY_("syntax error, unexpected %s" )); |
1452 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s" )); |
1453 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s" )); |
1454 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s" )); |
1455 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s" )); |
1456 | # undef YYCASE_ |
1457 | } |
1458 | |
1459 | { |
1460 | YYSIZE_T htmlsize1 = htmlsize + htmlstrlen (htmlformat); |
1461 | if (! (htmlsize <= htmlsize1 && htmlsize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1462 | return 2; |
1463 | htmlsize = htmlsize1; |
1464 | } |
1465 | |
1466 | if (*htmlmsg_alloc < htmlsize) |
1467 | { |
1468 | *htmlmsg_alloc = 2 * htmlsize; |
1469 | if (! (htmlsize <= *htmlmsg_alloc |
1470 | && *htmlmsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
1471 | *htmlmsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
1472 | return 1; |
1473 | } |
1474 | |
1475 | /* Avoid sprintf, as that infringes on the user's name space. |
1476 | Don't have undefined behavior even if the translation |
1477 | produced a string with the wrong number of "%s"s. */ |
1478 | { |
1479 | char *htmlp = *htmlmsg; |
1480 | int htmli = 0; |
1481 | while ((*htmlp = *htmlformat) != '\0') |
1482 | if (*htmlp == '%' && htmlformat[1] == 's' && htmli < htmlcount) |
1483 | { |
1484 | htmlp += htmltnamerr (htmlp, htmlarg[htmli++]); |
1485 | htmlformat += 2; |
1486 | } |
1487 | else |
1488 | { |
1489 | htmlp++; |
1490 | htmlformat++; |
1491 | } |
1492 | } |
1493 | return 0; |
1494 | } |
1495 | #endif /* YYERROR_VERBOSE */ |
1496 | |
1497 | /*-----------------------------------------------. |
1498 | | Release the memory associated to this symbol. | |
1499 | `-----------------------------------------------*/ |
1500 | |
1501 | static void |
1502 | htmldestruct (const char *htmlmsg, int htmltype, YYSTYPE *htmlvaluep) |
1503 | { |
1504 | YYUSE (htmlvaluep); |
1505 | if (!htmlmsg) |
1506 | htmlmsg = "Deleting" ; |
1507 | YY_SYMBOL_PRINT (htmlmsg, htmltype, htmlvaluep, htmllocationp); |
1508 | |
1509 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1510 | YYUSE (htmltype); |
1511 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1512 | } |
1513 | |
1514 | |
1515 | |
1516 | |
1517 | /* The lookahead symbol. */ |
1518 | int htmlchar; |
1519 | |
1520 | /* The semantic value of the lookahead symbol. */ |
1521 | YYSTYPE htmllval; |
1522 | /* Number of syntax errors so far. */ |
1523 | int htmlnerrs; |
1524 | |
1525 | |
1526 | /*----------. |
1527 | | htmlparse. | |
1528 | `----------*/ |
1529 | |
1530 | int |
1531 | htmlparse (void) |
1532 | { |
1533 | int htmlstate; |
1534 | /* Number of tokens to shift before error messages enabled. */ |
1535 | int htmlerrstatus; |
1536 | |
1537 | /* The stacks and their tools: |
1538 | 'htmlss': related to states. |
1539 | 'htmlvs': related to semantic values. |
1540 | |
1541 | Refer to the stacks through separate pointers, to allow htmloverflow |
1542 | to reallocate them elsewhere. */ |
1543 | |
1544 | /* The state stack. */ |
1545 | htmltype_int16 htmlssa[YYINITDEPTH]; |
1546 | htmltype_int16 *htmlss; |
1547 | htmltype_int16 *htmlssp; |
1548 | |
1549 | /* The semantic value stack. */ |
1550 | YYSTYPE htmlvsa[YYINITDEPTH]; |
1551 | YYSTYPE *htmlvs; |
1552 | YYSTYPE *htmlvsp; |
1553 | |
1554 | YYSIZE_T htmlstacksize; |
1555 | |
1556 | int htmln; |
1557 | int htmlresult; |
1558 | /* Lookahead token as an internal (translated) token number. */ |
1559 | int htmltoken = 0; |
1560 | /* The variables used to return semantic value and location from the |
1561 | action routines. */ |
1562 | YYSTYPE htmlval; |
1563 | |
1564 | #if YYERROR_VERBOSE |
1565 | /* Buffer for error messages, and its allocated size. */ |
1566 | char htmlmsgbuf[128]; |
1567 | char *htmlmsg = htmlmsgbuf; |
1568 | YYSIZE_T htmlmsg_alloc = sizeof htmlmsgbuf; |
1569 | #endif |
1570 | |
1571 | #define YYPOPSTACK(N) (htmlvsp -= (N), htmlssp -= (N)) |
1572 | |
1573 | /* The number of symbols on the RHS of the reduced rule. |
1574 | Keep to zero when no symbol should be popped. */ |
1575 | int htmllen = 0; |
1576 | |
1577 | htmlssp = htmlss = htmlssa; |
1578 | htmlvsp = htmlvs = htmlvsa; |
1579 | htmlstacksize = YYINITDEPTH; |
1580 | |
1581 | YYDPRINTF ((stderr, "Starting parse\n" )); |
1582 | |
1583 | htmlstate = 0; |
1584 | htmlerrstatus = 0; |
1585 | htmlnerrs = 0; |
1586 | htmlchar = YYEMPTY; /* Cause a token to be read. */ |
1587 | goto htmlsetstate; |
1588 | |
1589 | /*------------------------------------------------------------. |
1590 | | htmlnewstate -- Push a new state, which is found in htmlstate. | |
1591 | `------------------------------------------------------------*/ |
1592 | htmlnewstate: |
1593 | /* In all cases, when you get here, the value and location stacks |
1594 | have just been pushed. So pushing a state here evens the stacks. */ |
1595 | htmlssp++; |
1596 | |
1597 | htmlsetstate: |
1598 | *htmlssp = htmlstate; |
1599 | |
1600 | if (htmlss + htmlstacksize - 1 <= htmlssp) |
1601 | { |
1602 | /* Get the current used size of the three stacks, in elements. */ |
1603 | YYSIZE_T htmlsize = htmlssp - htmlss + 1; |
1604 | |
1605 | #ifdef htmloverflow |
1606 | { |
1607 | /* Give user a chance to reallocate the stack. Use copies of |
1608 | these so that the &'s don't force the real ones into |
1609 | memory. */ |
1610 | YYSTYPE *htmlvs1 = htmlvs; |
1611 | htmltype_int16 *htmlss1 = htmlss; |
1612 | |
1613 | /* Each stack pointer address is followed by the size of the |
1614 | data in use in that stack, in bytes. This used to be a |
1615 | conditional around just the two extra args, but that might |
1616 | be undefined if htmloverflow is a macro. */ |
1617 | htmloverflow (YY_("memory exhausted" ), |
1618 | &htmlss1, htmlsize * sizeof (*htmlssp), |
1619 | &htmlvs1, htmlsize * sizeof (*htmlvsp), |
1620 | &htmlstacksize); |
1621 | |
1622 | htmlss = htmlss1; |
1623 | htmlvs = htmlvs1; |
1624 | } |
1625 | #else /* no htmloverflow */ |
1626 | # ifndef YYSTACK_RELOCATE |
1627 | goto htmlexhaustedlab; |
1628 | # else |
1629 | /* Extend the stack our own way. */ |
1630 | if (YYMAXDEPTH <= htmlstacksize) |
1631 | goto htmlexhaustedlab; |
1632 | htmlstacksize *= 2; |
1633 | if (YYMAXDEPTH < htmlstacksize) |
1634 | htmlstacksize = YYMAXDEPTH; |
1635 | |
1636 | { |
1637 | htmltype_int16 *htmlss1 = htmlss; |
1638 | union htmlalloc *htmlptr = |
1639 | (union htmlalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (htmlstacksize)); |
1640 | if (! htmlptr) |
1641 | goto htmlexhaustedlab; |
1642 | YYSTACK_RELOCATE (htmlss_alloc, htmlss); |
1643 | YYSTACK_RELOCATE (htmlvs_alloc, htmlvs); |
1644 | # undef YYSTACK_RELOCATE |
1645 | if (htmlss1 != htmlssa) |
1646 | YYSTACK_FREE (htmlss1); |
1647 | } |
1648 | # endif |
1649 | #endif /* no htmloverflow */ |
1650 | |
1651 | htmlssp = htmlss + htmlsize - 1; |
1652 | htmlvsp = htmlvs + htmlsize - 1; |
1653 | |
1654 | YYDPRINTF ((stderr, "Stack size increased to %lu\n" , |
1655 | (uint_64_t) htmlstacksize)); |
1656 | |
1657 | if (htmlss + htmlstacksize - 1 <= htmlssp) |
1658 | YYABORT; |
1659 | } |
1660 | |
1661 | YYDPRINTF ((stderr, "Entering state %d\n" , htmlstate)); |
1662 | |
1663 | if (htmlstate == YYFINAL) |
1664 | YYACCEPT; |
1665 | |
1666 | goto htmlbackup; |
1667 | |
1668 | /*-----------. |
1669 | | htmlbackup. | |
1670 | `-----------*/ |
1671 | htmlbackup: |
1672 | |
1673 | /* Do appropriate processing given the current state. Read a |
1674 | lookahead token if we need one and don't already have one. */ |
1675 | |
1676 | /* First try to decide what to do without reference to lookahead token. */ |
1677 | htmln = htmlpact[htmlstate]; |
1678 | if (htmlpact_value_is_default (htmln)) |
1679 | goto htmldefault; |
1680 | |
1681 | /* Not known => get a lookahead token if don't already have one. */ |
1682 | |
1683 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
1684 | if (htmlchar == YYEMPTY) |
1685 | { |
1686 | YYDPRINTF ((stderr, "Reading a token: " )); |
1687 | htmlchar = htmllex (); |
1688 | } |
1689 | |
1690 | if (htmlchar <= YYEOF) |
1691 | { |
1692 | htmlchar = htmltoken = YYEOF; |
1693 | YYDPRINTF ((stderr, "Now at end of input.\n" )); |
1694 | } |
1695 | else |
1696 | { |
1697 | htmltoken = YYTRANSLATE (htmlchar); |
1698 | YY_SYMBOL_PRINT ("Next token is" , htmltoken, &htmllval, &htmllloc); |
1699 | } |
1700 | |
1701 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
1702 | detect an error, take that action. */ |
1703 | htmln += htmltoken; |
1704 | if (htmln < 0 || YYLAST < htmln || htmlcheck[htmln] != htmltoken) |
1705 | goto htmldefault; |
1706 | htmln = htmltable[htmln]; |
1707 | if (htmln <= 0) |
1708 | { |
1709 | if (htmltable_value_is_error (htmln)) |
1710 | goto htmlerrlab; |
1711 | htmln = -htmln; |
1712 | goto htmlreduce; |
1713 | } |
1714 | |
1715 | /* Count tokens shifted since error; after three, turn off error |
1716 | status. */ |
1717 | if (htmlerrstatus) |
1718 | htmlerrstatus--; |
1719 | |
1720 | /* Shift the lookahead token. */ |
1721 | YY_SYMBOL_PRINT ("Shifting" , htmltoken, &htmllval, &htmllloc); |
1722 | |
1723 | /* Discard the shifted token. */ |
1724 | htmlchar = YYEMPTY; |
1725 | |
1726 | htmlstate = htmln; |
1727 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1728 | *++htmlvsp = htmllval; |
1729 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1730 | |
1731 | goto htmlnewstate; |
1732 | |
1733 | |
1734 | /*-----------------------------------------------------------. |
1735 | | htmldefault -- do the default action for the current state. | |
1736 | `-----------------------------------------------------------*/ |
1737 | htmldefault: |
1738 | htmln = htmldefact[htmlstate]; |
1739 | if (htmln == 0) |
1740 | goto htmlerrlab; |
1741 | goto htmlreduce; |
1742 | |
1743 | |
1744 | /*-----------------------------. |
1745 | | htmlreduce -- Do a reduction. | |
1746 | `-----------------------------*/ |
1747 | htmlreduce: |
1748 | /* htmln is the number of a rule to reduce with. */ |
1749 | htmllen = htmlr2[htmln]; |
1750 | |
1751 | /* If YYLEN is nonzero, implement the default value of the action: |
1752 | '$$ = $1'. |
1753 | |
1754 | Otherwise, the following line sets YYVAL to garbage. |
1755 | This behavior is undocumented and Bison |
1756 | users should not rely upon it. Assigning to YYVAL |
1757 | unconditionally makes the parser a bit smaller, and it avoids a |
1758 | GCC warning that YYVAL may be used uninitialized. */ |
1759 | htmlval = htmlvsp[1-htmllen]; |
1760 | |
1761 | |
1762 | YY_REDUCE_PRINT (htmln); |
1763 | switch (htmln) |
1764 | { |
1765 | case 2: |
1766 | #line 447 "htmlparse.y" /* yacc.c:1646 */ |
1767 | { HTMLstate.lbl = mkLabel((htmlvsp[-1].txt),HTML_TEXT); } |
1768 | #line 1769 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1769 | break; |
1770 | |
1771 | case 3: |
1772 | #line 448 "htmlparse.y" /* yacc.c:1646 */ |
1773 | { HTMLstate.lbl = mkLabel((htmlvsp[-1].tbl),HTML_TBL); } |
1774 | #line 1775 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1775 | break; |
1776 | |
1777 | case 4: |
1778 | #line 449 "htmlparse.y" /* yacc.c:1646 */ |
1779 | { cleanup(); YYABORT; } |
1780 | #line 1781 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1781 | break; |
1782 | |
1783 | case 5: |
1784 | #line 452 "htmlparse.y" /* yacc.c:1646 */ |
1785 | { (htmlval.txt) = mkText(); } |
1786 | #line 1787 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1787 | break; |
1788 | |
1789 | case 8: |
1790 | #line 459 "htmlparse.y" /* yacc.c:1646 */ |
1791 | { appendFItemList(HTMLstate.str);} |
1792 | #line 1793 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1793 | break; |
1794 | |
1795 | case 9: |
1796 | #line 460 "htmlparse.y" /* yacc.c:1646 */ |
1797 | {appendFLineList((htmlvsp[0].i));} |
1798 | #line 1799 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1799 | break; |
1800 | |
1801 | case 18: |
1802 | #line 471 "htmlparse.y" /* yacc.c:1646 */ |
1803 | { pushFont ((htmlvsp[0].font)); } |
1804 | #line 1805 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1805 | break; |
1806 | |
1807 | case 19: |
1808 | #line 474 "htmlparse.y" /* yacc.c:1646 */ |
1809 | { popFont (); } |
1810 | #line 1811 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1811 | break; |
1812 | |
1813 | case 20: |
1814 | #line 477 "htmlparse.y" /* yacc.c:1646 */ |
1815 | {pushFont((htmlvsp[0].font));} |
1816 | #line 1817 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1817 | break; |
1818 | |
1819 | case 21: |
1820 | #line 480 "htmlparse.y" /* yacc.c:1646 */ |
1821 | {popFont();} |
1822 | #line 1823 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1823 | break; |
1824 | |
1825 | case 22: |
1826 | #line 483 "htmlparse.y" /* yacc.c:1646 */ |
1827 | {pushFont((htmlvsp[0].font));} |
1828 | #line 1829 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1829 | break; |
1830 | |
1831 | case 23: |
1832 | #line 486 "htmlparse.y" /* yacc.c:1646 */ |
1833 | {popFont();} |
1834 | #line 1835 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1835 | break; |
1836 | |
1837 | case 24: |
1838 | #line 489 "htmlparse.y" /* yacc.c:1646 */ |
1839 | {pushFont((htmlvsp[0].font));} |
1840 | #line 1841 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1841 | break; |
1842 | |
1843 | case 25: |
1844 | #line 492 "htmlparse.y" /* yacc.c:1646 */ |
1845 | {popFont();} |
1846 | #line 1847 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1847 | break; |
1848 | |
1849 | case 26: |
1850 | #line 495 "htmlparse.y" /* yacc.c:1646 */ |
1851 | {pushFont((htmlvsp[0].font));} |
1852 | #line 1853 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1853 | break; |
1854 | |
1855 | case 27: |
1856 | #line 498 "htmlparse.y" /* yacc.c:1646 */ |
1857 | {popFont();} |
1858 | #line 1859 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1859 | break; |
1860 | |
1861 | case 28: |
1862 | #line 501 "htmlparse.y" /* yacc.c:1646 */ |
1863 | {pushFont((htmlvsp[0].font));} |
1864 | #line 1865 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1865 | break; |
1866 | |
1867 | case 29: |
1868 | #line 504 "htmlparse.y" /* yacc.c:1646 */ |
1869 | {popFont();} |
1870 | #line 1871 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1871 | break; |
1872 | |
1873 | case 30: |
1874 | #line 507 "htmlparse.y" /* yacc.c:1646 */ |
1875 | {pushFont((htmlvsp[0].font));} |
1876 | #line 1877 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1877 | break; |
1878 | |
1879 | case 31: |
1880 | #line 510 "htmlparse.y" /* yacc.c:1646 */ |
1881 | {popFont();} |
1882 | #line 1883 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1883 | break; |
1884 | |
1885 | case 32: |
1886 | #line 513 "htmlparse.y" /* yacc.c:1646 */ |
1887 | {pushFont((htmlvsp[0].font));} |
1888 | #line 1889 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1889 | break; |
1890 | |
1891 | case 33: |
1892 | #line 516 "htmlparse.y" /* yacc.c:1646 */ |
1893 | {popFont();} |
1894 | #line 1895 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1895 | break; |
1896 | |
1897 | case 34: |
1898 | #line 519 "htmlparse.y" /* yacc.c:1646 */ |
1899 | { (htmlval.i) = (htmlvsp[-1].i); } |
1900 | #line 1901 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1901 | break; |
1902 | |
1903 | case 35: |
1904 | #line 520 "htmlparse.y" /* yacc.c:1646 */ |
1905 | { (htmlval.i) = (htmlvsp[0].i); } |
1906 | #line 1907 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1907 | break; |
1908 | |
1909 | case 38: |
1910 | #line 527 "htmlparse.y" /* yacc.c:1646 */ |
1911 | { |
1912 | if (nonSpace(agxbuse(HTMLstate.str))) { |
1913 | htmlerror ("Syntax error: non-space string used before <TABLE>" ); |
1914 | cleanup(); YYABORT; |
1915 | } |
1916 | (htmlvsp[0].tbl)->u.p.prev = HTMLstate.tblstack; |
1917 | (htmlvsp[0].tbl)->u.p.rows = dtopen(&rowDisc, Dtqueue); |
1918 | HTMLstate.tblstack = (htmlvsp[0].tbl); |
1919 | (htmlvsp[0].tbl)->font = HTMLstate.fontstack->cfont; |
1920 | (htmlval.tbl) = (htmlvsp[0].tbl); |
1921 | } |
1922 | #line 1923 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1923 | break; |
1924 | |
1925 | case 39: |
1926 | #line 538 "htmlparse.y" /* yacc.c:1646 */ |
1927 | { |
1928 | if (nonSpace(agxbuse(HTMLstate.str))) { |
1929 | htmlerror ("Syntax error: non-space string used after </TABLE>" ); |
1930 | cleanup(); YYABORT; |
1931 | } |
1932 | (htmlval.tbl) = HTMLstate.tblstack; |
1933 | HTMLstate.tblstack = HTMLstate.tblstack->u.p.prev; |
1934 | } |
1935 | #line 1936 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1936 | break; |
1937 | |
1938 | case 40: |
1939 | #line 548 "htmlparse.y" /* yacc.c:1646 */ |
1940 | { (htmlval.tbl) = (htmlvsp[0].tbl); } |
1941 | #line 1942 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1942 | break; |
1943 | |
1944 | case 41: |
1945 | #line 549 "htmlparse.y" /* yacc.c:1646 */ |
1946 | { (htmlval.tbl)=(htmlvsp[-1].tbl); } |
1947 | #line 1948 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1948 | break; |
1949 | |
1950 | case 42: |
1951 | #line 550 "htmlparse.y" /* yacc.c:1646 */ |
1952 | { (htmlval.tbl)=(htmlvsp[-1].tbl); } |
1953 | #line 1954 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1954 | break; |
1955 | |
1956 | case 43: |
1957 | #line 551 "htmlparse.y" /* yacc.c:1646 */ |
1958 | { (htmlval.tbl)=(htmlvsp[-1].tbl); } |
1959 | #line 1960 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1960 | break; |
1961 | |
1962 | case 44: |
1963 | #line 552 "htmlparse.y" /* yacc.c:1646 */ |
1964 | { (htmlval.tbl)=(htmlvsp[-1].tbl); } |
1965 | #line 1966 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1966 | break; |
1967 | |
1968 | case 45: |
1969 | #line 553 "htmlparse.y" /* yacc.c:1646 */ |
1970 | { (htmlval.tbl)=(htmlvsp[-1].tbl); } |
1971 | #line 1972 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1972 | break; |
1973 | |
1974 | case 48: |
1975 | #line 560 "htmlparse.y" /* yacc.c:1646 */ |
1976 | { (htmlval.p) = (htmlvsp[0].p); } |
1977 | #line 1978 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1978 | break; |
1979 | |
1980 | case 49: |
1981 | #line 561 "htmlparse.y" /* yacc.c:1646 */ |
1982 | { (htmlval.p) = (htmlvsp[0].p); } |
1983 | #line 1984 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1984 | break; |
1985 | |
1986 | case 50: |
1987 | #line 562 "htmlparse.y" /* yacc.c:1646 */ |
1988 | { (htmlvsp[-2].p)->ruled = 1; (htmlval.p) = (htmlvsp[0].p); } |
1989 | #line 1990 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1990 | break; |
1991 | |
1992 | case 51: |
1993 | #line 565 "htmlparse.y" /* yacc.c:1646 */ |
1994 | { addRow (); } |
1995 | #line 1996 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
1996 | break; |
1997 | |
1998 | case 52: |
1999 | #line 565 "htmlparse.y" /* yacc.c:1646 */ |
2000 | { (htmlval.p) = lastRow(); } |
2001 | #line 2002 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2002 | break; |
2003 | |
2004 | case 53: |
2005 | #line 568 "htmlparse.y" /* yacc.c:1646 */ |
2006 | { (htmlval.cell) = (htmlvsp[0].cell); } |
2007 | #line 2008 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2008 | break; |
2009 | |
2010 | case 54: |
2011 | #line 569 "htmlparse.y" /* yacc.c:1646 */ |
2012 | { (htmlval.cell) = (htmlvsp[0].cell); } |
2013 | #line 2014 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2014 | break; |
2015 | |
2016 | case 55: |
2017 | #line 570 "htmlparse.y" /* yacc.c:1646 */ |
2018 | { (htmlvsp[-2].cell)->ruled |= HTML_VRULE; (htmlval.cell) = (htmlvsp[0].cell); } |
2019 | #line 2020 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2020 | break; |
2021 | |
2022 | case 56: |
2023 | #line 573 "htmlparse.y" /* yacc.c:1646 */ |
2024 | { setCell((htmlvsp[-1].cell),(htmlvsp[0].tbl),HTML_TBL); } |
2025 | #line 2026 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2026 | break; |
2027 | |
2028 | case 57: |
2029 | #line 573 "htmlparse.y" /* yacc.c:1646 */ |
2030 | { (htmlval.cell) = (htmlvsp[-3].cell); } |
2031 | #line 2032 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2032 | break; |
2033 | |
2034 | case 58: |
2035 | #line 574 "htmlparse.y" /* yacc.c:1646 */ |
2036 | { setCell((htmlvsp[-1].cell),(htmlvsp[0].txt),HTML_TEXT); } |
2037 | #line 2038 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2038 | break; |
2039 | |
2040 | case 59: |
2041 | #line 574 "htmlparse.y" /* yacc.c:1646 */ |
2042 | { (htmlval.cell) = (htmlvsp[-3].cell); } |
2043 | #line 2044 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2044 | break; |
2045 | |
2046 | case 60: |
2047 | #line 575 "htmlparse.y" /* yacc.c:1646 */ |
2048 | { setCell((htmlvsp[-1].cell),(htmlvsp[0].img),HTML_IMAGE); } |
2049 | #line 2050 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2050 | break; |
2051 | |
2052 | case 61: |
2053 | #line 575 "htmlparse.y" /* yacc.c:1646 */ |
2054 | { (htmlval.cell) = (htmlvsp[-3].cell); } |
2055 | #line 2056 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2056 | break; |
2057 | |
2058 | case 62: |
2059 | #line 576 "htmlparse.y" /* yacc.c:1646 */ |
2060 | { setCell((htmlvsp[0].cell),mkText(),HTML_TEXT); } |
2061 | #line 2062 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2062 | break; |
2063 | |
2064 | case 63: |
2065 | #line 576 "htmlparse.y" /* yacc.c:1646 */ |
2066 | { (htmlval.cell) = (htmlvsp[-2].cell); } |
2067 | #line 2068 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2068 | break; |
2069 | |
2070 | case 64: |
2071 | #line 579 "htmlparse.y" /* yacc.c:1646 */ |
2072 | { (htmlval.img) = (htmlvsp[-1].img); } |
2073 | #line 2074 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2074 | break; |
2075 | |
2076 | case 65: |
2077 | #line 580 "htmlparse.y" /* yacc.c:1646 */ |
2078 | { (htmlval.img) = (htmlvsp[0].img); } |
2079 | #line 2080 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2080 | break; |
2081 | |
2082 | |
2083 | #line 2084 "/workspace/graphviz/build/lib/common/htmlparse.c" /* yacc.c:1646 */ |
2084 | default: break; |
2085 | } |
2086 | /* User semantic actions sometimes alter htmlchar, and that requires |
2087 | that htmltoken be updated with the new translation. We take the |
2088 | approach of translating immediately before every use of htmltoken. |
2089 | One alternative is translating here after every semantic action, |
2090 | but that translation would be missed if the semantic action invokes |
2091 | YYABORT, YYACCEPT, or YYERROR immediately after altering htmlchar or |
2092 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
2093 | incorrect destructor might then be invoked immediately. In the |
2094 | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
2095 | to an incorrect destructor call or verbose syntax error message |
2096 | before the lookahead is translated. */ |
2097 | YY_SYMBOL_PRINT ("-> $$ =" , htmlr1[htmln], &htmlval, &htmlloc); |
2098 | |
2099 | YYPOPSTACK (htmllen); |
2100 | htmllen = 0; |
2101 | YY_STACK_PRINT (htmlss, htmlssp); |
2102 | |
2103 | *++htmlvsp = htmlval; |
2104 | |
2105 | /* Now 'shift' the result of the reduction. Determine what state |
2106 | that goes to, based on the state we popped back to and the rule |
2107 | number reduced by. */ |
2108 | |
2109 | htmln = htmlr1[htmln]; |
2110 | |
2111 | htmlstate = htmlpgoto[htmln - YYNTOKENS] + *htmlssp; |
2112 | if (0 <= htmlstate && htmlstate <= YYLAST && htmlcheck[htmlstate] == *htmlssp) |
2113 | htmlstate = htmltable[htmlstate]; |
2114 | else |
2115 | htmlstate = htmldefgoto[htmln - YYNTOKENS]; |
2116 | |
2117 | goto htmlnewstate; |
2118 | |
2119 | |
2120 | /*--------------------------------------. |
2121 | | htmlerrlab -- here on detecting error. | |
2122 | `--------------------------------------*/ |
2123 | htmlerrlab: |
2124 | /* Make sure we have latest lookahead translation. See comments at |
2125 | user semantic actions for why this is necessary. */ |
2126 | htmltoken = htmlchar == YYEMPTY ? YYEMPTY : YYTRANSLATE (htmlchar); |
2127 | |
2128 | /* If not already recovering from an error, report this error. */ |
2129 | if (!htmlerrstatus) |
2130 | { |
2131 | ++htmlnerrs; |
2132 | #if ! YYERROR_VERBOSE |
2133 | htmlerror (YY_("syntax error" )); |
2134 | #else |
2135 | # define YYSYNTAX_ERROR htmlsyntax_error (&htmlmsg_alloc, &htmlmsg, \ |
2136 | htmlssp, htmltoken) |
2137 | { |
2138 | char const *htmlmsgp = YY_("syntax error" ); |
2139 | int htmlsyntax_error_status; |
2140 | htmlsyntax_error_status = YYSYNTAX_ERROR; |
2141 | if (htmlsyntax_error_status == 0) |
2142 | htmlmsgp = htmlmsg; |
2143 | else if (htmlsyntax_error_status == 1) |
2144 | { |
2145 | if (htmlmsg != htmlmsgbuf) |
2146 | YYSTACK_FREE (htmlmsg); |
2147 | htmlmsg = (char *) YYSTACK_ALLOC (htmlmsg_alloc); |
2148 | if (!htmlmsg) |
2149 | { |
2150 | htmlmsg = htmlmsgbuf; |
2151 | htmlmsg_alloc = sizeof htmlmsgbuf; |
2152 | htmlsyntax_error_status = 2; |
2153 | } |
2154 | else |
2155 | { |
2156 | htmlsyntax_error_status = YYSYNTAX_ERROR; |
2157 | htmlmsgp = htmlmsg; |
2158 | } |
2159 | } |
2160 | htmlerror (htmlmsgp); |
2161 | if (htmlsyntax_error_status == 2) |
2162 | goto htmlexhaustedlab; |
2163 | } |
2164 | # undef YYSYNTAX_ERROR |
2165 | #endif |
2166 | } |
2167 | |
2168 | |
2169 | |
2170 | if (htmlerrstatus == 3) |
2171 | { |
2172 | /* If just tried and failed to reuse lookahead token after an |
2173 | error, discard it. */ |
2174 | |
2175 | if (htmlchar <= YYEOF) |
2176 | { |
2177 | /* Return failure if at end of input. */ |
2178 | if (htmlchar == YYEOF) |
2179 | YYABORT; |
2180 | } |
2181 | else |
2182 | { |
2183 | htmldestruct ("Error: discarding" , |
2184 | htmltoken, &htmllval); |
2185 | htmlchar = YYEMPTY; |
2186 | } |
2187 | } |
2188 | |
2189 | /* Else will try to reuse lookahead token after shifting the error |
2190 | token. */ |
2191 | goto htmlerrlab1; |
2192 | |
2193 | |
2194 | /*---------------------------------------------------. |
2195 | | htmlerrorlab -- error raised explicitly by YYERROR. | |
2196 | `---------------------------------------------------*/ |
2197 | htmlerrorlab: |
2198 | |
2199 | /* Pacify compilers like GCC when the user code never invokes |
2200 | YYERROR and the label htmlerrorlab therefore never appears in user |
2201 | code. */ |
2202 | if (/*CONSTCOND*/ 0) |
2203 | goto htmlerrorlab; |
2204 | |
2205 | /* Do not reclaim the symbols of the rule whose action triggered |
2206 | this YYERROR. */ |
2207 | YYPOPSTACK (htmllen); |
2208 | htmllen = 0; |
2209 | YY_STACK_PRINT (htmlss, htmlssp); |
2210 | htmlstate = *htmlssp; |
2211 | goto htmlerrlab1; |
2212 | |
2213 | |
2214 | /*-------------------------------------------------------------. |
2215 | | htmlerrlab1 -- common code for both syntax error and YYERROR. | |
2216 | `-------------------------------------------------------------*/ |
2217 | htmlerrlab1: |
2218 | htmlerrstatus = 3; /* Each real token shifted decrements this. */ |
2219 | |
2220 | for (;;) |
2221 | { |
2222 | htmln = htmlpact[htmlstate]; |
2223 | if (!htmlpact_value_is_default (htmln)) |
2224 | { |
2225 | htmln += YYTERROR; |
2226 | if (0 <= htmln && htmln <= YYLAST && htmlcheck[htmln] == YYTERROR) |
2227 | { |
2228 | htmln = htmltable[htmln]; |
2229 | if (0 < htmln) |
2230 | break; |
2231 | } |
2232 | } |
2233 | |
2234 | /* Pop the current state because it cannot handle the error token. */ |
2235 | if (htmlssp == htmlss) |
2236 | YYABORT; |
2237 | |
2238 | |
2239 | htmldestruct ("Error: popping" , |
2240 | htmlstos[htmlstate], htmlvsp); |
2241 | YYPOPSTACK (1); |
2242 | htmlstate = *htmlssp; |
2243 | YY_STACK_PRINT (htmlss, htmlssp); |
2244 | } |
2245 | |
2246 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
2247 | *++htmlvsp = htmllval; |
2248 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
2249 | |
2250 | |
2251 | /* Shift the error token. */ |
2252 | YY_SYMBOL_PRINT ("Shifting" , htmlstos[htmln], htmlvsp, htmllsp); |
2253 | |
2254 | htmlstate = htmln; |
2255 | goto htmlnewstate; |
2256 | |
2257 | |
2258 | /*-------------------------------------. |
2259 | | htmlacceptlab -- YYACCEPT comes here. | |
2260 | `-------------------------------------*/ |
2261 | htmlacceptlab: |
2262 | htmlresult = 0; |
2263 | goto htmlreturn; |
2264 | |
2265 | /*-----------------------------------. |
2266 | | htmlabortlab -- YYABORT comes here. | |
2267 | `-----------------------------------*/ |
2268 | htmlabortlab: |
2269 | htmlresult = 1; |
2270 | goto htmlreturn; |
2271 | |
2272 | #if !defined htmloverflow || YYERROR_VERBOSE |
2273 | /*-------------------------------------------------. |
2274 | | htmlexhaustedlab -- memory exhaustion comes here. | |
2275 | `-------------------------------------------------*/ |
2276 | htmlexhaustedlab: |
2277 | htmlerror (YY_("memory exhausted" )); |
2278 | htmlresult = 2; |
2279 | /* Fall through. */ |
2280 | #endif |
2281 | |
2282 | htmlreturn: |
2283 | if (htmlchar != YYEMPTY) |
2284 | { |
2285 | /* Make sure we have latest lookahead translation. See comments at |
2286 | user semantic actions for why this is necessary. */ |
2287 | htmltoken = YYTRANSLATE (htmlchar); |
2288 | htmldestruct ("Cleanup: discarding lookahead" , |
2289 | htmltoken, &htmllval); |
2290 | } |
2291 | /* Do not reclaim the symbols of the rule whose action triggered |
2292 | this YYABORT or YYACCEPT. */ |
2293 | YYPOPSTACK (htmllen); |
2294 | YY_STACK_PRINT (htmlss, htmlssp); |
2295 | while (htmlssp != htmlss) |
2296 | { |
2297 | htmldestruct ("Cleanup: popping" , |
2298 | htmlstos[*htmlssp], htmlvsp); |
2299 | YYPOPSTACK (1); |
2300 | } |
2301 | #ifndef htmloverflow |
2302 | if (htmlss != htmlssa) |
2303 | YYSTACK_FREE (htmlss); |
2304 | #endif |
2305 | #if YYERROR_VERBOSE |
2306 | if (htmlmsg != htmlmsgbuf) |
2307 | YYSTACK_FREE (htmlmsg); |
2308 | #endif |
2309 | return htmlresult; |
2310 | } |
2311 | #line 592 "htmlparse.y" /* yacc.c:1906 */ |
2312 | |
2313 | |
2314 | /* parseHTML: |
2315 | * Return parsed label or NULL if failure. |
2316 | * Set warn to 0 on success; 1 for warning message; 2 if no expat. |
2317 | */ |
2318 | htmllabel_t* |
2319 | parseHTML (char* txt, int* warn, htmlenv_t *env) |
2320 | { |
2321 | unsigned char buf[SMALLBUF]; |
2322 | agxbuf str; |
2323 | htmllabel_t* l; |
2324 | sfont_t dfltf; |
2325 | |
2326 | dfltf.cfont = NULL; |
2327 | dfltf.pfont = NULL; |
2328 | HTMLstate.fontstack = &dfltf; |
2329 | HTMLstate.tblstack = 0; |
2330 | HTMLstate.lbl = 0; |
2331 | HTMLstate.gvc = GD_gvc(env->g); |
2332 | HTMLstate.fitemList = dtopen(&fstrDisc, Dtqueue); |
2333 | HTMLstate.fspanList = dtopen(&fspanDisc, Dtqueue); |
2334 | |
2335 | agxbinit (&str, SMALLBUF, buf); |
2336 | HTMLstate.str = &str; |
2337 | |
2338 | if (initHTMLlexer (txt, &str, env)) {/* failed: no libexpat - give up */ |
2339 | *warn = 2; |
2340 | l = NULL; |
2341 | } |
2342 | else { |
2343 | htmlparse(); |
2344 | *warn = clearHTMLlexer (); |
2345 | l = HTMLstate.lbl; |
2346 | } |
2347 | |
2348 | dtclose (HTMLstate.fitemList); |
2349 | dtclose (HTMLstate.fspanList); |
2350 | |
2351 | HTMLstate.fitemList = NULL; |
2352 | HTMLstate.fspanList = NULL; |
2353 | HTMLstate.fontstack = NULL; |
2354 | |
2355 | agxbfree (&str); |
2356 | |
2357 | return l; |
2358 | } |
2359 | |
2360 | |