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
+6 -14
View File
@@ -47,6 +47,7 @@ class TestExecutionContext(TestUsingMemoryBasedSheerka):
a.preprocess_evaluators = ["list of evaluators"]
a.protected_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
a.global_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
a.possible_variables = {"a", "b", "c"}
b = a.push(BuiltinConcepts.EVALUATION, "sub action context", desc="sub description")
@@ -65,8 +66,9 @@ class TestExecutionContext(TestUsingMemoryBasedSheerka):
assert b.preprocess_evaluators == a.preprocess_evaluators
assert b.protected_hints == {BuiltinConcepts.EVAL_BODY_REQUESTED}
assert b.global_hints == a.global_hints
assert b.possible_variables == a.possible_variables
def test_children_i_created_when_i_push(self):
def test_children_are_created_when_i_push(self):
sheerka = self.get_sheerka()
e = ExecutionContext("who_", Event("event"), sheerka, BuiltinConcepts.NOP, None)
@@ -75,19 +77,9 @@ class TestExecutionContext(TestUsingMemoryBasedSheerka):
e.push(BuiltinConcepts.NOP, None, who="c", desc="I do something else")
assert len(e._children) == 3
assert e._children[0].who, e._children[0].who == ("a", "I do something")
assert e._children[1].who, e._children[1].who == ("b", "oups! I did a again")
assert e._children[2].who, e._children[2].who == ("c", "I do something else")
# def test_i_can_add_variable_when_i_push(self):
# sheerka = self.get_sheerka()
#
# e = ExecutionContext("who_", Event("event"), sheerka, BuiltinConcepts.NOP, None)
# sub_e = e.push(BuiltinConcepts.NOP, None, who="a", my_new_var="new var value")
#
# assert sub_e.my_new_var == "new var value"
# with pytest.raises(AttributeError):
# assert e.my_new_var == "" # my_new_var does not exist in parent
assert (e._children[0].who, e._children[0].desc) == ("a", "I do something")
assert (e._children[1].who, e._children[1].desc) == ("b", "oups! I did a again")
assert (e._children[2].who, e._children[2].desc) == ("c", "I do something else")
def test_local_hints_are_local_and_global_hints_are_global(self):
sheerka = self.get_sheerka()