-
Notifications
You must be signed in to change notification settings - Fork 0
Placeholder Definition
⚠️ ⚠️ THIS WIKI IS BEING USED TO JOT DOWN IDEAS AT PRESENT. DON'T ASSUME ANYTHING IS FIXED.⚠️ ⚠️
A treacle place holder has the following form:
{{ source < arg1,arg2,argN > filter1 < arg1,arg2,argN > filterN < arg1,argN }}
or
{{ source: arg1,arg2,argN | filter1: arg1,arg2,argN | filterN: arg1,argN }}
Arguments (arg) are optional. If they are omitted then the preceding :
or <
must also be omitted. There is no limit to the number of arguments. Only @
command sources and filters take arguments. The number and type of arguments depends on the command or filter they are being used with. An argument is either given a literal value or it can take its value from a placeholder. A variable name can also be specified as an argument. This is a shorthand for {{ variable-name }}
There can be zero or more filters chained together. If there are no filters then the |
or >
must be omitted. A filter is either a predefined filter, or can be an @command that takes one argument. The command's argument is supplied by the input to the filter and its output is piped out of the filter.
in BNF:
<placeholder> ::= "{{" <source> [ <filter-chain> ] "}}"
<source> ::= <variable> | <command> | <literal-value>
<filter-chain> ::= <filter-pipe> <filter> [ <args-group> ]
[ <filter-chain> ]
<args-group> ::= <args-pipe> <args>
<args> ::= <arg> [ "," <args> ]
<arg> ::= <literal-value> | <placeholder> | <variable>
<variable> ::= <token>
<command> ::= "@" <token> [ <args-group> ]
<filter> ::= <token> | <filter-command>
<filter-command> ::= "@" <token>
<token> ::= <letter> [ <token-body> ]
<token-body> ::= (<letter> | <digit> | "_" | "-") [ <token-body> ]
<literal-value> ::= <quoted-string> | <integer> | <float>
<integer> ::= [ <number-sign> ] <digits>
<float> ::= <integer> "." <digits> [ <exponent> ]
<exponent> ::= ( "e" | "E" ) <integer>
<number-sign> ::= "+" | "-"
<digits> ::= <digit> [ <digits> ]
<quoted-string> ::= <single-quoted-string> | <double-quoted-string>
<single-quoted-string> ::= <single-quote> [ <escaped-text> ] <single-quote>
<double-quoted-string> ::= <double-quote> [ <escaped-text> ] <double-quote>
<filter-pipe> ::= ">" | "|"
<args-pipe> ::= "<" | ":"
<escaped-text> ::= (<non-escaping-char> | <escape-sequence>)
[ <escaped-text> ]
<escape-sequence> ::= "\" <escaping-char>
<escaping-char> ::= "\" | <single-quote> | <double-quote>
| "n" | "r" | "t"
<non-escaping-char> ::= Any character except an <escaping-char> or a
control character
<digit> ::= Any digit
<single-quote> ::= U+0027
<double-quote> ::= U+0022