Releases: alllex/parsus
Releases · alllex/parsus
v0.6.1
v0.6.0
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
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
New
- New
parseOrElse
andparseOrNull
shorthand functions forGrammar
- 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 toTuple7
- New
maybe
alias foroptional
Breaking
parser1 and parser2
now returnsParser<Tuple2<T1, T2>>
instead ofParser<Pair<T1, T2>>
Deprecations
- Parsing functions that start with
parseEntire*
are deprecated in favor of shorterparse*
functions. - Unary operators on the
ParsingContext
are deprecated, because they have a different semantics for the same types compared toGrammar
scope. Explicit functions likeskip
orhas
should be used instead.
v0.4.0
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()) }