Skip to content

Why using map combinator on delegate excludes it from list of tokens? #53

Answered by h0tk3y
gumanoid asked this question in Q&A
Discussion options

You must be logged in to vote

Defining tokens as separate declarations inside the grammar is needed for collecting the tokens and building a tokenizer on top of them. If you use tokens "inline" in other parsers, the grammar's current implementation won't be able to register the tokens and use them in a tokenizer.

So, the workaround is to always declare tokens as delegated properties inside a grammar.

Given that the set of tokens and their order really matters in parsing, following the convention of defining tokens as delegated properties also makes it more clear as to what tokens are there and in which order.

The grammar implementation could potentially be improved in some ways that would make best effort to enforce r…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gumanoid
Comment options

@gumanoid
Comment options

Answer selected by gumanoid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants