Skip to content

Alternative to Enums #521

Answered by spoenemann
ballcoach12 asked this question in Q&A
Jun 2, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

In this case you could write it like this:

'invocationCondition' '=' '"' invocationCondition=INVOCATION_CONDITION '"'

But I'm not sure how this affects the lexer (tokenizer). Chevrotain has a simple lexing approach that takes the first match in the defined order, so it might be that this shadows the general STRING terminal rule. An alternative is to hard-code the quotes into the enum values:

'"ManualInvoke"'      | '"PostPropertyChange"'  | '"PostRender"'         | ...

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@spoenemann
Comment options

@msujew
Comment options

@ballcoach12
Comment options

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