So right now I parse booleans like this, for instance:
string("true") || string("false")
, which means it tries the first parser, and on failure the second one (and therefore the consumed input must get "un-consumed").The smarter solution is to pick the right branch directly so there is no "un-consuming" necessary. Like this:
val c = one-of("tf")
if c == 't' then
string("rue")
else
string("alse")