|
Graphviz
2.29.20120523.0446
|
00001 /* A Bison parser, made by GNU Bison 2.5. */ 00002 00003 /* Bison implementation for Yacc-like parsers in C 00004 00005 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 /* As a special exception, you may create a larger work that contains 00021 part or all of the Bison parser skeleton and distribute that work 00022 under terms of your choice, so long as that work isn't itself a 00023 parser generator using the skeleton or a modified version thereof 00024 as a parser skeleton. Alternatively, if you modify or redistribute 00025 the parser skeleton itself, you may (at your option) remove this 00026 special exception, which will cause the skeleton and the resulting 00027 Bison output files to be licensed under the GNU General Public 00028 License without this special exception. 00029 00030 This special exception was added by the Free Software Foundation in 00031 version 2.2 of Bison. */ 00032 00033 /* C LALR(1) parser skeleton written by Richard Stallman, by 00034 simplifying the original so-called "semantic" parser. */ 00035 00036 /* All symbols defined below should begin with yy or YY, to avoid 00037 infringing on user name space. This should be done even for local 00038 variables, as they might otherwise be expanded by user macros. 00039 There are some unavoidable exceptions within include files to 00040 define necessary library symbols; they are noted "INFRINGES ON 00041 USER NAME SPACE" below. */ 00042 00043 /* Identify Bison output. */ 00044 #define YYBISON 1 00045 00046 /* Bison version. */ 00047 #define YYBISON_VERSION "2.5" 00048 00049 /* Skeleton name. */ 00050 #define YYSKELETON_NAME "yacc.c" 00051 00052 /* Pure parsers. */ 00053 #define YYPURE 0 00054 00055 /* Push parsers. */ 00056 #define YYPUSH 0 00057 00058 /* Pull parsers. */ 00059 #define YYPULL 1 00060 00061 /* Using locations. */ 00062 #define YYLSP_NEEDED 0 00063 00064 00065 00066 /* Copy the first part of user declarations. */ 00067 00068 /* Line 268 of yacc.c */ 00069 #line 14 "../../lib/common/htmlparse.y" 00070 00071 00072 #include "render.h" 00073 #include "htmltable.h" 00074 #include "htmllex.h" 00075 00076 extern int yyparse(void); 00077 00078 typedef struct sfont_t { 00079 htmlfont_t *cfont; 00080 struct sfont_t *pfont; 00081 } sfont_t; 00082 00083 static struct { 00084 htmllabel_t* lbl; /* Generated label */ 00085 htmltbl_t* tblstack; /* Stack of tables maintained during parsing */ 00086 Dt_t* fitemList; /* Dictionary for font text items */ 00087 Dt_t* fparaList; 00088 agxbuf* str; /* Buffer for text */ 00089 sfont_t* fontstack; 00090 } HTMLstate; 00091 00092 /* free_ritem: 00093 * Free row. This closes and frees row's list, then 00094 * the pitem itself is freed. 00095 */ 00096 static void 00097 free_ritem(Dt_t* d, pitem* p,Dtdisc_t* ds) 00098 { 00099 dtclose (p->u.rp); 00100 free (p); 00101 } 00102 00103 /* free_item: 00104 * Generic Dt free. Only frees container, assuming contents 00105 * have been copied elsewhere. 00106 */ 00107 static void 00108 free_item(Dt_t* d, void* p,Dtdisc_t* ds) 00109 { 00110 free (p); 00111 } 00112 00113 /* cleanTbl: 00114 * Clean up table if error in parsing. 00115 */ 00116 static void 00117 cleanTbl (htmltbl_t* tp) 00118 { 00119 dtclose (tp->u.p.rows); 00120 free_html_data (&tp->data); 00121 free (tp); 00122 } 00123 00124 /* cleanCell: 00125 * Clean up cell if error in parsing. 00126 */ 00127 static void 00128 cleanCell (htmlcell_t* cp) 00129 { 00130 if (cp->child.kind == HTML_TBL) cleanTbl (cp->child.u.tbl); 00131 else if (cp->child.kind == HTML_TEXT) free_html_text (cp->child.u.txt); 00132 free_html_data (&cp->data); 00133 free (cp); 00134 } 00135 00136 /* free_citem: 00137 * Free cell item during parsing. This frees cell and pitem. 00138 */ 00139 static void 00140 free_citem(Dt_t* d, pitem* p,Dtdisc_t* ds) 00141 { 00142 cleanCell (p->u.cp); 00143 free (p); 00144 } 00145 00146 static Dtdisc_t rowDisc = { 00147 offsetof(pitem,u), 00148 sizeof(void*), 00149 offsetof(pitem,link), 00150 NIL(Dtmake_f), 00151 (Dtfree_f)free_ritem, 00152 NIL(Dtcompar_f), 00153 NIL(Dthash_f), 00154 NIL(Dtmemory_f), 00155 NIL(Dtevent_f) 00156 }; 00157 static Dtdisc_t cellDisc = { 00158 offsetof(pitem,u), 00159 sizeof(void*), 00160 offsetof(pitem,link), 00161 NIL(Dtmake_f), 00162 (Dtfree_f)free_item, 00163 NIL(Dtcompar_f), 00164 NIL(Dthash_f), 00165 NIL(Dtmemory_f), 00166 NIL(Dtevent_f) 00167 }; 00168 00169 typedef struct { 00170 Dtlink_t link; 00171 textpara_t ti; 00172 } fitem; 00173 00174 typedef struct { 00175 Dtlink_t link; 00176 htextpara_t lp; 00177 } fpara; 00178 00179 static void 00180 free_fitem(Dt_t* d, fitem* p, Dtdisc_t* ds) 00181 { 00182 if (p->ti.str) 00183 free (p->ti.str); 00184 if (p->ti.font) 00185 free_html_font (p->ti.font); 00186 free (p); 00187 } 00188 00189 static void 00190 free_fpara(Dt_t* d, fpara* p, Dtdisc_t* ds) 00191 { 00192 textpara_t* ti; 00193 00194 if (p->lp.nitems) { 00195 int i; 00196 ti = p->lp.items; 00197 for (i = 0; i < p->lp.nitems; i++) { 00198 if (ti->str) free (ti->str); 00199 if (ti->font) free_html_font (ti->font); 00200 ti++; 00201 } 00202 free (p->lp.items); 00203 } 00204 free (p); 00205 } 00206 00207 static Dtdisc_t fstrDisc = { 00208 0, 00209 0, 00210 offsetof(fitem,link), 00211 NIL(Dtmake_f), 00212 (Dtfree_f)free_item, 00213 NIL(Dtcompar_f), 00214 NIL(Dthash_f), 00215 NIL(Dtmemory_f), 00216 NIL(Dtevent_f) 00217 }; 00218 00219 00220 static Dtdisc_t fparaDisc = { 00221 0, 00222 0, 00223 offsetof(fpara,link), 00224 NIL(Dtmake_f), 00225 (Dtfree_f)free_item, 00226 NIL(Dtcompar_f), 00227 NIL(Dthash_f), 00228 NIL(Dtmemory_f), 00229 NIL(Dtevent_f) 00230 }; 00231 00232 /* dupFont: 00233 */ 00234 static htmlfont_t * 00235 dupFont (htmlfont_t *f) 00236 { 00237 if (f) f->cnt++; 00238 return f; 00239 } 00240 00241 /* appendFItemList: 00242 * Append a new fitem to the list. 00243 */ 00244 static void 00245 appendFItemList (agxbuf *ag) 00246 { 00247 fitem *fi = NEW(fitem); 00248 00249 fi->ti.str = strdup(agxbuse(ag)); 00250 fi->ti.font = dupFont (HTMLstate.fontstack->cfont); 00251 dtinsert(HTMLstate.fitemList, fi); 00252 } 00253 00254 /* appendFLineList: 00255 */ 00256 static void 00257 appendFLineList (int v) 00258 { 00259 int cnt; 00260 fpara *ln = NEW(fpara); 00261 fitem *fi; 00262 Dt_t *ilist = HTMLstate.fitemList; 00263 00264 cnt = dtsize(ilist); 00265 ln->lp.nitems = cnt; 00266 ln->lp.just = v; 00267 if (cnt) { 00268 int i = 0; 00269 ln->lp.items = N_NEW(cnt, textpara_t); 00270 00271 fi = (fitem*)dtflatten(ilist); 00272 for (; fi; fi = (fitem*)dtlink(fitemList,(Dtlink_t*)fi)) { 00273 ln->lp.items[i] = fi->ti; 00274 i++; 00275 } 00276 } 00277 00278 dtclear(ilist); 00279 00280 dtinsert(HTMLstate.fparaList, ln); 00281 } 00282 00283 static htmltxt_t* 00284 mkText(void) 00285 { 00286 int cnt; 00287 Dt_t * ipara = HTMLstate.fparaList; 00288 fpara *fl ; 00289 htmltxt_t *hft = NEW(htmltxt_t); 00290 00291 if (dtsize (HTMLstate.fitemList)) 00292 appendFLineList (UNSET_ALIGN); 00293 00294 cnt = dtsize(ipara); 00295 hft->nparas = cnt; 00296 00297 if (cnt) { 00298 int i = 0; 00299 hft->paras = N_NEW(cnt,htextpara_t); 00300 for(fl=(fpara *)dtfirst(ipara); fl; fl=(fpara *)dtnext(ipara,fl)) { 00301 hft->paras[i] = fl->lp; 00302 i++; 00303 } 00304 } 00305 00306 dtclear(ipara); 00307 00308 return hft; 00309 } 00310 00311 static pitem* lastRow (void) 00312 { 00313 htmltbl_t* tbl = HTMLstate.tblstack; 00314 pitem* sp = dtlast (tbl->u.p.rows); 00315 return sp; 00316 } 00317 00318 /* addRow: 00319 * Add new cell row to current table. 00320 */ 00321 static pitem* addRow (void) 00322 { 00323 Dt_t* dp = dtopen(&cellDisc, Dtqueue); 00324 htmltbl_t* tbl = HTMLstate.tblstack; 00325 pitem* sp = NEW(pitem); 00326 sp->u.rp = dp; 00327 if (tbl->flags & HTML_HRULE) 00328 sp->ruled = 1; 00329 dtinsert (tbl->u.p.rows, sp); 00330 return sp; 00331 } 00332 00333 /* setCell: 00334 * Set cell body and type and attach to row 00335 */ 00336 static void setCell (htmlcell_t* cp, void* obj, int kind) 00337 { 00338 pitem* sp = NEW(pitem); 00339 htmltbl_t* tbl = HTMLstate.tblstack; 00340 pitem* rp = (pitem*)dtlast (tbl->u.p.rows); 00341 Dt_t* row = rp->u.rp; 00342 sp->u.cp = cp; 00343 dtinsert (row, sp); 00344 cp->child.kind = kind; 00345 if (tbl->flags & HTML_VRULE) 00346 cp->ruled = HTML_VRULE; 00347 00348 if(kind == HTML_TEXT) 00349 cp->child.u.txt = (htmltxt_t*)obj; 00350 else if (kind == HTML_IMAGE) 00351 cp->child.u.img = (htmlimg_t*)obj; 00352 else 00353 cp->child.u.tbl = (htmltbl_t*)obj; 00354 } 00355 00356 /* mkLabel: 00357 * Create label, given body and type. 00358 */ 00359 static htmllabel_t* mkLabel (void* obj, int kind) 00360 { 00361 htmllabel_t* lp = NEW(htmllabel_t); 00362 00363 lp->kind = kind; 00364 if (kind == HTML_TEXT) 00365 lp->u.txt = (htmltxt_t*)obj; 00366 else 00367 lp->u.tbl = (htmltbl_t*)obj; 00368 return lp; 00369 } 00370 00371 /* freeFontstack: 00372 * Free all stack items but the last, which is 00373 * put on artificially during in parseHTML. 00374 */ 00375 static void 00376 freeFontstack(void) 00377 { 00378 sfont_t* s; 00379 sfont_t* next; 00380 00381 for (s = HTMLstate.fontstack; (next = s->pfont); s = next) { 00382 free_html_font (s->cfont); 00383 free(s); 00384 } 00385 } 00386 00387 /* cleanup: 00388 * Called on error. Frees resources allocated during parsing. 00389 * This includes a label, plus a walk down the stack of 00390 * tables. Note that we use the free_citem function to actually 00391 * free cells. 00392 */ 00393 static void cleanup (void) 00394 { 00395 htmltbl_t* tp = HTMLstate.tblstack; 00396 htmltbl_t* next; 00397 00398 if (HTMLstate.lbl) { 00399 free_html_label (HTMLstate.lbl,1); 00400 HTMLstate.lbl = NULL; 00401 } 00402 cellDisc.freef = (Dtfree_f)free_citem; 00403 while (tp) { 00404 next = tp->u.p.prev; 00405 cleanTbl (tp); 00406 tp = next; 00407 } 00408 cellDisc.freef = (Dtfree_f)free_item; 00409 00410 fstrDisc.freef = (Dtfree_f)free_fitem; 00411 dtclear (HTMLstate.fitemList); 00412 fstrDisc.freef = (Dtfree_f)free_item; 00413 00414 fparaDisc.freef = (Dtfree_f)free_fpara; 00415 dtclear (HTMLstate.fparaList); 00416 fparaDisc.freef = (Dtfree_f)free_item; 00417 00418 freeFontstack(); 00419 } 00420 00421 /* nonSpace: 00422 * Return 1 if s contains a non-space character. 00423 */ 00424 static int nonSpace (char* s) 00425 { 00426 char c; 00427 00428 while ((c = *s++)) { 00429 if (c != ' ') return 1; 00430 } 00431 return 0; 00432 } 00433 00434 /* pushFont: 00435 * Fonts are allocated in the lexer. 00436 */ 00437 static void 00438 pushFont (htmlfont_t *f) 00439 { 00440 sfont_t *ft = NEW(sfont_t); 00441 htmlfont_t* curfont = HTMLstate.fontstack->cfont; 00442 00443 if (curfont) { 00444 if (!f->color && curfont->color) 00445 f->color = strdup(curfont->color); 00446 if ((f->size < 0.0) && (curfont->size >= 0.0)) 00447 f->size = curfont->size; 00448 if (!f->name && curfont->name) 00449 f->name = strdup(curfont->name); 00450 if (curfont->flags) 00451 f->flags |= curfont->flags; 00452 } 00453 00454 ft->cfont = dupFont (f); 00455 ft->pfont = HTMLstate.fontstack; 00456 HTMLstate.fontstack = ft; 00457 } 00458 00459 /* popFont: 00460 */ 00461 static void 00462 popFont (void) 00463 { 00464 sfont_t* curfont = HTMLstate.fontstack; 00465 sfont_t* prevfont = curfont->pfont; 00466 00467 free_html_font (curfont->cfont); 00468 free (curfont); 00469 HTMLstate.fontstack = prevfont; 00470 } 00471 00472 00473 00474 /* Line 268 of yacc.c */ 00475 #line 476 "y.tab.c" 00476 00477 /* Enabling traces. */ 00478 #ifndef YYDEBUG 00479 # define YYDEBUG 0 00480 #endif 00481 00482 /* Enabling verbose error messages. */ 00483 #ifdef YYERROR_VERBOSE 00484 # undef YYERROR_VERBOSE 00485 # define YYERROR_VERBOSE 1 00486 #else 00487 # define YYERROR_VERBOSE 0 00488 #endif 00489 00490 /* Enabling the token table. */ 00491 #ifndef YYTOKEN_TABLE 00492 # define YYTOKEN_TABLE 0 00493 #endif 00494 00495 00496 /* Tokens. */ 00497 #ifndef YYTOKENTYPE 00498 # define YYTOKENTYPE 00499 /* Put the tokens into the symbol table, so that GDB and other debuggers 00500 know about them. */ 00501 enum yytokentype { 00502 T_end_br = 258, 00503 T_end_img = 259, 00504 T_row = 260, 00505 T_end_row = 261, 00506 T_html = 262, 00507 T_end_html = 263, 00508 T_end_table = 264, 00509 T_end_cell = 265, 00510 T_end_font = 266, 00511 T_string = 267, 00512 T_error = 268, 00513 T_n_italic = 269, 00514 T_n_bold = 270, 00515 T_n_underline = 271, 00516 T_n_sup = 272, 00517 T_n_sub = 273, 00518 T_HR = 274, 00519 T_hr = 275, 00520 T_end_hr = 276, 00521 T_VR = 277, 00522 T_vr = 278, 00523 T_end_vr = 279, 00524 T_BR = 280, 00525 T_br = 281, 00526 T_IMG = 282, 00527 T_img = 283, 00528 T_table = 284, 00529 T_cell = 285, 00530 T_font = 286, 00531 T_italic = 287, 00532 T_bold = 288, 00533 T_underline = 289, 00534 T_sup = 290, 00535 T_sub = 291 00536 }; 00537 #endif 00538 /* Tokens. */ 00539 #define T_end_br 258 00540 #define T_end_img 259 00541 #define T_row 260 00542 #define T_end_row 261 00543 #define T_html 262 00544 #define T_end_html 263 00545 #define T_end_table 264 00546 #define T_end_cell 265 00547 #define T_end_font 266 00548 #define T_string 267 00549 #define T_error 268 00550 #define T_n_italic 269 00551 #define T_n_bold 270 00552 #define T_n_underline 271 00553 #define T_n_sup 272 00554 #define T_n_sub 273 00555 #define T_HR 274 00556 #define T_hr 275 00557 #define T_end_hr 276 00558 #define T_VR 277 00559 #define T_vr 278 00560 #define T_end_vr 279 00561 #define T_BR 280 00562 #define T_br 281 00563 #define T_IMG 282 00564 #define T_img 283 00565 #define T_table 284 00566 #define T_cell 285 00567 #define T_font 286 00568 #define T_italic 287 00569 #define T_bold 288 00570 #define T_underline 289 00571 #define T_sup 290 00572 #define T_sub 291 00573 00574 00575 00576 00577 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00578 typedef union YYSTYPE 00579 { 00580 00581 /* Line 293 of yacc.c */ 00582 #line 418 "../../lib/common/htmlparse.y" 00583 00584 int i; 00585 htmltxt_t* txt; 00586 htmlcell_t* cell; 00587 htmltbl_t* tbl; 00588 htmlfont_t* font; 00589 htmlimg_t* img; 00590 pitem* p; 00591 00592 00593 00594 /* Line 293 of yacc.c */ 00595 #line 596 "y.tab.c" 00596 } YYSTYPE; 00597 # define YYSTYPE_IS_TRIVIAL 1 00598 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00599 # define YYSTYPE_IS_DECLARED 1 00600 #endif 00601 00602 00603 /* Copy the second part of user declarations. */ 00604 00605 00606 /* Line 343 of yacc.c */ 00607 #line 608 "y.tab.c" 00608 00609 #ifdef short 00610 # undef short 00611 #endif 00612 00613 #ifdef YYTYPE_UINT8 00614 typedef YYTYPE_UINT8 yytype_uint8; 00615 #else 00616 typedef unsigned char yytype_uint8; 00617 #endif 00618 00619 #ifdef YYTYPE_INT8 00620 typedef YYTYPE_INT8 yytype_int8; 00621 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00622 || defined __cplusplus || defined _MSC_VER) 00623 typedef signed char yytype_int8; 00624 #else 00625 typedef short int yytype_int8; 00626 #endif 00627 00628 #ifdef YYTYPE_UINT16 00629 typedef YYTYPE_UINT16 yytype_uint16; 00630 #else 00631 typedef unsigned short int yytype_uint16; 00632 #endif 00633 00634 #ifdef YYTYPE_INT16 00635 typedef YYTYPE_INT16 yytype_int16; 00636 #else 00637 typedef short int yytype_int16; 00638 #endif 00639 00640 #ifndef YYSIZE_T 00641 # ifdef __SIZE_TYPE__ 00642 # define YYSIZE_T __SIZE_TYPE__ 00643 # elif defined size_t 00644 # define YYSIZE_T size_t 00645 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00646 || defined __cplusplus || defined _MSC_VER) 00647 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00648 # define YYSIZE_T size_t 00649 # else 00650 # define YYSIZE_T unsigned int 00651 # endif 00652 #endif 00653 00654 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00655 00656 #ifndef YY_ 00657 # if defined YYENABLE_NLS && YYENABLE_NLS 00658 # if ENABLE_NLS 00659 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00660 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00661 # endif 00662 # endif 00663 # ifndef YY_ 00664 # define YY_(msgid) msgid 00665 # endif 00666 #endif 00667 00668 /* Suppress unused-variable warnings by "using" E. */ 00669 #if ! defined lint || defined __GNUC__ 00670 # define YYUSE(e) ((void) (e)) 00671 #else 00672 # define YYUSE(e) /* empty */ 00673 #endif 00674 00675 /* Identity function, used to suppress warnings about constant conditions. */ 00676 #ifndef lint 00677 # define YYID(n) (n) 00678 #else 00679 #if (defined __STDC__ || defined __C99__FUNC__ \ 00680 || defined __cplusplus || defined _MSC_VER) 00681 static int 00682 YYID (int yyi) 00683 #else 00684 static int 00685 YYID (yyi) 00686 int yyi; 00687 #endif 00688 { 00689 return yyi; 00690 } 00691 #endif 00692 00693 #if ! defined yyoverflow || YYERROR_VERBOSE 00694 00695 /* The parser invokes alloca or malloc; define the necessary symbols. */ 00696 00697 # ifdef YYSTACK_USE_ALLOCA 00698 # if YYSTACK_USE_ALLOCA 00699 # ifdef __GNUC__ 00700 # define YYSTACK_ALLOC __builtin_alloca 00701 # elif defined __BUILTIN_VA_ARG_INCR 00702 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00703 # elif defined _AIX 00704 # define YYSTACK_ALLOC __alloca 00705 # elif defined _MSC_VER 00706 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 00707 # define alloca _alloca 00708 # else 00709 # define YYSTACK_ALLOC alloca 00710 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00711 || defined __cplusplus || defined _MSC_VER) 00712 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00713 # ifndef EXIT_SUCCESS 00714 # define EXIT_SUCCESS 0 00715 # endif 00716 # endif 00717 # endif 00718 # endif 00719 # endif 00720 00721 # ifdef YYSTACK_ALLOC 00722 /* Pacify GCC's `empty if-body' warning. */ 00723 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00724 # ifndef YYSTACK_ALLOC_MAXIMUM 00725 /* The OS might guarantee only one guard page at the bottom of the stack, 00726 and a page size can be as small as 4096 bytes. So we cannot safely 00727 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00728 to allow for a few compiler-allocated temporary stack slots. */ 00729 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00730 # endif 00731 # else 00732 # define YYSTACK_ALLOC YYMALLOC 00733 # define YYSTACK_FREE YYFREE 00734 # ifndef YYSTACK_ALLOC_MAXIMUM 00735 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00736 # endif 00737 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 00738 && ! ((defined YYMALLOC || defined malloc) \ 00739 && (defined YYFREE || defined free))) 00740 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00741 # ifndef EXIT_SUCCESS 00742 # define EXIT_SUCCESS 0 00743 # endif 00744 # endif 00745 # ifndef YYMALLOC 00746 # define YYMALLOC malloc 00747 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00748 || defined __cplusplus || defined _MSC_VER) 00749 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00750 # endif 00751 # endif 00752 # ifndef YYFREE 00753 # define YYFREE free 00754 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00755 || defined __cplusplus || defined _MSC_VER) 00756 void free (void *); /* INFRINGES ON USER NAME SPACE */ 00757 # endif 00758 # endif 00759 # endif 00760 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00761 00762 00763 #if (! defined yyoverflow \ 00764 && (! defined __cplusplus \ 00765 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00766 00767 /* A type that is properly aligned for any stack member. */ 00768 union yyalloc 00769 { 00770 yytype_int16 yyss_alloc; 00771 YYSTYPE yyvs_alloc; 00772 }; 00773 00774 /* The size of the maximum gap between one aligned stack and the next. */ 00775 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00776 00777 /* The size of an array large to enough to hold all stacks, each with 00778 N elements. */ 00779 # define YYSTACK_BYTES(N) \ 00780 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00781 + YYSTACK_GAP_MAXIMUM) 00782 00783 # define YYCOPY_NEEDED 1 00784 00785 /* Relocate STACK from its old location to the new one. The 00786 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00787 elements in the stack, and YYPTR gives the new location of the 00788 stack. Advance YYPTR to a properly aligned location for the next 00789 stack. */ 00790 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00791 do \ 00792 { \ 00793 YYSIZE_T yynewbytes; \ 00794 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00795 Stack = &yyptr->Stack_alloc; \ 00796 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00797 yyptr += yynewbytes / sizeof (*yyptr); \ 00798 } \ 00799 while (YYID (0)) 00800 00801 #endif 00802 00803 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 00804 /* Copy COUNT objects from FROM to TO. The source and destination do 00805 not overlap. */ 00806 # ifndef YYCOPY 00807 # if defined __GNUC__ && 1 < __GNUC__ 00808 # define YYCOPY(To, From, Count) \ 00809 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00810 # else 00811 # define YYCOPY(To, From, Count) \ 00812 do \ 00813 { \ 00814 YYSIZE_T yyi; \ 00815 for (yyi = 0; yyi < (Count); yyi++) \ 00816 (To)[yyi] = (From)[yyi]; \ 00817 } \ 00818 while (YYID (0)) 00819 # endif 00820 # endif 00821 #endif /* !YYCOPY_NEEDED */ 00822 00823 /* YYFINAL -- State number of the termination state. */ 00824 #define YYFINAL 27 00825 /* YYLAST -- Last index in YYTABLE. */ 00826 #define YYLAST 196 00827 00828 /* YYNTOKENS -- Number of terminals. */ 00829 #define YYNTOKENS 37 00830 /* YYNNTS -- Number of nonterminals. */ 00831 #define YYNNTS 35 00832 /* YYNRULES -- Number of rules. */ 00833 #define YYNRULES 62 00834 /* YYNRULES -- Number of states. */ 00835 #define YYNSTATES 103 00836 00837 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00838 #define YYUNDEFTOK 2 00839 #define YYMAXUTOK 291 00840 00841 #define YYTRANSLATE(YYX) \ 00842 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00843 00844 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00845 static const yytype_uint8 yytranslate[] = 00846 { 00847 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00848 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00849 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00850 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00851 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00852 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00853 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00854 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00855 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00856 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00857 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00858 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00859 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00860 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00861 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00862 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00863 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00864 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00865 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00866 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00867 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00868 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00869 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00870 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00871 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00872 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 00873 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00874 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 00875 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 00876 35, 36 00877 }; 00878 00879 #if YYDEBUG 00880 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00881 YYRHS. */ 00882 static const yytype_uint8 yyprhs[] = 00883 { 00884 0, 0, 3, 7, 11, 13, 15, 18, 20, 22, 00885 24, 28, 32, 36, 40, 44, 48, 50, 52, 54, 00886 56, 58, 60, 62, 64, 66, 68, 70, 72, 75, 00887 77, 79, 82, 83, 90, 92, 96, 100, 104, 108, 00888 110, 111, 113, 116, 120, 121, 126, 128, 131, 135, 00889 136, 141, 142, 147, 148, 153, 154, 158, 161, 163, 00890 166, 168, 171 00891 }; 00892 00893 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00894 static const yytype_int8 yyrhs[] = 00895 { 00896 38, 0, -1, 7, 39, 8, -1, 7, 58, 8, 00897 -1, 1, -1, 40, -1, 40, 41, -1, 41, -1, 00898 55, -1, 54, -1, 42, 40, 43, -1, 44, 40, 00899 45, -1, 48, 40, 49, -1, 46, 40, 47, -1, 00900 50, 40, 51, -1, 52, 40, 53, -1, 31, -1, 00901 11, -1, 32, -1, 14, -1, 33, -1, 15, -1, 00902 34, -1, 16, -1, 35, -1, 17, -1, 36, -1, 00903 18, -1, 26, 3, -1, 25, -1, 12, -1, 55, 00904 12, -1, -1, 59, 29, 57, 60, 9, 59, -1, 00905 56, -1, 42, 56, 43, -1, 44, 56, 45, -1, 00906 48, 56, 49, -1, 46, 56, 47, -1, 55, -1, 00907 -1, 61, -1, 60, 61, -1, 60, 70, 61, -1, 00908 -1, 5, 62, 63, 6, -1, 64, -1, 63, 64, 00909 -1, 63, 71, 64, -1, -1, 30, 58, 65, 10, 00910 -1, -1, 30, 39, 66, 10, -1, -1, 30, 69, 00911 67, 10, -1, -1, 30, 68, 10, -1, 28, 4, 00912 -1, 27, -1, 20, 21, -1, 19, -1, 23, 24, 00913 -1, 22, -1 00914 }; 00915 00916 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00917 static const yytype_uint16 yyrline[] = 00918 { 00919 0, 450, 450, 451, 452, 455, 458, 459, 462, 463, 00920 464, 465, 466, 467, 468, 469, 472, 475, 478, 481, 00921 484, 487, 490, 493, 496, 499, 502, 505, 508, 509, 00922 512, 513, 516, 516, 537, 538, 539, 540, 541, 544, 00923 545, 548, 549, 550, 553, 553, 556, 557, 558, 561, 00924 561, 562, 562, 563, 563, 564, 564, 567, 568, 571, 00925 572, 575, 576 00926 }; 00927 #endif 00928 00929 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00930 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00931 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00932 static const char *const yytname[] = 00933 { 00934 "$end", "error", "$undefined", "T_end_br", "T_end_img", "T_row", 00935 "T_end_row", "T_html", "T_end_html", "T_end_table", "T_end_cell", 00936 "T_end_font", "T_string", "T_error", "T_n_italic", "T_n_bold", 00937 "T_n_underline", "T_n_sup", "T_n_sub", "T_HR", "T_hr", "T_end_hr", 00938 "T_VR", "T_vr", "T_end_vr", "T_BR", "T_br", "T_IMG", "T_img", "T_table", 00939 "T_cell", "T_font", "T_italic", "T_bold", "T_underline", "T_sup", 00940 "T_sub", "$accept", "html", "fonttext", "text", "textitem", "font", 00941 "n_font", "italic", "n_italic", "bold", "n_bold", "underline", 00942 "n_underline", "sup", "n_sup", "sub", "n_sub", "br", "string", "table", 00943 "@1", "fonttable", "opt_space", "rows", "row", "$@2", "cells", "cell", 00944 "$@3", "$@4", "$@5", "$@6", "image", "HR", "VR", 0 00945 }; 00946 #endif 00947 00948 # ifdef YYPRINT 00949 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00950 token YYLEX-NUM. */ 00951 static const yytype_uint16 yytoknum[] = 00952 { 00953 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00954 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 00955 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 00956 285, 286, 287, 288, 289, 290, 291 00957 }; 00958 # endif 00959 00960 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00961 static const yytype_uint8 yyr1[] = 00962 { 00963 0, 37, 38, 38, 38, 39, 40, 40, 41, 41, 00964 41, 41, 41, 41, 41, 41, 42, 43, 44, 45, 00965 46, 47, 48, 49, 50, 51, 52, 53, 54, 54, 00966 55, 55, 57, 56, 58, 58, 58, 58, 58, 59, 00967 59, 60, 60, 60, 62, 61, 63, 63, 63, 65, 00968 64, 66, 64, 67, 64, 68, 64, 69, 69, 70, 00969 70, 71, 71 00970 }; 00971 00972 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00973 static const yytype_uint8 yyr2[] = 00974 { 00975 0, 2, 3, 3, 1, 1, 2, 1, 1, 1, 00976 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 00977 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 00978 1, 2, 0, 6, 1, 3, 3, 3, 3, 1, 00979 0, 1, 2, 3, 0, 4, 1, 2, 3, 0, 00980 4, 0, 4, 0, 4, 0, 3, 2, 1, 2, 00981 1, 2, 1 00982 }; 00983 00984 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. 00985 Performed when YYTABLE doesn't specify something else to do. Zero 00986 means the default is an error. */ 00987 static const yytype_uint8 yydefact[] = 00988 { 00989 0, 4, 40, 0, 30, 29, 0, 16, 18, 20, 00990 22, 24, 26, 0, 5, 7, 40, 40, 40, 40, 00991 0, 0, 9, 8, 34, 0, 0, 1, 28, 2, 00992 6, 0, 0, 0, 0, 8, 0, 0, 0, 0, 00993 0, 0, 0, 0, 0, 0, 31, 3, 32, 17, 00994 10, 35, 19, 11, 36, 21, 13, 38, 23, 12, 00995 37, 25, 14, 27, 15, 0, 44, 0, 41, 0, 00996 40, 60, 0, 42, 0, 40, 0, 46, 39, 33, 00997 59, 43, 58, 0, 51, 49, 0, 53, 45, 62, 00998 0, 47, 0, 57, 0, 0, 56, 0, 61, 48, 00999 52, 50, 54 01000 }; 01001 01002 /* YYDEFGOTO[NTERM-NUM]. */ 01003 static const yytype_int8 yydefgoto[] = 01004 { 01005 -1, 3, 13, 14, 15, 31, 50, 32, 53, 33, 01006 56, 34, 59, 20, 62, 21, 64, 22, 35, 24, 01007 65, 25, 26, 67, 68, 69, 76, 77, 95, 94, 01008 97, 86, 87, 74, 92 01009 }; 01010 01011 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 01012 STATE-NUM. */ 01013 #define YYPACT_NINF -68 01014 static const yytype_int16 yypact[] = 01015 { 01016 6, -68, 141, 8, -68, -68, 7, -68, -68, -68, 01017 -68, -68, -68, 4, 141, -68, 141, 141, 141, 141, 01018 141, 141, -68, -6, -68, 11, -8, -68, -68, -68, 01019 -68, 141, 141, 141, 141, 14, 30, 9, 55, 16, 01020 67, 13, 92, 33, 104, 129, -68, -68, -68, -68, 01021 -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, 01022 -68, -68, -68, -68, -68, 27, -68, 100, -68, 22, 01023 41, -68, 36, -68, 27, 12, 28, -68, 14, -68, 01024 -68, -68, -68, 50, -68, -68, 49, -68, -68, -68, 01025 46, -68, 22, -68, 61, 62, -68, 68, -68, -68, 01026 -68, -68, -68 01027 }; 01028 01029 /* YYPGOTO[NTERM-NUM]. */ 01030 static const yytype_int16 yypgoto[] = 01031 { 01032 -68, -68, -15, 162, -9, -1, 47, 0, 44, 1, 01033 65, 2, 42, -68, -68, -68, -68, -68, -2, 78, 01034 -68, 32, 40, -68, -56, -68, -68, -67, -68, -68, 01035 -68, -68, -68, -68, -68 01036 }; 01037 01038 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 01039 positive, shift that token. If negative, reduce the rule which 01040 number is the opposite. If YYTABLE_NINF, syntax error. */ 01041 #define YYTABLE_NINF -56 01042 static const yytype_int8 yytable[] = 01043 { 01044 23, 16, 17, 18, 19, 30, 46, 1, 27, 91, 01045 28, 73, 29, 2, 23, 23, 23, 23, 81, 47, 01046 49, 48, -55, -39, 4, 99, 46, 30, 55, 30, 01047 52, 30, 66, 30, 88, 30, 30, 5, 6, 82, 01048 83, 49, 4, 7, 8, 9, 10, 11, 12, 58, 01049 89, 90, 75, 4, 93, 5, 6, 80, 75, 96, 01050 84, 7, 8, 9, 10, 11, 12, 4, 78, 52, 01051 98, 100, 101, 23, 16, 17, 18, 19, 102, 4, 01052 5, 6, 55, 54, 51, 60, 7, 8, 9, 10, 01053 11, 12, 5, 6, 37, 39, 41, 43, 7, 8, 01054 9, 10, 11, 12, 4, 66, 57, 85, 58, 70, 01055 79, 0, 0, 0, 0, 0, 4, 5, 6, 71, 01056 72, 61, 0, 7, 8, 9, 10, 11, 12, 5, 01057 6, 0, 0, 0, 0, 7, 8, 9, 10, 11, 01058 12, 4, 0, 0, 0, 0, 0, 63, 0, 0, 01059 0, 0, 0, 4, 5, 6, 0, 0, 0, 0, 01060 7, 8, 9, 10, 11, 12, 5, 6, 0, 0, 01061 0, 0, 7, 8, 9, 10, 11, 12, 36, 38, 01062 40, 42, 44, 45, 0, 0, 0, 0, 0, 0, 01063 0, 0, 0, 36, 38, 40, 42 01064 }; 01065 01066 #define yypact_value_is_default(yystate) \ 01067 ((yystate) == (-68)) 01068 01069 #define yytable_value_is_error(yytable_value) \ 01070 YYID (0) 01071 01072 static const yytype_int8 yycheck[] = 01073 { 01074 2, 2, 2, 2, 2, 14, 12, 1, 0, 76, 01075 3, 67, 8, 7, 16, 17, 18, 19, 74, 8, 01076 11, 29, 10, 29, 12, 92, 12, 36, 15, 38, 01077 14, 40, 5, 42, 6, 44, 45, 25, 26, 27, 01078 28, 11, 12, 31, 32, 33, 34, 35, 36, 16, 01079 22, 23, 30, 12, 4, 25, 26, 21, 30, 10, 01080 75, 31, 32, 33, 34, 35, 36, 12, 70, 14, 01081 24, 10, 10, 75, 75, 75, 75, 75, 10, 12, 01082 25, 26, 15, 39, 37, 43, 31, 32, 33, 34, 01083 35, 36, 25, 26, 16, 17, 18, 19, 31, 32, 01084 33, 34, 35, 36, 12, 5, 41, 75, 16, 9, 01085 70, -1, -1, -1, -1, -1, 12, 25, 26, 19, 01086 20, 17, -1, 31, 32, 33, 34, 35, 36, 25, 01087 26, -1, -1, -1, -1, 31, 32, 33, 34, 35, 01088 36, 12, -1, -1, -1, -1, -1, 18, -1, -1, 01089 -1, -1, -1, 12, 25, 26, -1, -1, -1, -1, 01090 31, 32, 33, 34, 35, 36, 25, 26, -1, -1, 01091 -1, -1, 31, 32, 33, 34, 35, 36, 16, 17, 01092 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, 01093 -1, -1, -1, 31, 32, 33, 34 01094 }; 01095 01096 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 01097 symbol of state STATE-NUM. */ 01098 static const yytype_uint8 yystos[] = 01099 { 01100 0, 1, 7, 38, 12, 25, 26, 31, 32, 33, 01101 34, 35, 36, 39, 40, 41, 42, 44, 46, 48, 01102 50, 52, 54, 55, 56, 58, 59, 0, 3, 8, 01103 41, 42, 44, 46, 48, 55, 40, 56, 40, 56, 01104 40, 56, 40, 56, 40, 40, 12, 8, 29, 11, 01105 43, 43, 14, 45, 45, 15, 47, 47, 16, 49, 01106 49, 17, 51, 18, 53, 57, 5, 60, 61, 62, 01107 9, 19, 20, 61, 70, 30, 63, 64, 55, 59, 01108 21, 61, 27, 28, 39, 58, 68, 69, 6, 22, 01109 23, 64, 71, 4, 66, 65, 10, 67, 24, 64, 01110 10, 10, 10 01111 }; 01112 01113 #define yyerrok (yyerrstatus = 0) 01114 #define yyclearin (yychar = YYEMPTY) 01115 #define YYEMPTY (-2) 01116 #define YYEOF 0 01117 01118 #define YYACCEPT goto yyacceptlab 01119 #define YYABORT goto yyabortlab 01120 #define YYERROR goto yyerrorlab 01121 01122 01123 /* Like YYERROR except do call yyerror. This remains here temporarily 01124 to ease the transition to the new meaning of YYERROR, for GCC. 01125 Once GCC version 2 has supplanted version 1, this can go. However, 01126 YYFAIL appears to be in use. Nevertheless, it is formally deprecated 01127 in Bison 2.4.2's NEWS entry, where a plan to phase it out is 01128 discussed. */ 01129 01130 #define YYFAIL goto yyerrlab 01131 #if defined YYFAIL 01132 /* This is here to suppress warnings from the GCC cpp's 01133 -Wunused-macros. Normally we don't worry about that warning, but 01134 some users do, and we want to make it easy for users to remove 01135 YYFAIL uses, which will produce warnings from Bison 2.5. */ 01136 #endif 01137 01138 #define YYRECOVERING() (!!yyerrstatus) 01139 01140 #define YYBACKUP(Token, Value) \ 01141 do \ 01142 if (yychar == YYEMPTY && yylen == 1) \ 01143 { \ 01144 yychar = (Token); \ 01145 yylval = (Value); \ 01146 YYPOPSTACK (1); \ 01147 goto yybackup; \ 01148 } \ 01149 else \ 01150 { \ 01151 yyerror (YY_("syntax error: cannot back up")); \ 01152 YYERROR; \ 01153 } \ 01154 while (YYID (0)) 01155 01156 01157 #define YYTERROR 1 01158 #define YYERRCODE 256 01159 01160 01161 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 01162 If N is 0, then set CURRENT to the empty location which ends 01163 the previous symbol: RHS[0] (always defined). */ 01164 01165 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 01166 #ifndef YYLLOC_DEFAULT 01167 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 01168 do \ 01169 if (YYID (N)) \ 01170 { \ 01171 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 01172 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 01173 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 01174 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 01175 } \ 01176 else \ 01177 { \ 01178 (Current).first_line = (Current).last_line = \ 01179 YYRHSLOC (Rhs, 0).last_line; \ 01180 (Current).first_column = (Current).last_column = \ 01181 YYRHSLOC (Rhs, 0).last_column; \ 01182 } \ 01183 while (YYID (0)) 01184 #endif 01185 01186 01187 /* This macro is provided for backward compatibility. */ 01188 01189 #ifndef YY_LOCATION_PRINT 01190 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 01191 #endif 01192 01193 01194 /* YYLEX -- calling `yylex' with the right arguments. */ 01195 01196 #ifdef YYLEX_PARAM 01197 # define YYLEX yylex (YYLEX_PARAM) 01198 #else 01199 # define YYLEX yylex () 01200 #endif 01201 01202 /* Enable debugging if requested. */ 01203 #if YYDEBUG 01204 01205 # ifndef YYFPRINTF 01206 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 01207 # define YYFPRINTF fprintf 01208 # endif 01209 01210 # define YYDPRINTF(Args) \ 01211 do { \ 01212 if (yydebug) \ 01213 YYFPRINTF Args; \ 01214 } while (YYID (0)) 01215 01216 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 01217 do { \ 01218 if (yydebug) \ 01219 { \ 01220 YYFPRINTF (stderr, "%s ", Title); \ 01221 yy_symbol_print (stderr, \ 01222 Type, Value); \ 01223 YYFPRINTF (stderr, "\n"); \ 01224 } \ 01225 } while (YYID (0)) 01226 01227 01228 /*--------------------------------. 01229 | Print this symbol on YYOUTPUT. | 01230 `--------------------------------*/ 01231 01232 /*ARGSUSED*/ 01233 #if (defined __STDC__ || defined __C99__FUNC__ \ 01234 || defined __cplusplus || defined _MSC_VER) 01235 static void 01236 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01237 #else 01238 static void 01239 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 01240 FILE *yyoutput; 01241 int yytype; 01242 YYSTYPE const * const yyvaluep; 01243 #endif 01244 { 01245 if (!yyvaluep) 01246 return; 01247 # ifdef YYPRINT 01248 if (yytype < YYNTOKENS) 01249 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 01250 # else 01251 YYUSE (yyoutput); 01252 # endif 01253 switch (yytype) 01254 { 01255 default: 01256 break; 01257 } 01258 } 01259 01260 01261 /*--------------------------------. 01262 | Print this symbol on YYOUTPUT. | 01263 `--------------------------------*/ 01264 01265 #if (defined __STDC__ || defined __C99__FUNC__ \ 01266 || defined __cplusplus || defined _MSC_VER) 01267 static void 01268 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01269 #else 01270 static void 01271 yy_symbol_print (yyoutput, yytype, yyvaluep) 01272 FILE *yyoutput; 01273 int yytype; 01274 YYSTYPE const * const yyvaluep; 01275 #endif 01276 { 01277 if (yytype < YYNTOKENS) 01278 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 01279 else 01280 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 01281 01282 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 01283 YYFPRINTF (yyoutput, ")"); 01284 } 01285 01286 /*------------------------------------------------------------------. 01287 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 01288 | TOP (included). | 01289 `------------------------------------------------------------------*/ 01290 01291 #if (defined __STDC__ || defined __C99__FUNC__ \ 01292 || defined __cplusplus || defined _MSC_VER) 01293 static void 01294 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 01295 #else 01296 static void 01297 yy_stack_print (yybottom, yytop) 01298 yytype_int16 *yybottom; 01299 yytype_int16 *yytop; 01300 #endif 01301 { 01302 YYFPRINTF (stderr, "Stack now"); 01303 for (; yybottom <= yytop; yybottom++) 01304 { 01305 int yybot = *yybottom; 01306 YYFPRINTF (stderr, " %d", yybot); 01307 } 01308 YYFPRINTF (stderr, "\n"); 01309 } 01310 01311 # define YY_STACK_PRINT(Bottom, Top) \ 01312 do { \ 01313 if (yydebug) \ 01314 yy_stack_print ((Bottom), (Top)); \ 01315 } while (YYID (0)) 01316 01317 01318 /*------------------------------------------------. 01319 | Report that the YYRULE is going to be reduced. | 01320 `------------------------------------------------*/ 01321 01322 #if (defined __STDC__ || defined __C99__FUNC__ \ 01323 || defined __cplusplus || defined _MSC_VER) 01324 static void 01325 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 01326 #else 01327 static void 01328 yy_reduce_print (yyvsp, yyrule) 01329 YYSTYPE *yyvsp; 01330 int yyrule; 01331 #endif 01332 { 01333 int yynrhs = yyr2[yyrule]; 01334 int yyi; 01335 unsigned long int yylno = yyrline[yyrule]; 01336 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 01337 yyrule - 1, yylno); 01338 /* The symbols being reduced. */ 01339 for (yyi = 0; yyi < yynrhs; yyi++) 01340 { 01341 YYFPRINTF (stderr, " $%d = ", yyi + 1); 01342 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 01343 &(yyvsp[(yyi + 1) - (yynrhs)]) 01344 ); 01345 YYFPRINTF (stderr, "\n"); 01346 } 01347 } 01348 01349 # define YY_REDUCE_PRINT(Rule) \ 01350 do { \ 01351 if (yydebug) \ 01352 yy_reduce_print (yyvsp, Rule); \ 01353 } while (YYID (0)) 01354 01355 /* Nonzero means print parse trace. It is left uninitialized so that 01356 multiple parsers can coexist. */ 01357 int yydebug; 01358 #else /* !YYDEBUG */ 01359 # define YYDPRINTF(Args) 01360 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 01361 # define YY_STACK_PRINT(Bottom, Top) 01362 # define YY_REDUCE_PRINT(Rule) 01363 #endif /* !YYDEBUG */ 01364 01365 01366 /* YYINITDEPTH -- initial size of the parser's stacks. */ 01367 #ifndef YYINITDEPTH 01368 # define YYINITDEPTH 200 01369 #endif 01370 01371 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 01372 if the built-in stack extension method is used). 01373 01374 Do not make this value too large; the results are undefined if 01375 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 01376 evaluated with infinite-precision integer arithmetic. */ 01377 01378 #ifndef YYMAXDEPTH 01379 # define YYMAXDEPTH 10000 01380 #endif 01381 01382 01383 #if YYERROR_VERBOSE 01384 01385 # ifndef yystrlen 01386 # if defined __GLIBC__ && defined _STRING_H 01387 # define yystrlen strlen 01388 # else 01389 /* Return the length of YYSTR. */ 01390 #if (defined __STDC__ || defined __C99__FUNC__ \ 01391 || defined __cplusplus || defined _MSC_VER) 01392 static YYSIZE_T 01393 yystrlen (const char *yystr) 01394 #else 01395 static YYSIZE_T 01396 yystrlen (yystr) 01397 const char *yystr; 01398 #endif 01399 { 01400 YYSIZE_T yylen; 01401 for (yylen = 0; yystr[yylen]; yylen++) 01402 continue; 01403 return yylen; 01404 } 01405 # endif 01406 # endif 01407 01408 # ifndef yystpcpy 01409 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 01410 # define yystpcpy stpcpy 01411 # else 01412 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 01413 YYDEST. */ 01414 #if (defined __STDC__ || defined __C99__FUNC__ \ 01415 || defined __cplusplus || defined _MSC_VER) 01416 static char * 01417 yystpcpy (char *yydest, const char *yysrc) 01418 #else 01419 static char * 01420 yystpcpy (yydest, yysrc) 01421 char *yydest; 01422 const char *yysrc; 01423 #endif 01424 { 01425 char *yyd = yydest; 01426 const char *yys = yysrc; 01427 01428 while ((*yyd++ = *yys++) != '\0') 01429 continue; 01430 01431 return yyd - 1; 01432 } 01433 # endif 01434 # endif 01435 01436 # ifndef yytnamerr 01437 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 01438 quotes and backslashes, so that it's suitable for yyerror. The 01439 heuristic is that double-quoting is unnecessary unless the string 01440 contains an apostrophe, a comma, or backslash (other than 01441 backslash-backslash). YYSTR is taken from yytname. If YYRES is 01442 null, do not copy; instead, return the length of what the result 01443 would have been. */ 01444 static YYSIZE_T 01445 yytnamerr (char *yyres, const char *yystr) 01446 { 01447 if (*yystr == '"') 01448 { 01449 YYSIZE_T yyn = 0; 01450 char const *yyp = yystr; 01451 01452 for (;;) 01453 switch (*++yyp) 01454 { 01455 case '\'': 01456 case ',': 01457 goto do_not_strip_quotes; 01458 01459 case '\\': 01460 if (*++yyp != '\\') 01461 goto do_not_strip_quotes; 01462 /* Fall through. */ 01463 default: 01464 if (yyres) 01465 yyres[yyn] = *yyp; 01466 yyn++; 01467 break; 01468 01469 case '"': 01470 if (yyres) 01471 yyres[yyn] = '\0'; 01472 return yyn; 01473 } 01474 do_not_strip_quotes: ; 01475 } 01476 01477 if (! yyres) 01478 return yystrlen (yystr); 01479 01480 return yystpcpy (yyres, yystr) - yyres; 01481 } 01482 # endif 01483 01484 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 01485 about the unexpected token YYTOKEN for the state stack whose top is 01486 YYSSP. 01487 01488 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 01489 not large enough to hold the message. In that case, also set 01490 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 01491 required number of bytes is too large to store. */ 01492 static int 01493 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 01494 yytype_int16 *yyssp, int yytoken) 01495 { 01496 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); 01497 YYSIZE_T yysize = yysize0; 01498 YYSIZE_T yysize1; 01499 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 01500 /* Internationalized format string. */ 01501 const char *yyformat = 0; 01502 /* Arguments of yyformat. */ 01503 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01504 /* Number of reported tokens (one for the "unexpected", one per 01505 "expected"). */ 01506 int yycount = 0; 01507 01508 /* There are many possibilities here to consider: 01509 - Assume YYFAIL is not used. It's too flawed to consider. See 01510 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> 01511 for details. YYERROR is fine as it does not invoke this 01512 function. 01513 - If this state is a consistent state with a default action, then 01514 the only way this function was invoked is if the default action 01515 is an error action. In that case, don't check for expected 01516 tokens because there are none. 01517 - The only way there can be no lookahead present (in yychar) is if 01518 this state is a consistent state with a default action. Thus, 01519 detecting the absence of a lookahead is sufficient to determine 01520 that there is no unexpected or expected token to report. In that 01521 case, just report a simple "syntax error". 01522 - Don't assume there isn't a lookahead just because this state is a 01523 consistent state with a default action. There might have been a 01524 previous inconsistent state, consistent state with a non-default 01525 action, or user semantic action that manipulated yychar. 01526 - Of course, the expected token list depends on states to have 01527 correct lookahead information, and it depends on the parser not 01528 to perform extra reductions after fetching a lookahead from the 01529 scanner and before detecting a syntax error. Thus, state merging 01530 (from LALR or IELR) and default reductions corrupt the expected 01531 token list. However, the list is correct for canonical LR with 01532 one exception: it will still contain any token that will not be 01533 accepted due to an error action in a later state. 01534 */ 01535 if (yytoken != YYEMPTY) 01536 { 01537 int yyn = yypact[*yyssp]; 01538 yyarg[yycount++] = yytname[yytoken]; 01539 if (!yypact_value_is_default (yyn)) 01540 { 01541 /* Start YYX at -YYN if negative to avoid negative indexes in 01542 YYCHECK. In other words, skip the first -YYN actions for 01543 this state because they are default actions. */ 01544 int yyxbegin = yyn < 0 ? -yyn : 0; 01545 /* Stay within bounds of both yycheck and yytname. */ 01546 int yychecklim = YYLAST - yyn + 1; 01547 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01548 int yyx; 01549 01550 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01551 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 01552 && !yytable_value_is_error (yytable[yyx + yyn])) 01553 { 01554 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01555 { 01556 yycount = 1; 01557 yysize = yysize0; 01558 break; 01559 } 01560 yyarg[yycount++] = yytname[yyx]; 01561 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01562 if (! (yysize <= yysize1 01563 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01564 return 2; 01565 yysize = yysize1; 01566 } 01567 } 01568 } 01569 01570 switch (yycount) 01571 { 01572 # define YYCASE_(N, S) \ 01573 case N: \ 01574 yyformat = S; \ 01575 break 01576 YYCASE_(0, YY_("syntax error")); 01577 YYCASE_(1, YY_("syntax error, unexpected %s")); 01578 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 01579 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 01580 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 01581 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 01582 # undef YYCASE_ 01583 } 01584 01585 yysize1 = yysize + yystrlen (yyformat); 01586 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01587 return 2; 01588 yysize = yysize1; 01589 01590 if (*yymsg_alloc < yysize) 01591 { 01592 *yymsg_alloc = 2 * yysize; 01593 if (! (yysize <= *yymsg_alloc 01594 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 01595 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 01596 return 1; 01597 } 01598 01599 /* Avoid sprintf, as that infringes on the user's name space. 01600 Don't have undefined behavior even if the translation 01601 produced a string with the wrong number of "%s"s. */ 01602 { 01603 char *yyp = *yymsg; 01604 int yyi = 0; 01605 while ((*yyp = *yyformat) != '\0') 01606 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 01607 { 01608 yyp += yytnamerr (yyp, yyarg[yyi++]); 01609 yyformat += 2; 01610 } 01611 else 01612 { 01613 yyp++; 01614 yyformat++; 01615 } 01616 } 01617 return 0; 01618 } 01619 #endif /* YYERROR_VERBOSE */ 01620 01621 /*-----------------------------------------------. 01622 | Release the memory associated to this symbol. | 01623 `-----------------------------------------------*/ 01624 01625 /*ARGSUSED*/ 01626 #if (defined __STDC__ || defined __C99__FUNC__ \ 01627 || defined __cplusplus || defined _MSC_VER) 01628 static void 01629 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 01630 #else 01631 static void 01632 yydestruct (yymsg, yytype, yyvaluep) 01633 const char *yymsg; 01634 int yytype; 01635 YYSTYPE *yyvaluep; 01636 #endif 01637 { 01638 YYUSE (yyvaluep); 01639 01640 if (!yymsg) 01641 yymsg = "Deleting"; 01642 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01643 01644 switch (yytype) 01645 { 01646 01647 default: 01648 break; 01649 } 01650 } 01651 01652 01653 /* Prevent warnings from -Wmissing-prototypes. */ 01654 #ifdef YYPARSE_PARAM 01655 #if defined __STDC__ || defined __cplusplus 01656 int yyparse (void *YYPARSE_PARAM); 01657 #else 01658 int yyparse (); 01659 #endif 01660 #else /* ! YYPARSE_PARAM */ 01661 #if defined __STDC__ || defined __cplusplus 01662 int yyparse (void); 01663 #else 01664 int yyparse (); 01665 #endif 01666 #endif /* ! YYPARSE_PARAM */ 01667 01668 01669 /* The lookahead symbol. */ 01670 int yychar; 01671 01672 /* The semantic value of the lookahead symbol. */ 01673 YYSTYPE yylval; 01674 01675 /* Number of syntax errors so far. */ 01676 int yynerrs; 01677 01678 01679 /*----------. 01680 | yyparse. | 01681 `----------*/ 01682 01683 #ifdef YYPARSE_PARAM 01684 #if (defined __STDC__ || defined __C99__FUNC__ \ 01685 || defined __cplusplus || defined _MSC_VER) 01686 int 01687 yyparse (void *YYPARSE_PARAM) 01688 #else 01689 int 01690 yyparse (YYPARSE_PARAM) 01691 void *YYPARSE_PARAM; 01692 #endif 01693 #else /* ! YYPARSE_PARAM */ 01694 #if (defined __STDC__ || defined __C99__FUNC__ \ 01695 || defined __cplusplus || defined _MSC_VER) 01696 int 01697 yyparse (void) 01698 #else 01699 int 01700 yyparse () 01701 01702 #endif 01703 #endif 01704 { 01705 int yystate; 01706 /* Number of tokens to shift before error messages enabled. */ 01707 int yyerrstatus; 01708 01709 /* The stacks and their tools: 01710 `yyss': related to states. 01711 `yyvs': related to semantic values. 01712 01713 Refer to the stacks thru separate pointers, to allow yyoverflow 01714 to reallocate them elsewhere. */ 01715 01716 /* The state stack. */ 01717 yytype_int16 yyssa[YYINITDEPTH]; 01718 yytype_int16 *yyss; 01719 yytype_int16 *yyssp; 01720 01721 /* The semantic value stack. */ 01722 YYSTYPE yyvsa[YYINITDEPTH]; 01723 YYSTYPE *yyvs; 01724 YYSTYPE *yyvsp; 01725 01726 YYSIZE_T yystacksize; 01727 01728 int yyn; 01729 int yyresult; 01730 /* Lookahead token as an internal (translated) token number. */ 01731 int yytoken; 01732 /* The variables used to return semantic value and location from the 01733 action routines. */ 01734 YYSTYPE yyval; 01735 01736 #if YYERROR_VERBOSE 01737 /* Buffer for error messages, and its allocated size. */ 01738 char yymsgbuf[128]; 01739 char *yymsg = yymsgbuf; 01740 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01741 #endif 01742 01743 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 01744 01745 /* The number of symbols on the RHS of the reduced rule. 01746 Keep to zero when no symbol should be popped. */ 01747 int yylen = 0; 01748 01749 yytoken = 0; 01750 yyss = yyssa; 01751 yyvs = yyvsa; 01752 yystacksize = YYINITDEPTH; 01753 01754 YYDPRINTF ((stderr, "Starting parse\n")); 01755 01756 yystate = 0; 01757 yyerrstatus = 0; 01758 yynerrs = 0; 01759 yychar = YYEMPTY; /* Cause a token to be read. */ 01760 01761 /* Initialize stack pointers. 01762 Waste one element of value and location stack 01763 so that they stay on the same level as the state stack. 01764 The wasted elements are never initialized. */ 01765 yyssp = yyss; 01766 yyvsp = yyvs; 01767 01768 goto yysetstate; 01769 01770 /*------------------------------------------------------------. 01771 | yynewstate -- Push a new state, which is found in yystate. | 01772 `------------------------------------------------------------*/ 01773 yynewstate: 01774 /* In all cases, when you get here, the value and location stacks 01775 have just been pushed. So pushing a state here evens the stacks. */ 01776 yyssp++; 01777 01778 yysetstate: 01779 *yyssp = yystate; 01780 01781 if (yyss + yystacksize - 1 <= yyssp) 01782 { 01783 /* Get the current used size of the three stacks, in elements. */ 01784 YYSIZE_T yysize = yyssp - yyss + 1; 01785 01786 #ifdef yyoverflow 01787 { 01788 /* Give user a chance to reallocate the stack. Use copies of 01789 these so that the &'s don't force the real ones into 01790 memory. */ 01791 YYSTYPE *yyvs1 = yyvs; 01792 yytype_int16 *yyss1 = yyss; 01793 01794 /* Each stack pointer address is followed by the size of the 01795 data in use in that stack, in bytes. This used to be a 01796 conditional around just the two extra args, but that might 01797 be undefined if yyoverflow is a macro. */ 01798 yyoverflow (YY_("memory exhausted"), 01799 &yyss1, yysize * sizeof (*yyssp), 01800 &yyvs1, yysize * sizeof (*yyvsp), 01801 &yystacksize); 01802 01803 yyss = yyss1; 01804 yyvs = yyvs1; 01805 } 01806 #else /* no yyoverflow */ 01807 # ifndef YYSTACK_RELOCATE 01808 goto yyexhaustedlab; 01809 # else 01810 /* Extend the stack our own way. */ 01811 if (YYMAXDEPTH <= yystacksize) 01812 goto yyexhaustedlab; 01813 yystacksize *= 2; 01814 if (YYMAXDEPTH < yystacksize) 01815 yystacksize = YYMAXDEPTH; 01816 01817 { 01818 yytype_int16 *yyss1 = yyss; 01819 union yyalloc *yyptr = 01820 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01821 if (! yyptr) 01822 goto yyexhaustedlab; 01823 YYSTACK_RELOCATE (yyss_alloc, yyss); 01824 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01825 # undef YYSTACK_RELOCATE 01826 if (yyss1 != yyssa) 01827 YYSTACK_FREE (yyss1); 01828 } 01829 # endif 01830 #endif /* no yyoverflow */ 01831 01832 yyssp = yyss + yysize - 1; 01833 yyvsp = yyvs + yysize - 1; 01834 01835 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01836 (unsigned long int) yystacksize)); 01837 01838 if (yyss + yystacksize - 1 <= yyssp) 01839 YYABORT; 01840 } 01841 01842 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01843 01844 if (yystate == YYFINAL) 01845 YYACCEPT; 01846 01847 goto yybackup; 01848 01849 /*-----------. 01850 | yybackup. | 01851 `-----------*/ 01852 yybackup: 01853 01854 /* Do appropriate processing given the current state. Read a 01855 lookahead token if we need one and don't already have one. */ 01856 01857 /* First try to decide what to do without reference to lookahead token. */ 01858 yyn = yypact[yystate]; 01859 if (yypact_value_is_default (yyn)) 01860 goto yydefault; 01861 01862 /* Not known => get a lookahead token if don't already have one. */ 01863 01864 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01865 if (yychar == YYEMPTY) 01866 { 01867 YYDPRINTF ((stderr, "Reading a token: ")); 01868 yychar = YYLEX; 01869 } 01870 01871 if (yychar <= YYEOF) 01872 { 01873 yychar = yytoken = YYEOF; 01874 YYDPRINTF ((stderr, "Now at end of input.\n")); 01875 } 01876 else 01877 { 01878 yytoken = YYTRANSLATE (yychar); 01879 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01880 } 01881 01882 /* If the proper action on seeing token YYTOKEN is to reduce or to 01883 detect an error, take that action. */ 01884 yyn += yytoken; 01885 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01886 goto yydefault; 01887 yyn = yytable[yyn]; 01888 if (yyn <= 0) 01889 { 01890 if (yytable_value_is_error (yyn)) 01891 goto yyerrlab; 01892 yyn = -yyn; 01893 goto yyreduce; 01894 } 01895 01896 /* Count tokens shifted since error; after three, turn off error 01897 status. */ 01898 if (yyerrstatus) 01899 yyerrstatus--; 01900 01901 /* Shift the lookahead token. */ 01902 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01903 01904 /* Discard the shifted token. */ 01905 yychar = YYEMPTY; 01906 01907 yystate = yyn; 01908 *++yyvsp = yylval; 01909 01910 goto yynewstate; 01911 01912 01913 /*-----------------------------------------------------------. 01914 | yydefault -- do the default action for the current state. | 01915 `-----------------------------------------------------------*/ 01916 yydefault: 01917 yyn = yydefact[yystate]; 01918 if (yyn == 0) 01919 goto yyerrlab; 01920 goto yyreduce; 01921 01922 01923 /*-----------------------------. 01924 | yyreduce -- Do a reduction. | 01925 `-----------------------------*/ 01926 yyreduce: 01927 /* yyn is the number of a rule to reduce with. */ 01928 yylen = yyr2[yyn]; 01929 01930 /* If YYLEN is nonzero, implement the default value of the action: 01931 `$$ = $1'. 01932 01933 Otherwise, the following line sets YYVAL to garbage. 01934 This behavior is undocumented and Bison 01935 users should not rely upon it. Assigning to YYVAL 01936 unconditionally makes the parser a bit smaller, and it avoids a 01937 GCC warning that YYVAL may be used uninitialized. */ 01938 yyval = yyvsp[1-yylen]; 01939 01940 01941 YY_REDUCE_PRINT (yyn); 01942 switch (yyn) 01943 { 01944 case 2: 01945 01946 /* Line 1806 of yacc.c */ 01947 #line 450 "../../lib/common/htmlparse.y" 01948 { HTMLstate.lbl = mkLabel((yyvsp[(2) - (3)].txt),HTML_TEXT); } 01949 break; 01950 01951 case 3: 01952 01953 /* Line 1806 of yacc.c */ 01954 #line 451 "../../lib/common/htmlparse.y" 01955 { HTMLstate.lbl = mkLabel((yyvsp[(2) - (3)].tbl),HTML_TBL); } 01956 break; 01957 01958 case 4: 01959 01960 /* Line 1806 of yacc.c */ 01961 #line 452 "../../lib/common/htmlparse.y" 01962 { cleanup(); YYABORT; } 01963 break; 01964 01965 case 5: 01966 01967 /* Line 1806 of yacc.c */ 01968 #line 455 "../../lib/common/htmlparse.y" 01969 { (yyval.txt) = mkText(); } 01970 break; 01971 01972 case 8: 01973 01974 /* Line 1806 of yacc.c */ 01975 #line 462 "../../lib/common/htmlparse.y" 01976 { appendFItemList(HTMLstate.str);} 01977 break; 01978 01979 case 9: 01980 01981 /* Line 1806 of yacc.c */ 01982 #line 463 "../../lib/common/htmlparse.y" 01983 {appendFLineList((yyvsp[(1) - (1)].i));} 01984 break; 01985 01986 case 16: 01987 01988 /* Line 1806 of yacc.c */ 01989 #line 472 "../../lib/common/htmlparse.y" 01990 { pushFont ((yyvsp[(1) - (1)].font)); } 01991 break; 01992 01993 case 17: 01994 01995 /* Line 1806 of yacc.c */ 01996 #line 475 "../../lib/common/htmlparse.y" 01997 { popFont (); } 01998 break; 01999 02000 case 18: 02001 02002 /* Line 1806 of yacc.c */ 02003 #line 478 "../../lib/common/htmlparse.y" 02004 {pushFont((yyvsp[(1) - (1)].font));} 02005 break; 02006 02007 case 19: 02008 02009 /* Line 1806 of yacc.c */ 02010 #line 481 "../../lib/common/htmlparse.y" 02011 {popFont();} 02012 break; 02013 02014 case 20: 02015 02016 /* Line 1806 of yacc.c */ 02017 #line 484 "../../lib/common/htmlparse.y" 02018 {pushFont((yyvsp[(1) - (1)].font));} 02019 break; 02020 02021 case 21: 02022 02023 /* Line 1806 of yacc.c */ 02024 #line 487 "../../lib/common/htmlparse.y" 02025 {popFont();} 02026 break; 02027 02028 case 22: 02029 02030 /* Line 1806 of yacc.c */ 02031 #line 490 "../../lib/common/htmlparse.y" 02032 {pushFont((yyvsp[(1) - (1)].font));} 02033 break; 02034 02035 case 23: 02036 02037 /* Line 1806 of yacc.c */ 02038 #line 493 "../../lib/common/htmlparse.y" 02039 {popFont();} 02040 break; 02041 02042 case 24: 02043 02044 /* Line 1806 of yacc.c */ 02045 #line 496 "../../lib/common/htmlparse.y" 02046 {pushFont((yyvsp[(1) - (1)].font));} 02047 break; 02048 02049 case 25: 02050 02051 /* Line 1806 of yacc.c */ 02052 #line 499 "../../lib/common/htmlparse.y" 02053 {popFont();} 02054 break; 02055 02056 case 26: 02057 02058 /* Line 1806 of yacc.c */ 02059 #line 502 "../../lib/common/htmlparse.y" 02060 {pushFont((yyvsp[(1) - (1)].font));} 02061 break; 02062 02063 case 27: 02064 02065 /* Line 1806 of yacc.c */ 02066 #line 505 "../../lib/common/htmlparse.y" 02067 {popFont();} 02068 break; 02069 02070 case 28: 02071 02072 /* Line 1806 of yacc.c */ 02073 #line 508 "../../lib/common/htmlparse.y" 02074 { (yyval.i) = (yyvsp[(1) - (2)].i); } 02075 break; 02076 02077 case 29: 02078 02079 /* Line 1806 of yacc.c */ 02080 #line 509 "../../lib/common/htmlparse.y" 02081 { (yyval.i) = (yyvsp[(1) - (1)].i); } 02082 break; 02083 02084 case 32: 02085 02086 /* Line 1806 of yacc.c */ 02087 #line 516 "../../lib/common/htmlparse.y" 02088 { 02089 if (nonSpace(agxbuse(HTMLstate.str))) { 02090 yyerror ("Syntax error: non-space string used before <TABLE>"); 02091 cleanup(); YYABORT; 02092 } 02093 (yyvsp[(2) - (2)].tbl)->u.p.prev = HTMLstate.tblstack; 02094 (yyvsp[(2) - (2)].tbl)->u.p.rows = dtopen(&rowDisc, Dtqueue); 02095 HTMLstate.tblstack = (yyvsp[(2) - (2)].tbl); 02096 (yyvsp[(2) - (2)].tbl)->font = dupFont (HTMLstate.fontstack->cfont); 02097 (yyval.tbl) = (yyvsp[(2) - (2)].tbl); 02098 } 02099 break; 02100 02101 case 33: 02102 02103 /* Line 1806 of yacc.c */ 02104 #line 527 "../../lib/common/htmlparse.y" 02105 { 02106 if (nonSpace(agxbuse(HTMLstate.str))) { 02107 yyerror ("Syntax error: non-space string used after </TABLE>"); 02108 cleanup(); YYABORT; 02109 } 02110 (yyval.tbl) = HTMLstate.tblstack; 02111 HTMLstate.tblstack = HTMLstate.tblstack->u.p.prev; 02112 } 02113 break; 02114 02115 case 34: 02116 02117 /* Line 1806 of yacc.c */ 02118 #line 537 "../../lib/common/htmlparse.y" 02119 { (yyval.tbl) = (yyvsp[(1) - (1)].tbl); } 02120 break; 02121 02122 case 35: 02123 02124 /* Line 1806 of yacc.c */ 02125 #line 538 "../../lib/common/htmlparse.y" 02126 { (yyval.tbl)=(yyvsp[(2) - (3)].tbl); } 02127 break; 02128 02129 case 36: 02130 02131 /* Line 1806 of yacc.c */ 02132 #line 539 "../../lib/common/htmlparse.y" 02133 { (yyval.tbl)=(yyvsp[(2) - (3)].tbl); } 02134 break; 02135 02136 case 37: 02137 02138 /* Line 1806 of yacc.c */ 02139 #line 540 "../../lib/common/htmlparse.y" 02140 { (yyval.tbl)=(yyvsp[(2) - (3)].tbl); } 02141 break; 02142 02143 case 38: 02144 02145 /* Line 1806 of yacc.c */ 02146 #line 541 "../../lib/common/htmlparse.y" 02147 { (yyval.tbl)=(yyvsp[(2) - (3)].tbl); } 02148 break; 02149 02150 case 41: 02151 02152 /* Line 1806 of yacc.c */ 02153 #line 548 "../../lib/common/htmlparse.y" 02154 { (yyval.p) = (yyvsp[(1) - (1)].p); } 02155 break; 02156 02157 case 42: 02158 02159 /* Line 1806 of yacc.c */ 02160 #line 549 "../../lib/common/htmlparse.y" 02161 { (yyval.p) = (yyvsp[(2) - (2)].p); } 02162 break; 02163 02164 case 43: 02165 02166 /* Line 1806 of yacc.c */ 02167 #line 550 "../../lib/common/htmlparse.y" 02168 { (yyvsp[(1) - (3)].p)->ruled = 1; (yyval.p) = (yyvsp[(3) - (3)].p); } 02169 break; 02170 02171 case 44: 02172 02173 /* Line 1806 of yacc.c */ 02174 #line 553 "../../lib/common/htmlparse.y" 02175 { addRow (); } 02176 break; 02177 02178 case 45: 02179 02180 /* Line 1806 of yacc.c */ 02181 #line 553 "../../lib/common/htmlparse.y" 02182 { (yyval.p) = lastRow(); } 02183 break; 02184 02185 case 46: 02186 02187 /* Line 1806 of yacc.c */ 02188 #line 556 "../../lib/common/htmlparse.y" 02189 { (yyval.cell) = (yyvsp[(1) - (1)].cell); } 02190 break; 02191 02192 case 47: 02193 02194 /* Line 1806 of yacc.c */ 02195 #line 557 "../../lib/common/htmlparse.y" 02196 { (yyval.cell) = (yyvsp[(2) - (2)].cell); } 02197 break; 02198 02199 case 48: 02200 02201 /* Line 1806 of yacc.c */ 02202 #line 558 "../../lib/common/htmlparse.y" 02203 { (yyvsp[(1) - (3)].cell)->ruled |= HTML_VRULE; (yyval.cell) = (yyvsp[(3) - (3)].cell); } 02204 break; 02205 02206 case 49: 02207 02208 /* Line 1806 of yacc.c */ 02209 #line 561 "../../lib/common/htmlparse.y" 02210 { setCell((yyvsp[(1) - (2)].cell),(yyvsp[(2) - (2)].tbl),HTML_TBL); } 02211 break; 02212 02213 case 50: 02214 02215 /* Line 1806 of yacc.c */ 02216 #line 561 "../../lib/common/htmlparse.y" 02217 { (yyval.cell) = (yyvsp[(1) - (4)].cell); } 02218 break; 02219 02220 case 51: 02221 02222 /* Line 1806 of yacc.c */ 02223 #line 562 "../../lib/common/htmlparse.y" 02224 { setCell((yyvsp[(1) - (2)].cell),(yyvsp[(2) - (2)].txt),HTML_TEXT); } 02225 break; 02226 02227 case 52: 02228 02229 /* Line 1806 of yacc.c */ 02230 #line 562 "../../lib/common/htmlparse.y" 02231 { (yyval.cell) = (yyvsp[(1) - (4)].cell); } 02232 break; 02233 02234 case 53: 02235 02236 /* Line 1806 of yacc.c */ 02237 #line 563 "../../lib/common/htmlparse.y" 02238 { setCell((yyvsp[(1) - (2)].cell),(yyvsp[(2) - (2)].img),HTML_IMAGE); } 02239 break; 02240 02241 case 54: 02242 02243 /* Line 1806 of yacc.c */ 02244 #line 563 "../../lib/common/htmlparse.y" 02245 { (yyval.cell) = (yyvsp[(1) - (4)].cell); } 02246 break; 02247 02248 case 55: 02249 02250 /* Line 1806 of yacc.c */ 02251 #line 564 "../../lib/common/htmlparse.y" 02252 { setCell((yyvsp[(1) - (1)].cell),mkText(),HTML_TEXT); } 02253 break; 02254 02255 case 56: 02256 02257 /* Line 1806 of yacc.c */ 02258 #line 564 "../../lib/common/htmlparse.y" 02259 { (yyval.cell) = (yyvsp[(1) - (3)].cell); } 02260 break; 02261 02262 case 57: 02263 02264 /* Line 1806 of yacc.c */ 02265 #line 567 "../../lib/common/htmlparse.y" 02266 { (yyval.img) = (yyvsp[(1) - (2)].img); } 02267 break; 02268 02269 case 58: 02270 02271 /* Line 1806 of yacc.c */ 02272 #line 568 "../../lib/common/htmlparse.y" 02273 { (yyval.img) = (yyvsp[(1) - (1)].img); } 02274 break; 02275 02276 02277 02278 /* Line 1806 of yacc.c */ 02279 #line 2280 "y.tab.c" 02280 default: break; 02281 } 02282 /* User semantic actions sometimes alter yychar, and that requires 02283 that yytoken be updated with the new translation. We take the 02284 approach of translating immediately before every use of yytoken. 02285 One alternative is translating here after every semantic action, 02286 but that translation would be missed if the semantic action invokes 02287 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 02288 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 02289 incorrect destructor might then be invoked immediately. In the 02290 case of YYERROR or YYBACKUP, subsequent parser actions might lead 02291 to an incorrect destructor call or verbose syntax error message 02292 before the lookahead is translated. */ 02293 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 02294 02295 YYPOPSTACK (yylen); 02296 yylen = 0; 02297 YY_STACK_PRINT (yyss, yyssp); 02298 02299 *++yyvsp = yyval; 02300 02301 /* Now `shift' the result of the reduction. Determine what state 02302 that goes to, based on the state we popped back to and the rule 02303 number reduced by. */ 02304 02305 yyn = yyr1[yyn]; 02306 02307 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 02308 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 02309 yystate = yytable[yystate]; 02310 else 02311 yystate = yydefgoto[yyn - YYNTOKENS]; 02312 02313 goto yynewstate; 02314 02315 02316 /*------------------------------------. 02317 | yyerrlab -- here on detecting error | 02318 `------------------------------------*/ 02319 yyerrlab: 02320 /* Make sure we have latest lookahead translation. See comments at 02321 user semantic actions for why this is necessary. */ 02322 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 02323 02324 /* If not already recovering from an error, report this error. */ 02325 if (!yyerrstatus) 02326 { 02327 ++yynerrs; 02328 #if ! YYERROR_VERBOSE 02329 yyerror (YY_("syntax error")); 02330 #else 02331 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 02332 yyssp, yytoken) 02333 { 02334 char const *yymsgp = YY_("syntax error"); 02335 int yysyntax_error_status; 02336 yysyntax_error_status = YYSYNTAX_ERROR; 02337 if (yysyntax_error_status == 0) 02338 yymsgp = yymsg; 02339 else if (yysyntax_error_status == 1) 02340 { 02341 if (yymsg != yymsgbuf) 02342 YYSTACK_FREE (yymsg); 02343 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 02344 if (!yymsg) 02345 { 02346 yymsg = yymsgbuf; 02347 yymsg_alloc = sizeof yymsgbuf; 02348 yysyntax_error_status = 2; 02349 } 02350 else 02351 { 02352 yysyntax_error_status = YYSYNTAX_ERROR; 02353 yymsgp = yymsg; 02354 } 02355 } 02356 yyerror (yymsgp); 02357 if (yysyntax_error_status == 2) 02358 goto yyexhaustedlab; 02359 } 02360 # undef YYSYNTAX_ERROR 02361 #endif 02362 } 02363 02364 02365 02366 if (yyerrstatus == 3) 02367 { 02368 /* If just tried and failed to reuse lookahead token after an 02369 error, discard it. */ 02370 02371 if (yychar <= YYEOF) 02372 { 02373 /* Return failure if at end of input. */ 02374 if (yychar == YYEOF) 02375 YYABORT; 02376 } 02377 else 02378 { 02379 yydestruct ("Error: discarding", 02380 yytoken, &yylval); 02381 yychar = YYEMPTY; 02382 } 02383 } 02384 02385 /* Else will try to reuse lookahead token after shifting the error 02386 token. */ 02387 goto yyerrlab1; 02388 02389 02390 /*---------------------------------------------------. 02391 | yyerrorlab -- error raised explicitly by YYERROR. | 02392 `---------------------------------------------------*/ 02393 yyerrorlab: 02394 02395 /* Pacify compilers like GCC when the user code never invokes 02396 YYERROR and the label yyerrorlab therefore never appears in user 02397 code. */ 02398 if (/*CONSTCOND*/ 0) 02399 goto yyerrorlab; 02400 02401 /* Do not reclaim the symbols of the rule which action triggered 02402 this YYERROR. */ 02403 YYPOPSTACK (yylen); 02404 yylen = 0; 02405 YY_STACK_PRINT (yyss, yyssp); 02406 yystate = *yyssp; 02407 goto yyerrlab1; 02408 02409 02410 /*-------------------------------------------------------------. 02411 | yyerrlab1 -- common code for both syntax error and YYERROR. | 02412 `-------------------------------------------------------------*/ 02413 yyerrlab1: 02414 yyerrstatus = 3; /* Each real token shifted decrements this. */ 02415 02416 for (;;) 02417 { 02418 yyn = yypact[yystate]; 02419 if (!yypact_value_is_default (yyn)) 02420 { 02421 yyn += YYTERROR; 02422 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 02423 { 02424 yyn = yytable[yyn]; 02425 if (0 < yyn) 02426 break; 02427 } 02428 } 02429 02430 /* Pop the current state because it cannot handle the error token. */ 02431 if (yyssp == yyss) 02432 YYABORT; 02433 02434 02435 yydestruct ("Error: popping", 02436 yystos[yystate], yyvsp); 02437 YYPOPSTACK (1); 02438 yystate = *yyssp; 02439 YY_STACK_PRINT (yyss, yyssp); 02440 } 02441 02442 *++yyvsp = yylval; 02443 02444 02445 /* Shift the error token. */ 02446 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 02447 02448 yystate = yyn; 02449 goto yynewstate; 02450 02451 02452 /*-------------------------------------. 02453 | yyacceptlab -- YYACCEPT comes here. | 02454 `-------------------------------------*/ 02455 yyacceptlab: 02456 yyresult = 0; 02457 goto yyreturn; 02458 02459 /*-----------------------------------. 02460 | yyabortlab -- YYABORT comes here. | 02461 `-----------------------------------*/ 02462 yyabortlab: 02463 yyresult = 1; 02464 goto yyreturn; 02465 02466 #if !defined(yyoverflow) || YYERROR_VERBOSE 02467 /*-------------------------------------------------. 02468 | yyexhaustedlab -- memory exhaustion comes here. | 02469 `-------------------------------------------------*/ 02470 yyexhaustedlab: 02471 yyerror (YY_("memory exhausted")); 02472 yyresult = 2; 02473 /* Fall through. */ 02474 #endif 02475 02476 yyreturn: 02477 if (yychar != YYEMPTY) 02478 { 02479 /* Make sure we have latest lookahead translation. See comments at 02480 user semantic actions for why this is necessary. */ 02481 yytoken = YYTRANSLATE (yychar); 02482 yydestruct ("Cleanup: discarding lookahead", 02483 yytoken, &yylval); 02484 } 02485 /* Do not reclaim the symbols of the rule which action triggered 02486 this YYABORT or YYACCEPT. */ 02487 YYPOPSTACK (yylen); 02488 YY_STACK_PRINT (yyss, yyssp); 02489 while (yyssp != yyss) 02490 { 02491 yydestruct ("Cleanup: popping", 02492 yystos[*yyssp], yyvsp); 02493 YYPOPSTACK (1); 02494 } 02495 #ifndef yyoverflow 02496 if (yyss != yyssa) 02497 YYSTACK_FREE (yyss); 02498 #endif 02499 #if YYERROR_VERBOSE 02500 if (yymsg != yymsgbuf) 02501 YYSTACK_FREE (yymsg); 02502 #endif 02503 /* Make sure YYID is used. */ 02504 return YYID (yyresult); 02505 } 02506 02507 02508 02509 /* Line 2067 of yacc.c */ 02510 #line 580 "../../lib/common/htmlparse.y" 02511 02512 02513 /* parseHTML: 02514 * Return parsed label or NULL if failure. 02515 * Set warn to 0 on success; 1 for warning message; 2 if no expat. 02516 */ 02517 htmllabel_t* 02518 parseHTML (char* txt, int* warn, int charset) 02519 { 02520 unsigned char buf[SMALLBUF]; 02521 agxbuf str; 02522 htmllabel_t* l; 02523 sfont_t dfltf; 02524 02525 dfltf.cfont = NULL; 02526 dfltf.pfont = NULL; 02527 HTMLstate.fontstack = &dfltf; 02528 HTMLstate.tblstack = 0; 02529 HTMLstate.lbl = 0; 02530 HTMLstate.fitemList = dtopen(&fstrDisc, Dtqueue); 02531 HTMLstate.fparaList = dtopen(&fparaDisc, Dtqueue); 02532 02533 agxbinit (&str, SMALLBUF, buf); 02534 HTMLstate.str = &str; 02535 02536 if (initHTMLlexer (txt, &str, charset)) {/* failed: no libexpat - give up */ 02537 *warn = 2; 02538 l = NULL; 02539 } 02540 else { 02541 yyparse(); 02542 *warn = clearHTMLlexer (); 02543 l = HTMLstate.lbl; 02544 } 02545 02546 dtclose (HTMLstate.fitemList); 02547 dtclose (HTMLstate.fparaList); 02548 02549 HTMLstate.fitemList = NULL; 02550 HTMLstate.fparaList = NULL; 02551 HTMLstate.fontstack = NULL; 02552 02553 agxbfree (&str); 02554 02555 return l; 02556 } 02557 02558
1.7.5