| 1 |
Parser classes generated by b() offer the following public constructor, |
| 2 |
enums, members and types (in the following overview parser class-name prefixes |
| 3 |
(e.g., tt(Parser::)) prefixes were omitted): |
| 4 |
itemization( |
| 5 |
it() Constructors: the generated parser class merely defines the default |
| 6 |
constructor. Copy and move constructors are not available. The default |
| 7 |
constructor is a real default: it is declared as such in the parser's |
| 8 |
header file. Additional constructors can easily be added to the parser |
| 9 |
class's interface. Since the initialization of the parser's base class |
| 10 |
is performed by the parser base class's default constructor, |
| 11 |
constructors that are added to the generated parser class |
| 12 |
automatically call the base class constructor, so additional |
| 13 |
constructors do not have to explicitly initialize the parser's base |
| 14 |
class. |
| 15 |
|
| 16 |
it() bf(DebugMode_):nl() |
| 17 |
The values of this tt(enum) are used to configure the type of debug |
| 18 |
information that will be displayed (assuming that the tt(debug) |
| 19 |
option/directive was specified when bic() generated the parser's |
| 20 |
code). It has three values: |
| 21 |
|
| 22 |
tt(OFF): no debug information is displayed when the generated |
| 23 |
parser's tt(parse) function is called; |
| 24 |
|
| 25 |
tt(ON): extensive debug information about the parsing process is |
| 26 |
displayed when the generated parser's tt(parse) function is called; |
| 27 |
|
| 28 |
tt(ACTIONCASES): just before executing the grammar's action blocks |
| 29 |
the action block number is written to the standard output |
| 30 |
stream. These action block numbers refer to case labels of the switch |
| 31 |
that is defined in the parser's tt(executeAction) function. It is |
| 32 |
commonly used to find the action block where a fatal semantic value |
| 33 |
mismatch was observed. |
| 34 |
|
| 35 |
The tt(bit_or) operator can be used to combine tt(ON) and |
| 36 |
tt(ACTIONCASES) (see the member function tt(setDebug(DebugMode_ |
| 37 |
mode)) below). |
| 38 |
|
| 39 |
it() bf(LTYPE_):nl() |
| 40 |
The parser's location type (user-definable). Available only when |
| 41 |
either tt(%lsp-needed, %ltype) or tt(%locationstruct) has been |
| 42 |
declared. |
| 43 |
|
| 44 |
it() bf(STYPE_):nl() |
| 45 |
The parser's stack-type (user-definable), defaults to bf(int). |
| 46 |
|
| 47 |
it() bf(Tokens_):nl() |
| 48 |
The enumeration type of all the symbolic tokens defined in the grammar |
| 49 |
file (i.e., bic()'s input file). The scanner should be prepared to |
| 50 |
return these symbolic tokens. Note that, since the symbolic tokens are |
| 51 |
defined in the parser's class and not in the scanner's class, the |
| 52 |
lexical scanner must prefix the parser's class name to the symbolic |
| 53 |
token names when they are returned. E.g., tt(return Parser::IDENT) |
| 54 |
should be used rather than tt(return IDENT). |
| 55 |
|
| 56 |
it() bf(int parse()):nl() |
| 57 |
The parser's parsing member function. It returns 0 when parsing was |
| 58 |
successfully completed; 1 if errors were encountered while parsing the |
| 59 |
input. |
| 60 |
|
| 61 |
it() bf(void setDebug(bool mode)):nl() |
| 62 |
This member can be used to activate or deactivate the debug-code |
| 63 |
compiled into the parsing function. It is always defined but is only |
| 64 |
operational if the tt(debug) directive option was specified when bic() |
| 65 |
generated the tt(parse) function. If so, it is em(not) active by |
| 66 |
default; to activate the debug output call tt(setDebug(true)), to |
| 67 |
suppress the debug output call tt(setDebug(false)). |
| 68 |
|
| 69 |
it() bf(void setDebug(DebugMode_ mode)):nl() |
| 70 |
This member can also be used to activate or deactivate the debug-code |
| 71 |
compiled into the parsing function. Like tt(setDebug(bool)) it is |
| 72 |
always defined but only operational if the tt(debug) directive option |
| 73 |
was specified when bic() generated the tt(parse) function. If so, it |
| 74 |
is em(not) active by default; to activate, call |
| 75 |
tt(setDebug(Parser::ON), setDebug(Parser::ACTIONCASES)), or |
| 76 |
tt(setDebug(Parser::ON | Parser::ACTIONCASES)). To suppress the |
| 77 |
debug code output call tt(setDebug(Parser_::OFF)) or simply |
| 78 |
tt(setDebug(false)). |
| 79 |
) |
| 80 |
|
| 81 |
When the tt(%polymorphic) directive is used: |
| 82 |
itemization( |
| 83 |
it() bf(Meta_):nl() |
| 84 |
Templates and classes that are required for implementing the |
| 85 |
polymorphic semantic values are all declared in the tt(Meta_) |
| 86 |
namespace. The tt(Meta_) namespace itself is nested under the |
| 87 |
namespace that may have been declared by the tt(%namespace) |
| 88 |
directive. |
| 89 |
|
| 90 |
it() bf(Tag_):nl() |
| 91 |
The (strongly typed) tt(enum class Tag_) contains all the |
| 92 |
tag-identifiers specified by the tt(%polymorphic) directive. It is |
| 93 |
declared outside of the Parser's class, but within the namespace |
| 94 |
that may have been declared by the tt(%namespace) directive. |
| 95 |
) |
| 96 |
|
| 97 |
|