public static scanDeclarations(source as String, tokenizer as Tokenizer) as ArrayList<DeclarationNode>
Scans source using tokenizer and returns an ordered list of extracted DeclarationNodes.
| Parameter | Description |
|---|---|
source | Full source code text. |
tokenizer | Language tokenizer providing lexical classification and LanguageProfile. |
Flat ordered list of discovered declarations.
import klyn.code
import klyn.code.ast
p = LanguageProfile("python", "Python").withDefinitionMode("python").withLineComments(["#"])
nodes = DeclarationScanner.scanDeclarations("class Worker:\n def run(self):\n pass", CodeTokenizer(p))
assert nodes.size == 2