Skip to content

Variables Path

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

Variables: Path <<"path">>

Path variables create file-level dependencies by referencing other files in the project.

Syntax

<< "FROM" >>

Example

Given two files:

file.js:

import Class from '../otherfile.js';

otherfile.js:

function Class () {
  ...
}

Crodox Definition

<:import:> import <<name>> from <<"FROM".js>> <:>

The <<"FROM".js>> variable captures the file path and creates a dependency between file.js and otherfile.js. The string symbols (", ', `) do not need to be referred to in the Crodox definition - string objects get combined to an §§§ input element within the input parser.


File Extension Handling

The file extension specified in the variable determines how the path is captured:

<<"From".endung>>:  a/b/c.endung
=> "From" = a/b/c
<<"From">>:  a/b/c.endung
=> "From" = a/b/c.endung

When the extension is part of the variable declaration (e.g., <<"From".endung>>), it is separated from the captured path. When no extension is specified, the full path including the extension is captured.


Connecting Files and Variables

File variables should share the same name as the file grammar definition to establish a connection:

<~"FROM".ts~>       <<"FROM".ts>>

The file definition <~"FROM".ts~> and the path variable <<"FROM".ts>> both use "FROM" - this is how Crodox links a file reference to the correct subgrammar.


See also: Reference Variables · Uppercase Variables · All Variables

Clone this wiki locally