Erez Shinan
f67eead0b4
Added error when using terminal weights in dynamic earley (Discussed in #324 )
6 years ago
Erez Shinan
4e6f92b03b
Support relative rule import in interactive environment (Issue #335 )
6 years ago
Erez Shinan
e16bb35576
Change maybe_placeholders: Apply to [a] and [a b c], but not a? or (a b)? or [_a _b _c]
6 years ago
Rogdham
2f6b97cfd3
Allow renaming relative import rule
%import .local.foo -> bar
6 years ago
Rogdham
9b22d41e49
Change namespace naming and aliasing for imports
The `.` character is invalid as a group name in regex, replacing by `__`.
The bug arose in `lexer._build_mres`.
6 years ago
Kyungdahm Yun
d5c9006f01
Fix literal range escape assertion
6 years ago
Kyungdahm Yun
70d724732d
Support hex escape (\xhh) in string literal
6 years ago
Erez Shinan
d1fea12aa5
Remove duplicates of empty rules (Issue #315 )
6 years ago
Erez Shinan
145d8a8e7c
Don't compile unused terminals (mentioned in issue #309 )
6 years ago
Erez Shinan
c4f8483c09
Small fix
6 years ago
night199uk
80a09697fe
Rebuild the way Earley prioritizes ambiguities
- Makes rule ordering the default ambiguity tie breaker.
E.g.
start: a | b
a: "A"
b: "A"
will return:
start
a
start: b | a
a: "A"
b: "A"
will return
start
b
- Replaces the ambiguity='resolve__antiscore_sum' with a separate option: 'priority'.
The priority option has 4 values: 'auto', 'none', 'normal', 'invert'.
'Auto' maps to 'Normal' for CYK and Earley and 'None' for LALR.
'None' filters your priorities and ignores them. This saves some extra tree walking on Earley.
'Normal' uses your priorities untouched, mimicing the old behaviour.
'Invert' negates your priorities, emulating the old 'resolve__antiscore_sum' behaviour.
This allows you to use priority logic even when ambiguity=='explicit', to get a better idea
of the shape of your tree; and to easily disable priorities without removing them from the
grammar for testing (or performance).
- ambiguity='explicit' now correctly returns an ambiguous tree again, as 0.6 did.
6 years ago
night199uk
a543eeb162
Fix assert on empty options for a Rule
6 years ago
evandrocoan
48351c3d3e
Trimmed whitespaces and ensured a new line on the end of the file
6 years ago
Erez Shinan
467483553b
Fixed placeholder code, should work as expected (Issue #285 )
6 years ago
Erez Shinan
adb30180aa
maybe_placeholder now doesn't apply to anonymous terminals
6 years ago
Erez Shinan
222df5bab4
New Feature: Added maybe_placeholders option (Issue #285 )
6 years ago
Erez Shinan
149f7cec1f
BUGFIX: Importing the same grammar twice could lead to unexpected behavior (Issue #268 )
6 years ago
Jan Rydzewski
3ef84318b1
Removed unused imports and variables
6 years ago
Erez Shinan
21bbf9b970
Experimental support for importing rules
6 years ago
Erez Shinan
f048bfb870
Refactoring around terminals / tokens
6 years ago
Erez Shinan
ce75758f76
BUGFIX: Automatic terminal names didn't respect existing terminals(Issue #224 )
6 years ago
Erez Shinan
86c8ad41c9
BUGFIX affecting standalone generator (Issue #212 )
6 years ago
Erez Shinan
86cef7e654
Fix for issue #188
6 years ago
Erez Shinan
b924d87293
Fix error
6 years ago
Erez Shinan
32b78b8ee5
BUGFIX: Repeated use of optional rules tripped up the simplifier, manifesting when aliases were used (Issue #197 )
6 years ago
Erez Shinan
cffd610e77
Fixed reconstructor. All tests passing
6 years ago
Erez Shinan
454c88b58a
Refactoring and fixes for merge 2fd0087
6 years ago
Julien Malard
12004b3c65
Reimplemented relative and multiple imports.
6 years ago
Erez Shinan
1247a8c330
Improved error messages (as pointed out in issue #181 )
6 years ago
Erez Shinan
0240e1c248
Fixed issue where Lark would throw RecursionError for huge grammars (Issue #181 )
6 years ago
Erez Shinan
a49df1b2e4
Added option to provide a custom lexer (with example)
6 years ago
Julien Malard
405f6a399d
From and relative type imports seem to work.
6 years ago
Erez Shinan
5c6df8e825
Moved and restructured exceptions
* All exceptions are now under exceptions.py
* UnexpectedInput is now superclass of UnexpectedToken and UnexpectedCharacters,
all of which support the get_context() and match_examples() methods.
6 years ago
Erez Shinan
c0cf1b3176
Added some docstrings, removed is_terminal from common
6 years ago
Erez Shinan
6d76a4ce8d
visitor_args -> v_args
6 years ago
Erez Shinan
ac0d49e7ab
Added %declare
6 years ago
Erez Shinan
6bfc27c11d
New transformers near completion
Nearley tool still needs fixing
6 years ago
Erez Shinan
5e546f38a9
args decorators actually work now
6 years ago
Erez Shinan
9daacb9082
Refactored transformers, better code
6 years ago
Erez Shinan
55e9d56792
Missed those at merge
6 years ago
Erez Shinan
ea413fd648
Simplify PrepareAnonTerminals
6 years ago
Erez Shinan
0d56b0cf30
Anon terminals no longer need to start with _
6 years ago
Erez Shinan
7b32ffd83a
Fixed token visibility rules (Issue #109 )
Anonymous tokens would become visible if they had the same value as named tokens.
That's because they are merged for the lexer. But after this change, the rules for
visibility are based on their use in the rule, and not their name or identity.
6 years ago
Erez Shinan
c5e6cf0954
Refactoring to introduce Symbol instances before creating anons
6 years ago
Erez Shinan
1839c324d3
Small refactoring step
6 years ago
Erez Shinan
33caa391d5
Breaking backwards compatibility:
* Removed the scanless parsing feature (dynamic lexing is king)
* Default LALR lexer is now contextual
6 years ago
Erez Shinan
67f372c994
Symbols instead of strings - initial
6 years ago
Erez Shinan
51644a6c58
Added examples/lark.g - Reference implementation of the Lark grammar
(inspired by issue #116 )
6 years ago
Erez Shinan
9848cac9f0
Improved Lark's error reporting for grammar syntax errors (Based on PR #129 )
6 years ago
Rob Rose
ca3d4ca6f4
Changing changes from .lrk to .lark
6 years ago