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


10.2.9 D Complete Symbols

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);