Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
MIT License
Bot releases are hidden (Show)
Published by erezsh 2 months ago
Full Changelog: https://github.com/lark-parser/lark/compare/1.2.1...1.2.2
Published by erezsh 2 months ago
InteractiveParser.accepts()
Full Changelog: https://github.com/lark-parser/lark/compare/1.1.9...1.2.1
Published by erezsh 9 months ago
Full Changelog: https://github.com/lark-parser/lark/compare/1.1.8...1.1.9
Published by erezsh 12 months ago
Token.end_*
fields for ignored tokens by @jtbraun in https://github.com/lark-parser/lark/pull/1309
Full Changelog: https://github.com/lark-parser/lark/compare/1.1.7...1.1.8
Published by erezsh about 1 year ago
Bugfix in propagate_positions (issue #1304)
Published by erezsh over 1 year ago
strict=True
, implemented using interegular by @MegaIng
[*x]
by @evtn in https://github.com/lark-parser/lark/pull/1232
codespell
hook by @kianmeng in https://github.com/lark-parser/lark/pull/1244
if TYPE_CHECKING:
branches by @MegaIng in https://github.com/lark-parser/lark/pull/1278
PEP 621
-compliant pyproject.toml
. by @KOLANICH in https://github.com/lark-parser/lark/pull/1157
Full Changelog: https://github.com/lark-parser/lark/compare/1.1.5...1.1.6
Published by erezsh almost 2 years ago
Full Changelog: https://github.com/lark-parser/lark/compare/1.1.4...1.1.5
Published by erezsh almost 2 years ago
__all__
to __init__
by @aspizu in https://github.com/lark-parser/lark/pull/1200
__lark_meta__()
by @erezsh in https://github.com/lark-parser/lark/pull/1203
Full Changelog: https://github.com/lark-parser/lark/compare/1.1.3...1.1.4
Published by erezsh about 2 years ago
Add user to cache filename; better handle cache load/save failures by @klauer in https://github.com/lark-parser/lark/pull/1179
refactor: add 'usedforsecurity=False' arg to hashlib.md5 usage by @cquick01 in https://github.com/lark-parser/lark/pull/1190
Create lark/grammars/init.py by @chanicpanic in https://github.com/lark-parser/lark/pull/1171
Adjust imports for Python 3.11 by @The-Compiler in https://github.com/lark-parser/lark/pull/1140
Fix for issue #1173 by @erezsh in https://github.com/lark-parser/lark/pull/1198
Add match stmt support to python.lark by @joseph-e-k in https://github.com/lark-parser/lark/pull/1123
Added match stmt support to python.lark by @MegaIng in https://github.com/lark-parser/lark/pull/1016
Linting to fix minor issues by @Erotemic in https://github.com/lark-parser/lark/pull/1128
Simplify lexer: Use Match.lastgroup instead of lastindex by @erezsh in https://github.com/lark-parser/lark/pull/1129
Fix confusing import in examples by @JonasLoos in https://github.com/lark-parser/lark/pull/1138
Move iter_subtrees_topdown into standalone by @camgunz in https://github.com/lark-parser/lark/pull/1137
Fix 1146: use the class's get instead of the instance's get by @MegaIng in https://github.com/lark-parser/lark/pull/1147
fix: remove Python 2 legacy packaging code by @henryiii in https://github.com/lark-parser/lark/pull/1148
Fix for PR #1149 by @erezsh in https://github.com/lark-parser/lark/pull/1150
Old link for sppf is no longer valid. Point to web archive instead. by @patrickhuber in https://github.com/lark-parser/lark/pull/1159
Fix ForestToPyDotVisitor by @chanicpanic in https://github.com/lark-parser/lark/pull/1167
Close file-like objects to address ResourceWarning. by @shawnbrown in https://github.com/lark-parser/lark/pull/1183
Minor adjustments to PR #1179 by @erezsh in https://github.com/lark-parser/lark/pull/1189
Adjustments for PR #1152 by @erezsh in https://github.com/lark-parser/lark/pull/1191
Remove trailing whitespace by @bcr in https://github.com/lark-parser/lark/pull/1196
Full Changelog: https://github.com/lark-parser/lark/compare/1.1.2...1.1.3
Published by erezsh over 2 years ago
Tree
instances now have a pretty print with the "rich" library, when doing rich.print(tree)
Full Changelog: https://github.com/lark-parser/lark/compare/1.1.1...1.1.2
Published by erezsh over 2 years ago
n
to child
when iterating over children
by @hf-kklein in https://github.com/lark-parser/lark/pull/1110
type: ignore[error]
in lark/tree.py and lark/utils.py by @hf-kklein in https://github.com/lark-parser/lark/pull/1099
py.typed
to package_data of lark package by @hf-kklein in https://github.com/lark-parser/lark/pull/1109
iter_parse()
method, for easier instrumentation by @erezsh in https://github.com/lark-parser/lark/pull/1111
Full Changelog: https://github.com/lark-parser/lark/compare/1.1.0...1.1.1
Published by erezsh over 2 years ago
Better support for typing and mypy. Includes generic tree typing (Thanks @plannigan!)
Improvements to python.lark
(walrus operator, slashes in function params, and more). Now parses the entire Python 3.10 lib successfully
Bugfixes:
Transformer.__default__
not called in tree-less LALR mode (Issue #1029)v_args
failed to apply to class under standalone parser (Issue #1059)maybe_placeholders
incorrectly accumulated params when it encountered the | operator (Issue #1078)Published by erezsh almost 3 years ago
Over the last few years, Lark has grown to become a comprehensive toolkit for parsing structured text.
Today, I'm happy to announce the long anticipated version 1.0 of Lark, marking the API as stable.
We've made quite a few breaking changes, in order to achieve congruous API with as little "gotchas" as possible. Upgrading to version 1.0 might require a few changes to your project.
Dropped Python 2 support! Lark now only supports Python 3.6 and up.
Install lark using pip install lark
(instead of lark-parser ).
maybe_placeholders
is now True by default.
Renamed TraditionalLexer
to BasicLexer
, and 'standard'
lexer option to 'basic'
.
Default priority is now 0, for both terminals and rules (used to be 1 for terminals).
Discard mechanism is now done by returning Discard, instead of raising it as an exception.
use_accepts
in UnexpectedInput.match_examples()
is now True by default.
v_args(meta=True)
now gives meta as the first argument. i.e. (meta, children)
.
%import python (...)
Many thanks to all our contributors and donors, who made this release possible. Special thanks goes to -
Published by erezsh about 3 years ago
We are now working on a Python3.6+ only v1.0 branch, which will soon become the default. See the work in progress: https://github.com/lark-parser/lark/pull/925
We also have a new online IDE! Check it out here: https://lark-parser.github.io/ide
Lark can now generate standalone Javascript parsers! Check it out here: https://github.com/lark-parser/Lark.js (still in beta)
Using rule repeat (~
syntax) is now much much faster for large numbers, thanks to @MegaIng
Bugfix for the propagate_positions
option. Added option value propagate_positions='ignore_ws'
.
Fixed reconstructor for when keep_all_tokens=True
Added merge_transformers
(Thanks Robin!)
Many minor bugfixes, and improvements to code and docs
Published by erezsh over 3 years ago
%import
), and updates the cache if necessaryLark.parse_interactive()
for starting the parser in interactive modeAdded ast_utils
, to assist in tranforming lark.Tree
into a customized AST.
Better docs
Bugfixes
In the near future, Lark will drop support for Python 2. We will continue to develop for Python 3.6+ only, which will simplify the code and ease development.
Old releases (including this one) will still work, of course, and should be stable enough to accompany the remaining Python 2 users into the sunset.
If you have any objections, feel free to voice them here: https://github.com/lark-parser/lark/discussions/874
Thanks for everyone who helped make Lark better!
Published by erezsh over 3 years ago
%override
and %extend
statements, which allow to rewrite and extend imported rules and tokens, similarly to class inheritance. (See this example: https://github.com/lark-parser/lark/blob/master/examples/advanced/extend_python.py)Indenter now throws DedentError instead of AssertionError
Improved the Python3 grammar, now works with reconstructor. (See this example: https://github.com/lark-parser/lark/blob/master/examples/advanced/reconstruct_python.py)
Lots of refactoring for a better tomorrow.
rule/terminals names can now be in unicode. (thanks @julienmalard)
Better errors.
Better type hints.
lark.lark
is now part of the standard library.
Earley:
Published by erezsh almost 4 years ago
Published by erezsh almost 4 years ago
LALR parser
The LALR parser now supports priority in rules, as a way to resolve collision errors
Improvements to the standalone tool, including more command-line options, like optional compression for the json data.
Improvements to the puppet error handling interface
Better error reporting on LALR collisions
Bugfixes in Earley
Misc
Added support for syntax highlighting in Atom
Fixes and improvements for the cache
option. cache=True
now uses a temporary directory instead of working directory.
Lark can now be imported directly from a zip (See: ed5c8ec51c4c6e8bd0ac80caff6afcb90a97d218)
Added more terminals to the grammar library (available for %import).
Nearley tools now supports case insensitive strings
Deprecated some interfaces
Improvements to docs, stubs, and various bugfixes
Thanks to @MegaIng for helping with Lark's maintenance, and to @ldbo, @chanicpanic, @michael-k, @ThatXliner and everyone else for their help and contributions.
Published by erezsh about 4 years ago
Complete overhaul of documentation. Now using sphinx to generate API docs from docstrings. (commit 0664cbd3d3c19e321cae8df044839e7baf7135af. Thank you @chsasank !)
New and friendlier Earley SPPF interface! (commit 555b268eb26bcbfce64991ea7517338dee85a840. Thank you @chanicpanic !)
Added the ambiguity='forest'
option. Added ForestTransformer
and TreeForestTranformer
.
Various Bugfixes to improve the handling of ambiguous results.
Read the docs here: https://lark-parser.readthedocs.io/en/latest/forest.html
New Vim syntax highlighting for Lark (https://github.com/lark-parser/vim-lark-syntax Thank you @omega16 !)
Lark now loads faster from cache (commit 7dc00179e63efa6e98d688bfba3265d382db79c4)
Terminals can now be composed of regexps and strings with different flags, if using Python 3.6+ (commit e6fc3c9b00306e3a8661210fcc93bf50479ee229)
Added support for parsing byte-strings, with the use_bytes
flag (commit 9ee8428f3f6ad285ad93e2b62ec47d33fff54768).
UnexpectedToken
exception now has the accepts
attribute, which contains a list of terminals that would be accepted by the parser instead (in addition to the expects
attribute, which is guided by the lexer and may include terminals that won't be accepted by the parser) (commit a7bcd0bc2d3cb96030d9e77523c0007e8034ce49)
Allow multiline regexes with the x
flag (commit 9923987e94547ded8a17d7a03840c4cebce39188)
Lark no longer uses the default logger. Instead uses lark.LOGGER
. (commit 7010f96825b5fbac79522d1b30689065df53dc8c)
Lark now notifies on unused terminals/rules through logging.debug
.
Standalone generator now creates smaller files (without comments and docstrings). Also undergone various fixes. (commit bf2d9bf7b16cddb39f2e0ea3cefecc8de5269e2c)
Wheel distribution due to (somewhat) popular demand.
Lots of small bugfixes and improvements!
Many thanks to @MegaIng for his continued work on many of these new features and fixes, and to everyone else who contributed to Lark and helped make it even better.
Published by erezsh over 4 years ago
Added error handling to LALR!
on_error
option to Lark.parse()
.Support for better regexps with the regex
module, when using Lark(..., regex=True)
Read here: https://lark-parser.readthedocs.io/en/latest/classes/#using-unicode-character-classes-with-regex