Managing concept properties in ConceptEvaluator
This commit is contained in:
@@ -23,9 +23,13 @@ class BuiltinConcepts(Enum):
|
||||
INVALID_RETURN_VALUE = 14 # the return value of an evaluator is not correct
|
||||
BEFORE_PARSING = 15 # activated before evaluation by the parsers
|
||||
PARSING = 16 # activated during the parsing. It contains the text to parse
|
||||
AFTER_PARSING = 17 # activated when the parsing process seems to be finished
|
||||
CONCEPT_ALREADY_DEFINED = 18 # when you try to add the same concept twice
|
||||
NOP = 19 # no operation concept. Does nothing
|
||||
AFTER_PARSING = 17 # after parsing
|
||||
BEFORE_EVALUATION = 18 # before evalution
|
||||
EVALUATION = 19 # activated when the parsing process seems to be finished
|
||||
AFTER_EVALUATION = 20 # activated when the parsing process seems to be finished
|
||||
CONCEPT_ALREADY_DEFINED = 21 # when you try to add the same concept twice
|
||||
NOP = 22 # no operation concept. Does nothing
|
||||
PROPERTY_EVAL_ERROR = 23
|
||||
|
||||
|
||||
"""
|
||||
@@ -198,11 +202,34 @@ class BeforeParsingConcept(Concept):
|
||||
super().__init__(BuiltinConcepts.BEFORE_PARSING, True, True, BuiltinConcepts.BEFORE_PARSING)
|
||||
|
||||
|
||||
class ParsingConcept(Concept):
|
||||
class EvaluationConcept(Concept):
|
||||
def __init__(self):
|
||||
super().__init__(BuiltinConcepts.PARSING, True, True, BuiltinConcepts.PARSING)
|
||||
super().__init__(BuiltinConcepts.EVALUATION, True, True, BuiltinConcepts.EVALUATION)
|
||||
|
||||
|
||||
class AfterParsingConcept(Concept):
|
||||
class AfterEvaluationConcept(Concept):
|
||||
def __init__(self):
|
||||
super().__init__(BuiltinConcepts.AFTER_PARSING, True, True, BuiltinConcepts.AFTER_PARSING)
|
||||
super().__init__(BuiltinConcepts.AFTER_EVALUATION, True, True, BuiltinConcepts.AFTER_EVALUATION)
|
||||
|
||||
|
||||
class PropertyEvalError(Concept):
|
||||
def __init__(self, property_name=None, concept=None, error=None):
|
||||
super().__init__(BuiltinConcepts.PROPERTY_EVAL_ERROR, True, False, BuiltinConcepts.PROPERTY_EVAL_ERROR)
|
||||
self.set_prop("concept", concept)
|
||||
self.set_prop("error", error)
|
||||
self.body = property_name
|
||||
|
||||
def __repr__(self):
|
||||
return f"PropertyEvalError(property={self.property_name}, concept={self.concept}), error={self.error})"
|
||||
|
||||
@property
|
||||
def concept(self):
|
||||
return self.props["concept"].value
|
||||
|
||||
@property
|
||||
def error(self):
|
||||
return self.props["error"].value
|
||||
|
||||
@property
|
||||
def property_name(self):
|
||||
return self.body
|
||||
|
||||
Reference in New Issue
Block a user