File: stype.yo

package info (click to toggle)
bisonc%2B%2B 6.09.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,984 kB
  • sloc: cpp: 9,375; ansic: 1,505; fortran: 1,134; makefile: 1,062; sh: 526; yacc: 84; lex: 60
file content (23 lines) | stat: -rw-r--r-- 1,019 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Syntax: bf(%stype typename) nl()    

This directive defines the type of the semantic value of tokens.  The
specified type must be a default constructible type, like tt(size_t) or
tt(std::string). By default, b() uses tt(int) for the semantic value type of
its parser's tokens. To use another single semantic value type , this
directive must be used.

In programs using a simple grammar it may be sufficient to use the same data
type for the semantic values of all language constructs (see, e.g., sections
ref(RPN) and ref(CALC)).

    Any text following tt(%stype) up to the end of the line, up to the first
of a series of trailing blanks or tabs or up to a comment-token (tt(//) or
tt(/*)) becomes part of the type definition. Be sure em(not) to end a
tt(%stype) definition in a semicolon.

tt(%stype, %union) and tt(%polymorphic) are mutually exclusive: only one
of these directives can be used.  

Sources including the generated parser class header file should refer to the
semantic value typename as bf(STYPE_).