Closed Kyras closed 6 years ago
@Kyras, sorry for the late replay.
We can use the negative lookahead operator.
# a.peg
START <- TEXT '\n'
TEXT <- (!'\n' .)*
$ peglint -ast -s $'hello' a.peg
1:6 syntax error
$ peglint -ast -s $'hello\n' a.peg
+ START
- TEXT ("hello")
Hope it helps
@Kyras, please let me know if the above solution doesn't work for you.
I would need to create predicate to match every symbol but newline symbol. Something like [^\n] in regex or negative lookahead operator !"\n". Would that be possible ?