JeffreyBenjaminBrown / digraphs-with-text

BSD 3-Clause "New" or "Revised" License
65 stars 5 forks source link

When parsing, the # operator must abut something #1

Closed JeffreyBenjaminBrown closed 6 years ago

JeffreyBenjaminBrown commented 6 years ago

Currently, to parse an empty joint, I can use #(). I would like to be able to use # alone (surrounded by non-word characters).

JeffreyBenjaminBrown commented 6 years ago

Solved. I was using Megaparsec.Char.symbol to parse the # operator, and symbol is a lexeme, so it had already consumed any trailing space before looking for the label that might follow the #. (The # operator by itself is not a lexeme; only the combination of having looked for that and then looked for the trailing label should be treated as a lexeme.)

So I switched to Megaparsec.Char.string.