Added RET keyword
This commit is contained in:
@@ -84,6 +84,7 @@ class DefConceptNode(DefaultParserNode):
|
||||
pre: ReturnValueConcept = NotInitializedNode()
|
||||
post: ReturnValueConcept = NotInitializedNode()
|
||||
body: ReturnValueConcept = NotInitializedNode()
|
||||
ret: ReturnValueConcept = NotInitializedNode()
|
||||
definition: ReturnValueConcept = NotInitializedNode()
|
||||
definition_type: str = None
|
||||
|
||||
@@ -245,6 +246,7 @@ class DefaultParser(BaseParser):
|
||||
concept_found.pre = asts_found_by_parts[Keywords.PRE]
|
||||
concept_found.post = asts_found_by_parts[Keywords.POST]
|
||||
concept_found.body = asts_found_by_parts[Keywords.AS]
|
||||
concept_found.ret = asts_found_by_parts[Keywords.RET]
|
||||
|
||||
return concept_found
|
||||
|
||||
@@ -279,7 +281,13 @@ class DefaultParser(BaseParser):
|
||||
|
||||
def regroup_tokens_by_parts(self, keywords_tokens):
|
||||
|
||||
def_concept_parts = [Keywords.CONCEPT, Keywords.FROM, Keywords.AS, Keywords.WHERE, Keywords.PRE, Keywords.POST]
|
||||
def_concept_parts = [Keywords.CONCEPT,
|
||||
Keywords.FROM,
|
||||
Keywords.AS,
|
||||
Keywords.WHERE,
|
||||
Keywords.PRE,
|
||||
Keywords.POST,
|
||||
Keywords.RET]
|
||||
|
||||
# tokens found, when trying to recognize the parts
|
||||
tokens_found_by_parts = {
|
||||
@@ -289,6 +297,7 @@ class DefaultParser(BaseParser):
|
||||
Keywords.WHERE: None,
|
||||
Keywords.PRE: None,
|
||||
Keywords.POST: None,
|
||||
Keywords.RET: None,
|
||||
}
|
||||
current_part = Keywords.CONCEPT
|
||||
token = self.parser_input.token
|
||||
@@ -386,6 +395,7 @@ class DefaultParser(BaseParser):
|
||||
Keywords.WHERE: NotInitializedNode(),
|
||||
Keywords.PRE: NotInitializedNode(),
|
||||
Keywords.POST: NotInitializedNode(),
|
||||
Keywords.RET: NotInitializedNode()
|
||||
}
|
||||
|
||||
for keyword in tokens_found_by_parts:
|
||||
|
||||
@@ -67,7 +67,7 @@ class UnrecognizedNodeParser(BaseParser):
|
||||
has_unrecognized = True # never trust source code not. I may be an invalid source code
|
||||
|
||||
else: # cannot happen as of today :-)
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError(f"Node is {type(node)}, which is not supported yet")
|
||||
|
||||
# concept with UnrecognizedToken in their properties is considered as fatal error
|
||||
if self.has_error:
|
||||
|
||||
Reference in New Issue
Block a user