mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
kinds: also define the possibly qualified symbol kinds
* data/skeletons/bison.m4 (b4_symbol_kind): Rename as... (b4_symbol_kind_base): this. (b4_symbol_kind): New, for fully qualified kind name. * data/skeletons/lalr1.cc (b4_symbol_kind): New. Adjust to use b4_symbol_kind where appropriate. * src/parse-gram.h, src/parse-gram.c: regen.
This commit is contained in:
@@ -84,19 +84,20 @@ field), where field can `has_id`, `id`, etc.: see
|
||||
The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
|
||||
|
||||
- `has_id`: 0 or 1
|
||||
Whether the symbol has an id.
|
||||
Whether the symbol has an `id`.
|
||||
|
||||
- `id`: string
|
||||
If has_id, the id (prefixed by api.token.prefix if defined), otherwise
|
||||
defined as empty. Guaranteed to be usable as a C identifier. This is
|
||||
used to define the token kind (i.e., the enum used by the return value of
|
||||
yylex).
|
||||
If `has_id`, the name of the token kind (prefixed by api.token.prefix if
|
||||
defined), otherwise empty. Guaranteed to be usable as a C identifier.
|
||||
This is used to define the token kind (i.e., the enum used by the return
|
||||
value of yylex). Should be named `token_kind`.
|
||||
|
||||
- `tag`: string
|
||||
A human representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
||||
A human readable representation of the symbol. Can be `'foo'`,
|
||||
`'foo.id'`, `'"foo"'` etc.
|
||||
|
||||
- `code`: integer
|
||||
The token code associated to the `id`.
|
||||
The token code associated to the token kind `id`.
|
||||
The external number as used by yylex. Can be ASCII code when a character,
|
||||
some number chosen by bison, or some user number in the case of `%token
|
||||
FOO <NUM>`. Corresponds to `yychar` in `yacc.c`.
|
||||
@@ -104,9 +105,14 @@ The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
|
||||
- `is_token`: 0 or 1
|
||||
Whether this is a terminal symbol.
|
||||
|
||||
- `kind_base`: string
|
||||
The base of the symbol kind, i.e., the enumerator of this symbol (token or
|
||||
nonterminal) which is mapping to its `number`.
|
||||
|
||||
- `kind`: string
|
||||
The symbol kind, i.e., the enumerator of this symbol (token or nonterminal)
|
||||
which is mapping to its `number`.
|
||||
Same as `kind_base`, but possibly with a prefix in some languages. E.g.,
|
||||
EOF's `kind_base` and `kind` are `YYSYMBOL_YYEOF` in C, but are
|
||||
`S_YYEMPTY` and `symbol_kind::S_YYEMPTY` in C++.
|
||||
|
||||
- `number`: integer
|
||||
The code associated to the `kind`.
|
||||
|
||||
Reference in New Issue
Block a user