public classifyIdentifier(token as String, line as String, endIndex as Long, previousWord as String, inQueryBlock as Boolean) as TokenKind
Classifies an identifier token according to the active LanguageProfile and preceding word context.
| Parameter | Description |
|---|---|
token | Identifier substring. |
line | Full source line. |
endIndex | Exclusive end index of token in line. |
previousWord | Immediately preceding identifier/keyword on the same line, or "". |
inQueryBlock | true when scanning inside a contextual query block (e.g. Klyn KQL). |
Resolved TokenKind.
import klyn.code
p = LanguageProfile("java", "Java").withKeywords(["def", "class"]).withTypes(["int"])
t = CodeTokenizer(p)
assert t.classifyIdentifier("MyService", "class MyService:", 15, "class", false) == TokenKind.DECLARATION_NAME