Debian Codegraph @

documentation/manual/directives/tokens.yo

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