1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Syntax: quote(
bf(%token) tt(terminal token(s)) nl()
bf(%token) [ <type> ] tt(terminal token(s))
)
The bf(%token) directive is used to define one or more symbolic terminal
tokens. When multiple tokens are listed they must be separated by whitespace
or by commas.
The tt(<type>) specification is optional, and specifies the type of the
semantic value when receiving one of the subsequently named tokens is
received. The pointed arrows are part of the type specification; the type
itself must be a field of a tt(%union) specification (see section ref(UNION))
or a tag defined at the tt(%polymorphic) directive (see section
ref(POLYMORPHIC)).
b() traditionally converted symbolic tokens (including those defined
by the precedence directives (cf. section ref(PRECEDENCE))) into
tt(Parser::Tokens_) enumeration values (see section ref(PARSERCLASS)),
allowing the lexical scanner to return named tokens as
tt(Parser::name). Although this approach is still available, it is deprecated
as of b()'s version 6.04.00. Starting with that version the tt(token-path)
option or directive should be used, by default defining the symbolic tokens in
the class tt(Tokens), made available in a separate file which can be included
by any class needing access to the grammar's symbolic tokens (cf. section
ref(TOKENPATH)).
|