Implemented FunctionParser
This commit is contained in:
@@ -558,6 +558,12 @@ class Sheerka(Concept):
|
||||
return self._get_unknown(metadata)
|
||||
|
||||
def resolve(self, concept):
|
||||
"""
|
||||
Try to find a concept by its name, id, or c:: definition
|
||||
A new instance (using new_from_template()) is returned when it's possible
|
||||
:param concept:
|
||||
:return:
|
||||
"""
|
||||
|
||||
def new_instances(concepts):
|
||||
if hasattr(concepts, "__iter__"):
|
||||
@@ -567,6 +573,9 @@ class Sheerka(Concept):
|
||||
if concept is None:
|
||||
return None
|
||||
|
||||
# ##############
|
||||
# PREPROCESS
|
||||
# ##############
|
||||
# if the entry is a concept token, use its values.
|
||||
if isinstance(concept, Token):
|
||||
if concept.type != TokenKind.CONCEPT:
|
||||
@@ -578,6 +587,9 @@ class Sheerka(Concept):
|
||||
(tmp := core.utils.unstr_concept(concept)) != (None, None):
|
||||
concept = tmp
|
||||
|
||||
# ##############
|
||||
# PROCESS
|
||||
# ##############
|
||||
# if the entry is a tuple
|
||||
# concept[0] is the name
|
||||
# concept[1] is the id
|
||||
@@ -599,7 +611,7 @@ class Sheerka(Concept):
|
||||
if isinstance(concept, str):
|
||||
if self.is_known(found := self.get_by_name(concept)):
|
||||
instances = new_instances(found)
|
||||
core.builtin_helpers.set_is_evaluated(instances)
|
||||
core.builtin_helpers.set_is_evaluated(instances, check_nb_variables=True)
|
||||
return instances
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user