diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2020-04-15 08:34:48 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2020-04-16 07:35:06 +0200 |
commit | caadfc552b5549e6c1e59568a408ddb73a940533 (patch) | |
tree | 726adbb718dfd41d3d5c76d9103399519ee8996b | |
parent | c4c25e091cf5a3fded4c58d0e4918b6e750be305 (diff) | |
download | bison-caadfc552b5549e6c1e59568a408ddb73a940533.tar.gz |
skeletons: use symbol(-2, kind)
Not all the symbols have a fixed symbol code. UNDEF's one is fixed:
-2.
* data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/lalr1.d,
* data/skeletons/yacc.c: here.
-rw-r--r-- | data/skeletons/glr.c | 6 | ||||
-rw-r--r-- | data/skeletons/lalr1.cc | 6 | ||||
-rw-r--r-- | data/skeletons/lalr1.d | 6 | ||||
-rw-r--r-- | data/skeletons/yacc.c | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c index 0f2336ef..cd72f69b 100644 --- a/data/skeletons/glr.c +++ b/data/skeletons/glr.c @@ -2132,7 +2132,7 @@ static yysymbol_kind_t yypcontext_token (const yyGLRStack *yystackp) { YYUSE (yystackp); - yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol_prefix[YYEMPTY : YYTRANSLATE (yychar); + yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar); return yytoken; } @@ -2151,7 +2151,7 @@ yypcontext_location (const yyGLRStack *yystackp) yy_syntax_error_arguments (const yyGLRStack* yystackp, yysymbol_kind_t yyarg[], int yyargn) { - yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol_prefix[YYEMPTY : YYTRANSLATE (yychar); + yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar); /* Actual size of YYARG. */ int yycount = 0; /* There are many possibilities here to consider: @@ -2182,7 +2182,7 @@ yy_syntax_error_arguments (const yyGLRStack* yystackp, one exception: it will still contain any token that will not be accepted due to an error action in a later state.]])[ */ - if (yytoken != ]b4_symbol_prefix[YYEMPTY) + if (yytoken != ]b4_symbol(-2, kind)[) { int yyn; if (yyarg) diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc index 587c280f..e9ad255c 100644 --- a/data/skeletons/lalr1.cc +++ b/data/skeletons/lalr1.cc @@ -377,7 +377,7 @@ m4_define([b4_shared_declarations], void move (by_state& that); /// The symbol kind (corresponding to \a state). - /// \a ]b4_symbol_prefix[YYEMPTY when empty. + /// \a ]b4_symbol(-2, kind)[ when empty. symbol_kind_type type_get () const YY_NOEXCEPT; /// The state number used to denote an empty symbol. @@ -700,7 +700,7 @@ b4_parse_error_case([verbose], [[ ]b4_parser_class[::by_state::type_get () const YY_NOEXCEPT { if (state == empty_state) - return symbol_kind::]b4_symbol_prefix[YYEMPTY; + return symbol_kind::]b4_symbol(-2, kind)[; else return YY_CAST (symbol_kind_type, yystos_[+state]); } @@ -725,7 +725,7 @@ b4_parse_error_case([verbose], [[ b4_symbol_variant([that.type_get ()], [value], [move], [YY_MOVE (that.value)])])[ // that is emptied. - that.type = symbol_kind::]b4_symbol_prefix[YYEMPTY; + that.type = symbol_kind::]b4_symbol(-2, kind)[; } #if YY_CPLUSPLUS < 201103L diff --git a/data/skeletons/lalr1.d b/data/skeletons/lalr1.d index a61b683d..01257411 100644 --- a/data/skeletons/lalr1.d +++ b/data/skeletons/lalr1.d @@ -430,7 +430,7 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[) { /// Lookahead and lookahead in internal form. int yychar = TokenKind.YYEMPTY; - SymbolKind yytoken = SymbolKind.]b4_symbol_prefix[YYEMPTY; + SymbolKind yytoken = SymbolKind.]b4_symbol(-2, kind)[; /* State. */ int yyn = 0; @@ -574,7 +574,7 @@ m4_popdef([b4_at_dollar])])dnl { ++yynerrs_; if (yychar == TokenKind.YYEMPTY) - yytoken = SymbolKind.]b4_symbol_prefix[YYEMPTY; + yytoken = SymbolKind.]b4_symbol(-2, kind)[; yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken)); } @@ -712,7 +712,7 @@ m4_popdef([b4_at_dollar])])dnl will still contain any token that will not be accepted due to an error action in a later state. */ - if (tok != SymbolKind.]b4_symbol_prefix[YYEMPTY) + if (tok != SymbolKind.]b4_symbol(-2, kind)[) { // FIXME: This method of building the message is not compatible // with internationalization. diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c index 5225dd69..77794f72 100644 --- a/data/skeletons/yacc.c +++ b/data/skeletons/yacc.c @@ -1351,7 +1351,7 @@ yy_syntax_error_arguments (const yypcontext_t *yyctx, one exception: it will still contain any token that will not be accepted due to an error action in a later state.]])[ */ - if (yyctx->yytoken != ]b4_symbol_prefix[YYEMPTY) + if (yyctx->yytoken != ]b4_symbol(-2, kind)[) { int yyn;]b4_lac_if([[ YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[ @@ -1582,7 +1582,7 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])[ /* The return value of yyparse. */ int yyresult; /* Lookahead token as an internal (translated) token number. */ - yysymbol_kind_t yytoken = ]b4_symbol_prefix[YYEMPTY; + yysymbol_kind_t yytoken = ]b4_symbol(-2, kind)[; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval;]b4_locations_if([[ @@ -1895,7 +1895,7 @@ yyreduce: yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol_prefix[YYEMPTY : YYTRANSLATE (yychar); + yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { |