X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/02650b7f0e3ef470a949768bdb907183da4b3beb..04c12cb83d8ec86f5061e436424fcdc4dcc42071:/src/scan-gram.l diff --git a/src/scan-gram.l b/src/scan-gram.l index 5cf5a28c..cf704c77 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -87,8 +87,11 @@ static size_t no_cr_read (FILE *, char *, size_t); static struct obstack obstack_for_string; /* A string representing the most recently saved token. */ -static char *last_string; +char *last_string; +/* The location of the most recently saved token, if it was a + BRACED_CODE token; otherwise, this has an unspecified value. */ +location last_braced_code_loc; #define STRING_GROW \ obstack_grow (&obstack_for_string, yytext, yyleng) @@ -289,6 +292,8 @@ splice (\\[ \f\t\v]*\n)* /* Code in between braces. */ "{" { + if (current_rule && current_rule->action) + grammar_midrule_action (); STRING_GROW; token_type = BRACED_CODE; braces_level = 0; @@ -618,6 +623,7 @@ splice (\\[ \f\t\v]*\n)* loc->start = code_start; val->chars = last_string; increment_rule_length (*loc); + last_braced_code_loc = *loc; BEGIN INITIAL; return token_type; } @@ -752,12 +758,13 @@ adjust_location (location *loc, char const *token, size_t size) break; case '\t': - { - column = add_column_width (column, p0, p - p0); - column = add_column_width (column, NULL, 8 - ((column - 1) & 7)); - p0 = p + 1; - break; - } + column = add_column_width (column, p0, p - p0); + column = add_column_width (column, NULL, 8 - ((column - 1) & 7)); + p0 = p + 1; + break; + + default: + break; } scanner_cursor.line = line;