Skip to main content

Module rules

Module rules 

Source
Expand description

The Shell -> JavaScript substitution rules.

Every construct the formalizer can produce has exactly one TranslationRule here: a LinkQuery selecting the links it owns, plus one template per target language. Nothing about the translation lives outside this file — super::engine only walks the network and substitutes.

Four target languages express the four contexts a node can appear in:

languagecontextexample
JavaScripta statementawait $`ls`;
JavaScript:commandtext inside ``$`…```ls
JavaScript:valuetext inside `…`ls without quoting
JavaScript:expressiona JavaScript valueprocess.env.HOME

Placeholder syntax is documented in super::engine.

Constants§

COMMAND
EXPRESSION
TARGET
VALUE

Functions§

build_rule_set
Builds the Shell -> JavaScript rule set.
language_fallbacks
A :value rendering falls back to the :command one when unquoting is a no-op.
modes
Placeholder modes available to the templates below.