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

Tokenizes a single source line starting from initialState and returns the resulting TokenSpan list together with the end-of-line LexicalState.

Parameters
ParameterDescription
lineSingle source line (without trailing newline).
initialStateLexical state inherited from the previous line, or null for LexicalState.NORMAL.
Returns

LineScanResult containing the ordered TokenSpans and endState.

Example
import klyn.code
import klyn.code.klyn

tokenizer = KlynTokenizer()
scan = tokenizer.tokenizeLine("x as Int = 42", LexicalState.NORMAL)
assert scan.spans.size >= 4