Browse Source

Merge branch 'refactor' of https://github.com/SupraSummus/lark into SupraSummus-refactor

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.6.6
Erez Shinan 5 years ago
parent
commit
71bb980271
3 changed files with 1 additions and 10 deletions
  1. +0
    -3
      lark/lark.py
  2. +0
    -4
      lark/reconstruct.py
  3. +1
    -3
      lark/tools/standalone.py

+ 0
- 3
lark/lark.py View File

@@ -117,9 +117,6 @@ class Lark:
self.source = grammar.name
except AttributeError:
self.source = '<string>'
cache_file = "larkcache_%s" % str(hash(grammar)%(2**32))
else:
cache_file = "larkcache_%s" % os.path.basename(self.source)

# Drain file-like objects to get their contents
try:


+ 0
- 4
lark/reconstruct.py View File

@@ -101,10 +101,7 @@ class Reconstructor:
for origin, rule_aliases in aliases.items():
for alias in rule_aliases:
yield Rule(origin, [Terminal(alias)], alias=MakeMatchTree(origin.name, [NonTerminal(alias)]))
yield Rule(origin, [Terminal(origin.name)], alias=MakeMatchTree(origin.name, [origin]))


def _match(self, term, token):
if isinstance(token, Tree):
@@ -128,4 +125,3 @@ class Reconstructor:

def reconstruct(self, tree):
return ''.join(self._reconstruct(tree))


+ 1
- 3
lark/tools/standalone.py View File

@@ -45,9 +45,7 @@ from collections import defaultdict

import lark
from lark import Lark
from lark.parsers.lalr_analysis import Shift, Reduce

from ..grammar import Rule
from lark.parsers.lalr_analysis import Reduce

_dir = path.dirname(__file__)
_larkdir = path.join(_dir, path.pardir)


Loading…
Cancel
Save