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

Tokenizes a single line of source code starting from initialState.

Parameters
ParameterDescription
lineSource line text.
initialStateLexical state at the start of line, or null for LexicalState.NORMAL.
Returns

LineScanResult with spans and endState.

Example
import klyn.code

p = LanguageProfile("java", "Java").withLineComments(["//"]).withKeywords(["return"])
t = CodeTokenizer(p)
res = t.tokenizeLine("return 42; // done")
assert res.spans.size > 0