Added keyword c:xxx: to express that we want the concept, not its body

This commit is contained in:
2019-12-29 18:56:41 +01:00
parent 81b2355633
commit 197b0700fa
9 changed files with 191 additions and 65 deletions
+6 -1
View File
@@ -86,7 +86,12 @@ class BaseParser:
if not hasattr(tokens, "__iter__"):
tokens = [tokens]
switcher = {
TokenKind.KEYWORD: lambda t: Keywords(t.value).value,
TokenKind.CONCEPT: lambda t: f"__C__{t.value}__C__"
}
for token in tokens:
value = Keywords(token.value).value if token.type == TokenKind.KEYWORD else token.value
value = switcher.get(token.type, lambda t: t.value)(token)
res += value
return res