public collectIdentifiers(source as String, minLength as Long = 2) as ArrayList<String>
Collects all unique identifier tokens of length >= minLength occurring in code positions (outside comments and string/character/regex literals) in source.
| Parameter | Description |
|---|---|
source | Full document text. |
minLength | Minimum identifier character length. |
Ordered list of unique identifiers found in source.
import klyn.code.klyn
t = KlynTokenizer()
ids = t.collectIdentifiers("alpha = beta + alpha # ignore_comment")
assert "alpha" in ids
assert "beta" in ids
assert "ignore_comment" not in ids