Fixed variable recognition when it is a concept

This commit is contained in:
2020-11-20 17:24:52 +01:00
parent 315f8ea09b
commit 0e945fe0fd
8 changed files with 79 additions and 36 deletions
+7 -1
View File
@@ -18,6 +18,12 @@ class ChickenAndEggError(Exception):
concepts: Set[str]
@dataclass
class NoFirstTokenError(ErrorNode):
concept: Concept
key: str
@dataclass()
class LexerNode(Node):
start: int # starting index in the tokens list
@@ -891,7 +897,7 @@ class BaseNodeParser(BaseParser):
if keywords is None:
# no first token found for a concept ?
return sheerka.ret(sheerka.name, False, concept)
return sheerka.ret(sheerka.name, False, NoFirstTokenError(concept, concept.key))
for keyword in keywords:
res.setdefault(keyword, []).append(concept.id)