X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/ddee1b066660d06c6c3bf0cf6f9884d79e6fee27..06f01bc4964795ec030c756e292f52b6f439a3d4:/data/glr.c?ds=sidebyside diff --git a/data/glr.c b/data/glr.c index 88103770..0c1faedd 100644 --- a/data/glr.c +++ b/data/glr.c @@ -171,7 +171,7 @@ m4_define([b4_shared_declarations], /* Copy the first part of user declarations. */ ]b4_pre_prologue[ -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED ]m4_ifdef([b4_stype], [typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ]) b4_stype @@ -183,7 +183,7 @@ b4_syncline([@oline@], [@ofile@]) # define YYSTYPE_IS_TRIVIAL 1 #endif -#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED) +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { ]b4_location_if([ @@ -253,7 +253,7 @@ b4_syncline([@oline@], [@ofile@]) #endif /* Suppress unused-variable warnings by "using" E. */ -#ifndef lint +#if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ @@ -302,7 +302,7 @@ b4_syncline([@oline@], [@ofile@]) #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if (!defined (__GNUC__) || __GNUC__ < 2 \ +# if (! defined __GNUC__ || __GNUC__ < 2 \ || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__) # define __attribute__(Spec) /* empty */ # endif @@ -563,9 +563,9 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG; #if YYDEBUG -#if ! defined (YYFPRINTF) +# ifndef YYFPRINTF # define YYFPRINTF fprintf -#endif +# endif # define YYDPRINTF(Args) \ do { \ @@ -621,9 +621,9 @@ int yydebug; #define YYHEADROOM 2 #ifndef YYSTACKEXPANDABLE -# if (! defined (__cplusplus) \ - || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \ - && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)) +# if (! defined __cplusplus \ + || (]b4_location_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)) # define YYSTACKEXPANDABLE 1 # else # define YYSTACKEXPANDABLE 0 @@ -648,7 +648,7 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in @@ -761,11 +761,11 @@ struct yyGLRState { struct yyGLRStateSet { yyGLRState** yystates; - /** During nondeterministic operation, yylookaheadStatuses tracks which + /** During nondeterministic operation, yylookaheadNeeds tracks which * stacks have actually needed the current lookahead. During deterministic - * operation, yylookaheadStatuses[0] is not maintained since it would merely + * operation, yylookaheadNeeds[0] is not maintained since it would merely * duplicate yychar != YYEMPTY. */ - yybool* yylookaheadStatuses; + yybool* yylookaheadNeeds; size_t yysize, yycapacity; }; @@ -1103,7 +1103,7 @@ yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState) /** Add a new semantic action that will execute the action for rule * RULENUM on the semantic values in RHS to the list of - * alternative actions for STATE. Assumes that RHS comes from + * alternative actions for STATE. Assumes that RHS comes from * stack #K of *STACKP. */ static void yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate, @@ -1113,7 +1113,7 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate, &yynewGLRStackItem (yystackp, yyfalse)->yyoption; yynewOption->yystate = rhs; yynewOption->yyrule = yyrule; - if (yystackp->yytops.yylookaheadStatuses[yyk]) + if (yystackp->yytops.yylookaheadNeeds[yyk]) { yynewOption->yyrawchar = yychar; yynewOption->yyval = yylval; @@ -1139,9 +1139,9 @@ yyinitStateSet (yyGLRStateSet* yyset) if (! yyset->yystates) return yyfalse; yyset->yystates[0] = NULL; - yyset->yylookaheadStatuses = - (yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadStatuses[0]); - if (! yyset->yylookaheadStatuses) + yyset->yylookaheadNeeds = + (yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]); + if (! yyset->yylookaheadNeeds) { YYFREE (yyset->yystates); return yyfalse; @@ -1152,7 +1152,7 @@ yyinitStateSet (yyGLRStateSet* yyset) static void yyfreeStateSet (yyGLRStateSet* yyset) { YYFREE (yyset->yystates); - YYFREE (yyset->yylookaheadStatuses); + YYFREE (yyset->yylookaheadNeeds); } /** Initialize STACK to a single empty stack, with total maximum @@ -1300,12 +1300,12 @@ yyremoveDeletes (yyGLRStack* yystackp) { yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi]; /* In the current implementation, it's unnecessary to copy - yystackp->yytops.yylookaheadStatuses[yyi] since, after + yystackp->yytops.yylookaheadNeeds[yyi] since, after yyremoveDeletes returns, the parser immediately either enters deterministic operation or shifts a token. However, it doesn't hurt, and the code might evolve to need it. */ - yystackp->yytops.yylookaheadStatuses[yyj] = - yystackp->yytops.yylookaheadStatuses[yyi]; + yystackp->yytops.yylookaheadNeeds[yyj] = + yystackp->yytops.yylookaheadNeeds[yyi]; if (yyj != yyi) { YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n", @@ -1533,10 +1533,10 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk) if (yystackp->yytops.yysize >= yystackp->yytops.yycapacity) { yyGLRState** yynewStates; - yybool* yynewLookaheadStatuses; + yybool* yynewLookaheadNeeds; yynewStates = NULL; - + if (yystackp->yytops.yycapacity > (YYSIZEMAX / (2 * sizeof yynewStates[0]))) yyMemoryExhausted (yystackp); @@ -1550,18 +1550,18 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk) yyMemoryExhausted (yystackp); yystackp->yytops.yystates = yynewStates; - yynewLookaheadStatuses = - (yybool*) YYREALLOC (yystackp->yytops.yylookaheadStatuses, + yynewLookaheadNeeds = + (yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds, (yystackp->yytops.yycapacity - * sizeof yynewLookaheadStatuses[0])); - if (yynewLookaheadStatuses == NULL) + * sizeof yynewLookaheadNeeds[0])); + if (yynewLookaheadNeeds == NULL) yyMemoryExhausted (yystackp); - yystackp->yytops.yylookaheadStatuses = yynewLookaheadStatuses; + yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds; } yystackp->yytops.yystates[yystackp->yytops.yysize] = yystackp->yytops.yystates[yyk]; - yystackp->yytops.yylookaheadStatuses[yystackp->yytops.yysize] - = yystackp->yytops.yylookaheadStatuses[yyk]; + yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize] + = yystackp->yytops.yylookaheadNeeds[yyk]; yystackp->yytops.yysize += 1; return yystackp->yytops.yysize-1; } @@ -1953,7 +1953,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk, } else { - yystackp->yytops.yylookaheadStatuses[yyk] = yytrue; + yystackp->yytops.yylookaheadNeeds[yyk] = yytrue; if (*yytokenp == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2318,7 +2318,7 @@ b4_syncline([@oline@], [@ofile@])])dnl size_t yyn = yystack.yytops.yysize; for (yys = 0; yys < yyn; yys += 1) - yystackp->yytops.yylookaheadStatuses[yys] = yychar != YYEMPTY; + yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY; /* yyprocessOneStack returns one of three things: