public static extractIdentifiers(tokenizer as Tokenizer, source as String, minLength as Int = 2) as ArrayList<String>
Extracts all unique identifiers appearing in executable code (excluding comments and literals).
| Parameter | Description |
|---|---|
tokenizer | Language tokenizer to use. |
source | Source code text. |
minLength | Minimum identifier length to include (default 2). |
Ordered list of unique identifier names.
import klyn.code import klyn.code.klyn ids = SourceTokenCursor.extractIdentifiers(KlynTokenizer(), "count = count + step # ignoreThis") assert "count" in ids assert "step" in ids assert "ignoreThis" not in ids