klyn.code.CodeTokenizer.classifyIdentifier
method
public classifyIdentifier(token as String, line as String, endIndex as Long, previousWord as String, inQueryBlock as Boolean) as TokenKind
Description

Classifies an identifier token according to the active LanguageProfile and preceding word context.

Parameters
ParameterDescription
tokenIdentifier substring.
lineFull source line.
endIndexExclusive end index of token in line.
previousWordImmediately preceding identifier/keyword on the same line, or "".
inQueryBlocktrue when scanning inside a contextual query block (e.g. Klyn KQL).
Returns

Resolved TokenKind.

Example
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