public isCodePositionInSource(source as String, targetLine as Long, targetColumn as Long) as Boolean
Checks whether (targetLine, targetColumn) in a multi-line source document is a code position (outside comments and string/character/regex literals).
| Parameter | Description |
|---|---|
source | Full document text. |
targetLine | Zero-based line index. |
targetColumn | Zero-based column offset. |
true when (targetLine, targetColumn) is in executable code.
import klyn.code.klyn
t = KlynTokenizer()
assert t.isCodePositionInSource("x = 1\ny = \"str\"", 0, 2)
assert not t.isCodePositionInSource("x = 1\ny = \"str\"", 1, 6)