Previous: , Up: Java Parsers   [Contents][Index]


10.2.9 Java Declarations Summary

This summary only include declarations specific to Java or have special meaning when used in a Java parser.

Directive: %language "Java"

Generate a Java class for the parser.

Directive: %lex-param {type name}

A parameter for the lexer class defined by %code lexer only, added as parameters to the lexer constructor and the parser constructor that creates a lexer. Default is none. See Java Scanner Interface.

Directive: %name-prefix "prefix"

The prefix of the parser class name prefixParser if ‘%define parser_class_name’ is not used. Default is YY. See 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 Java Parser Interface.

Directive: %token <type> token

Declare tokens. Note that the angle brackets enclose a Java type. See Java Semantic Values.

Directive: %type <type> nonterminal

Declare the type of nonterminals. Note that the angle brackets enclose a Java type. See Java Semantic Values.

Directive: %code { code … }

Code appended to the inside of the parser class. See Java Differences.

Directive: %code imports { code … }

Code inserted just after the package declaration. See Java Differences.

Directive: %code init { code … }

Code inserted at the beginning of the parser constructor body. See Java Parser Interface.

Directive: %code lexer { code … }

Code added to the body of a inner lexer class within the parser class. See Java Scanner Interface.

Directive: %% code

Code (after the second %%) appended to the end of the file, outside the parser class. See Java Differences.

Directive: %{ code … %}

Not supported. Use %code imports instead. See Java Differences.

Directive: %define abstract

Whether the parser class is declared abstract. Default is false. See Java Bison Interface.

Directive: %define annotations {annotations}

The Java annotations for the parser class. Default is none. See Java Bison Interface.

Directive: %define extends {superclass}

The superclass of the parser class. Default is none. See Java Bison Interface.

Directive: %define final

Whether the parser class is declared final. Default is false. See Java Bison Interface.

Directive: %define implements {interfaces}

The implemented interfaces of the parser class, a comma-separated list. Default is none. See Java Bison Interface.

Directive: %define init_throws {exceptions}

The exceptions thrown by %code init from the parser class constructor. Default is none. See Java Parser Interface.

Directive: %define lex_throws {exceptions}

The exceptions thrown by the yylex method of the lexer, a comma-separated list. Default is java.io.IOException. See Java Scanner Interface.

Directive: %define api.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 is Location. Formerly named location_type. See Java Location Values.

Directive: %define package {package}

The package to put the parser class in. Default is none. See Java Bison Interface.

Directive: %define parser_class_name {name}

The name of the parser class. Default is YYParser or name-prefixParser. See Java Bison Interface.

Directive: %define api.position.type {class}

The name of the class used for positions. This class must be supplied by the user. Default is Position. Formerly named position_type. See Java Location Values.

Directive: %define public

Whether the parser class is declared public. Default is false. See Java Bison Interface.

Directive: %define api.value.type {class}

The base type of semantic values. Default is Object. See Java Semantic Values.

Directive: %define strictfp

Whether the parser class is declared strictfp. Default is false. See 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 Java Parser Interface.


Previous: , Up: Java Parsers   [Contents][Index]