I want to create a parser for EOL, I can't just do whitespace because I need it to ignore spaces.
So I want to create a parser that will match on "\r\n" or '\n'. Doing a single character is easy Character.EqualTo('\n') but trying to match a specific string literal is perplexing me. I would think this should be a regular thing that needs to be done for keywords, but I am at a loss.
The
\r\ncombination is a string, which means that you need to combine the simple\nparser (that is a character parser) with a string parser.How about:
If you prefer the non-LINQ syntax:
Edited: Use the Span parser to parse strings: