Fork me on GitHub
#instaparse
<
2018-11-20
>
Vincent Cantin09:11:29

@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.

Vincent Cantin09:11:50

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

aengelberg17:11:58

@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.

👍 8
Vincent Cantin06:11:21

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