Skip to content

Variables

Benedict Albrecht edited this page Jun 2, 2026 · 3 revisions

Variables

Variables capture tokens from parsed source code and are the foundation of Crodox's dependency resolution system. How a variable is declared determines its type, scope, and behavior.


Scoping Model

graph TB
    GLOBAL["🌐 :global<br/>Visible everywhere"]

    UP["⬆️ :up<br/>Parent objects"]
    SIBLINGS["↔️ :siblings<br/>All siblings"]
    FOLLOWING["➡️ :following<br/>Following siblings<br/><i>(default)</i>"]
    DOWN["⬇️ :down<br/>Child objects"]
    HOOK["🪝 :hook<br/>Hooked object"]

    CURRENT(("Current<br/>Object"))

    CURRENT --> UP
    CURRENT --> DOWN
    CURRENT --> SIBLINGS
    CURRENT --> FOLLOWING
    CURRENT --> GLOBAL
    CURRENT --> HOOK

    style CURRENT fill:#e67e22,color:#fff
    style FOLLOWING fill:#27ae60,color:#fff
    style GLOBAL fill:#4a90d9,color:#fff
Loading

Variable Types

Syntax Type Creates Dependency Overwrites
<< var >> Standard
<< "path" >> Path - -
<< 'var' >> Reference
<< VAR >> Uppercase

Scope Reference

Scope Direction Description
:following Forward Visible to siblings that come after this object (default)
:up Upward Visible to parent objects
:down Downward Visible to child objects
:siblings Lateral Visible to all siblings (before and after)
:global Everywhere Visible to all objects in the grammar
:hook Targeted Visible to a specifically hooked object

Detailed Pages

Types:

Scoping:


Next: Variable Declarations - How variables are declared in grammar definitions.

Clone this wiki locally