Fixed #29: Parsers: Implement parsing memoization

Fixed #77 : Parser: ShortTermMemoryParser should be called separately
Fixed #78 : Remove VariableNode usage
Fixed #79 : ConceptManager: Implement compile caching
Fixed #80 : SheerkaExecute : parsers_key is not correctly computed
Fixed #81 : ValidateConceptEvaluator : Validate concept's where and pre clauses right after the parsing
Fixed #82 : SheerkaIsAManager: isa() failed when the set as a body
Fixed #83 : ValidateConceptEvaluator : Support BNF and SYA Concepts
Fixed #84 : ExpressionParser: Implement the parser as a standard parser
Fixed #85 : Services: Give order to services
Fixed #86 : cannot manage smart_get_attr(the short, color)
This commit is contained in:
2021-06-07 21:14:03 +02:00
parent 1059ce25c5
commit 7dcaa9c111
92 changed files with 4263 additions and 1890 deletions
+15 -2
View File
@@ -1227,6 +1227,18 @@ class BnfNodeConceptExpressionVisitor(ParsingExpressionVisitor):
self.references.append(pe.concept)
class HasAChoiceExpressionVisitor(ParsingExpressionVisitor):
def __init__(self):
super().__init__()
self.result = False
def visit_OrderedChoice(self, parsing_expression):
self.result = True
def visit_UnOrderedChoice(self, parsing_expression):
self.result = True
class BnfConceptParserHelper:
def __init__(self, parser, debugger):
self.parser = parser
@@ -1480,6 +1492,7 @@ class BnfConceptParserHelper:
key = (template.key, template.id) if template.id else template.key
concept = sheerka.new(key)
concept = self.finalize_concept(sheerka, concept, underlying)
concept.get_hints().use_copy = True
concept_node = ConceptNode(concept,
underlying.start,
underlying.end,
@@ -1555,7 +1568,7 @@ class BnfConceptParserHelper:
_underlying.parsing_expression.rule_name not in _concept.get_compiled()):
var_value = _get_underlying_value(_underlying)
_add_compiled(_concept, _underlying.parsing_expression.rule_name, var_value)
_concept.get_metadata().need_validation = True
_concept.get_hints().need_validation = True
elif isinstance(_underlying, NonTerminalNode):
for child in _underlying.children:
@@ -1567,7 +1580,7 @@ class BnfConceptParserHelper:
concept.get_compiled()[ConceptParts.BODY] = value
if underlying.parsing_expression.rule_name:
_add_compiled(concept, underlying.parsing_expression.rule_name, value)
# KSI : Why don't we set concept.get_metadata().need_validation to True ?
# KSI : Why don't we set concept.get_hints().need_validation to True ?
# then recursively browse children to update concept variables
if isinstance(underlying, NonTerminalNode) and not isinstance(underlying.parsing_expression, ConceptExpression):