[Solved] Combine-language without single line comments

#1

I’m building a parser for a language that has block comments but no single-line comments. How do I modify https://github.com/Marwes/combine-language/blob/master/src/lib.rs#L25 to indicate there are no single line comments?

#2

Use a parser that always fails and doesn’t consume any input.

1 Like
#3

@NobbZ : In theory, I agree with you. In practice, how do I write a parser that rejects everything?

#4

I haven’t used combine so far, but on a quick glance, satisfy(|_| false) should do it.

1 Like
#5

I ended up having to slightly adjust it to:

satisfy(|_s| false).map(|_| ())

as it wants a return type of () .

This now compiles and now appears to work. Thanks!