X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/25005f6ab0c38e8106148648834389b787ad5877..39a06c251ad9c523b1172835e545d2043431873d:/src/scan-gram.l diff --git a/src/scan-gram.l b/src/scan-gram.l index 2e782317..a3275015 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -182,6 +182,7 @@ splice (\\[ \f\t\v]*\n)* { "%binary" return PERCENT_NONASSOC; "%debug" return PERCENT_DEBUG; + "%default"[-_]"prec" return PERCENT_DEFAULT_PREC; "%define" return PERCENT_DEFINE; "%defines" return PERCENT_DEFINES; "%destructor" token_type = PERCENT_DESTRUCTOR; BEGIN SC_PRE_CODE; @@ -190,6 +191,7 @@ splice (\\[ \f\t\v]*\n)* "%expect" return PERCENT_EXPECT; "%file-prefix" return PERCENT_FILE_PREFIX; "%fixed"[-_]"output"[-_]"files" return PERCENT_YACC; + "%initial-action" token_type = PERCENT_INITIAL_ACTION; BEGIN SC_PRE_CODE; "%glr-parser" return PERCENT_GLR_PARSER; "%left" return PERCENT_LEFT; "%lex-param" token_type = PERCENT_LEX_PARAM; BEGIN SC_PRE_CODE; @@ -649,8 +651,8 @@ splice (\\[ \f\t\v]*\n)* %% -/* Keeps track of the maximum number of semantic values to the left of - a handle (those referenced by $0, $-1, etc.) are required by the +/* Keeps track of the maximum number of semantic values to the left of + a handle (those referenced by $0, $-1, etc.) are required by the semantic actions of this grammar. */ int max_left_semantic_context = 0; @@ -807,10 +809,10 @@ handle_action_dollar (char *text, location loc) } -/*-----------------------------------------------------------------. -| Dispatch onto handle_action_dollar, or handle_destructor_dollar, | -| depending upon TOKEN_TYPE. | -`-----------------------------------------------------------------*/ +/*----------------------------------------------------------------. +| Map `$?' onto the proper M4 symbol, depending on its TOKEN_TYPE | +| (are we in an action?). | +`----------------------------------------------------------------*/ static void handle_dollar (int token_type, char *text, location loc) @@ -823,6 +825,7 @@ handle_dollar (int token_type, char *text, location loc) break; case PERCENT_DESTRUCTOR: + case PERCENT_INITIAL_ACTION: case PERCENT_PRINTER: if (text[1] == '$') { @@ -875,10 +878,10 @@ handle_action_at (char *text, location loc) } -/*-------------------------------------------------------------------. -| Dispatch onto handle_action_at, or handle_destructor_at, depending | -| upon CODE_KIND. | -`-------------------------------------------------------------------*/ +/*----------------------------------------------------------------. +| Map `@?' onto the proper M4 symbol, depending on its TOKEN_TYPE | +| (are we in an action?). | +`----------------------------------------------------------------*/ static void handle_at (int token_type, char *text, location loc) @@ -889,6 +892,7 @@ handle_at (int token_type, char *text, location loc) handle_action_at (text, loc); return; + case PERCENT_INITIAL_ACTION: case PERCENT_DESTRUCTOR: case PERCENT_PRINTER: if (text[1] == '$')