mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
* 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:
17
src/gram.h
17
src/gram.h
@@ -97,17 +97,18 @@
|
||||
|
||||
Associativities are recorded similarly in SYMBOLS[I]->assoc. */
|
||||
|
||||
#include "symtab.h"
|
||||
# include "location.h"
|
||||
# include "symtab.h"
|
||||
|
||||
#define ISTOKEN(s) ((s) < ntokens)
|
||||
#define ISVAR(s) ((s) >= ntokens)
|
||||
# define ISTOKEN(s) ((s) < ntokens)
|
||||
# define ISVAR(s) ((s) >= ntokens)
|
||||
|
||||
extern int nrules;
|
||||
extern int nsyms;
|
||||
extern int ntokens;
|
||||
extern int nvars;
|
||||
|
||||
#define ITEM_NUMBER_MAX INT_MAX
|
||||
# define ITEM_NUMBER_MAX INT_MAX
|
||||
typedef int item_number_t;
|
||||
extern item_number_t *ritem;
|
||||
extern unsigned int nritems;
|
||||
@@ -118,8 +119,8 @@ extern unsigned int nritems;
|
||||
|
||||
Therefore, an symbol_number_t must be a valid item_number_t, and we
|
||||
sometimes have to perform the converse transformation. */
|
||||
#define symbol_number_as_item_number(Tok) ((item_number_t) (Tok))
|
||||
#define item_number_as_symbol_number(Ite) ((symbol_number_t) (Ite))
|
||||
# define symbol_number_as_item_number(Tok) ((item_number_t) (Tok))
|
||||
# define item_number_as_symbol_number(Ite) ((symbol_number_t) (Ite))
|
||||
|
||||
extern symbol_number_t start_symbol;
|
||||
|
||||
@@ -143,11 +144,11 @@ typedef struct rule_s
|
||||
/* This symbol was attached to the rule via %prec. */
|
||||
symbol_t *precsym;
|
||||
|
||||
int line;
|
||||
location_t location;
|
||||
bool useful;
|
||||
|
||||
const char *action;
|
||||
int action_line;
|
||||
location_t action_location;
|
||||
} rule_t;
|
||||
|
||||
extern struct rule_s *rules;
|
||||
|
||||
Reference in New Issue
Block a user