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

Tokenizes a single line of JSON/JSONC, promoting "key" tokens immediately followed by : to TokenKind.PROPERTY_NAME.

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

LineScanResult with JSON token spans.

Example
import klyn.code
import klyn.code.json

t = JsonTokenizer()
res = t.tokenizeLine("  \"version\": 1")
assert res.spans[1].kind == TokenKind.PROPERTY_NAME