hotscript icon indicating copy to clipboard operation
hotscript copied to clipboard

feat(parser): add parser combinators

Open ecyrbe opened this issue 3 years ago • 0 comments

This is a Combinator Parser with a lot of goodies:

  • advanced error handling for parsing errors
  • parser introspection to give better hints to users about the errors
  • multiple easy to understand primitives to create complex parsers
About recursive parsers (resolved) we get recursive too deep and probably infinite error. i only see trampolines as a workaround. This means complexify a lot the library. Because this implies returning a `ParserFn` in the composed parsers and calling those in a loop.

solution

was simply to remove ParserFn constraint

Combinators in this PR:

  • [ ] Helpers
    • [x] Parse
    • [x] ToString
  • [ ] Combinators
    • [x] Literal
    • [x] NotLiteral
    • [x] Optional
    • [x] Many
    • [x] Many1
    • [x] Sequence
    • [x] EndOfInput
    • [x] Choice
    • [x] Or
    • [x] Not
    • [x] Whitespace
    • [x] Whitespaces
    • [x] Trim
    • [x] TrimLeft
    • [x] TrimRight
    • [x] Any
    • [x] CharRange
    • [x] Alpha
    • [x] AlphaNum
    • [x] Digit
    • [x] Digits
    • [x] Word
    • [x] SepBy
    • [x] Between
  • [ ] Transformers
    • [x] Map
    • [x] MapError
    • [x] Skip

ecyrbe avatar Mar 05 '23 19:03 ecyrbe