* src/parse-gram.y (YYLLOC_DEFAULT, current_lhs_location): New.

(input): Don't try to initialize yylloc here, do it in the
scanner.
* src/scan-gram.l (YY_USER_INIT): Initialize yylloc.
* src/gram.h (rule_t): Change line and action_line into location
and action_location, of location_t type.
Adjust all dependencies.
* src/location.h, src/location.c (empty_location): New.
* src/reader.h, src/reader.c (grammar_start_symbol_set)
(grammar_symbol_append, grammar_rule_begin, grammar_rule_end)
(grammar_current_rule_symbol_append)
(grammar_current_rule_action_append): Expect a location as argument.
* src/reader.c (grammar_midrule_action): Adjust to attach an
action's location as dummy symbol location.
* src/symtab.h, src/symtab.c (startsymbol_location): New.
* tests/regression.at (Web2c Report, Rule Line Numbers): Adjust
the line numbers.
This commit is contained in:
Akim Demaille
2002-06-15 18:21:11 +00:00
parent 4f6bb8b24b
commit 8efe435c05
28 changed files with 699 additions and 603 deletions

View File

@@ -31,6 +31,13 @@
#include "reader.h"
/* Each time we match a string, move the end cursor to its end. */
#define YY_USER_INIT \
do { \
LOCATION_RESET (*yylloc); \
/* This is only to avoid GCC warnings. */ \
if (yycontrol) {;}; \
} while (0)
#define YY_USER_ACTION LOCATION_COLUMNS (*yylloc, yyleng)
#define YY_LINES LOCATION_LINES (*yylloc, yyleng); lineno += yyleng;
#define YY_STEP LOCATION_STEP (*yylloc)
@@ -69,9 +76,6 @@ scanner_last_string_free (void)
}
/* This is only to avoid GCC warnings. */
#define YY_USER_INIT if (yycontrol) {;};
static int braces_level = 0;
static int percent_percent_count = 0;
@@ -96,7 +100,7 @@ blanks [ \t\f]+
start of the next token. */
#define TR_POS 0
#if TR_POS
fprintf (stderr, "FOO1: ");
fprintf (stderr, "FOO1: %p: ", yylloc);
LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, "\n");
#endif