Skip to content

Printing ParseError when using custom token types? #367

Closed Answered by m0rphism
m0rphism asked this question in Q&A
Discussion options

You must be logged in to vote

I ended up with using a parameterized rule to wrap token parsing:

rule tok(t: Token<'a>) -> () = quiet!{[t2 if t2 == t] { () }} / expected!(t.to_str())

In other rules I can then parse tokens via e.g. tok(Colon) instead of [Colon].

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by m0rphism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant