public isCodePosition(line as String, column as Long, initialState as LexicalState = null) as Boolean
Checks whether the zero-based column in line is a code position (outside comments and string/character/regex literals).
| Parameter | Description |
|---|---|
line | Source line text. |
column | Zero-based column offset. |
initialState | Lexical state at the start of line. |
true when column is in executable code.
import klyn.code
import klyn.code.klyn
tokenizer = KlynTokenizer()
assert tokenizer.isCodePosition("x = 1 # comment", 2, LexicalState.NORMAL)
assert not tokenizer.isCodePosition("x = 1 # comment", 10, LexicalState.NORMAL)