Debian Codegraph @

documentation/manual/directives/stype.yo

raw
1 Syntax: bf(%stype typename) nl()
2
3 This directive defines the type of the semantic value of tokens. The
4 specified type must be a default constructible type, like tt(size_t) or
5 tt(std::string). By default, b() uses tt(int) for the semantic value type of
6 its parser's tokens. To use another single semantic value type , this
7 directive must be used.
8
9 In programs using a simple grammar it may be sufficient to use the same data
10 type for the semantic values of all language constructs (see, e.g., sections
11 ref(RPN) and ref(CALC)).
12
13 Any text following tt(%stype) up to the end of the line, up to the first
14 of a series of trailing blanks or tabs or up to a comment-token (tt(//) or
15 tt(/*)) becomes part of the type definition. Be sure em(not) to end a
16 tt(%stype) definition in a semicolon.
17
18 tt(%stype, %union) and tt(%polymorphic) are mutually exclusive: only one
19 of these directives can be used.
20
21 Sources including the generated parser class header file should refer to the
22 semantic value typename as bf(STYPE_).
23