Fixed some bugs

This commit is contained in:
2020-08-27 18:54:28 +02:00
parent 351c16f946
commit 37cd3ed757
27 changed files with 685 additions and 189 deletions
+1
View File
@@ -15,6 +15,7 @@ class ConceptOrRuleNameVisitor(ParsingExpressionVisitor):
"""
def __init__(self):
super().__init__()
self.names = set()
def visit_ConceptExpression(self, node):
+1 -2
View File
@@ -1,7 +1,6 @@
from core.builtin_concepts import ParserResultConcept, BuiltinConcepts
from evaluators.BaseEvaluator import OneReturnValueEvaluator
from parsers.BaseNodeParser import SourceCodeNode
from parsers.BnfNodeParser import ConceptNode
from parsers.BaseNodeParser import SourceCodeNode, ConceptNode
from parsers.PythonParser import LexerNodeParserHelperForPython, PythonNode
+10
View File
@@ -298,6 +298,12 @@ class PythonEvaluator(OneReturnValueEvaluator):
@staticmethod
def resolve_concept(context, concept_hint):
"""
Try to find a concept by its name, id or the pattern c:key|id:
:param context:
:param concept_hint:
:return:
"""
if isinstance(concept_hint, Concept):
return concept_hint
@@ -310,6 +316,10 @@ class PythonEvaluator(OneReturnValueEvaluator):
# So a concept was explicitly required, not its value
# We mark the concept as already evaluated, so it's body will not be evaluated
new_instance.metadata.is_evaluated = True
if len(concept.metadata.variables) > 0:
# In this situation, it means that we are dealing with the concept and not its instantiation
# So do not try to evaluate it
new_instance.metadata.is_evaluated = True
return new_instance