From: Akim Demaille Date: Thu, 20 Jun 2002 09:08:37 +0000 (+0000) Subject: * src/symtab.h, src/symtab.c (symbol_t): printer and X-Git-Tag: BISON-1_49b~144 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=366eea36d3a9aaccf80a78c2fcd8c3cd6b563e25;p=platform%2Fupstream%2Fbison.git * src/symtab.h, src/symtab.c (symbol_t): printer and printer_location are new members. (symbol_printer_set): New. * src/parse-gram.y (PERCENT_PRINTER): New token. Handle its associated rule. * src/scan-gram.l: Adjust. (handle_destructor_at, handle_destructor_dollar): Rename as... (handle_symbol_code_at, handle_symbol_code_dollar): these. * src/output.c (symbol_printers_output): New. (output_skeleton): Call it. * data/bison.simple (yysymprint): New. Cannot be named yyprint since there are already many grammar files with a user `yyprint'. Replace the calls to YYPRINT to calls to yysymprint. * tests/calc.at: Adjust. * tests/torture.at (AT_DATA_STACK_TORTURE): Remove YYPRINT: it was taking advantage of parser very internal details (stack size!). --- diff --git a/ChangeLog b/ChangeLog index 21baf84..93daaaa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,28 @@ 2002-06-20 Akim Demaille + * src/symtab.h, src/symtab.c (symbol_t): printer and + printer_location are new members. + (symbol_printer_set): New. + * src/parse-gram.y (PERCENT_PRINTER): New token. + Handle its associated rule. + * src/scan-gram.l: Adjust. + (handle_destructor_at, handle_destructor_dollar): Rename as... + (handle_symbol_code_at, handle_symbol_code_dollar): these. + * src/output.c (symbol_printers_output): New. + (output_skeleton): Call it. + * data/bison.simple (yysymprint): New. Cannot be named yyprint + since there are already many grammar files with a user `yyprint'. + Replace the calls to YYPRINT to calls to yysymprint. + * tests/calc.at: Adjust. + * tests/torture.at (AT_DATA_STACK_TORTURE): Remove YYPRINT: it was + taking advantage of parser very internal details (stack size!). + +2002-06-20 Akim Demaille + * src/scan-gram.l: Complete the scanner with the missing patterns to pacify Flex. Use `quote' and `symbol_tag_get' where appropriate. - 2002-06-19 Akim Demaille * tests/actions.at (Destructors): Augment to test locations. diff --git a/data/bison.simple b/data/bison.simple index cf50307..906f313 100644 --- a/data/bison.simple +++ b/data/bison.simple @@ -671,6 +671,10 @@ int yyparse (void); #if defined (__STDC__) || defined (__cplusplus) static void yydestructor (int yytype, YYSTYPE yyvalue[]b4_location_if([, YYLTYPE yylocation])); +# if YYDEBUG +static void yysymprint (FILE* out, int yytype, + YYSTYPE yyvalue[]b4_location_if([, YYLTYPE yylocation])); +# endif #endif m4_divert_push([KILL])# ======================== M4 code. @@ -887,14 +891,9 @@ yybackup: which are defined only if `YYDEBUG' is set. */ if (yydebug) { - YYFPRINTF (stderr, "Next token is %d (%s", - yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise - meaning of a token, for further debugging info. */ -# ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -# endif - YYFPRINTF (stderr, ")\n"); + YYFPRINTF (stderr, "Next token is "); + yysymprint (stderr, yychar1, yylval]b4_location_if([, yyloc])[); + YYFPRINTF (stderr, "\n"); } #endif } @@ -1113,21 +1112,11 @@ yyerrlab1: #if YYDEBUG if (yydebug) { - if (yystos[*yyssp] < YYNTOKENS) - { - YYFPRINTF (stderr, "Error: popping token %d (%s", - yytoknum[yystos[*yyssp]], - yytname[yystos[*yyssp]]); -# ifdef YYPRINT - YYPRINT (stderr, yytoknum[yystos[*yyssp]], *yyvsp); -# endif - YYFPRINTF (stderr, ")\n"); - } - else - { - YYFPRINTF (stderr, "Error: popping nonterminal (%s)\n", - yytname[yystos[*yyssp]]); - } + YYFPRINTF (stderr, "Error: popping "); + yysymprint (stderr, + yystos[*yyssp], + *yyvsp]b4_location_if([, *yylsp])[); + YYFPRINTF (stderr, "\n"); } #endif yydestructor (yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[); @@ -1168,20 +1157,11 @@ yyerrlab1: #if YYDEBUG if (yydebug) { - if (yystos[yystate] < YYNTOKENS) - { - YYFPRINTF (stderr, "Error: popping token %d (%s", - yytoknum[yystos[yystate]], yytname[yystos[yystate]]); -# ifdef YYPRINT - YYPRINT (stderr, yytoknum[yystos[yystate]], *yyvsp); -# endif - YYFPRINTF (stderr, ")\n"); - } - else - { - YYFPRINTF (stderr, "Error: popping nonterminal (%s)\n", - yytname[yystos[yystate]]); - } + YYFPRINTF (stderr, "Error: popping "); + yysymprint (stderr, + yystos[*yyssp], + *yyvsp]b4_location_if([, *yylsp])[); + YYFPRINTF (stderr, "\n"); } #endif @@ -1247,9 +1227,9 @@ yyreturn: ]} -/*-------------------------------------------------. -| Release the memory associated to SYMBOL-NUMBER. | -`-------------------------------------------------*/ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ m4_divert_push([KILL])# M4 code. # b4_symbol_destructor(SYMBOL-NUMBER, DESTRUCTOR, TYPE-NAME) @@ -1274,12 +1254,53 @@ yydestructor (int yytype, { m4_map([b4_symbol_destructor], m4_defn([b4_symbol_destructors]))dnl default: - YYDPRINTF ((stderr, "yydestructor: unknown symbol type: %d (%s)\n", - yytype, yytname[[yytype]])); break; } } + +#if YYDEBUG +/*---------------------------. +| Print this symbol on OUT. | +`---------------------------*/ + +m4_divert_push([KILL])# M4 code. +# b4_symbol_printer(SYMBOL-NUMBER, PRINTER, TYPE-NAME) +# ---------------------------------------------------------- +m4_define([b4_symbol_printer], +[m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl +m4_pushdef([b4_at_dollar], [yylocation])dnl + case $4: /* $3 */ +#line $2 "$1" + $5; +#line __oline__ "__ofile__" + break; +m4_popdef([b4_at_dollar])dnl +m4_popdef([b4_dollar_dollar])]) + +m4_divert_pop([KILL])dnl# End of M4 code. +static void +yysymprint (FILE* out, int yytype, + YYSTYPE yyvalue[]b4_location_if([, YYLTYPE yylocation])) +{ + if (yytype < YYNTOKENS) + YYFPRINTF (out, "token %d (%s ", yytoknum[[yytype]], yytname[[yytype]]); + else + YYFPRINTF (out, "nterm %s (", yytname[[yytype]]); +# ifdef YYPRINT + YYPRINT (out, yytype, yyvalue); +# else + switch (yytype) + { +m4_map([b4_symbol_printer], m4_defn([b4_symbol_printers]))dnl + default: + break; + } +# endif /* !defined YYPRINT. */ + YYFPRINTF (out, ")"); +} +#endif /* YYDEBUG. */ + b4_epilogue m4_if(b4_defines_flag, 0, [], [#output "b4_output_header_name" diff --git a/src/output.c b/src/output.c index a2049ce..dd3db47 100644 --- a/src/output.c +++ b/src/output.c @@ -639,6 +639,39 @@ symbol_destructors_output (FILE *out) } +/*-------------------------------------. +| Output the symbol printers to OOUT. | +`-------------------------------------*/ + +static void +symbol_printers_output (FILE *out) +{ + int i; + int first = 1; + + fputs ("m4_define([b4_symbol_printers], \n[", out); + for (i = 0; i < nsyms; ++i) + if (symbols[i]->destructor) + { + symbol_t *symbol = symbols[i]; + + /* Filename, lineno, + Symbol-name, Symbol-number, + destructor, typename. */ + fprintf (out, "%s[[[%s]], [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]", + first ? "" : ",\n", + infile, symbol->printer_location.first_line, + symbol_tag_get (symbol), + symbol->number, + symbol->printer, + symbol->type_name); + + first = 0; + } + fputs ("])\n\n", out); +} + + static void save_column (int symbol, int default_state) { @@ -1053,6 +1086,7 @@ output_skeleton (void) actions_output (out); token_definitions_output (out); symbol_destructors_output (out); + symbol_printers_output (out); muscles_m4_output (out); diff --git a/src/parse-gram.c b/src/parse-gram.c index d2f1e84..e69a250 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -55,10 +55,7 @@ #define yychar gram_char #define yydebug gram_debug #define yynerrs gram_nerrs -#if YYLSP_NEEDED -# define yylloc gram_lloc -#endif - +#define yylloc gram_lloc /* Copy the first part of user declarations. */ #line 31 "parse-gram.y" @@ -133,37 +130,38 @@ braced_code_t current_braced_code = action_braced_code; PERCENT_NTERM = 262, PERCENT_TYPE = 263, PERCENT_DESTRUCTOR = 264, - PERCENT_UNION = 265, - PERCENT_LEFT = 266, - PERCENT_RIGHT = 267, - PERCENT_NONASSOC = 268, - PERCENT_EXPECT = 269, - PERCENT_START = 270, - PERCENT_PREC = 271, - PERCENT_VERBOSE = 272, - PERCENT_ERROR_VERBOSE = 273, - PERCENT_OUTPUT = 274, - PERCENT_FILE_PREFIX = 275, - PERCENT_NAME_PREFIX = 276, - PERCENT_DEFINE = 277, - PERCENT_PURE_PARSER = 278, - PERCENT_DEFINES = 279, - PERCENT_YACC = 280, - PERCENT_DEBUG = 281, - PERCENT_LOCATIONS = 282, - PERCENT_NO_LINES = 283, - PERCENT_SKELETON = 284, - PERCENT_TOKEN_TABLE = 285, - TYPE = 286, - EQUAL = 287, - SEMICOLON = 288, - COLON = 289, - PIPE = 290, - ID = 291, - PERCENT_PERCENT = 292, - PROLOGUE = 293, - EPILOGUE = 294, - BRACED_CODE = 295 + PERCENT_PRINTER = 265, + PERCENT_UNION = 266, + PERCENT_LEFT = 267, + PERCENT_RIGHT = 268, + PERCENT_NONASSOC = 269, + PERCENT_EXPECT = 270, + PERCENT_START = 271, + PERCENT_PREC = 272, + PERCENT_VERBOSE = 273, + PERCENT_ERROR_VERBOSE = 274, + PERCENT_OUTPUT = 275, + PERCENT_FILE_PREFIX = 276, + PERCENT_NAME_PREFIX = 277, + PERCENT_DEFINE = 278, + PERCENT_PURE_PARSER = 279, + PERCENT_DEFINES = 280, + PERCENT_YACC = 281, + PERCENT_DEBUG = 282, + PERCENT_LOCATIONS = 283, + PERCENT_NO_LINES = 284, + PERCENT_SKELETON = 285, + PERCENT_TOKEN_TABLE = 286, + TYPE = 287, + EQUAL = 288, + SEMICOLON = 289, + COLON = 290, + PIPE = 291, + ID = 292, + PERCENT_PERCENT = 293, + PROLOGUE = 294, + EPILOGUE = 295, + BRACED_CODE = 296 }; # endif /* POSIX requires `int' for tokens in interfaces. */ @@ -177,37 +175,38 @@ braced_code_t current_braced_code = action_braced_code; #define PERCENT_NTERM 262 #define PERCENT_TYPE 263 #define PERCENT_DESTRUCTOR 264 -#define PERCENT_UNION 265 -#define PERCENT_LEFT 266 -#define PERCENT_RIGHT 267 -#define PERCENT_NONASSOC 268 -#define PERCENT_EXPECT 269 -#define PERCENT_START 270 -#define PERCENT_PREC 271 -#define PERCENT_VERBOSE 272 -#define PERCENT_ERROR_VERBOSE 273 -#define PERCENT_OUTPUT 274 -#define PERCENT_FILE_PREFIX 275 -#define PERCENT_NAME_PREFIX 276 -#define PERCENT_DEFINE 277 -#define PERCENT_PURE_PARSER 278 -#define PERCENT_DEFINES 279 -#define PERCENT_YACC 280 -#define PERCENT_DEBUG 281 -#define PERCENT_LOCATIONS 282 -#define PERCENT_NO_LINES 283 -#define PERCENT_SKELETON 284 -#define PERCENT_TOKEN_TABLE 285 -#define TYPE 286 -#define EQUAL 287 -#define SEMICOLON 288 -#define COLON 289 -#define PIPE 290 -#define ID 291 -#define PERCENT_PERCENT 292 -#define PROLOGUE 293 -#define EPILOGUE 294 -#define BRACED_CODE 295 +#define PERCENT_PRINTER 265 +#define PERCENT_UNION 266 +#define PERCENT_LEFT 267 +#define PERCENT_RIGHT 268 +#define PERCENT_NONASSOC 269 +#define PERCENT_EXPECT 270 +#define PERCENT_START 271 +#define PERCENT_PREC 272 +#define PERCENT_VERBOSE 273 +#define PERCENT_ERROR_VERBOSE 274 +#define PERCENT_OUTPUT 275 +#define PERCENT_FILE_PREFIX 276 +#define PERCENT_NAME_PREFIX 277 +#define PERCENT_DEFINE 278 +#define PERCENT_PURE_PARSER 279 +#define PERCENT_DEFINES 280 +#define PERCENT_YACC 281 +#define PERCENT_DEBUG 282 +#define PERCENT_LOCATIONS 283 +#define PERCENT_NO_LINES 284 +#define PERCENT_SKELETON 285 +#define PERCENT_TOKEN_TABLE 286 +#define TYPE 287 +#define EQUAL 288 +#define SEMICOLON 289 +#define COLON 290 +#define PIPE 291 +#define ID 292 +#define PERCENT_PERCENT 293 +#define PROLOGUE 294 +#define EPILOGUE 295 +#define BRACED_CODE 296 @@ -234,8 +233,8 @@ typedef union { char *string; associativity assoc; } yystype; -/* Line 199 of /usr/local/share/bison/bison.simple. */ -#line 239 "parse-gram.c" +/* Line 232 of /usr/local/share/bison/bison.simple. */ +#line 238 "parse-gram.c" # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif @@ -255,8 +254,8 @@ typedef struct yyltype /* Copy the second part of user declarations. */ -/* Line 219 of /usr/local/share/bison/bison.simple. */ -#line 260 "parse-gram.c" +/* Line 252 of /usr/local/share/bison/bison.simple. */ +#line 259 "parse-gram.c" #if ! defined (yyoverflow) || YYERROR_VERBOSE @@ -299,9 +298,7 @@ union yyalloc { short yyss; YYSTYPE yyvs; -# if YYLSP_NEEDED - YYLTYPE yyls; -# endif + YYLTYPE yyls; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -309,15 +306,9 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ -# if YYLSP_NEEDED -# define YYSTACK_BYTES(N) \ +# define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAX) -# else -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAX) -# endif /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ @@ -358,20 +349,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 #define YYFLAG -32768 -#define YYLAST 115 +#define YYLAST 151 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 41 +#define YYNTOKENS 42 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 27 +#define YYNNTS 28 /* YYNRULES -- Number of rules. */ -#define YYNRULES 69 +#define YYNRULES 71 /* YYNRULES -- Number of states. */ -#define YYNSTATES 97 +#define YYNSTATES 101 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 295 +#define YYMAXUTOK 296 #define YYTRANSLATE(X) \ ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK) @@ -408,7 +399,7 @@ static const unsigned char yytranslate[] = 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40 + 35, 36, 37, 38, 39, 40, 41 }; #if YYDEBUG @@ -419,45 +410,48 @@ static const unsigned char yyprhs[] = 0, 0, 3, 8, 9, 13, 15, 17, 19, 23, 25, 27, 30, 34, 36, 40, 42, 46, 48, 51, 53, 55, 57, 59, 61, 64, 67, 68, 73, 74, - 78, 79, 83, 87, 91, 93, 95, 97, 98, 100, - 102, 105, 107, 109, 112, 115, 119, 121, 124, 126, - 129, 131, 134, 135, 141, 143, 147, 148, 151, 154, - 158, 160, 162, 164, 166, 168, 170, 171, 174, 175 + 79, 80, 84, 85, 89, 93, 97, 99, 101, 103, + 104, 106, 108, 111, 113, 115, 118, 121, 125, 127, + 130, 132, 135, 137, 140, 141, 147, 149, 153, 154, + 157, 160, 164, 166, 168, 170, 172, 174, 176, 177, + 180, 181 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const signed char yyrhs[] = { - 42, 0, -1, 43, 37, 56, 66, -1, -1, 43, - 44, 67, -1, 45, -1, 38, -1, 26, -1, 22, - 65, 65, -1, 24, -1, 18, -1, 14, 5, -1, - 20, 32, 65, -1, 27, -1, 21, 32, 65, -1, - 28, -1, 19, 32, 65, -1, 23, -1, 29, 65, - -1, 30, -1, 17, -1, 25, -1, 50, -1, 47, - -1, 15, 62, -1, 10, 40, -1, -1, 9, 46, - 40, 53, -1, -1, 7, 48, 55, -1, -1, 6, - 49, 55, -1, 8, 31, 53, -1, 51, 52, 53, - -1, 11, -1, 12, -1, 13, -1, -1, 31, -1, - 62, -1, 53, 62, -1, 31, -1, 36, -1, 36, - 5, -1, 36, 64, -1, 36, 5, 64, -1, 54, - -1, 55, 54, -1, 57, -1, 56, 57, -1, 58, - -1, 45, 33, -1, -1, 36, 34, 59, 60, 33, - -1, 61, -1, 60, 35, 61, -1, -1, 61, 62, - -1, 61, 63, -1, 61, 16, 62, -1, 36, -1, - 64, -1, 4, -1, 40, -1, 3, -1, 3, -1, - -1, 37, 39, -1, -1, 33, -1 + 43, 0, -1, 44, 38, 58, 68, -1, -1, 44, + 45, 69, -1, 46, -1, 39, -1, 27, -1, 23, + 67, 67, -1, 25, -1, 19, -1, 15, 5, -1, + 21, 33, 67, -1, 28, -1, 22, 33, 67, -1, + 29, -1, 20, 33, 67, -1, 24, -1, 30, 67, + -1, 31, -1, 18, -1, 26, -1, 52, -1, 49, + -1, 16, 64, -1, 11, 41, -1, -1, 9, 47, + 41, 55, -1, -1, 10, 48, 41, 55, -1, -1, + 7, 50, 57, -1, -1, 6, 51, 57, -1, 8, + 32, 55, -1, 53, 54, 55, -1, 12, -1, 13, + -1, 14, -1, -1, 32, -1, 64, -1, 55, 64, + -1, 32, -1, 37, -1, 37, 5, -1, 37, 66, + -1, 37, 5, 66, -1, 56, -1, 57, 56, -1, + 59, -1, 58, 59, -1, 60, -1, 46, 34, -1, + -1, 37, 35, 61, 62, 34, -1, 63, -1, 62, + 36, 63, -1, -1, 63, 64, -1, 63, 65, -1, + 63, 17, 64, -1, 37, -1, 66, -1, 4, -1, + 41, -1, 3, -1, 3, -1, -1, 38, 40, -1, + -1, 34, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short yyrline[] = { - 0, 154, 154, 167, 169, 172, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 192, 194, 195, 199, 205, 205, 217, 217, - 223, 223, 228, 237, 252, 254, 255, 258, 260, 265, - 267, 271, 276, 281, 287, 293, 303, 306, 315, 317, - 323, 325, 328, 328, 333, 335, 338, 341, 343, 345, - 349, 351, 352, 355, 361, 370, 378, 383, 389, 391 + 0, 158, 158, 171, 173, 176, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 196, 198, 199, 203, 210, 209, 220, 219, + 232, 231, 237, 237, 242, 251, 266, 268, 269, 272, + 274, 279, 281, 285, 290, 295, 301, 307, 317, 320, + 329, 331, 337, 339, 343, 342, 347, 349, 352, 355, + 357, 359, 363, 365, 366, 369, 375, 384, 392, 397, + 403, 405 }; #endif @@ -468,19 +462,20 @@ static const char *const yytname[] = { "\"end of string\"", "error", "$undefined.", "STRING", "CHARACTER", "INT", "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"", - "\"%union\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%expect\"", - "\"%start\"", "\"%prec\"", "\"%verbose\"", "\"%error-verbose\"", - "\"%output\"", "\"%file-prefix\"", "\"%name-prefix\"", "\"%define\"", - "\"%pure-parser\"", "\"%defines\"", "\"%yacc\"", "\"%debug\"", - "\"%locations\"", "\"%no-lines\"", "\"%skeleton\"", "\"%token-table\"", - "TYPE", "\"=\"", "\";\"", "\":\"", "\"|\"", "\"identifier\"", "\"%%\"", - "PROLOGUE", "EPILOGUE", "BRACED_CODE", "$axiom", "input", - "declarations", "declaration", "grammar_declaration", "@1", - "symbol_declaration", "@2", "@3", "precedence_declaration", - "precedence_declarator", "type.opt", "symbols.1", "symbol_def", - "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules", - "@4", "rhses.1", "rhs", "symbol", "action", "string_as_id", - "string_content", "epilogue.opt", "semi_colon.opt", 0 + "\"%printer\"", "\"%union\"", "\"%left\"", "\"%right\"", + "\"%nonassoc\"", "\"%expect\"", "\"%start\"", "\"%prec\"", + "\"%verbose\"", "\"%error-verbose\"", "\"%output\"", "\"%file-prefix\"", + "\"%name-prefix\"", "\"%define\"", "\"%pure-parser\"", "\"%defines\"", + "\"%yacc\"", "\"%debug\"", "\"%locations\"", "\"%no-lines\"", + "\"%skeleton\"", "\"%token-table\"", "TYPE", "\"=\"", "\";\"", "\":\"", + "\"|\"", "\"identifier\"", "\"%%\"", "PROLOGUE", "EPILOGUE", + "BRACED_CODE", "$axiom", "input", "declarations", "declaration", + "grammar_declaration", "@1", "@2", "symbol_declaration", "@3", "@4", + "precedence_declaration", "precedence_declarator", "type.opt", + "symbols.1", "symbol_def", "symbol_defs.1", "grammar", + "rules_or_grammar_declaration", "rules", "@5", "rhses.1", "rhs", + "symbol", "action", "string_as_id", "string_content", "epilogue.opt", + "semi_colon.opt", 0 }; #endif @@ -492,19 +487,20 @@ static const short yytoknum[] = 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, -1 + 295, 296, -1 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { - 0, 41, 42, 43, 43, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 45, 45, 45, 45, 46, 45, 48, 47, - 49, 47, 47, 50, 51, 51, 51, 52, 52, 53, - 53, 54, 54, 54, 54, 54, 55, 55, 56, 56, - 57, 57, 59, 58, 60, 60, 61, 61, 61, 61, - 62, 62, 62, 63, 64, 65, 66, 66, 67, 67 + 0, 42, 43, 44, 44, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 46, 46, 46, 46, 47, 46, 48, 46, + 50, 49, 51, 49, 49, 52, 53, 53, 53, 54, + 54, 55, 55, 56, 56, 56, 56, 56, 57, 57, + 58, 58, 59, 59, 61, 60, 62, 62, 63, 63, + 63, 63, 64, 64, 64, 65, 66, 67, 68, 68, + 69, 69 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -512,11 +508,12 @@ static const unsigned char yyr2[] = { 0, 2, 4, 0, 3, 1, 1, 1, 3, 1, 1, 2, 3, 1, 3, 1, 3, 1, 2, 1, - 1, 1, 1, 1, 2, 2, 0, 4, 0, 3, - 0, 3, 3, 3, 1, 1, 1, 0, 1, 1, - 2, 1, 1, 2, 2, 3, 1, 2, 1, 2, - 1, 2, 0, 5, 1, 3, 0, 2, 2, 3, - 1, 1, 1, 1, 1, 1, 0, 2, 0, 1 + 1, 1, 1, 1, 2, 2, 0, 4, 0, 4, + 0, 3, 0, 3, 3, 3, 1, 1, 1, 0, + 1, 1, 2, 1, 1, 2, 2, 3, 1, 2, + 1, 2, 1, 2, 0, 5, 1, 3, 0, 2, + 2, 3, 1, 1, 1, 1, 1, 1, 0, 2, + 0, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -524,48 +521,50 @@ static const unsigned char yyr2[] = means the default is an error. */ static const short yydefact[] = { - 3, 0, 0, 0, 30, 28, 0, 26, 0, 34, - 35, 36, 0, 0, 20, 10, 0, 0, 0, 0, - 17, 9, 21, 7, 13, 15, 0, 19, 0, 6, - 68, 5, 23, 22, 37, 0, 0, 0, 0, 25, - 11, 64, 62, 60, 24, 61, 0, 0, 0, 65, - 0, 18, 0, 0, 66, 48, 50, 69, 4, 38, - 0, 41, 42, 46, 31, 29, 32, 39, 0, 16, - 12, 14, 8, 52, 51, 0, 49, 2, 33, 43, - 44, 47, 40, 27, 56, 67, 45, 0, 54, 53, - 56, 0, 63, 57, 58, 55, 59 + 3, 0, 0, 0, 32, 30, 0, 26, 28, 0, + 36, 37, 38, 0, 0, 20, 10, 0, 0, 0, + 0, 17, 9, 21, 7, 13, 15, 0, 19, 0, + 6, 70, 5, 23, 22, 39, 0, 0, 0, 0, + 0, 25, 11, 66, 64, 62, 24, 63, 0, 0, + 0, 67, 0, 18, 0, 0, 68, 50, 52, 71, + 4, 40, 0, 43, 44, 48, 33, 31, 34, 41, + 0, 0, 16, 12, 14, 8, 54, 53, 0, 51, + 2, 35, 45, 46, 49, 42, 27, 29, 58, 69, + 47, 0, 56, 55, 58, 0, 65, 59, 60, 57, + 61 }; /* YYPGOTO[NTERM-NUM]. */ static const short yydefgoto[] = { - -1, 1, 2, 30, 53, 38, 32, 36, 35, 33, - 34, 60, 66, 63, 64, 54, 55, 56, 84, 87, - 88, 67, 94, 45, 50, 77, 58 + -1, 1, 2, 31, 55, 39, 40, 33, 37, 36, + 34, 35, 62, 68, 65, 66, 56, 57, 58, 88, + 91, 92, 69, 98, 47, 52, 80, 60 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const short yypact[] = { - -32768, 25, 77,-32768,-32768,-32768, -20,-32768, -31,-32768, - -32768,-32768, 35, 0,-32768,-32768, 12, 15, 16, 46, - -32768,-32768,-32768,-32768,-32768,-32768, 46,-32768, 20,-32768, - 17,-32768,-32768,-32768, 21, -24, -24, 0, 14,-32768, - -32768,-32768,-32768,-32768,-32768,-32768, 46, 46, 46,-32768, - 46,-32768, 26, 18, 9,-32768,-32768,-32768,-32768,-32768, - 0,-32768, 5,-32768, -24, -24, 0,-32768, 0,-32768, - -32768,-32768,-32768,-32768,-32768, 23,-32768,-32768, 0, 52, - -32768,-32768,-32768, 0,-32768,-32768,-32768, 6, -2,-32768, - -32768, 0,-32768,-32768,-32768, -2,-32768 + -32768, 8, 80,-32768,-32768,-32768, -19,-32768,-32768, -11, + -32768,-32768,-32768, 31, 0,-32768,-32768, 5, 9, 11, + 40,-32768,-32768,-32768,-32768,-32768,-32768, 40,-32768, 114, + -32768, 12,-32768,-32768,-32768, 13, -27, -27, 0, 14, + 15,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 40, 40, + 40,-32768, 40,-32768, 16, 18, 10,-32768,-32768,-32768, + -32768,-32768, 0,-32768, 6,-32768, -27, -27, 0,-32768, + 0, 0,-32768,-32768,-32768,-32768,-32768,-32768, 17,-32768, + -32768, 0, 46,-32768,-32768,-32768, 0, 0,-32768,-32768, + -32768, -22, -2,-32768,-32768, 0,-32768,-32768,-32768, -2, + -32768 }; /* YYPGOTO[NTERM-NUM]. */ static const short yypgoto[] = { - -32768,-32768,-32768,-32768, 61,-32768,-32768,-32768,-32768,-32768, - -32768,-32768, -55, -22, 28,-32768, 13,-32768,-32768,-32768, - -21, -13,-32768, -56, 11,-32768,-32768 + -32768,-32768,-32768,-32768, 48,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768, -30, -33, 21,-32768, -3,-32768,-32768, + -32768, -35, -14,-32768, -57, -21,-32768,-32768 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -573,53 +572,60 @@ static const short yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. */ static const short yytable[] = { - 44, 41, 42, 41, 42, 78, 80, 61, 41, 39, - 79, 37, 62, 83, 91, 4, 5, 6, 7, 8, - 9, 10, 11, 86, 13, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 43, 13, 43, 51, 92, 89, - 40, 90, 81, 81, 46, 52, 75, 47, 48, 49, - 57, 74, 59, 82, 68, 41, 52, 69, 70, 71, - 73, 72, 85, 31, 65, 82, 0, 76, 0, 95, - 82, 0, 0, 0, 0, 93, 0, 0, 96, 0, - 0, 0, 93, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 0, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 0, 0, - 0, 0, 0, 0, 28, 29 + 46, 43, 44, 43, 44, 63, 53, 83, 3, 43, + 64, 82, 93, 38, 94, 95, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 90, 14, 72, 73, 74, + 41, 75, 81, 84, 84, 45, 42, 45, 48, 96, + 86, 87, 49, 51, 50, 61, 59, 54, 78, 43, + 32, 76, 77, 79, 85, 70, 71, 89, 67, 99, + 0, 0, 0, 0, 0, 0, 0, 85, 0, 0, + 0, 0, 85, 85, 0, 0, 0, 0, 97, 0, + 0, 100, 0, 0, 0, 97, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 0, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 0, 0, 0, 0, 0, 0, 29, 30, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, + 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 54 }; static const short yycheck[] = { - 13, 3, 4, 3, 4, 60, 62, 31, 3, 40, - 5, 31, 36, 68, 16, 6, 7, 8, 9, 10, - 11, 12, 13, 79, 15, 0, 6, 7, 8, 9, - 10, 11, 12, 13, 36, 15, 36, 26, 40, 33, - 5, 35, 64, 65, 32, 36, 37, 32, 32, 3, - 33, 33, 31, 66, 40, 3, 36, 46, 47, 48, - 34, 50, 39, 2, 36, 78, -1, 54, -1, 90, - 83, -1, -1, -1, -1, 88, -1, -1, 91, -1, - -1, -1, 95, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, -1, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, -1, -1, - -1, -1, -1, -1, 37, 38 + 14, 3, 4, 3, 4, 32, 27, 64, 0, 3, + 37, 5, 34, 32, 36, 17, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 82, 16, 48, 49, 50, + 41, 52, 62, 66, 67, 37, 5, 37, 33, 41, + 70, 71, 33, 3, 33, 32, 34, 37, 38, 3, + 2, 35, 34, 56, 68, 41, 41, 40, 37, 94, + -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, + -1, -1, 86, 87, -1, -1, -1, -1, 92, -1, + -1, 95, -1, -1, -1, 99, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, -1, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, -1, -1, -1, -1, -1, -1, 38, 39, + 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, + 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 37 }; -#if YYDEBUG /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { - 0, 42, 43, 0, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 37, 38, - 44, 45, 47, 50, 51, 49, 48, 31, 46, 40, - 5, 3, 4, 36, 62, 64, 32, 32, 32, 3, - 65, 65, 36, 45, 56, 57, 58, 33, 67, 31, - 52, 31, 36, 54, 55, 55, 53, 62, 40, 65, - 65, 65, 65, 34, 33, 37, 57, 66, 53, 5, - 64, 54, 62, 53, 59, 39, 64, 60, 61, 33, - 35, 16, 40, 62, 63, 61, 62 + 0, 43, 44, 0, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 38, + 39, 45, 46, 49, 52, 53, 51, 50, 32, 47, + 48, 41, 5, 3, 4, 37, 64, 66, 33, 33, + 33, 3, 67, 67, 37, 46, 58, 59, 60, 34, + 69, 32, 54, 32, 37, 56, 57, 57, 55, 64, + 41, 41, 67, 67, 67, 67, 35, 34, 38, 59, + 68, 55, 5, 66, 56, 64, 55, 55, 61, 40, + 66, 62, 63, 34, 36, 17, 41, 64, 65, 63, + 64 }; -#endif #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -687,23 +693,11 @@ while (0) /* YYLEX -- calling `yylex' with the right arguments. */ -#if YYPURE -# if YYLSP_NEEDED -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval, &yylloc) -# endif -# else /* !YYLSP_NEEDED */ -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval) -# endif -# endif /* !YYLSP_NEEDED */ -#else /* !YYPURE */ -# define YYLEX yylex () -#endif /* !YYPURE */ +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval, &yylloc, ) +#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -829,45 +823,25 @@ int yyparse (void *); int yyparse (void); # endif #endif +static void yydestructor (int symbol_type, YYSTYPE symbol_value); -/* YY_DECL_VARIABLES -- depending whether we use a pure parser, - variables are global, or local to YYPARSE. */ - -#define YY_DECL_NON_LSP_VARIABLES \ -/* The lookahead symbol. */ \ -int yychar; \ - \ -/* The semantic value of the lookahead symbol. */ \ -YYSTYPE yylval; \ - \ -/* Number of parse errors so far. */ \ -int yynerrs; -#if YYLSP_NEEDED -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES \ - \ -/* Location data for the lookahead symbol. */ \ -YYLTYPE yylloc; -#else -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES -#endif -/* If nonreentrant, generate the variables here. */ - -#if !YYPURE -YY_DECL_VARIABLES -#endif /* !YYPURE */ int yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { - /* If reentrant, generate the variables here. */ -#if YYPURE - YY_DECL_VARIABLES -#endif /* !YYPURE */ + /* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of parse errors so far. */ +int yynerrs; +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc; register int yystate; register int yyn; @@ -895,27 +869,19 @@ yyparse (YYPARSE_PARAM_ARG) YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; -#if YYLSP_NEEDED /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; -#endif -#if YYLSP_NEEDED -# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -# define YYPOPSTACK (yyvsp--, yyssp--) -#endif +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -#if YYLSP_NEEDED YYLTYPE yyloc; -#endif /* When reducing, the number of symbols on the RHS of the reduced rule. */ @@ -935,9 +901,7 @@ yyparse (YYPARSE_PARAM_ARG) yyssp = yyss; yyvsp = yyvs; -#if YYLSP_NEEDED yylsp = yyls; -#endif goto yysetstate; /*------------------------------------------------------------. @@ -964,25 +928,18 @@ yyparse (YYPARSE_PARAM_ARG) memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. */ -# if YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; -# else - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); -# endif yyss = yyss1; yyvs = yyvs1; } @@ -1005,9 +962,7 @@ yyparse (YYPARSE_PARAM_ARG) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); -# if YYLSP_NEEDED YYSTACK_RELOCATE (yyls); -# endif # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1017,9 +972,7 @@ yyparse (YYPARSE_PARAM_ARG) yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; -#if YYLSP_NEEDED yylsp = yyls + yysize - 1; -#endif YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1123,9 +1076,7 @@ yybackup: yychar = YYEMPTY; *++yyvsp = yylval; -#if YYLSP_NEEDED *++yylsp = yylloc; -#endif /* Count tokens shifted since error; after three, turn off error status. */ @@ -1163,10 +1114,8 @@ yyreduce: GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; -#if YYLSP_NEEDED /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); -#endif #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which @@ -1187,7 +1136,7 @@ yyreduce: switch (yyn) { case 2: -#line 156 "parse-gram.y" +#line 160 "parse-gram.y" { yycontrol->errcode = 0; epilogue_set (yyvsp[0].string, yylsp[0]); @@ -1195,94 +1144,94 @@ yyreduce: break; case 6: -#line 174 "parse-gram.y" +#line 178 "parse-gram.y" { prologue_augment (yyvsp[0].string, yylsp[0]); } break; case 7: -#line 175 "parse-gram.y" +#line 179 "parse-gram.y" { debug_flag = 1; } break; case 8: -#line 176 "parse-gram.y" +#line 180 "parse-gram.y" { muscle_insert (yyvsp[-1].string, yyvsp[0].string); } break; case 9: -#line 177 "parse-gram.y" +#line 181 "parse-gram.y" { defines_flag = 1; } break; case 10: -#line 178 "parse-gram.y" +#line 182 "parse-gram.y" { error_verbose = 1; } break; case 11: -#line 179 "parse-gram.y" +#line 183 "parse-gram.y" { expected_conflicts = yyvsp[0].integer; } break; case 12: -#line 180 "parse-gram.y" +#line 184 "parse-gram.y" { spec_file_prefix = yyvsp[0].string; } break; case 13: -#line 181 "parse-gram.y" +#line 185 "parse-gram.y" { locations_flag = 1; } break; case 14: -#line 182 "parse-gram.y" +#line 186 "parse-gram.y" { spec_name_prefix = yyvsp[0].string; } break; case 15: -#line 183 "parse-gram.y" +#line 187 "parse-gram.y" { no_lines_flag = 1; } break; case 16: -#line 184 "parse-gram.y" +#line 188 "parse-gram.y" { spec_outfile = yyvsp[0].string; } break; case 17: -#line 185 "parse-gram.y" +#line 189 "parse-gram.y" { pure_parser = 1; } break; case 18: -#line 186 "parse-gram.y" +#line 190 "parse-gram.y" { skeleton = yyvsp[0].string; } break; case 19: -#line 187 "parse-gram.y" +#line 191 "parse-gram.y" { token_table_flag = 1; } break; case 20: -#line 188 "parse-gram.y" +#line 192 "parse-gram.y" { report_flag = 1; } break; case 21: -#line 189 "parse-gram.y" +#line 193 "parse-gram.y" { yacc_flag = 1; } break; case 24: -#line 196 "parse-gram.y" +#line 200 "parse-gram.y" { grammar_start_symbol_set (yyvsp[0].symbol, yylsp[0]); } break; case 25: -#line 200 "parse-gram.y" +#line 204 "parse-gram.y" { typed = 1; MUSCLE_INSERT_INT ("stype_line", yylsp[0].first_line); @@ -1291,12 +1240,12 @@ yyreduce: break; case 26: -#line 206 "parse-gram.y" +#line 210 "parse-gram.y" { current_braced_code = destructor_braced_code; } break; case 27: -#line 208 "parse-gram.y" +#line 212 "parse-gram.y" { symbol_list_t *list; for (list = yyvsp[0].list; list; list = list->next) @@ -1307,25 +1256,28 @@ yyreduce: break; case 28: -#line 218 "parse-gram.y" - { current_class = nterm_sym; } +#line 220 "parse-gram.y" + { current_braced_code = printer_braced_code; } break; case 29: -#line 219 "parse-gram.y" +#line 222 "parse-gram.y" { - current_class = unknown_sym; - current_type = NULL; + symbol_list_t *list; + for (list = yyvsp[0].list; list; list = list->next) + symbol_printer_set (list->sym, yyvsp[-1].string, list->location); + symbol_list_free (yyvsp[0].list); + current_braced_code = action_braced_code; } break; case 30: -#line 223 "parse-gram.y" - { current_class = token_sym; } +#line 232 "parse-gram.y" + { current_class = nterm_sym; } break; case 31: -#line 224 "parse-gram.y" +#line 233 "parse-gram.y" { current_class = unknown_sym; current_type = NULL; @@ -1333,7 +1285,20 @@ yyreduce: break; case 32: -#line 229 "parse-gram.y" +#line 237 "parse-gram.y" + { current_class = token_sym; } + break; + + case 33: +#line 238 "parse-gram.y" + { + current_class = unknown_sym; + current_type = NULL; + } + break; + + case 34: +#line 243 "parse-gram.y" { symbol_list_t *list; for (list = yyvsp[0].list; list; list = list->next) @@ -1342,8 +1307,8 @@ yyreduce: } break; - case 33: -#line 239 "parse-gram.y" + case 35: +#line 253 "parse-gram.y" { symbol_list_t *list; ++current_prec; @@ -1357,58 +1322,58 @@ yyreduce: } break; - case 34: -#line 253 "parse-gram.y" + case 36: +#line 267 "parse-gram.y" { yyval.assoc = left_assoc; } break; - case 35: -#line 254 "parse-gram.y" + case 37: +#line 268 "parse-gram.y" { yyval.assoc = right_assoc; } break; - case 36: -#line 255 "parse-gram.y" + case 38: +#line 269 "parse-gram.y" { yyval.assoc = non_assoc; } break; - case 37: -#line 259 "parse-gram.y" + case 39: +#line 273 "parse-gram.y" { current_type = NULL;} break; - case 38: -#line 260 "parse-gram.y" + case 40: +#line 274 "parse-gram.y" { current_type = yyvsp[0].string; } break; - case 39: -#line 266 "parse-gram.y" + case 41: +#line 280 "parse-gram.y" { yyval.list = symbol_list_new (yyvsp[0].symbol, yylsp[0]); } break; - case 40: -#line 267 "parse-gram.y" + case 42: +#line 281 "parse-gram.y" { yyval.list = symbol_list_prepend (yyvsp[-1].list, yyvsp[0].symbol, yylsp[0]); } break; - case 41: -#line 273 "parse-gram.y" + case 43: +#line 287 "parse-gram.y" { current_type = yyvsp[0].string; } break; - case 42: -#line 277 "parse-gram.y" + case 44: +#line 291 "parse-gram.y" { symbol_class_set (yyvsp[0].symbol, current_class); symbol_type_set (yyvsp[0].symbol, yylsp[0], current_type); } break; - case 43: -#line 282 "parse-gram.y" + case 45: +#line 296 "parse-gram.y" { symbol_class_set (yyvsp[-1].symbol, current_class); symbol_type_set (yyvsp[-1].symbol, yylsp[-1], current_type); @@ -1416,8 +1381,8 @@ yyreduce: } break; - case 44: -#line 288 "parse-gram.y" + case 46: +#line 302 "parse-gram.y" { symbol_class_set (yyvsp[-1].symbol, current_class); symbol_type_set (yyvsp[-1].symbol, yylsp[-1], current_type); @@ -1425,8 +1390,8 @@ yyreduce: } break; - case 45: -#line 294 "parse-gram.y" + case 47: +#line 308 "parse-gram.y" { symbol_class_set (yyvsp[-2].symbol, current_class); symbol_type_set (yyvsp[-2].symbol, yylsp[-2], current_type); @@ -1435,101 +1400,101 @@ yyreduce: } break; - case 46: -#line 305 "parse-gram.y" + case 48: +#line 319 "parse-gram.y" {;} break; - case 47: -#line 307 "parse-gram.y" + case 49: +#line 321 "parse-gram.y" {;} break; - case 52: -#line 329 "parse-gram.y" + case 54: +#line 343 "parse-gram.y" { current_lhs = yyvsp[-1].symbol; current_lhs_location = yylsp[-1]; } break; - case 53: -#line 330 "parse-gram.y" + case 55: +#line 344 "parse-gram.y" {;} break; - case 54: -#line 334 "parse-gram.y" + case 56: +#line 348 "parse-gram.y" { grammar_rule_end (yylsp[0]); } break; - case 55: -#line 335 "parse-gram.y" + case 57: +#line 349 "parse-gram.y" { grammar_rule_end (yylsp[0]); } break; - case 56: -#line 340 "parse-gram.y" + case 58: +#line 354 "parse-gram.y" { grammar_rule_begin (current_lhs, current_lhs_location); } break; - case 57: -#line 342 "parse-gram.y" + case 59: +#line 356 "parse-gram.y" { grammar_current_rule_symbol_append (yyvsp[0].symbol, yylsp[0]); } break; - case 58: -#line 344 "parse-gram.y" + case 60: +#line 358 "parse-gram.y" { grammar_current_rule_action_append (yyvsp[0].string, yylsp[0]); } break; - case 59: -#line 346 "parse-gram.y" + case 61: +#line 360 "parse-gram.y" { grammar_current_rule_prec_set (yyvsp[0].symbol); } break; - case 60: -#line 350 "parse-gram.y" + case 62: +#line 364 "parse-gram.y" { yyval.symbol = yyvsp[0].symbol; } break; - case 61: -#line 351 "parse-gram.y" + case 63: +#line 365 "parse-gram.y" { yyval.symbol = yyvsp[0].symbol; } break; - case 62: -#line 352 "parse-gram.y" + case 64: +#line 366 "parse-gram.y" { yyval.symbol = getsym (yyvsp[0].string, yylsp[0]); } break; - case 63: -#line 357 "parse-gram.y" + case 65: +#line 371 "parse-gram.y" { yyval.string = yyvsp[0].string; } break; - case 64: -#line 363 "parse-gram.y" + case 66: +#line 377 "parse-gram.y" { yyval.symbol = getsym (yyvsp[0].string, yylsp[0]); symbol_class_set (yyval.symbol, token_sym); } break; - case 65: -#line 372 "parse-gram.y" + case 67: +#line 386 "parse-gram.y" { yyval.string = yyvsp[0].string + 1; yyval.string[strlen (yyval.string) - 1] = '\0'; } break; - case 66: -#line 380 "parse-gram.y" + case 68: +#line 394 "parse-gram.y" { yyval.string = xstrdup (""); } break; - case 67: -#line 384 "parse-gram.y" + case 69: +#line 398 "parse-gram.y" { yyval.string = yyvsp[0].string; } @@ -1538,14 +1503,12 @@ yyreduce: } -/* Line 1012 of /usr/local/share/bison/bison.simple. */ -#line 1543 "parse-gram.c" +/* Line 996 of /usr/local/share/bison/bison.simple. */ +#line 1508 "parse-gram.c" yyvsp -= yylen; yyssp -= yylen; -#if YYLSP_NEEDED yylsp -= yylen; -#endif #if YYDEBUG if (yydebug) @@ -1559,9 +1522,7 @@ yyreduce: #endif *++yyvsp = yyval; -#if YYLSP_NEEDED *++yylsp = yyloc; -#endif /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule @@ -1649,9 +1610,41 @@ yyerrlab1: /* Return failure if at end of input. */ if (yychar == YYEOF) - YYABORT; + { + /* Pop the error token. */ + YYPOPSTACK; + /* Pop the rest of the stack. */ + while (yyssp > yyss) + { +#if YYDEBUG + if (yydebug) + { + if (yystos[*yyssp] < YYNTOKENS) + { + YYFPRINTF (stderr, "Error: popping token %d (%s", + yytoknum[yystos[*yyssp]], + yytname[yystos[*yyssp]]); +# ifdef YYPRINT + YYPRINT (stderr, yytoknum[yystos[*yyssp]], *yyvsp); +# endif + YYFPRINTF (stderr, ")\n"); + } + else + { + YYFPRINTF (stderr, "Error: popping nonterminal (%s)\n", + yytname[yystos[*yyssp]]); + } + } +#endif + yydestructor (yystos[*yyssp], *yyvsp); + YYPOPSTACK; + } + YYABORT; + } + YYDPRINTF ((stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1])); + yydestructor (yychar1, yylval); yychar = YYEMPTY; } @@ -1698,11 +1691,10 @@ yyerrlab1: } #endif + yydestructor (yystos[yystate], *yyvsp); yyvsp--; yystate = *--yyssp; -#if YYLSP_NEEDED yylsp--; -#endif #if YYDEBUG if (yydebug) @@ -1722,9 +1714,7 @@ yyerrlab1: YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; -#if YYLSP_NEEDED *++yylsp = yylloc; -#endif yystate = yyn; goto yynewstate; @@ -1744,13 +1734,15 @@ yyabortlab: yyresult = 1; goto yyreturn; -/*---------------------------------------------. -| yyoverflowab -- parser overflow comes here. | -`---------------------------------------------*/ +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ +#endif yyreturn: #ifndef yyoverflow @@ -1760,7 +1752,24 @@ yyreturn: return yyresult; } -#line 393 "parse-gram.y" + +/*-------------------------------------------------. +| Release the memory associated to SYMBOL-NUMBER. | +`-------------------------------------------------*/ + +static void +yydestructor (int symbol_type, YYSTYPE symbol_value) +{ + switch (symbol_type) + { + default: + YYDPRINTF ((stderr, "yydestructor: unknown symbol type: %d (%s)\n", + symbol_type, yytname[symbol_type])); + break; + } +} + +#line 407 "parse-gram.y" /*------------------------------------------------------------------. | When debugging the parser, display tokens' locations and values. | diff --git a/src/parse-gram.h b/src/parse-gram.h index 8b76eb4..0f58ee0 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -15,37 +15,38 @@ PERCENT_NTERM = 262, PERCENT_TYPE = 263, PERCENT_DESTRUCTOR = 264, - PERCENT_UNION = 265, - PERCENT_LEFT = 266, - PERCENT_RIGHT = 267, - PERCENT_NONASSOC = 268, - PERCENT_EXPECT = 269, - PERCENT_START = 270, - PERCENT_PREC = 271, - PERCENT_VERBOSE = 272, - PERCENT_ERROR_VERBOSE = 273, - PERCENT_OUTPUT = 274, - PERCENT_FILE_PREFIX = 275, - PERCENT_NAME_PREFIX = 276, - PERCENT_DEFINE = 277, - PERCENT_PURE_PARSER = 278, - PERCENT_DEFINES = 279, - PERCENT_YACC = 280, - PERCENT_DEBUG = 281, - PERCENT_LOCATIONS = 282, - PERCENT_NO_LINES = 283, - PERCENT_SKELETON = 284, - PERCENT_TOKEN_TABLE = 285, - TYPE = 286, - EQUAL = 287, - SEMICOLON = 288, - COLON = 289, - PIPE = 290, - ID = 291, - PERCENT_PERCENT = 292, - PROLOGUE = 293, - EPILOGUE = 294, - BRACED_CODE = 295 + PERCENT_PRINTER = 265, + PERCENT_UNION = 266, + PERCENT_LEFT = 267, + PERCENT_RIGHT = 268, + PERCENT_NONASSOC = 269, + PERCENT_EXPECT = 270, + PERCENT_START = 271, + PERCENT_PREC = 272, + PERCENT_VERBOSE = 273, + PERCENT_ERROR_VERBOSE = 274, + PERCENT_OUTPUT = 275, + PERCENT_FILE_PREFIX = 276, + PERCENT_NAME_PREFIX = 277, + PERCENT_DEFINE = 278, + PERCENT_PURE_PARSER = 279, + PERCENT_DEFINES = 280, + PERCENT_YACC = 281, + PERCENT_DEBUG = 282, + PERCENT_LOCATIONS = 283, + PERCENT_NO_LINES = 284, + PERCENT_SKELETON = 285, + PERCENT_TOKEN_TABLE = 286, + TYPE = 287, + EQUAL = 288, + SEMICOLON = 289, + COLON = 290, + PIPE = 291, + ID = 292, + PERCENT_PERCENT = 293, + PROLOGUE = 294, + EPILOGUE = 295, + BRACED_CODE = 296 }; # endif /* POSIX requires `int' for tokens in interfaces. */ @@ -59,37 +60,38 @@ #define PERCENT_NTERM 262 #define PERCENT_TYPE 263 #define PERCENT_DESTRUCTOR 264 -#define PERCENT_UNION 265 -#define PERCENT_LEFT 266 -#define PERCENT_RIGHT 267 -#define PERCENT_NONASSOC 268 -#define PERCENT_EXPECT 269 -#define PERCENT_START 270 -#define PERCENT_PREC 271 -#define PERCENT_VERBOSE 272 -#define PERCENT_ERROR_VERBOSE 273 -#define PERCENT_OUTPUT 274 -#define PERCENT_FILE_PREFIX 275 -#define PERCENT_NAME_PREFIX 276 -#define PERCENT_DEFINE 277 -#define PERCENT_PURE_PARSER 278 -#define PERCENT_DEFINES 279 -#define PERCENT_YACC 280 -#define PERCENT_DEBUG 281 -#define PERCENT_LOCATIONS 282 -#define PERCENT_NO_LINES 283 -#define PERCENT_SKELETON 284 -#define PERCENT_TOKEN_TABLE 285 -#define TYPE 286 -#define EQUAL 287 -#define SEMICOLON 288 -#define COLON 289 -#define PIPE 290 -#define ID 291 -#define PERCENT_PERCENT 292 -#define PROLOGUE 293 -#define EPILOGUE 294 -#define BRACED_CODE 295 +#define PERCENT_PRINTER 265 +#define PERCENT_UNION 266 +#define PERCENT_LEFT 267 +#define PERCENT_RIGHT 268 +#define PERCENT_NONASSOC 269 +#define PERCENT_EXPECT 270 +#define PERCENT_START 271 +#define PERCENT_PREC 272 +#define PERCENT_VERBOSE 273 +#define PERCENT_ERROR_VERBOSE 274 +#define PERCENT_OUTPUT 275 +#define PERCENT_FILE_PREFIX 276 +#define PERCENT_NAME_PREFIX 277 +#define PERCENT_DEFINE 278 +#define PERCENT_PURE_PARSER 279 +#define PERCENT_DEFINES 280 +#define PERCENT_YACC 281 +#define PERCENT_DEBUG 282 +#define PERCENT_LOCATIONS 283 +#define PERCENT_NO_LINES 284 +#define PERCENT_SKELETON 285 +#define PERCENT_TOKEN_TABLE 286 +#define TYPE 287 +#define EQUAL 288 +#define SEMICOLON 289 +#define COLON 290 +#define PIPE 291 +#define ID 292 +#define PERCENT_PERCENT 293 +#define PROLOGUE 294 +#define EPILOGUE 295 +#define BRACED_CODE 296 @@ -103,8 +105,8 @@ typedef union { char *string; associativity assoc; } yystype; -/* Line 1271 of /usr/local/share/bison/bison.simple. */ -#line 108 "y.tab.h" +/* Line 1313 of /usr/local/share/bison/bison.simple. */ +#line 110 "y.tab.h" # define YYSTYPE yystype #endif diff --git a/src/parse-gram.y b/src/parse-gram.y index c3250cc..06a32c3 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -103,9 +103,13 @@ braced_code_t current_braced_code = action_braced_code; %token PERCENT_TOKEN "%token" %token PERCENT_NTERM "%nterm" + %token PERCENT_TYPE "%type" %token PERCENT_DESTRUCTOR "%destructor" +%token PERCENT_PRINTER "%printer" + %token PERCENT_UNION "%union" + %token PERCENT_LEFT "%left" %token PERCENT_RIGHT "%right" %token PERCENT_NONASSOC "%nonassoc" @@ -212,6 +216,16 @@ grammar_declaration: symbol_list_free ($4); current_braced_code = action_braced_code; } +| "%printer" + { current_braced_code = printer_braced_code; } + BRACED_CODE symbols.1 + { + symbol_list_t *list; + for (list = $4; list; list = list->next) + symbol_printer_set (list->sym, $3, list->location); + symbol_list_free ($4); + current_braced_code = action_braced_code; + } ; symbol_declaration: diff --git a/src/reader.h b/src/reader.h index e40cafc..e2443fd 100644 --- a/src/reader.h +++ b/src/reader.h @@ -52,7 +52,8 @@ int gram_parse (void *control); typedef enum braced_code_e { action_braced_code, - destructor_braced_code + destructor_braced_code, + printer_braced_code } braced_code_t; /* FIXME: This is really a dirty hack which demonstrates that we should probably not try to parse the actions now. */ diff --git a/src/scan-gram.c b/src/scan-gram.c index 1fa90fc..ed419f8 100644 --- a/src/scan-gram.c +++ b/src/scan-gram.c @@ -309,49 +309,49 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 97 -#define YY_END_OF_BUFFER 98 -static yyconst short int yy_accept[356] = +#define YY_NUM_RULES 98 +#define YY_END_OF_BUFFER 99 +static yyconst short int yy_accept[361] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 98, 45, - 34, 33, 33, 38, 45, 37, 35, 45, 36, 30, - 32, 45, 29, 42, 31, 49, 50, 50, 51, 46, - 47, 76, 79, 79, 75, 46, 78, 47, 71, 74, - 74, 70, 73, 53, 54, 54, 52, 69, 56, 57, - 57, 55, 89, 90, 90, 81, 91, 80, 84, 91, - 46, 47, 86, 85, 93, 95, 95, 81, 94, 80, - 84, 96, 96, 96, 81, 80, 84, 34, 33, 33, - 33, 33, 44, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 41, 35, 39, - 40, 36, 0, 49, 50, 50, 50, 50, 48, 76, - 79, 79, 79, 79, 77, 71, 74, 74, 74, 74, - 72, 53, 54, 54, 54, 54, 68, 67, 68, 60, - 61, 62, 63, 64, 65, 66, 68, 57, 57, 57, - 57, 89, 90, 90, 90, 90, 87, 0, 87, 0, - 82, 83, 88, 0, 88, 93, 95, 95, 95, 95, - 92, 96, 96, 96, 96, 96, 82, 83, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 99, 46, + 35, 34, 34, 39, 46, 38, 36, 46, 37, 31, + 33, 46, 30, 43, 32, 50, 51, 51, 52, 47, + 48, 77, 80, 80, 76, 47, 79, 48, 72, 75, + 75, 71, 74, 54, 55, 55, 53, 70, 57, 58, + 58, 56, 90, 91, 91, 82, 92, 81, 85, 92, + 47, 48, 87, 86, 94, 96, 96, 82, 95, 81, + 85, 97, 97, 97, 82, 81, 85, 35, 34, 34, + 34, 34, 45, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 42, 36, 40, + 41, 37, 0, 50, 51, 51, 51, 51, 49, 77, + 80, 80, 80, 80, 78, 72, 75, 75, 75, 75, + 73, 54, 55, 55, 55, 55, 69, 68, 69, 61, + 62, 63, 64, 65, 66, 67, 69, 58, 58, 58, + 58, 90, 91, 91, 91, 91, 88, 0, 88, 0, + 83, 84, 89, 0, 89, 94, 96, 96, 96, 96, + 93, 97, 97, 97, 97, 97, 83, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 40, 43, 0, 0, 0, 83, 83, 83, 0, 0, + 41, 44, 0, 0, 0, 84, 84, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 58, 59, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, - 0, 0, 17, 0, 0, 0, 0, 22, 0, 25, - 0, 0, 28, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 15, 0, 0, 19, 0, - 21, 23, 26, 0, 1, 3, 0, 0, 7, 0, - 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, - - 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 27, 0, 0, 0, 0, 0, 0, 13, - 14, 0, 20, 0, 0, 0, 0, 0, 11, 0, - 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, - 8, 0, 12, 18, 24, 0, 0, 6, 0, 0, - 0, 0, 0, 9, 0 + 0, 0, 0, 0, 0, 59, 60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, + 0, 0, 0, 17, 0, 0, 0, 0, 0, 23, + 0, 26, 0, 0, 29, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, + 0, 20, 0, 22, 24, 27, 0, 1, 3, 0, + 0, 7, 0, 0, 0, 0, 0, 0, 16, 0, + + 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, + 0, 0, 0, 18, 0, 0, 0, 28, 0, 0, + 0, 0, 0, 0, 13, 14, 0, 21, 0, 0, + 0, 0, 0, 11, 0, 0, 0, 5, 0, 0, + 0, 0, 0, 0, 0, 8, 0, 12, 19, 25, + 0, 0, 6, 0, 0, 0, 0, 0, 9, 0 } ; static yyconst int yy_ec[256] = @@ -395,99 +395,99 @@ static yyconst int yy_meta[51] = 9, 9, 9, 9, 9, 9, 9, 5, 1, 5 } ; -static yyconst short int yy_base[382] = +static yyconst short int yy_base[387] = { 0, 0, 0, 48, 51, 58, 61, 83, 86, 73, 94, - 108, 110, 131, 179, 227, 249, 116, 142, 814, 815, - 811, 55, 64, 815, 267, 815, 0, 44, 79, 815, - 815, 0, 815, 815, 815, 0, 97, 99, 800, 815, - 815, 0, 119, 122, 815, 815, 0, 815, 0, 126, - 138, 815, 0, 0, 145, 153, 815, 311, 815, 155, - 157, 815, 0, 159, 164, 815, 159, 815, 62, 164, - 815, 815, 815, 815, 0, 185, 189, 815, 761, 815, - 185, 192, 201, 203, 205, 207, 209, 808, 211, 213, - 216, 219, 815, 775, 778, 86, 773, 49, 198, 762, - - 184, 771, 109, 203, 766, 773, 776, 815, 0, 815, - 0, 230, 782, 0, 242, 244, 255, 259, 815, 0, - 261, 263, 265, 272, 815, 0, 274, 276, 278, 280, - 815, 0, 282, 284, 286, 288, 815, 815, 787, 815, - 815, 815, 815, 815, 815, 815, 0, 296, 298, 314, - 316, 0, 318, 322, 324, 326, 815, 318, 322, 0, - 815, 0, 815, 326, 330, 0, 342, 344, 347, 355, - 815, 357, 359, 361, 363, 365, 367, 369, 761, 144, - 757, 757, 144, 765, 767, 757, 364, 763, 749, 761, - 749, 757, 758, 761, 745, 750, 744, 749, 741, 753, - - 0, 815, 767, 0, 760, 0, 372, 375, 752, 733, - 742, 732, 735, 743, 742, 741, 727, 743, 738, 731, - 740, 724, 724, 735, 732, 728, 724, 718, 721, 727, - 726, 716, 727, 725, 815, 815, 371, 711, 719, 712, - 708, 707, 719, 736, 716, 815, 701, 230, 709, 700, - 704, 696, 815, 370, 696, 708, 694, 815, 698, 815, - 697, 695, 815, 686, 815, 702, 687, 373, 687, 689, - 376, 694, 687, 688, 683, 815, 681, 683, 815, 653, - 815, 378, 815, 650, 815, 626, 637, 606, 815, 607, - 606, 605, 601, 611, 601, 815, 611, 595, 588, 599, - - 815, 585, 597, 596, 557, 562, 569, 536, 546, 532, - 511, 522, 815, 508, 503, 508, 491, 491, 498, 815, - 815, 362, 815, 373, 351, 360, 348, 315, 815, 319, - 311, 297, 815, 284, 267, 260, 249, 252, 242, 228, - 815, 217, 815, 815, 815, 208, 380, 815, 205, 192, - 166, 85, 62, 815, 815, 405, 419, 433, 447, 461, - 475, 489, 503, 189, 517, 531, 545, 557, 571, 583, - 597, 610, 624, 638, 652, 666, 84, 680, 694, 708, - 58 + 108, 110, 131, 179, 227, 249, 116, 142, 819, 820, + 816, 55, 64, 820, 267, 820, 0, 44, 79, 820, + 820, 0, 820, 820, 820, 0, 97, 99, 805, 820, + 820, 0, 119, 122, 820, 820, 0, 820, 0, 126, + 138, 820, 0, 0, 145, 153, 820, 311, 820, 155, + 157, 820, 0, 159, 164, 820, 159, 820, 62, 164, + 820, 820, 820, 820, 0, 185, 189, 820, 766, 820, + 185, 192, 201, 203, 205, 207, 209, 813, 211, 213, + 216, 219, 820, 780, 783, 86, 778, 49, 198, 767, + + 184, 776, 109, 203, 771, 778, 781, 820, 0, 820, + 0, 230, 787, 0, 242, 244, 255, 259, 820, 0, + 261, 263, 265, 272, 820, 0, 274, 276, 278, 280, + 820, 0, 282, 284, 286, 288, 820, 820, 792, 820, + 820, 820, 820, 820, 820, 820, 0, 296, 298, 314, + 316, 0, 318, 322, 324, 326, 820, 318, 322, 0, + 820, 0, 820, 326, 330, 0, 342, 344, 347, 355, + 820, 357, 359, 361, 363, 365, 367, 369, 766, 144, + 762, 762, 144, 770, 772, 762, 364, 768, 754, 168, + 755, 763, 764, 767, 751, 756, 750, 755, 747, 759, + + 0, 820, 773, 0, 766, 0, 372, 375, 758, 739, + 748, 738, 741, 749, 748, 747, 733, 749, 744, 737, + 746, 730, 730, 741, 730, 737, 733, 729, 723, 726, + 732, 731, 721, 732, 730, 820, 820, 371, 716, 724, + 717, 713, 712, 724, 741, 721, 820, 706, 230, 714, + 705, 709, 701, 820, 701, 370, 700, 712, 698, 820, + 702, 820, 701, 699, 820, 690, 820, 706, 691, 373, + 691, 693, 376, 698, 691, 692, 687, 820, 685, 697, + 686, 820, 682, 820, 378, 820, 682, 820, 681, 668, + 647, 820, 627, 626, 612, 607, 615, 605, 820, 601, + + 615, 601, 594, 604, 820, 588, 599, 598, 583, 588, + 571, 558, 571, 820, 537, 536, 547, 820, 510, 507, + 516, 501, 497, 503, 820, 820, 491, 820, 502, 363, + 373, 358, 347, 820, 348, 325, 317, 820, 302, 287, + 279, 267, 263, 265, 251, 820, 229, 820, 820, 820, + 240, 380, 820, 229, 192, 164, 85, 62, 820, 820, + 405, 419, 433, 447, 461, 475, 489, 503, 227, 517, + 531, 545, 557, 571, 583, 597, 610, 624, 638, 652, + 666, 84, 680, 694, 708, 58 } ; -static yyconst short int yy_def[382] = +static yyconst short int yy_def[387] = { 0, - 355, 1, 356, 356, 357, 357, 358, 358, 359, 359, - 360, 360, 361, 361, 362, 362, 363, 363, 355, 355, - 355, 355, 355, 355, 355, 355, 364, 355, 355, 355, - 355, 365, 355, 355, 355, 366, 355, 355, 355, 355, - 355, 367, 355, 355, 355, 355, 368, 355, 369, 355, - 355, 355, 370, 371, 355, 355, 355, 372, 355, 355, - 355, 355, 373, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 374, 355, 355, 355, 355, 355, - 355, 375, 375, 375, 375, 375, 375, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - - 355, 355, 355, 355, 355, 355, 355, 355, 364, 355, - 376, 355, 365, 366, 355, 355, 355, 355, 355, 367, - 355, 355, 355, 355, 355, 369, 355, 355, 355, 355, - 355, 371, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 377, 355, 355, 355, - 355, 373, 355, 355, 355, 355, 355, 355, 355, 378, - 355, 379, 355, 355, 355, 374, 355, 355, 355, 355, - 355, 375, 375, 375, 375, 375, 375, 380, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - - 376, 355, 355, 381, 378, 379, 380, 380, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 0, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355 + 360, 1, 361, 361, 362, 362, 363, 363, 364, 364, + 365, 365, 366, 366, 367, 367, 368, 368, 360, 360, + 360, 360, 360, 360, 360, 360, 369, 360, 360, 360, + 360, 370, 360, 360, 360, 371, 360, 360, 360, 360, + 360, 372, 360, 360, 360, 360, 373, 360, 374, 360, + 360, 360, 375, 376, 360, 360, 360, 377, 360, 360, + 360, 360, 378, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 379, 360, 360, 360, 360, 360, + 360, 380, 380, 380, 380, 380, 380, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + + 360, 360, 360, 360, 360, 360, 360, 360, 369, 360, + 381, 360, 370, 371, 360, 360, 360, 360, 360, 372, + 360, 360, 360, 360, 360, 374, 360, 360, 360, 360, + 360, 376, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 382, 360, 360, 360, + 360, 378, 360, 360, 360, 360, 360, 360, 360, 383, + 360, 384, 360, 360, 360, 379, 360, 360, 360, 360, + 360, 380, 380, 380, 380, 380, 380, 385, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + + 381, 360, 360, 386, 383, 384, 385, 385, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 0, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360 } ; -static yyconst short int yy_nxt[866] = +static yyconst short int yy_nxt[871] = { 0, 20, 21, 22, 23, 24, 20, 25, 26, 20, 20, 27, 28, 29, 29, 30, 31, 32, 33, 20, 20, @@ -495,13 +495,13 @@ static yyconst short int yy_nxt[866] = 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 34, 35, 20, 37, 38, 110, 37, 38, 111, 39, 89, 90, 39, - 43, 44, 45, 43, 44, 45, 91, 92, 236, 40, + 43, 44, 45, 43, 44, 45, 91, 92, 237, 40, 161, 41, 40, 162, 41, 55, 56, 57, 184, 46, 47, 48, 46, 47, 48, 50, 51, 185, 50, 51, 52, 112, 112, 52, 204, 58, 55, 56, 57, 115, - 116, 117, 118, 354, 46, 53, 48, 46, 53, 48, - 60, 61, 60, 61, 353, 62, 58, 62, 83, 84, + 116, 117, 118, 359, 46, 53, 48, 46, 53, 48, + 60, 61, 60, 61, 358, 62, 58, 62, 83, 84, 85, 121, 122, 86, 123, 124, 181, 87, 127, 128, 58, 182, 58, 64, 65, 66, 67, 46, 68, 48, 129, 130, 69, 193, 83, 84, 85, 133, 134, 86, @@ -509,31 +509,31 @@ static yyconst short int yy_nxt[866] = 151, 153, 154, 46, 157, 48, 155, 156, 158, 163, 210, 159, 159, 164, 211, 160, 165, 165, 73, 215, 74, 64, 65, 66, 67, 212, 68, 167, 168, 216, - 69, 169, 170, 161, 173, 174, 162, 109, 70, 109, + 69, 169, 170, 161, 173, 174, 162, 224, 70, 357, - 71, 352, 72, 173, 175, 176, 174, 173, 174, 173, + 71, 225, 72, 173, 175, 176, 174, 173, 174, 173, 174, 173, 174, 89, 90, 91, 92, 177, 89, 90, - 178, 91, 92, 186, 190, 351, 73, 191, 74, 76, - 77, 78, 195, 79, 80, 350, 187, 348, 81, 273, + 178, 91, 92, 186, 190, 356, 73, 191, 74, 76, + 77, 78, 195, 79, 80, 109, 187, 109, 81, 275, 188, 196, 112, 112, 115, 116, 117, 118, 46, 197, - 48, 76, 77, 78, 273, 79, 80, 115, 116, 347, - 81, 117, 118, 121, 122, 123, 124, 121, 122, 346, - 46, 345, 48, 93, 123, 124, 127, 128, 129, 130, + 48, 76, 77, 78, 275, 79, 80, 115, 116, 355, + 81, 117, 118, 121, 122, 123, 124, 121, 122, 353, + 46, 352, 48, 93, 123, 124, 127, 128, 129, 130, 127, 128, 129, 130, 133, 134, 135, 136, 133, 134, - 135, 136, 344, 94, 343, 95, 96, 97, 148, 149, - - 150, 151, 98, 342, 99, 100, 101, 102, 103, 104, - 105, 106, 341, 107, 108, 138, 148, 149, 150, 151, - 153, 154, 340, 139, 155, 156, 153, 154, 155, 156, - 159, 159, 339, 138, 159, 159, 140, 141, 165, 165, - 338, 142, 165, 165, 167, 168, 169, 170, 143, 167, - 168, 144, 337, 145, 336, 146, 147, 169, 170, 173, + 135, 136, 351, 94, 350, 95, 96, 97, 148, 149, + + 150, 151, 98, 349, 99, 100, 101, 102, 103, 104, + 105, 106, 348, 107, 108, 138, 148, 149, 150, 151, + 153, 154, 347, 139, 155, 156, 153, 154, 155, 156, + 159, 159, 346, 138, 159, 159, 140, 141, 165, 165, + 345, 142, 165, 165, 167, 168, 169, 170, 143, 167, + 168, 144, 344, 145, 343, 146, 147, 169, 170, 173, 174, 173, 175, 176, 174, 176, 174, 173, 175, 173, - 174, 173, 208, 220, 173, 208, 157, 176, 208, 278, - 158, 335, 288, 159, 159, 291, 334, 299, 220, 349, - 206, 333, 206, 206, 278, 206, 206, 288, 206, 332, + 174, 173, 208, 220, 173, 208, 157, 176, 208, 281, + 158, 342, 291, 159, 159, 294, 341, 303, 220, 354, + 206, 340, 206, 206, 281, 206, 206, 291, 206, 339, - 291, 221, 299, 331, 349, 36, 36, 36, 36, 36, + 294, 221, 303, 338, 354, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 49, 49, 49, 49, 49, 49, 49, @@ -546,47 +546,47 @@ static yyconst short int yy_nxt[866] = 75, 75, 75, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 113, 330, 113, - 113, 114, 329, 328, 114, 114, 114, 114, 327, 114, - 114, 114, 114, 326, 114, 120, 325, 324, 323, 120, + 113, 113, 113, 113, 113, 113, 113, 113, 337, 113, + 113, 114, 336, 335, 114, 114, 114, 114, 334, 114, + 114, 114, 114, 333, 114, 120, 332, 331, 330, 120, 120, 120, 120, 120, 120, 120, 120, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 126, 322, 321, 126, 126, 126, 320, 126, 126, + 125, 126, 329, 328, 126, 126, 126, 327, 126, 126, 126, 126, 126, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 132, 319, 318, + 131, 131, 131, 131, 131, 131, 131, 132, 326, 325, - 317, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 324, 132, 132, 132, 132, 132, 132, 132, 132, 132, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 152, 316, 315, 314, 313, 152, - 312, 152, 152, 311, 152, 152, 310, 152, 166, 309, - 308, 307, 166, 306, 305, 166, 166, 304, 166, 166, - 303, 166, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 302, 172, 201, 301, 201, 201, + 137, 137, 137, 137, 152, 323, 322, 321, 320, 152, + 319, 152, 152, 318, 152, 152, 317, 152, 166, 316, + 315, 314, 166, 313, 312, 166, 166, 311, 166, 166, + 310, 166, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 309, 172, 201, 308, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, - 205, 300, 205, 205, 206, 298, 206, 206, 206, 206, + 205, 307, 205, 205, 206, 306, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 297, 296, 295, 294, 293, 292, 290, 289, - 287, 286, 285, 284, 283, 282, 281, 280, 279, 277, - 276, 275, 274, 272, 271, 270, 269, 268, 267, 266, - 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, - 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, - 245, 244, 243, 242, 241, 240, 239, 238, 237, 235, - 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, - 224, 223, 222, 219, 218, 217, 214, 213, 209, 203, - - 202, 200, 199, 198, 192, 189, 183, 180, 179, 88, - 171, 119, 88, 355, 19, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355 + 207, 207, 305, 304, 302, 301, 300, 299, 298, 297, + 296, 295, 293, 292, 290, 289, 288, 287, 286, 285, + 284, 283, 282, 280, 279, 278, 277, 276, 274, 273, + 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, + 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, + 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 242, 241, 240, 239, 238, 236, 235, 234, 233, 232, + 231, 230, 229, 228, 227, 226, 223, 222, 219, 218, + + 217, 214, 213, 209, 203, 202, 200, 199, 198, 192, + 189, 183, 180, 179, 88, 171, 119, 88, 360, 19, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360 } ; -static yyconst short int yy_chk[866] = +static yyconst short int yy_chk[871] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -594,13 +594,13 @@ static yyconst short int yy_chk[866] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 28, 4, 4, 28, 3, 22, 22, 4, - 5, 5, 5, 6, 6, 6, 23, 23, 381, 3, + 5, 5, 5, 6, 6, 6, 23, 23, 386, 3, 69, 3, 4, 69, 4, 9, 9, 9, 98, 5, 5, 5, 6, 6, 6, 7, 7, 98, 8, 8, - 7, 29, 29, 8, 377, 9, 10, 10, 10, 37, + 7, 29, 29, 8, 382, 9, 10, 10, 10, 37, - 37, 38, 38, 353, 7, 7, 7, 8, 8, 8, - 11, 11, 12, 12, 352, 11, 10, 12, 17, 17, + 37, 38, 38, 358, 7, 7, 7, 8, 8, 8, + 11, 11, 12, 12, 357, 11, 10, 12, 17, 17, 17, 43, 43, 17, 44, 44, 96, 17, 50, 50, 11, 96, 12, 13, 13, 13, 13, 17, 13, 17, 51, 51, 13, 103, 18, 18, 18, 55, 55, 18, @@ -608,81 +608,81 @@ static yyconst short int yy_chk[866] = 61, 64, 64, 18, 67, 18, 65, 65, 67, 70, 180, 67, 67, 70, 180, 67, 70, 70, 13, 183, 13, 14, 14, 14, 14, 180, 14, 76, 76, 183, - 14, 77, 77, 81, 82, 82, 81, 364, 14, 364, + 14, 77, 77, 81, 82, 82, 81, 190, 14, 356, - 14, 351, 14, 83, 83, 84, 84, 85, 85, 86, + 14, 190, 14, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 89, 89, 90, 90, 87, 91, 91, - 87, 92, 92, 99, 101, 350, 14, 101, 14, 15, - 15, 15, 104, 15, 15, 349, 99, 346, 15, 248, + 87, 92, 92, 99, 101, 355, 14, 101, 14, 15, + 15, 15, 104, 15, 15, 369, 99, 369, 15, 249, 99, 104, 112, 112, 115, 115, 116, 116, 15, 104, - 15, 16, 16, 16, 248, 16, 16, 117, 117, 342, - 16, 118, 118, 121, 121, 122, 122, 123, 123, 340, - 16, 339, 16, 25, 124, 124, 127, 127, 128, 128, + 15, 16, 16, 16, 249, 16, 16, 117, 117, 354, + 16, 118, 118, 121, 121, 122, 122, 123, 123, 351, + 16, 347, 16, 25, 124, 124, 127, 127, 128, 128, 129, 129, 130, 130, 133, 133, 134, 134, 135, 135, - 136, 136, 338, 25, 337, 25, 25, 25, 148, 148, - - 149, 149, 25, 336, 25, 25, 25, 25, 25, 25, - 25, 25, 335, 25, 25, 58, 150, 150, 151, 151, - 153, 153, 334, 58, 154, 154, 155, 155, 156, 156, - 158, 158, 332, 58, 159, 159, 58, 58, 164, 164, - 331, 58, 165, 165, 167, 167, 168, 168, 58, 169, - 169, 58, 330, 58, 328, 58, 58, 170, 170, 172, + 136, 136, 345, 25, 344, 25, 25, 25, 148, 148, + + 149, 149, 25, 343, 25, 25, 25, 25, 25, 25, + 25, 25, 342, 25, 25, 58, 150, 150, 151, 151, + 153, 153, 341, 58, 154, 154, 155, 155, 156, 156, + 158, 158, 340, 58, 159, 159, 58, 58, 164, 164, + 339, 58, 165, 165, 167, 167, 168, 168, 58, 169, + 169, 58, 337, 58, 336, 58, 58, 170, 170, 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, - 177, 178, 178, 187, 207, 207, 237, 208, 208, 254, - 237, 327, 268, 237, 237, 271, 326, 282, 187, 347, - 178, 325, 178, 207, 254, 207, 208, 268, 208, 324, - - 271, 187, 282, 322, 347, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 358, 358, 358, 358, 358, 358, 358, - 358, 358, 358, 358, 358, 358, 358, 359, 359, 359, - 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, - 359, 360, 360, 360, 360, 360, 360, 360, 360, 360, - 360, 360, 360, 360, 360, 361, 361, 361, 361, 361, + 177, 178, 178, 187, 207, 207, 238, 208, 208, 256, + 238, 335, 270, 238, 238, 273, 333, 285, 187, 352, + 178, 332, 178, 207, 256, 207, 208, 270, 208, 331, + + 273, 187, 285, 330, 352, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 363, 363, 363, 363, 363, 363, 363, - 363, 363, 363, 363, 363, 363, 363, 365, 365, 365, - 365, 365, 365, 365, 365, 365, 365, 365, 319, 365, - 365, 366, 318, 317, 366, 366, 366, 366, 316, 366, - 366, 366, 366, 315, 366, 367, 314, 312, 311, 367, - 367, 367, 367, 367, 367, 367, 367, 368, 368, 368, - 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, - 368, 369, 310, 309, 369, 369, 369, 308, 369, 369, - 369, 369, 369, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 371, 307, 306, - - 305, 371, 371, 371, 371, 371, 371, 371, 371, 371, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 373, 304, 303, 302, 300, 373, - 299, 373, 373, 298, 373, 373, 297, 373, 374, 295, - 294, 293, 374, 292, 291, 374, 374, 290, 374, 374, - 288, 374, 375, 375, 375, 375, 375, 375, 375, 375, - 375, 375, 375, 375, 287, 375, 376, 286, 376, 376, - 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 284, 378, 378, 379, 280, 379, 379, 379, 379, - - 379, 379, 379, 379, 379, 379, 379, 379, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 278, 277, 275, 274, 273, 272, 270, 269, - 267, 266, 264, 262, 261, 259, 257, 256, 255, 252, - 251, 250, 249, 247, 245, 244, 243, 242, 241, 240, - 239, 238, 234, 233, 232, 231, 230, 229, 228, 227, - 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, - 216, 215, 214, 213, 212, 211, 210, 209, 205, 203, - 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, - 190, 189, 188, 186, 185, 184, 182, 181, 179, 139, - - 113, 107, 106, 105, 102, 100, 97, 95, 94, 88, - 79, 39, 21, 19, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355 + 363, 363, 363, 363, 363, 363, 363, 364, 364, 364, + 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, + 364, 365, 365, 365, 365, 365, 365, 365, 365, 365, + 365, 365, 365, 365, 365, 366, 366, 366, 366, 366, + 366, 366, 366, 366, 366, 366, 366, 366, 366, 367, + 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, + + 367, 367, 367, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 368, 370, 370, 370, + 370, 370, 370, 370, 370, 370, 370, 370, 329, 370, + 370, 371, 327, 324, 371, 371, 371, 371, 323, 371, + 371, 371, 371, 322, 371, 372, 321, 320, 319, 372, + 372, 372, 372, 372, 372, 372, 372, 373, 373, 373, + 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + 373, 374, 317, 316, 374, 374, 374, 315, 374, 374, + 374, 374, 374, 375, 375, 375, 375, 375, 375, 375, + 375, 375, 375, 375, 375, 375, 375, 376, 313, 312, + + 311, 376, 376, 376, 376, 376, 376, 376, 376, 376, + 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, + 377, 377, 377, 377, 378, 310, 309, 308, 307, 378, + 306, 378, 378, 304, 378, 378, 303, 378, 379, 302, + 301, 300, 379, 298, 297, 379, 379, 296, 379, 379, + 295, 379, 380, 380, 380, 380, 380, 380, 380, 380, + 380, 380, 380, 380, 294, 380, 381, 293, 381, 381, + 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, + 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, + 383, 291, 383, 383, 384, 290, 384, 384, 384, 384, + + 384, 384, 384, 384, 384, 384, 384, 384, 385, 385, + 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 289, 287, 283, 281, 280, 279, 277, 276, + 275, 274, 272, 271, 269, 268, 266, 264, 263, 261, + 259, 258, 257, 255, 253, 252, 251, 250, 248, 246, + 245, 244, 243, 242, 241, 240, 239, 235, 234, 233, + 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, + 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, + 212, 211, 210, 209, 205, 203, 200, 199, 198, 197, + 196, 195, 194, 193, 192, 191, 189, 188, 186, 185, + + 184, 182, 181, 179, 139, 113, 107, 106, 105, 102, + 100, 97, 95, 94, 88, 79, 39, 21, 19, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360 } ; static yy_state_type yy_last_accepting_state; @@ -691,18 +691,18 @@ static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 1; -static yyconst short int yy_rule_linenum[97] = +static yyconst short int yy_rule_linenum[98] = { 0, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 151, 152, - 153, 154, 156, 157, 158, 163, 166, 169, 172, 173, - 176, 179, 182, 190, 196, 212, 213, 224, 236, 237, - 238, 255, 264, 266, 286, 300, 302, 322, 334, 338, - 339, 340, 341, 342, 343, 344, 345, 346, 352, 363, - 369, 370, 372, 374, 392, 398, 399, 401, 403, 421, - 424, 427, 428, 431, 442, 453, 455, 457, 460, 461, - 464, 484, 491, 492, 493, 513 + 142, 143, 144, 145, 146, 147, 148, 149, 150, 152, + 153, 154, 155, 157, 158, 159, 164, 167, 170, 173, + 174, 177, 180, 183, 191, 197, 213, 214, 225, 237, + 238, 239, 256, 265, 267, 287, 301, 303, 323, 335, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 353, + 364, 370, 371, 373, 375, 393, 399, 400, 402, 404, + 422, 425, 428, 429, 432, 443, 454, 456, 458, 461, + 462, 465, 485, 492, 493, 494, 514 } ; @@ -1049,13 +1049,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 356 ) + if ( yy_current_state >= 361 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 815 ); + while ( yy_base[yy_current_state] != 820 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1075,13 +1075,13 @@ do_action: /* This label is used only to access EOF actions. */ { if ( yy_act == 0 ) fprintf( stderr, "--scanner backing up\n" ); - else if ( yy_act < 97 ) + else if ( yy_act < 98 ) fprintf( stderr, "--accepting rule at line %d (\"%s\")\n", yy_rule_linenum[yy_act], yytext ); - else if ( yy_act == 97 ) + else if ( yy_act == 98 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", yytext ); - else if ( yy_act == 98 ) + else if ( yy_act == 99 ) fprintf( stderr, "--(end of buffer or a NUL)\n" ); else fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); @@ -1186,27 +1186,27 @@ return PERCENT_PREC; case 18: YY_RULE_SETUP #line 139 "scan-gram.l" -return PERCENT_PURE_PARSER; +return PERCENT_PRINTER; YY_BREAK case 19: YY_RULE_SETUP #line 140 "scan-gram.l" -return PERCENT_RIGHT; +return PERCENT_PURE_PARSER; YY_BREAK case 20: YY_RULE_SETUP #line 141 "scan-gram.l" -return PERCENT_SKELETON; +return PERCENT_RIGHT; YY_BREAK case 21: YY_RULE_SETUP #line 142 "scan-gram.l" -return PERCENT_START; +return PERCENT_SKELETON; YY_BREAK case 22: YY_RULE_SETUP #line 143 "scan-gram.l" -return PERCENT_TOKEN; +return PERCENT_START; YY_BREAK case 23: YY_RULE_SETUP @@ -1216,110 +1216,115 @@ return PERCENT_TOKEN; case 24: YY_RULE_SETUP #line 145 "scan-gram.l" -return PERCENT_TOKEN_TABLE; +return PERCENT_TOKEN; YY_BREAK case 25: YY_RULE_SETUP #line 146 "scan-gram.l" -return PERCENT_TYPE; +return PERCENT_TOKEN_TABLE; YY_BREAK case 26: YY_RULE_SETUP #line 147 "scan-gram.l" -return PERCENT_UNION; +return PERCENT_TYPE; YY_BREAK case 27: YY_RULE_SETUP #line 148 "scan-gram.l" -return PERCENT_VERBOSE; +return PERCENT_UNION; YY_BREAK case 28: YY_RULE_SETUP #line 149 "scan-gram.l" -return PERCENT_YACC; +return PERCENT_VERBOSE; YY_BREAK case 29: YY_RULE_SETUP -#line 151 "scan-gram.l" -return EQUAL; +#line 150 "scan-gram.l" +return PERCENT_YACC; YY_BREAK case 30: YY_RULE_SETUP #line 152 "scan-gram.l" -return COLON; +return EQUAL; YY_BREAK case 31: YY_RULE_SETUP #line 153 "scan-gram.l" -return PIPE; +return COLON; YY_BREAK case 32: YY_RULE_SETUP #line 154 "scan-gram.l" -return SEMICOLON; +return PIPE; YY_BREAK case 33: YY_RULE_SETUP -#line 156 "scan-gram.l" -YY_LINES; YY_STEP; +#line 155 "scan-gram.l" +return SEMICOLON; YY_BREAK case 34: YY_RULE_SETUP #line 157 "scan-gram.l" -YY_STEP; +YY_LINES; YY_STEP; YY_BREAK case 35: YY_RULE_SETUP #line 158 "scan-gram.l" +YY_STEP; + YY_BREAK +case 36: +YY_RULE_SETUP +#line 159 "scan-gram.l" { yylval->symbol = getsym (yytext, *yylloc); return ID; } YY_BREAK -case 36: +case 37: YY_RULE_SETUP -#line 163 "scan-gram.l" +#line 164 "scan-gram.l" yylval->integer = strtol (yytext, 0, 10); return INT; YY_BREAK /* Characters. We don't check there is only one. */ -case 37: +case 38: YY_RULE_SETUP -#line 166 "scan-gram.l" +#line 167 "scan-gram.l" YY_OBS_GROW; yy_push_state (SC_ESCAPED_CHARACTER); YY_BREAK /* Strings. */ -case 38: +case 39: YY_RULE_SETUP -#line 169 "scan-gram.l" +#line 170 "scan-gram.l" YY_OBS_GROW; yy_push_state (SC_ESCAPED_STRING); YY_BREAK /* Comments. */ -case 39: +case 40: YY_RULE_SETUP -#line 172 "scan-gram.l" +#line 173 "scan-gram.l" yy_push_state (SC_COMMENT); YY_BREAK -case 40: +case 41: YY_RULE_SETUP -#line 173 "scan-gram.l" +#line 174 "scan-gram.l" YY_STEP; YY_BREAK /* Prologue. */ -case 41: +case 42: YY_RULE_SETUP -#line 176 "scan-gram.l" +#line 177 "scan-gram.l" yy_push_state (SC_PROLOGUE); YY_BREAK /* Code in between braces. */ -case 42: +case 43: YY_RULE_SETUP -#line 179 "scan-gram.l" +#line 180 "scan-gram.l" YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE); YY_BREAK /* A type. */ -case 43: +case 44: YY_RULE_SETUP -#line 182 "scan-gram.l" +#line 183 "scan-gram.l" { obstack_grow (&string_obstack, yytext + 1, yyleng - 2); YY_OBS_FINISH; @@ -1327,18 +1332,18 @@ YY_RULE_SETUP return TYPE; } YY_BREAK -case 44: +case 45: YY_RULE_SETUP -#line 190 "scan-gram.l" +#line 191 "scan-gram.l" { if (++percent_percent_count == 2) yy_push_state (SC_EPILOGUE); return PERCENT_PERCENT; } YY_BREAK -case 45: +case 46: YY_RULE_SETUP -#line 196 "scan-gram.l" +#line 197 "scan-gram.l" { LOCATION_PRINT (stderr, *yylloc); fprintf (stderr, ": invalid character: `%c'\n", *yytext); @@ -1353,14 +1358,14 @@ YY_RULE_SETUP `------------------------------------------------------------*/ -case 46: +case 47: YY_RULE_SETUP -#line 212 "scan-gram.l" +#line 213 "scan-gram.l" if (YY_START != SC_COMMENT) obstack_sgrow (&string_obstack, "@<:@"); YY_BREAK -case 47: +case 48: YY_RULE_SETUP -#line 213 "scan-gram.l" +#line 214 "scan-gram.l" if (YY_START != SC_COMMENT) obstack_sgrow (&string_obstack, "@:>@"); YY_BREAK @@ -1369,9 +1374,9 @@ if (YY_START != SC_COMMENT) obstack_sgrow (&string_obstack, "@:>@"); `-----------------------------------------------------------*/ -case 48: +case 49: YY_RULE_SETUP -#line 224 "scan-gram.l" +#line 225 "scan-gram.l" { /* End of the comment. */ if (yy_top_state () == INITIAL) { @@ -1384,23 +1389,23 @@ YY_RULE_SETUP yy_pop_state (); } YY_BREAK -case 49: -YY_RULE_SETUP -#line 236 "scan-gram.l" -if (yy_top_state () != INITIAL) YY_OBS_GROW; - YY_BREAK case 50: YY_RULE_SETUP #line 237 "scan-gram.l" -if (yy_top_state () != INITIAL) YY_OBS_GROW; YY_LINES; +if (yy_top_state () != INITIAL) YY_OBS_GROW; YY_BREAK case 51: YY_RULE_SETUP #line 238 "scan-gram.l" +if (yy_top_state () != INITIAL) YY_OBS_GROW; YY_LINES; + YY_BREAK +case 52: +YY_RULE_SETUP +#line 239 "scan-gram.l" /* Stray `*'. */if (yy_top_state () != INITIAL) YY_OBS_GROW; YY_BREAK case YY_STATE_EOF(SC_COMMENT): -#line 240 "scan-gram.l" +#line 241 "scan-gram.l" { LOCATION_PRINT (stderr, *yylloc); fprintf (stderr, ": unexpected end of file in a comment\n"); @@ -1414,9 +1419,9 @@ case YY_STATE_EOF(SC_COMMENT): `----------------------------------------------------------------*/ -case 52: +case 53: YY_RULE_SETUP -#line 255 "scan-gram.l" +#line 256 "scan-gram.l" { assert (yy_top_state () == INITIAL); YY_OBS_GROW; @@ -1426,18 +1431,18 @@ YY_RULE_SETUP return STRING; } YY_BREAK -case 53: +case 54: YY_RULE_SETUP -#line 264 "scan-gram.l" +#line 265 "scan-gram.l" YY_OBS_GROW; YY_BREAK -case 54: +case 55: YY_RULE_SETUP -#line 266 "scan-gram.l" +#line 267 "scan-gram.l" obstack_1grow (&string_obstack, '\n'); YY_LINES; YY_BREAK case YY_STATE_EOF(SC_ESCAPED_STRING): -#line 268 "scan-gram.l" +#line 269 "scan-gram.l" { LOCATION_PRINT (stderr, *yylloc); fprintf (stderr, ": unexpected end of file in a string\n"); @@ -1455,9 +1460,9 @@ case YY_STATE_EOF(SC_ESCAPED_STRING): `---------------------------------------------------------------*/ -case 55: +case 56: YY_RULE_SETUP -#line 286 "scan-gram.l" +#line 287 "scan-gram.l" { YY_OBS_GROW; assert (yy_top_state () == INITIAL); @@ -1472,18 +1477,18 @@ YY_RULE_SETUP } } YY_BREAK -case 56: +case 57: YY_RULE_SETUP -#line 300 "scan-gram.l" +#line 301 "scan-gram.l" YY_OBS_GROW; YY_BREAK -case 57: +case 58: YY_RULE_SETUP -#line 302 "scan-gram.l" +#line 303 "scan-gram.l" obstack_1grow (&string_obstack, '\n'); YY_LINES; YY_BREAK case YY_STATE_EOF(SC_ESCAPED_CHARACTER): -#line 304 "scan-gram.l" +#line 305 "scan-gram.l" { LOCATION_PRINT (stderr, *yylloc); fprintf (stderr, ": unexpected end of file in a character\n"); @@ -1500,9 +1505,9 @@ case YY_STATE_EOF(SC_ESCAPED_CHARACTER): `----------------------------*/ -case 58: +case 59: YY_RULE_SETUP -#line 322 "scan-gram.l" +#line 323 "scan-gram.l" { long c = strtol (yytext + 1, 0, 8); if (c > 255) @@ -1515,56 +1520,56 @@ YY_RULE_SETUP obstack_1grow (&string_obstack, c); } YY_BREAK -case 59: +case 60: YY_RULE_SETUP -#line 334 "scan-gram.l" +#line 335 "scan-gram.l" { obstack_1grow (&string_obstack, strtol (yytext + 2, 0, 16)); } YY_BREAK -case 60: -YY_RULE_SETUP -#line 338 "scan-gram.l" -obstack_1grow (&string_obstack, '\a'); - YY_BREAK case 61: YY_RULE_SETUP #line 339 "scan-gram.l" -obstack_1grow (&string_obstack, '\b'); +obstack_1grow (&string_obstack, '\a'); YY_BREAK case 62: YY_RULE_SETUP #line 340 "scan-gram.l" -obstack_1grow (&string_obstack, '\f'); +obstack_1grow (&string_obstack, '\b'); YY_BREAK case 63: YY_RULE_SETUP #line 341 "scan-gram.l" -obstack_1grow (&string_obstack, '\n'); +obstack_1grow (&string_obstack, '\f'); YY_BREAK case 64: YY_RULE_SETUP #line 342 "scan-gram.l" -obstack_1grow (&string_obstack, '\r'); +obstack_1grow (&string_obstack, '\n'); YY_BREAK case 65: YY_RULE_SETUP #line 343 "scan-gram.l" -obstack_1grow (&string_obstack, '\t'); +obstack_1grow (&string_obstack, '\r'); YY_BREAK case 66: YY_RULE_SETUP #line 344 "scan-gram.l" -obstack_1grow (&string_obstack, '\v'); +obstack_1grow (&string_obstack, '\t'); YY_BREAK case 67: YY_RULE_SETUP #line 345 "scan-gram.l" -obstack_1grow (&string_obstack, yytext[1]); +obstack_1grow (&string_obstack, '\v'); YY_BREAK case 68: YY_RULE_SETUP #line 346 "scan-gram.l" +obstack_1grow (&string_obstack, yytext[1]); + YY_BREAK +case 69: +YY_RULE_SETUP +#line 347 "scan-gram.l" { LOCATION_PRINT (stderr, *yylloc); fprintf (stderr, ": unrecognized escape: %s\n", quote (yytext)); @@ -1572,9 +1577,9 @@ YY_RULE_SETUP } YY_BREAK /* FLex wants this rule, in case of a `\<>'. */ -case 69: +case 70: YY_RULE_SETUP -#line 352 "scan-gram.l" +#line 353 "scan-gram.l" YY_OBS_GROW; YY_BREAK @@ -1584,38 +1589,38 @@ YY_OBS_GROW; `----------------------------------------------------------*/ -case 70: +case 71: YY_RULE_SETUP -#line 363 "scan-gram.l" +#line 364 "scan-gram.l" { YY_OBS_GROW; assert (yy_top_state () != INITIAL); yy_pop_state (); } YY_BREAK -case 71: -YY_RULE_SETUP -#line 369 "scan-gram.l" -YY_OBS_GROW; - YY_BREAK case 72: YY_RULE_SETUP #line 370 "scan-gram.l" YY_OBS_GROW; YY_BREAK -/* FLex wants this rule, in case of a `\<>'. */ case 73: YY_RULE_SETUP -#line 372 "scan-gram.l" +#line 371 "scan-gram.l" YY_OBS_GROW; YY_BREAK +/* FLex wants this rule, in case of a `\<>'. */ case 74: YY_RULE_SETUP -#line 374 "scan-gram.l" +#line 373 "scan-gram.l" +YY_OBS_GROW; + YY_BREAK +case 75: +YY_RULE_SETUP +#line 375 "scan-gram.l" YY_OBS_GROW; YY_LINES; YY_BREAK case YY_STATE_EOF(SC_CHARACTER): -#line 376 "scan-gram.l" +#line 377 "scan-gram.l" { LOCATION_PRINT (stderr, *yylloc); fprintf (stderr, ": unexpected end of file in a character\n"); @@ -1630,38 +1635,38 @@ case YY_STATE_EOF(SC_CHARACTER): `----------------------------------------------------------------*/ -case 75: +case 76: YY_RULE_SETUP -#line 392 "scan-gram.l" +#line 393 "scan-gram.l" { assert (yy_top_state () != INITIAL); YY_OBS_GROW; yy_pop_state (); } YY_BREAK -case 76: -YY_RULE_SETUP -#line 398 "scan-gram.l" -YY_OBS_GROW; - YY_BREAK case 77: YY_RULE_SETUP #line 399 "scan-gram.l" YY_OBS_GROW; YY_BREAK -/* FLex wants this rule, in case of a `\<>'. */ case 78: YY_RULE_SETUP -#line 401 "scan-gram.l" +#line 400 "scan-gram.l" YY_OBS_GROW; YY_BREAK +/* FLex wants this rule, in case of a `\<>'. */ case 79: YY_RULE_SETUP -#line 403 "scan-gram.l" +#line 402 "scan-gram.l" +YY_OBS_GROW; + YY_BREAK +case 80: +YY_RULE_SETUP +#line 404 "scan-gram.l" YY_OBS_GROW; YY_LINES; YY_BREAK case YY_STATE_EOF(SC_STRING): -#line 405 "scan-gram.l" +#line 406 "scan-gram.l" { LOCATION_PRINT (stderr, *yylloc); fprintf (stderr, ": unexpected end of file in a string\n"); @@ -1676,32 +1681,32 @@ case YY_STATE_EOF(SC_STRING): /* Characters. We don't check there is only one. */ -case 80: +case 81: YY_RULE_SETUP -#line 421 "scan-gram.l" +#line 422 "scan-gram.l" YY_OBS_GROW; yy_push_state (SC_CHARACTER); YY_BREAK /* Strings. */ -case 81: +case 82: YY_RULE_SETUP -#line 424 "scan-gram.l" +#line 425 "scan-gram.l" YY_OBS_GROW; yy_push_state (SC_STRING); YY_BREAK /* Comments. */ -case 82: +case 83: YY_RULE_SETUP -#line 427 "scan-gram.l" +#line 428 "scan-gram.l" YY_OBS_GROW; yy_push_state (SC_COMMENT); YY_BREAK -case 83: +case 84: YY_RULE_SETUP -#line 428 "scan-gram.l" +#line 429 "scan-gram.l" YY_OBS_GROW; YY_BREAK /* Not comments. */ -case 84: +case 85: YY_RULE_SETUP -#line 431 "scan-gram.l" +#line 432 "scan-gram.l" YY_OBS_GROW; YY_BREAK @@ -1711,9 +1716,9 @@ YY_OBS_GROW; `---------------------------------------------------------------*/ -case 85: +case 86: YY_RULE_SETUP -#line 442 "scan-gram.l" +#line 443 "scan-gram.l" { YY_OBS_GROW; if (--braces_level == 0) @@ -1725,41 +1730,41 @@ YY_RULE_SETUP } } YY_BREAK -case 86: +case 87: YY_RULE_SETUP -#line 453 "scan-gram.l" +#line 454 "scan-gram.l" YY_OBS_GROW; braces_level++; YY_BREAK -case 87: +case 88: YY_RULE_SETUP -#line 455 "scan-gram.l" +#line 456 "scan-gram.l" { handle_dollar (current_braced_code, yytext, *yylloc); } YY_BREAK -case 88: +case 89: YY_RULE_SETUP -#line 457 "scan-gram.l" +#line 458 "scan-gram.l" { handle_at (current_braced_code, yytext, *yylloc); } YY_BREAK -case 89: +case 90: YY_RULE_SETUP -#line 460 "scan-gram.l" +#line 461 "scan-gram.l" YY_OBS_GROW; YY_BREAK -case 90: +case 91: YY_RULE_SETUP -#line 461 "scan-gram.l" +#line 462 "scan-gram.l" YY_OBS_GROW; YY_LINES; YY_BREAK /* A lose $, or /, or etc. */ -case 91: +case 92: YY_RULE_SETUP -#line 464 "scan-gram.l" +#line 465 "scan-gram.l" YY_OBS_GROW; YY_BREAK case YY_STATE_EOF(SC_BRACED_CODE): -#line 466 "scan-gram.l" +#line 467 "scan-gram.l" { LOCATION_PRINT (stderr, *yylloc); fprintf (stderr, ": unexpected end of file in a braced code\n"); @@ -1775,9 +1780,9 @@ case YY_STATE_EOF(SC_BRACED_CODE): `--------------------------------------------------------------*/ -case 92: +case 93: YY_RULE_SETUP -#line 484 "scan-gram.l" +#line 485 "scan-gram.l" { yy_pop_state (); YY_OBS_FINISH; @@ -1785,11 +1790,6 @@ YY_RULE_SETUP return PROLOGUE; } YY_BREAK -case 93: -YY_RULE_SETUP -#line 491 "scan-gram.l" -YY_OBS_GROW; - YY_BREAK case 94: YY_RULE_SETUP #line 492 "scan-gram.l" @@ -1798,10 +1798,15 @@ YY_OBS_GROW; case 95: YY_RULE_SETUP #line 493 "scan-gram.l" +YY_OBS_GROW; + YY_BREAK +case 96: +YY_RULE_SETUP +#line 494 "scan-gram.l" YY_OBS_GROW; YY_LINES; YY_BREAK case YY_STATE_EOF(SC_PROLOGUE): -#line 495 "scan-gram.l" +#line 496 "scan-gram.l" { LOCATION_PRINT (stderr, *yylloc); fprintf (stderr, ": unexpected end of file in a prologue\n"); @@ -1818,13 +1823,13 @@ case YY_STATE_EOF(SC_PROLOGUE): `---------------------------------------------------------------*/ -case 96: +case 97: YY_RULE_SETUP -#line 513 "scan-gram.l" +#line 514 "scan-gram.l" YY_OBS_GROW; YY_BREAK case YY_STATE_EOF(SC_EPILOGUE): -#line 515 "scan-gram.l" +#line 516 "scan-gram.l" { yy_pop_state (); YY_OBS_FINISH; @@ -1833,12 +1838,12 @@ case YY_STATE_EOF(SC_EPILOGUE): } YY_BREAK -case 97: +case 98: YY_RULE_SETUP -#line 524 "scan-gram.l" +#line 525 "scan-gram.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1842 "lex.yy.c" +#line 1847 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2130,7 +2135,7 @@ static yy_state_type yy_get_previous_state() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 356 ) + if ( yy_current_state >= 361 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2165,11 +2170,11 @@ yy_state_type yy_current_state; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 356 ) + if ( yy_current_state >= 361 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 355); + yy_is_jam = (yy_current_state == 360); return yy_is_jam ? 0 : yy_current_state; } @@ -2728,11 +2733,11 @@ int main() return 0; } #endif -#line 524 "scan-gram.l" +#line 525 "scan-gram.l" /*------------------------------------------------------------------. -| CP is pointing to a wannabee semantic value (i.e., a `$'). | +| TEXT is pointing to a wannabee semantic value (i.e., a `$'). | | | | Possible inputs: $[]($|integer) | | | @@ -2740,11 +2745,10 @@ int main() `------------------------------------------------------------------*/ static inline void -handle_action_dollar (char *cp, location_t location) +handle_action_dollar (char *text, location_t location) { const char *type_name = NULL; - - ++cp; + char *cp = text + 1; /* Get the type name if explicit. */ if (*cp == '<') @@ -2796,31 +2800,24 @@ handle_action_dollar (char *cp, location_t location) } else { - char buf[] = "$c"; - buf[1] = *cp; - complain_at (location, _("%s is invalid"), quote (buf)); + complain_at (location, _("%s is invalid"), quote (text)); } } -/*---------------------------------------. -| CP is pointing to $$ in a destructor. | -`---------------------------------------*/ +/*---------------------------------------------------------------. +| TEXT is expexted tp be $$ in some code associated to a symbol: | +| destructor or printer. | +`---------------------------------------------------------------*/ static inline void -handle_destructor_dollar (char *cp, location_t location) +handle_symbol_code_dollar (char *text, location_t location) { - ++cp; + char *cp = text + 1; if (*cp == '$') - { - obstack_sgrow (&string_obstack, "]b4_dollar_dollar["); - } + obstack_sgrow (&string_obstack, "]b4_dollar_dollar["); else - { - char buf[] = "$c"; - buf[1] = *cp; - complain_at (location, _("%s is invalid"), quote (buf)); - } + complain_at (location, _("%s is invalid"), quote (text)); } @@ -2840,7 +2837,8 @@ handle_dollar (braced_code_t braced_code_kind, break; case destructor_braced_code: - handle_destructor_dollar (text, location); + case printer_braced_code: + handle_symbol_code_dollar (text, location); break; } } @@ -2854,21 +2852,21 @@ handle_dollar (braced_code_t braced_code_kind, static inline void handle_action_at (char *text, location_t location) { + char *cp = text + 1; locations_flag = 1; - ++text; - if (*text == '$') + if (*cp == '$') { obstack_sgrow (&string_obstack, "]b4_lhs_location["); } - else if (isdigit (*text) || *text == '-') + else if (isdigit (*cp) || *cp == '-') { /* RULE_LENGTH is the number of values in the current rule so far, which says where to find `$0' with respect to the top of the stack. It is not the same as the rule->length in the case of mid rule actions. */ int rule_length = symbol_list_length (current_rule->next); - int n = strtol (text, &text, 10); + int n = strtol (cp, &cp, 10); if (n > rule_length) complain_at (location, _("invalid value: %s%d"), "@", n); @@ -2878,31 +2876,24 @@ handle_action_at (char *text, location_t location) } else { - char buf[] = "@c"; - buf[1] = *text; - complain_at (location, _("%s is invalid"), quote (buf)); + complain_at (location, _("%s is invalid"), quote (text)); } } -/*--------------------------------------------. -| TEXT is expexted tp be @$ in a destructor. | -`--------------------------------------------*/ +/*---------------------------------------------------------------. +| TEXT is expexted tp be @$ in some code associated to a symbol: | +| destructor or printer. | +`---------------------------------------------------------------*/ static inline void -handle_destructor_at (char *text, location_t location) +handle_symbol_code_at (char *text, location_t location) { - ++text; - if (*text == '$') - { - obstack_sgrow (&string_obstack, "]b4_at_dollar["); - } + char *cp = text + 1; + if (*cp == '$') + obstack_sgrow (&string_obstack, "]b4_at_dollar["); else - { - char buf[] = "$c"; - buf[1] = *text; - complain_at (location, _("%s is invalid"), quote (buf)); - } + complain_at (location, _("%s is invalid"), quote (text)); } @@ -2922,7 +2913,8 @@ handle_at (braced_code_t braced_code_kind, break; case destructor_braced_code: - handle_destructor_at (text, location); + case printer_braced_code: + handle_symbol_code_at (text, location); break; } } diff --git a/src/scan-gram.l b/src/scan-gram.l index 462be23..d1299c5 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -136,6 +136,7 @@ blanks [ \t\f]+ "%nterm" return PERCENT_NTERM; "%output" return PERCENT_OUTPUT; "%prec" return PERCENT_PREC; + "%printer" return PERCENT_PRINTER; "%pure"[-_]"parser" return PERCENT_PURE_PARSER; "%right" return PERCENT_RIGHT; "%skeleton" return PERCENT_SKELETON; @@ -524,7 +525,7 @@ blanks [ \t\f]+ %% /*------------------------------------------------------------------. -| CP is pointing to a wannabee semantic value (i.e., a `$'). | +| TEXT is pointing to a wannabee semantic value (i.e., a `$'). | | | | Possible inputs: $[]($|integer) | | | @@ -532,11 +533,10 @@ blanks [ \t\f]+ `------------------------------------------------------------------*/ static inline void -handle_action_dollar (char *cp, location_t location) +handle_action_dollar (char *text, location_t location) { const char *type_name = NULL; - - ++cp; + char *cp = text + 1; /* Get the type name if explicit. */ if (*cp == '<') @@ -588,31 +588,24 @@ handle_action_dollar (char *cp, location_t location) } else { - char buf[] = "$c"; - buf[1] = *cp; - complain_at (location, _("%s is invalid"), quote (buf)); + complain_at (location, _("%s is invalid"), quote (text)); } } -/*---------------------------------------. -| CP is pointing to $$ in a destructor. | -`---------------------------------------*/ +/*---------------------------------------------------------------. +| TEXT is expexted tp be $$ in some code associated to a symbol: | +| destructor or printer. | +`---------------------------------------------------------------*/ static inline void -handle_destructor_dollar (char *cp, location_t location) +handle_symbol_code_dollar (char *text, location_t location) { - ++cp; + char *cp = text + 1; if (*cp == '$') - { - obstack_sgrow (&string_obstack, "]b4_dollar_dollar["); - } + obstack_sgrow (&string_obstack, "]b4_dollar_dollar["); else - { - char buf[] = "$c"; - buf[1] = *cp; - complain_at (location, _("%s is invalid"), quote (buf)); - } + complain_at (location, _("%s is invalid"), quote (text)); } @@ -632,7 +625,8 @@ handle_dollar (braced_code_t braced_code_kind, break; case destructor_braced_code: - handle_destructor_dollar (text, location); + case printer_braced_code: + handle_symbol_code_dollar (text, location); break; } } @@ -646,21 +640,21 @@ handle_dollar (braced_code_t braced_code_kind, static inline void handle_action_at (char *text, location_t location) { + char *cp = text + 1; locations_flag = 1; - ++text; - if (*text == '$') + if (*cp == '$') { obstack_sgrow (&string_obstack, "]b4_lhs_location["); } - else if (isdigit (*text) || *text == '-') + else if (isdigit (*cp) || *cp == '-') { /* RULE_LENGTH is the number of values in the current rule so far, which says where to find `$0' with respect to the top of the stack. It is not the same as the rule->length in the case of mid rule actions. */ int rule_length = symbol_list_length (current_rule->next); - int n = strtol (text, &text, 10); + int n = strtol (cp, &cp, 10); if (n > rule_length) complain_at (location, _("invalid value: %s%d"), "@", n); @@ -670,31 +664,24 @@ handle_action_at (char *text, location_t location) } else { - char buf[] = "@c"; - buf[1] = *text; - complain_at (location, _("%s is invalid"), quote (buf)); + complain_at (location, _("%s is invalid"), quote (text)); } } -/*--------------------------------------------. -| TEXT is expexted tp be @$ in a destructor. | -`--------------------------------------------*/ +/*---------------------------------------------------------------. +| TEXT is expexted tp be @$ in some code associated to a symbol: | +| destructor or printer. | +`---------------------------------------------------------------*/ static inline void -handle_destructor_at (char *text, location_t location) +handle_symbol_code_at (char *text, location_t location) { - ++text; - if (*text == '$') - { - obstack_sgrow (&string_obstack, "]b4_at_dollar["); - } + char *cp = text + 1; + if (*cp == '$') + obstack_sgrow (&string_obstack, "]b4_at_dollar["); else - { - char buf[] = "$c"; - buf[1] = *text; - complain_at (location, _("%s is invalid"), quote (buf)); - } + complain_at (location, _("%s is invalid"), quote (text)); } @@ -714,7 +701,8 @@ handle_at (braced_code_t braced_code_kind, break; case destructor_braced_code: - handle_destructor_at (text, location); + case printer_braced_code: + handle_symbol_code_at (text, location); break; } } diff --git a/src/symtab.c b/src/symtab.c index 655b8fa..57bb796 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -118,8 +118,7 @@ symbol_type_set (symbol_t *symbol, location_t location, char *type_name) /*-------------------------------------------------------------------. -| Set the DESTRUCTOR associated to SYMBOL. Does nothing if passed 0 | -| as DESTRUCTOR. | +| Set the DESTRUCTOR associated to SYMBOL. Do nothing if passed 0. | `-------------------------------------------------------------------*/ void @@ -129,14 +128,33 @@ symbol_destructor_set (symbol_t *symbol, location_t location, char *destructor) { if (symbol->destructor) complain_at (location, - _("destructor redeclaration for %s"), - symbol_tag_get (symbol)); + _("%s redeclaration for %s"), + "%destructor", symbol_tag_get (symbol)); symbol->destructor = destructor; symbol->destructor_location = location; } } +/*----------------------------------------------------------------. +| Set the PRITNER associated to SYMBOL. Do nothing if passed 0. | +`----------------------------------------------------------------*/ + +void +symbol_printer_set (symbol_t *symbol, char *printer, location_t location) +{ + if (printer) + { + if (symbol->printer) + complain_at (location, + _("%s redeclaration for %s"), + "%printer", symbol_tag_get (symbol)); + symbol->printer = printer; + symbol->printer_location = location; + } +} + + /*------------------------------------------------------------------. | Set the PRECEDENCE associated to SYMBOL. Does nothing if invoked | | with UNDEF_ASSOC as ASSOC. | diff --git a/src/symtab.h b/src/symtab.h index b7cf6be..f5aed39 100644 --- a/src/symtab.h +++ b/src/symtab.h @@ -59,11 +59,12 @@ struct symbol_s /* The location of its first occurence. */ location_t location; - /* Its %type and associated destructor. */ + /* Its %type and associated printer and destructor. */ char *type_name; char *destructor; location_t destructor_location; - + char *printer; + location_t printer_location; symbol_number_t number; short prec; @@ -116,6 +117,10 @@ void symbol_type_set PARAMS ((symbol_t *symbol, location_t location, void symbol_destructor_set PARAMS ((symbol_t *symbol, location_t location, char *destructor)); +/* Set the PRINTER associated to SYMBOL. */ +void symbol_printer_set PARAMS ((symbol_t *symbol, + char *printer, location_t location)); + /* Set the PRECEDENCE associated to SYMBOL. Ensures that SYMBOL is a terminal. Does nothing if invoked with UNDEF_ASSOC as ASSOC. */ void symbol_precedence_set PARAMS ((symbol_t *symbol, location_t location, diff --git a/tests/calc.at b/tests/calc.at index 3b2e137..ec19d90 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -415,40 +415,34 @@ _AT_CHECK_CALC([$1], (2^2)^3 = 64], [486]) # Some parse errors. -_AT_CHECK_CALC_ERROR([$1], [0 0], [12], +_AT_CHECK_CALC_ERROR([$1], [0 0], [11], [1.3-1.4: parse error, unexpected "number"]) -_AT_CHECK_CALC_ERROR([$1], [1//2], [17], +_AT_CHECK_CALC_ERROR([$1], [1//2], [15], [1.3-1.4: parse error, unexpected '/', expecting "number" or '-' or '(']) _AT_CHECK_CALC_ERROR([$1], [error], [4], [1.1-1.2: parse error, unexpected $undefined., expecting "number" or '-' or '\n' or '(']) -_AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3], [25], +_AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3], [22], [1.7-1.8: parse error, unexpected '=']) _AT_CHECK_CALC_ERROR([$1], [ +1], - [15], + [14], [2.1-2.2: parse error, unexpected '+']) # Exercise error messages with EOF: work on an empty file. -_AT_CHECK_CALC_ERROR([$1], - [/dev/null], - [4], +_AT_CHECK_CALC_ERROR([$1], [/dev/null], [4], [1.1-1.2: parse error, unexpected "end of file", expecting "number" or '-' or '\n' or '(']) # Exercise the error token: without it, we die at the first error, # hence be sure i. to have several errors, ii. to test the action # associated to `error'. -_AT_CHECK_CALC_ERROR([$1], - [(1 ++ 2) + (0 0) = 1], - [91], +_AT_CHECK_CALC_ERROR([$1], [(1 ++ 2) + (0 0) = 1], [82], [1.5-1.6: parse error, unexpected '+', expecting "number" or '-' or '(' 1.15-1.16: parse error, unexpected "number" calc: error: 0 != 1]) # Add a studid example demonstrating that Bison can further improve the # error message. FIXME: Fix this ridiculous message. -_AT_CHECK_CALC_ERROR([$1], - [()], - [21], +_AT_CHECK_CALC_ERROR([$1], [()], [21], [1.2-1.3: parse error, unexpected ')', expecting error or "number" or '-' or '(']) AT_CLEANUP diff --git a/tests/torture.at b/tests/torture.at index f536e4b..747201c 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -371,9 +371,6 @@ AT_DATA([input.y], ]$1[ static int yylex (void); static void yyerror (const char *msg); -#define YYPRINT(File, Type, Value) \ - fprintf (File, " (%d, stack size = %d, max = %d)", \ - Value, yyssp - yyss + 1, yystacksize); %} %error-verbose %debug