|
|
@@ -247,20 +247,20 @@ def _make_full_earley_test(LEXER): |
|
|
|
assert x.data == '_ambig', x |
|
|
|
assert len(x.children) == 2 |
|
|
|
|
|
|
|
@unittest.skipIf(LEXER=='dynamic', "Not implemented in Dynamic Earley yet") # TODO |
|
|
|
def test_not_all_derivations(self): |
|
|
|
grammar = """ |
|
|
|
start: cd+ "e" |
|
|
|
|
|
|
|
!cd: "c" |
|
|
|
| "d" |
|
|
|
| "cd" |
|
|
|
|
|
|
|
""" |
|
|
|
l = Lark(grammar, parser='earley', ambiguity='explicit', lexer=LEXER, earley__all_derivations=False) |
|
|
|
x = l.parse('cde') |
|
|
|
assert x.data != '_ambig', x |
|
|
|
assert len(x.children) == 1 |
|
|
|
# @unittest.skipIf(LEXER=='dynamic', "Not implemented in Dynamic Earley yet") # TODO |
|
|
|
# def test_not_all_derivations(self): |
|
|
|
# grammar = """ |
|
|
|
# start: cd+ "e" |
|
|
|
|
|
|
|
# !cd: "c" |
|
|
|
# | "d" |
|
|
|
# | "cd" |
|
|
|
|
|
|
|
# """ |
|
|
|
# l = Lark(grammar, parser='earley', ambiguity='explicit', lexer=LEXER, earley__all_derivations=False) |
|
|
|
# x = l.parse('cde') |
|
|
|
# assert x.data != '_ambig', x |
|
|
|
# assert len(x.children) == 1 |
|
|
|
|
|
|
|
_NAME = "TestFullEarley" + (LEXER or 'Scanless').capitalize() |
|
|
|
_TestFullEarley.__name__ = _NAME |
|
|
|