The name of the generated parser class defaults to
YY prefix may be changed using the
or the -p/--name-prefix option. Alternatively, use
%define parser_class_name "name
" to give a custom name to
the class. The interface of this class is detailed below.
By default, the parser class has package visibility. A declaration
%define public will change to public visibility. Remember that,
according to the Java language specification, the name of the .java
file should match the name of the class in this case. Similarly, you can
strictfp with the
%define declaration to add other modifiers to the parser class.
The Java package name of the parser class can be specified using the
%define package directive. The superclass and the implemented
interfaces of the parser class can be specified with the
%define implements directives.
The parser class defines an inner class,
Location, that is used
for location tracking (see Java Location Values), and a inner
Lexer (see Java Scanner Interface). Other than
these inner class/interface, and the members described in the interface
below, all the other members and fields are preceded with a
YY prefix to avoid clashes with user code.
The parser class can be extended using the
directive. Each occurrence of the directive will add a
final field to the parser class, and an argument to its constructor,
which initialize them automatically.
Token names defined by
%token and the predefined
name are added as constant fields to the parser class.
Build a new parser object with embedded
%code lexer. There are no parameters, unless
%lex-params are used.
Build a new parser object using the specified scanner. There are no additional parameters unless
%parse-params are used.
If the scanner is defined by
%code lexer, this constructor is declared
protectedand is called automatically with a scanner created with the correct
Run the syntactic analysis, and return
During the syntactic analysis, return
trueif recovering from a syntax error. See Error Recovery.
Get or set the stream used for tracing the parsing. It defaults to