Added first version of DebugManager. Implemented draft of the rule engine

This commit is contained in:
2020-11-20 13:41:45 +01:00
parent cd066881b4
commit 315f8ea09b
156 changed files with 8388 additions and 2852 deletions
+10 -4
View File
@@ -3,16 +3,24 @@ from typing import List
from core.builtin_concepts import BuiltinConcepts
from core.builtin_helpers import get_lexer_nodes_from_unrecognized, update_compiled
from core.concept import Concept
from core.sheerka.services.SheerkaExecute import ParserInput
from core.tokenizer import TokenKind, Token
from core.utils import get_n_clones
from parsers.SequenceNodeParser import SequenceNodeParser
from parsers.BaseNodeParser import SourceCodeNode, SourceCodeWithConceptNode, UnrecognizedTokensNode
from parsers.BaseParser import BaseParser, UnexpectedTokenErrorNode, UnexpectedEofNode, Node
from parsers.BnfNodeParser import BnfNodeParser
from parsers.PythonWithConceptsParser import PythonWithConceptsParser
from parsers.RuleParser import RuleParser
from parsers.SyaNodeParser import SyaNodeParser
# No need to check for Python code as the source code node will resolve to python code anyway
# I only look for concepts, so
PARSERS = ["BnfNode", "SyaNode", "AtomNode"]
PARSERS = [RuleParser.NAME,
SequenceNodeParser.NAME,
BnfNodeParser.NAME,
SyaNodeParser.NAME]
@dataclass
@@ -334,8 +342,6 @@ class FunctionParser(BaseParser):
res = [SourceCodeWithConceptNode(function_node.first.to_unrecognized(), function_node.last.to_unrecognized())]
function_name = function_node.first.str_value()
for param in function_node.parameters:
if isinstance(param.value, NamesNode):
# try to recognize concepts
@@ -383,7 +389,7 @@ class FunctionParser(BaseParser):
# make sure that concepts found can be evaluated
errors = []
for c in source_code_node.python_node.concepts.values():
for c in [c for c in source_code_node.python_node.objects.values() if isinstance(c, Concept)]:
update_compiled(self.context, c, errors)
return res