Skip to content

Releases: alllex/parsus

v0.6.1

20 Dec 11:34
Compare
Choose a tag to compare

Improvements

  • Better error reporting for some cases when parsing fails

Bugfixes

  • Fixed a corner-case of separated and split combinators failing to parse valid input

v0.6.0

07 Oct 21:52
7be1fa4
Compare
Choose a tag to compare

New

  • Parsus uses a new "scannerless" parsing approach to avoid token declaration order problems
    • The tokens can be declared in any order now!
    • However, this could be breaking and require reordering alternatives in the parsers like p1 or p2 or p3
  • Explicit parsing of ignored tokens is now possible.
    • This can be handy, for instance, to enforce whitespace between certain things.
  • Unmatched-token errors are now user-friendly
    • They include a section of the input to pinpoint problems faster, and also previously matched token for context

Deprecated

  • Using currentToken is deprecated, because it will always be null due to avoidance of the eager tokenization in the "scannerless" approach.

v0.5.5

22 Aug 07:03
660b386
Compare
Choose a tag to compare

Fixes

  • Non-literal token declaration order is now honored, same as it already was for literal tokens.
    If there was a regex token declared before a literal token, and a literal token was a prefix of the regex, the parser would have always chosen the literal, which is not correct.

v0.5.4

03 Aug 06:47
761cf01
Compare
Choose a tag to compare

New

  • New parseOrElse and parseOrNull shorthand functions for Grammar
  • Case-insensitive parsing of literal and regex tokens with ignoreCase=true parameter
  • Case-insensitive grammars with Grammar<T>(ignoreCase = true) (makes all literal and regex tokens case-insensitive)
  • Parsing with non-root parser is now possible with g.parse(g.someParser, text) for easier testing and debugging
  • High level and combinator to type-safely parse sequences of parses up to Tuple7
  • New maybe alias for optional

Breaking

  • parser1 and parser2 now returns Parser<Tuple2<T1, T2>> instead of Parser<Pair<T1, T2>>

Deprecations

  • Parsing functions that start with parseEntire* are deprecated in favor of shorter parse* functions.
  • Unary operators on the ParsingContext are deprecated, because they have a different semantics for the same types compared to Grammar scope. Explicit functions like skip or has should be used instead.

v0.4.0

16 Mar 17:37
22c625b
Compare
Choose a tag to compare

New Combinators

and, optional, repeated, zeroOrMore, oneOrMore, separated, leftAssociative, rightAssociative

Most utilities that were available inside the parser { ... } closure are now also accessible as actual parser combinators.

    val keyValue by str * -colon and ref(::jsonValue)
    val jsonObj by -lbrace * separated(keyValue, comma) * -rbrace map { Json.Obj(it.toMap()) }

v0.3.0

12 Mar 15:24
7da3314
Compare
Choose a tag to compare

First release with Kotlin Multiplatform support.

Big thanks to @aSemy for making this happen!

v0.1.4

30 Jun 07:35
Compare
Choose a tag to compare

Publish the library to Maven Central. See README for details.