BNF grammar for D?

Bruno Medeiros via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 8 06:09:13 PST 2015


On 22/12/2014 11:44, Kingsley wrote:
> Hi Bruno - would be easy to return the list of tokens included for each
> node in the DeeParser?

You can create an utility method that does that, if you have a 
DeeParseResult.

The DeeParseResult has a 'tokenList' member, ordered by the source 
range. With a node's source range, you can do a binary search in that 
list to find the corresponding tokens.

For more convenience, I guess DeeParser could be modified so that this 
information - in the form of a sublist of 'tokenList' - would be stored 
directly in each ASTNode, in the 'data' field. This way one would not 
need to provide the DeeParseResult directly.


-- 
Bruno Medeiros
https://twitter.com/brunodomedeiros


More information about the Digitalmars-d mailing list