-
How do I write a grammar that skips all unrecognized characters that are between tokens? For example, consider this input string: "##abc& &def%%" I would like to recognized "abc" and "def" as words, and skip everything else. This is what I have tried:
The problem with the first two is that WHITESPACE and "other" recognize too much. Essentially, I need a reluctant quantifier. In a regular expression "?" does the trick, but it's not working as expected here. I don't know what the issue is with the last two. The very last one really should work, but it is expecting another word at the end and I don't know why. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I believe the following peg will work:
|
Beta Was this translation helpful? Give feedback.
I believe the following peg will work: