-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add EOF token to grammar #1162
Add EOF token to grammar #1162
Conversation
@Yokozuna59 I had to discard the other PR. The current implementation only allows EOF within parser rules - so no terminals or terminal fragments. I am wondering if it is still helpful. When I was searching for test examples, this EOF feature seemed not to be very powerful. |
@Lotes I think the main usage in my mind about it is to use it as So it should be used as fragment rule:
The main issue we're facing is that each attribute should be in a separate line, so we can't use |
I think in your context that you have described, the new EOF keyword will help, so you are not dependent on the lexer hack. Since EOL is a parser rule, it will work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good, but there's a test case I'm missing (which is the main reason to use EOF
at all): Can you create a test that builds a line based language and confirm that it parses as expected? I.e. something like this:
Lines: lines+=Line*;
Line: text=ID (EOL | EOF);
terminal EOL: /\r?\n/;
@msujew New tests were pushed and branch was rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright looks good. Can you please remove the changes to the package-lock.json
before merging?
Adds the ability to explicitly parse the EOF token from Chevrotain.