** yacc.c: YYBACKUP works as expected.
-** glr.c: __attribute__ is preserved:
+** glr.c improvements:
+
+*** Location support is eliminated when not requested:
+
+ GLR parsers used to include location-related code even when
+ locations were not requested, and therefore not even usable.
+
+*** __attribute__ is preserved:
__attribute__ is no longer disabled when __STRICT_ANSI__ is defined
(i.e., when -std is passed to GCC).
[[typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1]])])[
#endif
-
+]b4_locations_if([[
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE
{
-]b4_locations_if([
int first_line;
int first_column;
int last_line;
int last_column;
-],[
- char yydummy;
-])[
} YYLTYPE;
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
-
+]])[
]b4_percent_code_get([[provides]])[]dnl
])
#define b4_prefix[]char yychar
#define b4_prefix[]lval yylval
#define b4_prefix[]lloc yylloc])],
-[YYSTYPE yylval;
-
-YYLTYPE yylloc;
+[YYSTYPE yylval;]b4_locations_if([[
+YYLTYPE yylloc;]])[
int yynerrs;
int yychar;])[
yySemanticOption* yyfirstVal;
/** Semantic value for this state. */
YYSTYPE yysval;
- } yysemantics;
+ } yysemantics;]b4_locations_if([[
/** Source location for this state. */
- YYLTYPE yyloc;
+ YYLTYPE yyloc;]])[
};
struct yyGLRStateSet {
yyGLRState* yystate;
/** The lookahead for this reduction. */
int yyrawchar;
- YYSTYPE yyval;
- YYLTYPE yyloc;
+ YYSTYPE yyval;]b4_locations_if([[
+ YYLTYPE yyloc;]])[
/** Next sibling in chain of options. To facilitate merging,
* options are chained in decreasing order by address. */
yySemanticOption* yynext;
[
int yyerrcnt;
int yyrawchar;
- YYSTYPE yyval;
- YYLTYPE yyloc;
+ YYSTYPE yyval;]b4_locations_if([[
+ YYLTYPE yyloc;]])[
])[
YYJMP_BUF yyexception_buffer;
yyGLRStackItem* yyitems;
{
YYASSERT (s->yyresolved);
yyvsp[i].yystate.yyresolved = yytrue;
- yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;
- yyvsp[i].yystate.yyloc = s->yyloc;
+ yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;]b4_locations_if([[
+ yyvsp[i].yystate.yyloc = s->yyloc;]])[
s = yyvsp[i].yystate.yypred = s->yypred;
}
}