Fixed #20: I can parse simple concepts

This commit is contained in:
2023-07-09 18:08:47 +02:00
parent ba397b0b72
commit 57f9ce2bbb
44 changed files with 2462 additions and 149 deletions
+10 -5
View File
@@ -27,7 +27,12 @@ class DefinitionType:
class ConceptMetadata:
"""
Static information of the Concept
What is the difference between variable and parameter ?
A variable is an attribute of the concept
A parameter is a variable that must be set upon instantiation
for example :
def concept a plus b def_var a b => a and b are parameters (and also variables)
def concept color def_var color_name => color_name is a variable, but not a parameter
"""
id: str # unique identifier for a concept. The id will never be modified (but the key can)
name: str
@@ -45,8 +50,8 @@ class ConceptMetadata:
autouse: bool # indicates if eval must be automatically called on the concept once validated
bound_body: str # which property must be considered have default value for the concept
props: dict # hashmap of properties, values
variables: tuple # list of concept variables(tuple), with their default values
parameters: tuple # list of variables that are part of the name of the concept
variables: list # list of concept variables(tuple), with their default values
parameters: set # variables that are part of the definition of the concept
digest: str = None
all_attrs: tuple = None
@@ -138,7 +143,7 @@ class Concept:
return True
def __hash__(self):
return self._metadata.digest
return hash(self._metadata.digest)
@property
def id(self):
@@ -198,5 +203,5 @@ class Concept:
except AttributeError:
return NotInit if name in self.all_attrs() else NotFound
def get_runtime_info(self):
def get_runtime_info(self) -> ConceptRuntimeInfo:
return self._runtime_info