Skip to content

Commit

Permalink
Revert "Basic %ignore implementation"
Browse files Browse the repository at this point in the history
This reverts commit 22e2fe9
  • Loading branch information
MegaIng committed Sep 25, 2021
1 parent 7e955fa commit 42ab48a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lark/load_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ def rule_dependencies(symbol):
self._definitions = {k: v for k, v in self._definitions.items() if k in _used}


def resolve_import(self, dotted_path: Tuple[str, ...], base_path: Optional[str]) -> Tuple[str, Union[str, PackageResource]]:
def resolve_import(self, dotted_path: Tuple[str, ...], base_path: Optional[str]) -> tuple[str, Union[str, PackageResource]]:
assert dotted_path
grammar_path = os.path.join(*dotted_path) + EXT
to_try = self.import_paths + ([base_path] if base_path is not None else []) + [stdlib_loader]
Expand Down
9 changes: 0 additions & 9 deletions tests/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,6 @@ def test_import_custom_sources3(self):
x = p.parse('12 capybaras')
self.assertEqual(x.children, ['12', 'capybaras'])

def test_include(self):
grammar = """
start: startab
%include .grammars.ab
"""
p = Lark(grammar, source_path=__file__)
self.assertEqual(p.parse('ab'),
Tree('start', [Tree('startab', [Tree('expr', [Token('A', 'a'), Token('B', 'b')])])]))

def test_find_grammar_errors(self):
text = """
a: rule
Expand Down
2 changes: 1 addition & 1 deletion tests/test_nearley/nearley

0 comments on commit 42ab48a

Please sign in to comment.