mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 07:43:03 +00:00
symbols: improve symbol aliasing
Rather than having duplicate info in the symbol and the alias that has to be resolved later on, both the symbol and the alias have a common pointer to a separate structure containing this info. * src/symtab.h (sym_content): New structure. * src/symtab.c (sym_content_new, sym_content_free, symbol_free): New * src/AnnotationList.c, src/conflicts.c, src/gram.c, src/gram.h, * src/graphviz.c, src/ielr.c, src/output.c, src/parse-gram.y, src/print.c * src/print-xml.c, src/print_graph.c, src/reader.c, src/reduce.c, * src/state.h, src/symlist.c, src/symtab.c, src/symtab.h, src/tables.c: Adjust. * tests/input.at: Fix expectations (order changes).
This commit is contained in:
committed by
Akim Demaille
parent
c4aa4ff541
commit
a728075710
21
src/symtab.h
21
src/symtab.h
@@ -50,6 +50,7 @@ typedef int symbol_number;
|
||||
|
||||
|
||||
typedef struct symbol symbol;
|
||||
typedef struct sym_content sym_content;
|
||||
|
||||
/* Declaration status of a symbol.
|
||||
|
||||
@@ -82,8 +83,6 @@ enum code_props_type
|
||||
|
||||
enum { CODE_PROPS_SIZE = 2 };
|
||||
|
||||
/* When extending this structure, be sure to complete
|
||||
symbol_check_alias_consistency. */
|
||||
struct symbol
|
||||
{
|
||||
/** The key, name of the symbol. */
|
||||
@@ -91,6 +90,20 @@ struct symbol
|
||||
/** The location of its first occurrence. */
|
||||
location location;
|
||||
|
||||
/* Points to the other in the symbol-string pair for an alias. */
|
||||
symbol *alias;
|
||||
|
||||
/** Whether this symbol is the alias of another or not. */
|
||||
bool is_alias;
|
||||
|
||||
/** All the info about the pointed symbol is there. */
|
||||
sym_content *content;
|
||||
};
|
||||
|
||||
struct sym_content
|
||||
{
|
||||
symbol *symbol;
|
||||
|
||||
/** Its \c \%type.
|
||||
|
||||
Beware that this is the type_name as was entered by the user,
|
||||
@@ -117,10 +130,6 @@ struct symbol
|
||||
assoc assoc;
|
||||
int user_token_number;
|
||||
|
||||
/* Points to the other in the symbol-string pair for an alias.
|
||||
Special value USER_NUMBER_HAS_STRING_ALIAS in the symbol half of the
|
||||
symbol-string pair for an alias. */
|
||||
symbol *alias;
|
||||
symbol_class class;
|
||||
status status;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user