41 |
nterm_sym /* non-terminal */ |
nterm_sym /* non-terminal */ |
42 |
} symbol_class; |
} symbol_class; |
43 |
|
|
44 |
|
|
45 |
/* Internal token numbers. */ |
/* Internal token numbers. */ |
46 |
typedef short token_number_t; |
typedef short token_number_t; |
47 |
|
|
|
#define SUNDEF -1 /* For undefined user number. */ |
|
|
#define SALIAS -9991 /* for symbol generated with an alias */ |
|
|
|
|
|
#define NUMBER_UNDEFINED ((token_number_t) -1) |
|
48 |
|
|
49 |
|
typedef struct symbol_s symbol_t; |
50 |
struct symbol_s |
struct symbol_s |
51 |
{ |
{ |
52 |
/* The key, name of the symbol. */ |
/* The key, name of the symbol. */ |
59 |
associativity assoc; |
associativity assoc; |
60 |
int user_token_number; |
int user_token_number; |
61 |
|
|
62 |
/* Points to the other in the identifier-symbol pair for an |
/* Points to the other in the identifier-symbol pair for an alias. |
63 |
alias. Special value SALIAS in the identifier half of the |
Special value USER_NUMBER_ALIAS in the identifier half of the |
64 |
identifier-symbol pair for an alias. */ |
identifier-symbol pair for an alias. */ |
65 |
struct symbol_s *alias; |
symbol_t *alias; |
66 |
symbol_class class; |
symbol_class class; |
67 |
}; |
}; |
68 |
|
|
69 |
typedef struct symbol_s symbol_t; |
/* Undefined user number. */ |
70 |
|
#define USER_NUMBER_UNDEFINED -1 |
71 |
|
|
72 |
|
/* `symbol->user_token_number == USER_NUMBER_ALIAS' means this symbol |
73 |
|
*has* (not is) a string literal alias. For instance, `%token foo |
74 |
|
"foo"' has `"foo"' numbered regularly, and `foo' numbered as |
75 |
|
USER_NUMBER_ALIAS. */ |
76 |
|
#define USER_NUMBER_ALIAS -9991 |
77 |
|
|
78 |
|
/* Undefined internal token number. */ |
79 |
|
#define NUMBER_UNDEFINED ((token_number_t) -1) |
80 |
|
|
81 |
|
|
82 |
/* A function to apply to each symbol. */ |
/* A function to apply to each symbol. */ |
83 |
typedef bool (*symbol_processor) PARAMS ((symbol_t *)); |
typedef bool (*symbol_processor) PARAMS ((symbol_t *)); |