public static findDefinition(source as String, symbol as String, tokenizer as Tokenizer) as ArrayList<Long>
Locates the first declaration of symbol in source using tokenizer. Returns [line, column] (0-based) or null if no declaration is found.
| Parameter | Description |
|---|---|
source | Full source code text. |
symbol | Identifier name to resolve. |
tokenizer | Language tokenizer. |
Two-element ArrayList<Long> [line, column] or null.
import klyn.code
import klyn.code.ast
p = LanguageProfile("klyn", "Klyn").withDefinitionMode("klyn").withLineComments(["#"])
loc = DeclarationScanner.findDefinition("public class Order:\n public total() as Int:\n return 0", "total", CodeTokenizer(p))
assert loc is not null and loc[0] == 1