Browse Source

Cleanup unused Derivation

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.6.6
night199uk 6 years ago
parent
commit
637f121109
2 changed files with 0 additions and 18 deletions
  1. +0
    -17
      lark/parsers/earley_common.py
  2. +0
    -1
      lark/parsers/earley_forest.py

+ 0
- 17
lark/parsers/earley_common.py View File

@@ -13,23 +13,6 @@
# Author: Erez Shinan (2017) # Author: Erez Shinan (2017)
# Email : erezshin@gmail.com # Email : erezshin@gmail.com


## for recursive repr
from ..tree import Tree

class Derivation(Tree):
def __init__(self, rule, children = None):
Tree.__init__(self, 'drv', children if children is not None else [])
self.meta.rule = rule
self._hash = None

def __repr__(self, indent = 0):
return 'Derivation(%s, %s, %s)' % (self.data, self.rule.origin, '...')

def __hash__(self):
if self._hash is None:
self._hash = Tree.__hash__(self)
return self._hash

class Item(object): class Item(object):
"An Earley Item, the atom of the algorithm." "An Earley Item, the atom of the algorithm."




+ 0
- 1
lark/parsers/earley_forest.py View File

@@ -13,7 +13,6 @@ from ..exceptions import ParseError
from ..lexer import Token from ..lexer import Token
from ..utils import Str from ..utils import Str
from ..grammar import NonTerminal, Terminal from ..grammar import NonTerminal, Terminal
from .earley_common import Derivation


from collections import deque from collections import deque
from importlib import import_module from importlib import import_module


Loading…
Cancel
Save