Skip to contents

The AST uses one class name for two structurally different things: a declaration (new_set(), carrying data, desc and friends) and a reference (ast_set(), carrying a name and the dims it is used at). The "multimod" class marker is what separates them - measured across the whole packaged model, it sits on every declaration and on nothing else.

Usage

is_declaration(x)

Arguments

x

An AST node.

Value

TRUE for a declaration, FALSE otherwise.

Details

Prefer this to inherits(x, "multimod"), which says what the marker is rather than what it means.

Examples

is_declaration(new_set("tech"))   # TRUE
#> [1] TRUE
is_declaration(ast_set("tech"))   # FALSE
#> [1] FALSE