instaparse

If you're not trampolining your parser, why bother getting up in the morning?
2018-11-20T09:30:29.006Z

@aengelberg The context is: I am parsing a markdown document and I need to detect a line separator as either something based on \n and \r, or either the end of the document.

2018-11-20T09:31:50.007400Z

Thank you for the negative lookahead hint, I will try it.

aengelberg 2018-11-20T17:11:58.008300Z

@vincent.cantin you could maybe structure the parser as

S = line (separator line)*
separator = '\n' | '\r'
then you don't have to explicitly check whether it reaches the end of the file.

👍 2
2018-11-22T06:41:21.014700Z

That would be doable, but it requires to adapt the full grammar for that.