klyn.code.DeclarationScanner.scanDeclarations
method
public static scanDeclarations(source as String, tokenizer as Tokenizer) as ArrayList<DeclarationNode>
Description

Scans source using tokenizer and returns an ordered list of extracted DeclarationNodes.

Parameters
ParameterDescription
sourceFull source code text.
tokenizerLanguage tokenizer providing lexical classification and LanguageProfile.
Returns

Flat ordered list of discovered declarations.

Example
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