Implemented a first and basic version of a Rete rule engine
This commit is contained in:
@@ -42,6 +42,9 @@ class LexerNode(Node):
|
||||
def to_short_str(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def get_source_to_parse(self):
|
||||
return self.source
|
||||
|
||||
|
||||
class UnrecognizedTokensNode(LexerNode):
|
||||
def __init__(self, start, end, tokens):
|
||||
@@ -296,6 +299,12 @@ class SourceCodeNode(LexerNode):
|
||||
def to_short_str(self):
|
||||
return f"SCN('{self.source}')"
|
||||
|
||||
def get_python_node(self):
|
||||
return self.python_node
|
||||
|
||||
def get_source_to_parse(self):
|
||||
return self.python_node.source
|
||||
|
||||
|
||||
class SourceCodeWithConceptNode(LexerNode):
|
||||
"""
|
||||
@@ -409,6 +418,12 @@ class SourceCodeWithConceptNode(LexerNode):
|
||||
def to_short_str(self):
|
||||
return f"SCWC({self.first}" + ", ".join(n.to_short_str for n in self.nodes) + f"{self.last})"
|
||||
|
||||
def get_python_node(self):
|
||||
return self.python_node
|
||||
|
||||
def get_source_to_parse(self):
|
||||
return self.python_node.source
|
||||
|
||||
|
||||
@dataclass()
|
||||
class GrammarErrorNode(ParsingError):
|
||||
|
||||
Reference in New Issue
Block a user