Skip to content

Token for EOF #1041

Answered by erezsh
NeoCortex97 asked this question in Q&A
Discussion options

You must be logged in to vote

There is a branch of Lark the implements the end symbol as $: https://github.com/lark-parser/lark/tree/end_symbol_2021

We haven't merged it in, because for some grammars, which are hard to detect automatically, the parser might go into an infinite loop. But it's pretty stable per grammar, so if you get it working for yours, it's probably fine.

However,

In practice I think the easiest choice is to only check for newlines, and always add a newline at the end of your input, before sending it to the parser.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by NeoCortex97
Comment options

You must be logged in to vote
0 replies
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