onlinejudge_template.analyzer.variables module

the module to analyze free variables in format trees

この module はフォーマット木の中に自由に出現する変数を分析します。 たとえば

sequence([
    item("N"),
    newline(),
    loop(counter="i", size="N",
        item("A", indices="i + 1")
    ),
    newline(),
])

のようなフォーマット木 (FormatNode) が与えられれば

{
    "N": {
    },
    "A": {
        "dims": ["N"],
        "bases": ["1"],
        "depending": ["N"],
    },
}

のような情報 (VarDecl を値とする辞書) を返します。 型の情報は取得できないことに注意してください。

exception onlinejudge_template.analyzer.variables.DeclaredVariablesError[source]

Bases: onlinejudge_template.types.AnalyzerError

onlinejudge_template.analyzer.variables.list_declared_variables(node: onlinejudge_template.types.FormatNode) → Dict[NewType.<locals>.new_type, onlinejudge_template.types.VarDecl][source]
Raises:DeclaredVariablesError