This commit is contained in:
Akim Demaille
2019-09-01 10:14:54 -05:00
parent 8ac28ba1f0
commit 569125a6bf
2 changed files with 105 additions and 130 deletions

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.4.1.72-9d4b. */
/* A Bison parser, made by GNU Bison 3.4.2.86-be13. */
/* Bison implementation for Yacc-like parsers in C
@@ -48,7 +48,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "3.4.1.72-9d4b"
#define YYBISON_VERSION "3.4.2.86-be13"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -179,6 +179,7 @@
/* Handle a %yacc directive. */
static void handle_yacc (location const *loc);
/* Implementation of yyerror. */
static void gram_error (location const *, char const *);
/* A string that describes a char (e.g., 'a' -> "'a'"). */
@@ -431,64 +432,25 @@ union yyalloc
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
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, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59
};
#define YYTRANSLATE(YYX) (YYX)
#if GRAM_DEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 294, 294, 303, 304, 308, 309, 315, 319, 324,
325, 330, 331, 332, 333, 334, 339, 344, 345, 346,
347, 348, 349, 349, 350, 351, 352, 353, 354, 355,
356, 357, 361, 362, 371, 372, 376, 387, 391, 395,
403, 413, 414, 424, 425, 431, 444, 444, 449, 449,
454, 458, 468, 469, 470, 471, 475, 476, 481, 482,
486, 487, 491, 492, 493, 506, 515, 519, 523, 531,
532, 536, 549, 550, 562, 566, 570, 578, 580, 585,
592, 602, 606, 610, 618, 619, 627, 628, 634, 635,
636, 643, 643, 651, 652, 653, 658, 661, 663, 665,
667, 669, 671, 673, 675, 677, 682, 683, 692, 716,
717, 718, 719, 731, 733, 748, 753, 754, 759, 768,
769, 773, 774
0, 296, 296, 305, 306, 310, 311, 317, 321, 326,
327, 332, 333, 334, 335, 336, 341, 346, 347, 348,
349, 350, 351, 351, 352, 353, 354, 355, 356, 357,
358, 359, 363, 364, 373, 374, 378, 389, 393, 397,
405, 415, 416, 426, 427, 433, 446, 446, 451, 451,
456, 460, 470, 471, 472, 473, 477, 478, 483, 484,
488, 489, 493, 494, 495, 508, 517, 521, 525, 533,
534, 538, 551, 552, 564, 568, 572, 580, 582, 587,
594, 604, 608, 612, 620, 621, 629, 630, 636, 637,
638, 645, 645, 653, 654, 655, 660, 663, 665, 667,
669, 671, 673, 675, 677, 679, 684, 685, 694, 718,
719, 720, 721, 733, 735, 762, 767, 768, 773, 782,
783, 787, 788
};
#endif
@@ -508,19 +470,20 @@ static const char *const yytname[] =
"\"%nondeterministic-parser\"", "\"%output\"", "\"%pure-parser\"",
"\"%require\"", "\"%skeleton\"", "\"%start\"", "\"%token-table\"",
"\"%verbose\"", "\"%yacc\"", "\"{...}\"", "\"%?{...}\"",
"\"[identifier]\"", "\"char\"", "\":\"", "\"epilogue\"", "\"=\"",
"\"identifier\"", "\"identifier:\"", "\"%%\"", "\"|\"", "\"%{...%}\"",
"\";\"", "\"<tag>\"", "\"<*>\"", "\"<>\"", "\"integer\"", "\"%param\"",
"\"%union\"", "\"%empty\"", "$accept", "input", "prologue_declarations",
"prologue_declaration", "$@1", "params", "grammar_declaration",
"code_props_type", "union_name", "symbol_declaration", "$@2", "$@3",
"precedence_declarator", "tag.opt", "generic_symlist",
"generic_symlist_item", "tag", "nterm_decls", "token_decls",
"token_decl.1", "token_decl", "int.opt", "token_decls_for_prec",
"token_decl_for_prec.1", "token_decl_for_prec", "symbol_decls",
"symbol_decl.1", "grammar", "rules_or_grammar_declaration", "rules",
"$@4", "rhses.1", "rhs", "named_ref.opt", "variable", "value", "id",
"id_colon", "symbol", "string_as_id", "string_as_id.opt", "epilogue.opt", YY_NULLPTR
"\"[identifier]\"", "\"character literal\"", "\":\"", "\"epilogue\"",
"\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"|\"",
"\"%{...%}\"", "\";\"", "\"<tag>\"", "\"<*>\"", "\"<>\"", "\"integer\"",
"\"%param\"", "\"%union\"", "\"%empty\"", "$accept", "input",
"prologue_declarations", "prologue_declaration", "$@1", "params",
"grammar_declaration", "code_props_type", "union_name",
"symbol_declaration", "$@2", "$@3", "precedence_declarator", "tag.opt",
"generic_symlist", "generic_symlist_item", "tag", "nterm_decls",
"token_decls", "token_decl.1", "token_decl", "int.opt",
"token_decls_for_prec", "token_decl_for_prec.1", "token_decl_for_prec",
"symbol_decls", "symbol_decl.1", "grammar",
"rules_or_grammar_declaration", "rules", "$@4", "rhses.1", "rhs",
"named_ref.opt", "variable", "value", "id", "id_colon", "symbol",
"string_as_id", "string_as_id.opt", "epilogue.opt", YY_NULLPTR
};
#endif
@@ -925,7 +888,7 @@ tron (yyo);
{ fprintf (yyo, "[%s]", ((*yyvaluep).BRACKETED_ID)); }
break;
case 43: /* "char" */
case 43: /* "character literal" */
{ fputs (char_name (((*yyvaluep).CHAR)), yyo); }
break;
@@ -2485,12 +2448,24 @@ yyreduce:
case 114:
{
const char *var = "api.token.raw";
if (current_class == nterm_sym)
{
gram_error (&(yylsp[0]),
_("character literals cannot be nonterminals"));
complain (&(yylsp[0]), complaint,
_("character literals cannot be nonterminals"));
YYERROR;
}
if (muscle_percent_define_ifdef (var))
{
unsigned indent = 0;
complain_indent (&(yylsp[0]), complaint, &indent,
_("character literals cannot be used together"
" with %s"), var);
indent += SUB_INDENT;
location loc = muscle_percent_define_get_loc (var);
complain_indent (&loc, complaint, &indent,
_("definition of %s"), var);
}
(yyval.id) = symbol_get (char_name ((yyvsp[0].CHAR)), (yylsp[0]));
symbol_class_set ((yyval.id), token_sym, (yylsp[0]), false);
symbol_user_token_number_set ((yyval.id), (yyvsp[0].CHAR), (yylsp[0]));

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.4.1.72-9d4b. */
/* A Bison parser, made by GNU Bison 3.4.2.86-be13. */
/* Bison interface for Yacc-like parsers in C
@@ -78,63 +78,63 @@ extern int gram_debug;
enum gram_tokentype
{
GRAM_EOF = 0,
STRING = 258,
PERCENT_TOKEN = 259,
PERCENT_NTERM = 260,
PERCENT_TYPE = 261,
PERCENT_DESTRUCTOR = 262,
PERCENT_PRINTER = 263,
PERCENT_LEFT = 264,
PERCENT_RIGHT = 265,
PERCENT_NONASSOC = 266,
PERCENT_PRECEDENCE = 267,
PERCENT_PREC = 268,
PERCENT_DPREC = 269,
PERCENT_MERGE = 270,
PERCENT_CODE = 271,
PERCENT_DEFAULT_PREC = 272,
PERCENT_DEFINE = 273,
PERCENT_DEFINES = 274,
PERCENT_ERROR_VERBOSE = 275,
PERCENT_EXPECT = 276,
PERCENT_EXPECT_RR = 277,
PERCENT_FLAG = 278,
PERCENT_FILE_PREFIX = 279,
PERCENT_GLR_PARSER = 280,
PERCENT_INITIAL_ACTION = 281,
PERCENT_LANGUAGE = 282,
PERCENT_NAME_PREFIX = 283,
PERCENT_NO_DEFAULT_PREC = 284,
PERCENT_NO_LINES = 285,
PERCENT_NONDETERMINISTIC_PARSER = 286,
PERCENT_OUTPUT = 287,
PERCENT_PURE_PARSER = 288,
PERCENT_REQUIRE = 289,
PERCENT_SKELETON = 290,
PERCENT_START = 291,
PERCENT_TOKEN_TABLE = 292,
PERCENT_VERBOSE = 293,
PERCENT_YACC = 294,
BRACED_CODE = 295,
BRACED_PREDICATE = 296,
BRACKETED_ID = 297,
CHAR = 298,
COLON = 299,
EPILOGUE = 300,
EQUAL = 301,
ID = 302,
ID_COLON = 303,
PERCENT_PERCENT = 304,
PIPE = 305,
PROLOGUE = 306,
SEMICOLON = 307,
TAG = 308,
TAG_ANY = 309,
TAG_NONE = 310,
INT = 311,
PERCENT_PARAM = 312,
PERCENT_UNION = 313,
PERCENT_EMPTY = 314
STRING = 3,
PERCENT_TOKEN = 4,
PERCENT_NTERM = 5,
PERCENT_TYPE = 6,
PERCENT_DESTRUCTOR = 7,
PERCENT_PRINTER = 8,
PERCENT_LEFT = 9,
PERCENT_RIGHT = 10,
PERCENT_NONASSOC = 11,
PERCENT_PRECEDENCE = 12,
PERCENT_PREC = 13,
PERCENT_DPREC = 14,
PERCENT_MERGE = 15,
PERCENT_CODE = 16,
PERCENT_DEFAULT_PREC = 17,
PERCENT_DEFINE = 18,
PERCENT_DEFINES = 19,
PERCENT_ERROR_VERBOSE = 20,
PERCENT_EXPECT = 21,
PERCENT_EXPECT_RR = 22,
PERCENT_FLAG = 23,
PERCENT_FILE_PREFIX = 24,
PERCENT_GLR_PARSER = 25,
PERCENT_INITIAL_ACTION = 26,
PERCENT_LANGUAGE = 27,
PERCENT_NAME_PREFIX = 28,
PERCENT_NO_DEFAULT_PREC = 29,
PERCENT_NO_LINES = 30,
PERCENT_NONDETERMINISTIC_PARSER = 31,
PERCENT_OUTPUT = 32,
PERCENT_PURE_PARSER = 33,
PERCENT_REQUIRE = 34,
PERCENT_SKELETON = 35,
PERCENT_START = 36,
PERCENT_TOKEN_TABLE = 37,
PERCENT_VERBOSE = 38,
PERCENT_YACC = 39,
BRACED_CODE = 40,
BRACED_PREDICATE = 41,
BRACKETED_ID = 42,
CHAR = 43,
COLON = 44,
EPILOGUE = 45,
EQUAL = 46,
ID = 47,
ID_COLON = 48,
PERCENT_PERCENT = 49,
PIPE = 50,
PROLOGUE = 51,
SEMICOLON = 52,
TAG = 53,
TAG_ANY = 54,
TAG_NONE = 55,
INT = 56,
PERCENT_PARAM = 57,
PERCENT_UNION = 58,
PERCENT_EMPTY = 59
};
#endif
@@ -221,7 +221,7 @@ union GRAM_STYPE
uniqstr tag;
/* variable */
uniqstr variable;
/* "char" */
/* "character literal" */
unsigned char CHAR;
/* value */
value_type value;