Implemented a first and basic version of a Rete rule engine

This commit is contained in:
2021-02-09 16:06:32 +01:00
parent 821dbed189
commit a2a8d5c5e5
110 changed files with 7301 additions and 1654 deletions
+6 -6
View File
@@ -53,7 +53,7 @@ class UnrecognizedNodeParser(BaseParser):
if not res.status:
self.add_error(res.body)
else:
sequences_found = core.utils.product(sequences_found, [res.body])
sequences_found = core.utils.sheerka_product(sequences_found, [res.body])
elif isinstance(node, UnrecognizedTokensNode):
res = parse_unrecognized(context, node.source, PARSERS)
@@ -62,16 +62,16 @@ class UnrecognizedNodeParser(BaseParser):
lexer_nodes = get_lexer_nodes(res.body.body, node.start, node.tokens)
if lexer_nodes:
# make lexer_nodes is not empty (for example, some Python result are discarded)
sequences_found = core.utils.product(sequences_found, lexer_nodes)
sequences_found = core.utils.sheerka_product(sequences_found, lexer_nodes)
else:
sequences_found = core.utils.product(sequences_found, [node])
sequences_found = core.utils.sheerka_product(sequences_found, [node])
has_unrecognized = True
else:
sequences_found = core.utils.product(sequences_found, [node])
sequences_found = core.utils.sheerka_product(sequences_found, [node])
has_unrecognized = True
elif isinstance(node, SourceCodeNode):
sequences_found = core.utils.product(sequences_found, [node])
sequences_found = core.utils.sheerka_product(sequences_found, [node])
has_unrecognized = True # to let PythonWithConceptParser validate the code
elif isinstance(node, SourceCodeWithConceptNode):
@@ -82,7 +82,7 @@ class UnrecognizedNodeParser(BaseParser):
break
else:
node.nodes[i] = res.body
sequences_found = core.utils.product(sequences_found, [node])
sequences_found = core.utils.sheerka_product(sequences_found, [node])
has_unrecognized = True # to let PythonWithConceptParser validate the code
else: # cannot happen as of today :-)