Closed MystPi closed 7 months ago
I noticed that CanBacktrack
actually has to be set to False
for the parser to work correctly. What do you think @hayleigh-dot-dev?
Ah it might be that I got confused with the naming. At one point in time I think this type was called ShouldBacktrack
or Backtrackble
or something... the core parser stuff is a port from elm that I muddled through.
Do you think you could add some tests for this just to make sure it works fine?
I can try! Is ./test/unit/parser_test.gleam a good place for the tests?
Yeah sounds good! I'd just like to make sure we get sensible results if we do like
use before <- do(span())
use _ <- do(some_parser())
use after <- do(span())
If you could be bothered you could also consider a very minimal reproduction of your sexpr parser and place it under test/examples/ :)
If you could be bothered you could also consider a very minimal reproduction of your sexpr parser and place it under test/examples/ :)
Ooh I think I'll do that!
I think the sexpr test I added pretty much verifies that the parser works. Nice to have more nibble examples too!
Adds a parser for getting the current position.
Apologies for the messy diff; looks like my editor removed some trailing whitespace from comments.