belatuk_combinator 6.0.0
belatuk_combinator: ^6.0.0 copied to clipboard
Packrat parser combinators that support static typing, generics, file spans, memoization, and more.
Change Log #
6.0.0 #
Breaking changes in 6.0.0 #
- Breaking: Requires
belatuk_code_buffer6.0.0, whichParser.stringifytakes. Itslength, span offsets andwriteln()behave differently, as described in its changelog. - Breaking:
chain,thenand thetupleNfunctions givenullfor an element without a value, instead of the string'NULL'. Achainwith a non-nullable type, such aschain<String>, throws aStateErrorwhen an element has no value, so use a nullable type, such aschain<String?>, when that can happen. - Breaking:
star()gives an empty list when nothing matches, instead ofnull. - Breaking: Left-recursive rules, such as
sum := sum '+' number | number, parse all of their input and group from the left, instead of stopping after one step, so1+2+3is no longer parsed as1+2. A grammar that was left-recursive by accident, and relied on that rule failing, can now parse differently.anyandlongestno longer skip an alternative that is already being parsed at the same position; it fails there instead, as before. - Breaking:
stringifynumbers each reference, printing it asreference #1 (...)the first time and asreference #1 (printed above)after that, instead of writing(previously printed reference). - Breaking:
cache()returns the parser itself, instead of a new parser thatstringifyprints ascache (...). Every parser's results are already cached for one parse, so parsing new text with a cached parser no longer returns earlier results, and a cached part of a left-recursive rule still grows. - Breaking:
Reference.printedis removed. Each call tostringifytracks the references it has printed.
Fixes in 6.0.0 #
- Parsing: A memoized result moves the scanner to where the original parse ended, so alternatives that start with the same parser, such as
any([chain([a, b]), chain([a, c])]), parse correctly. - Parsing:
separatedByComma()no longer throws aTypeErrorwhen it matches a comma. - Parsing:
surroundedByCurlyBracesandsurroundedBySquareBracketsgivedefaultValuefor empty braces or brackets, instead of throwing aTypeError. - Parsing:
&and|accept a parser of any type, so they no longer throw aTypeErrorat run time when the two parsers' types differ.|casts the other parser's values to this parser's type. - Parsing:
opt(backtrack: false)keeps the text consumed by a failed attempt, as documented, instead of always backtracking, and includes that text in its span.optgives no span when the failed attempt consumed nothing. - Parsing:
chainwithfailFast: falseno longer throws aStateErrorfor an element without a value once an element has failed. With a non-nullable type, the failed result then has no value. With a nullable type, it keeps the partial list of values, as before. - Parsing: Left-recursive rules reached while another rule is growing at the same position, including mutually left-recursive rules, also grow, so they parse all of their input.
- Parsing: A result added with
Trampoline.memoizemoves the scanner to the end of its span when it is used again, like a result memoized during parsing. - Performance: Memoized results are stored by position, so looking one up, and forgetting a position while a left-recursive rule grows, no longer scans every parser's results.
- Stringify: Each call to
stringifyprints references in full again, even into a buffer that was used before or cleared. - Stringify: A reference that contains itself no longer recurses forever.
- Examples: The
json,main,calculator,basic_authandsexpexamples run, and every interactive example stops at the end of its input instead of crashing.
5.5.0 #
- Require Dart >= 3.13
5.4.0 #
- Require Dart >= 3.8
5.3.0 #
- Require Dart >= 3.5
- Updated
lintsto 5.0.0
5.2.0 #
- Require Dart >= 3.3
- Updated
lintsto 4.0.0
5.1.0 #
- Updated
lintsto 3.0.0 - Fixed lints warnings
5.0.0 #
- Require Dart >= 3.0
5.0.0-beta.1 #
- Require Dart >= 3.0
- Updated
belatuk_code_bufferto 5.0.0
4.0.0 #
- Require Dart >= 2.17
3.0.1 #
- Fixed license link
3.0.0 #
- Upgraded from
pendantictolintslinter - Published as
belatuk_combinatorpackage - Resolved static analysis warnings
2.0.2 #
- Resolved static analysis warnings
2.0.1 #
- Updated README
2.0.0 #
- Migrated to support Dart SDK 2.12.x NNBD
1.1.0 #
- Add
tupleXparsers. Hooray for strong typing!
1.0.0+3 #
thennow always returnsdynamic.
1.0.0+2 #
starnow includes with a call toopt.- Added comments.
- Enforce generics on
separatedBy. - Enforce Dart 2 semantics.