github lark-parser/lark 1.3.0
1.3.0 - Introduces text-slices, Earley fix, and various small improvements

10 hours ago

New features

  • Lark can now parse in sections of strings, using TextSlice, as a faster alternative to creating a "copy-slice" with s[i:j]. Learn more
  • Added support to match on Tree instances
  • When serializing a Lark instance, added the option to include the grammar object (before compilation).
  • Added convenience method Tree.find_token()

Bugfixes

  • Bugfix of an edge case in Earley related to representation of ambiguity.
  • Bugfixes in the standalone parser related to imports
  • Bugfix in indenter - now dedents always contain line information
  • Various small bugfixes (see PR list below)

Full list of PRs

  • Docs: Rephrase v_args() documentation to underline it only applies to Transformer classes by @skepppy in #1458
  • Tiny refactor for PR #1451 by @erezsh in #1459
  • Earley: share nodes created by the scanner with the completer by @chanicpanic in #1451
  • Better error in Lark.parse when using on_error when parser!=lalr (issue #1311) by @erezsh in #1460
  • Fix Symbol.__eq__ to return false when comparing with None by @weaversam8 in #1481
  • Mention internal/external transformers in the documentation by @odanoburu in #1486
  • Add Tree.find_token() method by @makukha in #1467
  • Type Terminal.__init__ by @Liam-DeVoe in #1503
  • Add guidance on handling comments in languages with significant indentation by @nchammas in #1502
  • [docs] Small fix for PR 1507 by @erezsh in #1508
  • Add note on binding power of numeric quantifiers by @414owen in #1507
  • Wrap functools.partial in staticmethod() to add compatibility with Python 3.14 by @hrnciar in #1483
  • Fix generic type of Transformer_InPlaceRecursive by @lbhm in #1518
  • Added TextSlice; Lark can now parse/lex a text-slice by @erezsh in #1452
  • Support match on tree by @colmmurphyxyz in #1521
  • Docs: Updated link of DSL article to a new version by @erezsh in #1529
  • better error messages for shift/reduct conflicts by @skogsbaer in #1531
  • Serialize Lark.grammar (fixes issue #1472) by @NasalDaemon in #1506
  • Fixes for PR #1506, which adds the option to cache the grammar definition by @erezsh in #1540
  • Bugfix in indenter - now always creating dedents with line information by @erezsh in #1547
  • Bugfix: issue when unpickling in the standalone parser, due to lingering Token instances by @erezsh in #1553
  • Include missing import in standalone parser by @pdeibert in #1541
  • Version bump (1.3.0) by @erezsh in #1554

New Contributors

Full Changelog: 1.2.2...1.3.0

Don't miss a new lark release

NewReleases is sending notifications on new releases.