Skip to content

Skip all unrecognized chars #727

Answered by xiaket
ccleve asked this question in Q&A
Discussion options

You must be logged in to vote

I believe the following peg will work:

main = { SOI ~ words ~ EOI }
words = { unwanted* ~ word ~ unwanted* ~ words? ~ unwanted* }
word = { ('a'..'z')+ }
unwanted = _{
    !(word)
    ~ ANY
}

Replies: 2 comments

Comment options

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