Const
Check if you have reached the end of the string you are parsing.
Just An Int
const justAnInt: Parser<number> = succeed((n: number) => n) .apply(int) .skip(end) // run(justAnInt("90210")) => Ok(90210) // run(justAnInt("1 + 2")) => Err(...) // run(int("1 + 2")) . => Ok(1)
Parsers can succeed without parsing the whole string. Ending your parser with end guarantees that you have successfully parsed the whole string.
end
Check if you have reached the end of the string you are parsing.
Remarks
Example
Just An Int
Parsers can succeed without parsing the whole string. Ending your parser with
end
guarantees that you have successfully parsed the whole string.