[Solved] Combine-language without single line comments


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?


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

1 Like

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


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

1 Like

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!