| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
10.2.8 Java Declarations Summary
This summary only include declarations specific to Java or have special meaning when used in a Java parser.
- Directive: %lex-param {type name}
A parameter for the lexer class defined by
%code lexeronly, added as parameters to the lexer constructor and the parser constructor that creates a lexer. Default is none. See section Java Scanner Interface.
- Directive: %name-prefix "prefix"
The prefix of the parser class name
prefixParserif%define parser_class_nameis not used. Default isYY. See section Java Bison Interface.
- Directive: %parse-param {type name}
A parameter for the parser class added as parameters to constructor(s) and as fields initialized by the constructor(s). Default is none. See section Java Parser Interface.
- Directive: %token <type> token …
Declare tokens. Note that the angle brackets enclose a Java type. See section Java Semantic Values.
- Directive: %type <type> nonterminal …
Declare the type of nonterminals. Note that the angle brackets enclose a Java type. See section Java Semantic Values.
- Directive: %code { code … }
Code appended to the inside of the parser class. See section Differences between C/C++ and Java Grammars.
- Directive: %code imports { code … }
Code inserted just after the
packagedeclaration. See section Differences between C/C++ and Java Grammars.
- Directive: %code lexer { code … }
Code added to the body of a inner lexer class within the parser class. See section Java Scanner Interface.
- Directive: %% code …
Code (after the second
%%) appended to the end of the file, outside the parser class. See section Differences between C/C++ and Java Grammars.
- Directive: %{ code … %}
Not supported. Use
%code importinstead. See section Differences between C/C++ and Java Grammars.
- Directive: %define abstract
Whether the parser class is declared
abstract. Default is false. See section Java Bison Interface.
- Directive: %define extends "superclass"
The superclass of the parser class. Default is none. See section Java Bison Interface.
- Directive: %define final
Whether the parser class is declared
final. Default is false. See section Java Bison Interface.
- Directive: %define implements "interfaces"
The implemented interfaces of the parser class, a comma-separated list. Default is none. See section Java Bison Interface.
- Directive: %define lex_throws "exceptions"
The exceptions thrown by the
yylexmethod of the lexer, a comma-separated list. Default isjava.io.IOException. See section Java Scanner Interface.
- Directive: %define location_type "class"
The name of the class used for locations (a range between two positions). This class is generated as an inner class of the parser class by
bison. Default isLocation. See section Java Location Values.
- Directive: %define package "package"
The package to put the parser class in. Default is none. See section Java Bison Interface.
- Directive: %define parser_class_name "name"
The name of the parser class. Default is
YYParserorname-prefixParser. See section Java Bison Interface.
- Directive: %define position_type "class"
The name of the class used for positions. This class must be supplied by the user. Default is
Position. See section Java Location Values.
- Directive: %define public
Whether the parser class is declared
public. Default is false. See section Java Bison Interface.
- Directive: %define stype "class"
The base type of semantic values. Default is
Object. See section Java Semantic Values.
- Directive: %define strictfp
Whether the parser class is declared
strictfp. Default is false. See section Java Bison Interface.
- Directive: %define throws "exceptions"
The exceptions thrown by user-supplied parser actions and
%initial-action, a comma-separated list. Default is none. See section Java Parser Interface.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
