Refactored Caching, Refactored BnfNodeParser, Introduced Sphinx

This commit is contained in:
2020-05-12 17:21:10 +02:00
parent 7d3a490bc5
commit 6e343ba996
110 changed files with 13865 additions and 7540 deletions
+8 -8
View File
@@ -79,18 +79,18 @@ class AddConceptEvaluator(OneReturnValueEvaluator):
continue
# try to find what can be a property
for p in self.get_props(sheerka, part_ret_val, name_to_use):
for p in self.get_variables(sheerka, part_ret_val, name_to_use):
props_found.add(p)
# add props by order of appearance when possible
# add variables by order of appearance when possible
for token in def_concept_node.name.tokens:
if token.value in props_found:
concept.def_prop(token.value, None)
concept.def_var(token.value, None)
# add the remaining properties
for p in props_found:
if p not in concept.props:
concept.def_prop(p, None)
if p not in concept.values:
concept.def_var(p, None)
# initialize the key
key_source = def_concept_node.definition.tokens if \
@@ -105,7 +105,7 @@ class AddConceptEvaluator(OneReturnValueEvaluator):
ret = sheerka.create_new_concept(context, concept)
if not ret.status:
error_cause = sheerka.value(ret.body)
error_cause = sheerka.objvalue(ret.body)
context.log(f"Failed to add concept '{concept.name}'. Reason: {error_cause}", self.name)
return sheerka.ret(self.name, ret.status, ret.value, parents=[return_value])
@@ -115,7 +115,7 @@ class AddConceptEvaluator(OneReturnValueEvaluator):
return [part.value for part in core.utils.strip_tokens(source.tokens, True)]
@staticmethod
def get_props(sheerka, ret_value, concept_name):
def get_variables(sheerka, ret_value, concept_name):
"""
Try to find out the variables
This function can only be a draft, as there may be tons of different situations
@@ -146,7 +146,7 @@ class AddConceptEvaluator(OneReturnValueEvaluator):
# case of concept
#
if isinstance(ret_value.value, ParserResultConcept) and isinstance(ret_value.value.value, Concept):
return list(ret_value.value.value.props.keys())
return list(ret_value.value.value.values.keys())
#
# case of BNF