First version of explain. Creating a new parser was a wrong approach. Need to reimplement
This commit is contained in:
@@ -58,6 +58,7 @@ class BuiltinConcepts(Enum):
|
||||
WHERE_CLAUSE_FAILED = "where clause failed" # failed to validate where clause during evaluation
|
||||
CHICKEN_AND_EGG = "chicken and egg" # infinite recursion when declaring concept
|
||||
ISA = "is a" # builtin concept to express that a concept is an instance of another one
|
||||
EXPLANATION = "explanation"
|
||||
|
||||
NODE = "node"
|
||||
GENERIC_NODE = "generic node"
|
||||
@@ -436,3 +437,17 @@ class NotForMeConcept(Concept):
|
||||
|
||||
def __repr__(self):
|
||||
return f"NotForMeConcept(source={self.body}, reason={self.get_prop('reason')})"
|
||||
|
||||
|
||||
class ExplanationConcept(Concept):
|
||||
def __init__(self, digest=None, command=None, title=None, instructions=None, execution_result=None):
|
||||
super().__init__(BuiltinConcepts.EXPLANATION,
|
||||
True,
|
||||
False,
|
||||
BuiltinConcepts.EXPLANATION)
|
||||
self.def_prop("digest", digest) # event digest
|
||||
self.def_prop("command", command) # explain command parameters
|
||||
self.def_prop("title", title) # a title to the explanation
|
||||
self.def_prop("instructions", instructions) # instructions for SheerkaPrint
|
||||
self.set_metadata_value(ConceptParts.BODY, execution_result) # list of results
|
||||
self.metadata.is_evaluated = True
|
||||
|
||||
Reference in New Issue
Block a user