Previous: D Push Parser Interface, Up: D Parsers [Contents][Index]
To build return values for yylex
, call the Symbol
method of
the same name as the token kind reported, and adding the parameters for
value and location if necessary. These methods generate compile-time errors
if the parameters are inconsistent. Token constructors work with both
%union
and ‘%define api.value.type union’.
The order of the parameters is the same as for the Symbol
constructor. An example for the token kind NUM
, which has value
ival
and with location tracking activated:
Symbol.NUM(ival, location);