klyn.code.klyn.KlynTokenizer.tokenizeLine
method
public override tokenizeLine(line as String, initialState as LexicalState = null) as LineScanResult
Description

Tokenizes a single line of Klyn code with contextual KQL query: state and regex literal support.

Parameters
ParameterDescription
lineSingle line of Klyn source text.
initialStateLexical state inherited from the previous line.
Returns

LineScanResult with spans and updated LexicalState.

Example
import klyn.code
import klyn.code.klyn

t = KlynTokenizer()
r1 = t.tokenizeLine("    query:", LexicalState.NORMAL)
assert r1.endState.inQueryBlock()
r2 = t.tokenizeLine("        select id from users where active", r1.endState)
assert r2.spans[1].kind == TokenKind.QUERY_KEYWORD