Skip to content

Calling terminal fragment in another fragment does not work as expected #638

Answered by msujew
luan-xiaokun asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @luan-xiaokun

Do I need to do something to suppress such warnings, or this feature is not fully supported yet?

It's supported, but the missing validation was a bug, see #633.

The second one is just manually copying&pasting the regex and it has the desired behaviour, but the first one does not work as expected.

So Chevrotain (our underlying parser library) is heavily reliant on the order of terminals. It will always perform a first match approach (i.e. find the first tokentype that matches the next characters) instead of a longest fit (as one might expect). So in your case, the DECSEQ terminal is always parsed first, even though DECFRAG might fit as well. To fix this, you'll just h…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@luan-xiaokun
Comment options

@luan-xiaokun
Comment options

@msujew
Comment options

@luan-xiaokun
Comment options

@luan-xiaokun
Comment options

Answer selected by luan-xiaokun
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