Brush

Check-in [ed36f3fb28]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Begin updating grammar
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1: ed36f3fb28e9fdd5df6ed7e08192c6d0300add81
User & Date: andy 2021-12-27 00:40:47.901
Context
2021-12-27
00:40:47
Begin updating grammar Leaf check-in: ed36f3fb28 user: andy tags: trunk
2021-12-26
17:42:20
A few updates check-in: 1a694ab3c2 user: andy tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/grammar.y.
17
18
19
20
21
22
23
24

25
26
27

28
29
30
31
32
33
34
comment ::= COMMENT.

/* Word sequences consist of any number of words and comments. */
wordSeq ::= wordSeq word.
wordSeq ::= wordSeq comment.
wordSeq ::= .

/* The word types are: raw, quoted, braced, list, reference, and expanded. */

word ::= WORD wordRaw.
word ::= WORD wordQuote.
word ::= WORD wordBrace.

word ::= WORD wordList.
word ::= WORD wordReference.
word ::= WORD wordExpand.

/* A raw word is a concatenated sequence of literals and substitutions. */
wordRaw ::= syllableSeq.








|
>



>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
comment ::= COMMENT.

/* Word sequences consist of any number of words and comments. */
wordSeq ::= wordSeq word.
wordSeq ::= wordSeq comment.
wordSeq ::= .

/* The word types are: raw, quoted, braced, script, list, reference, and
 * expanded. */
word ::= WORD wordRaw.
word ::= WORD wordQuote.
word ::= WORD wordBrace.
word ::= WORD wordScript.
word ::= WORD wordList.
word ::= WORD wordReference.
word ::= WORD wordExpand.

/* A raw word is a concatenated sequence of literals and substitutions. */
wordRaw ::= syllableSeq.

46
47
48
49
50
51
52
53
54

55
56
57

58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* A list word is zero or more words and/or comments within (parentheses). */
wordList ::= LPAREN wordSeq RPAREN.

/* A reference word is an &ampersand followed by a variable identifier and any
 * number of index operators. */
wordReference ::= AMP variableIdentifier indexSeq.

/* Raw, quoted, braced, and list words may be preceded by *asterisk to treat
 * them as lists, each word of which becomes a separate word in context. */

wordExpand ::= STAR wordRaw.
wordExpand ::= STAR wordQuote.
wordExpand ::= STAR wordBrace.

wordExpand ::= STAR wordList.


/* Zero or more syllables concatenated form a syllable sequence. */
syllableSeq ::= syllableSeq syllable.
syllableSeq ::= .

/* Syllables may be literal strings or any kind of substitution. */
syllable ::= LITERAL.
syllable ::= substBackslash.
syllable ::= substIndex.
syllable ::= substScript.

/* Variable, expression, and value substitutions all start with one or two
 * $dollar signs and may be used in combination with index operators. */
substIndex ::= substVariable indexSeq.
substIndex ::= substExpr indexSeq.

substIndex ::= substValue indexSeq.

/* Variable substitutions are a $dollar sign followed by a parent specifier, a
 * namespace specifier, a variable name, and any number of index operators. */
substVariable ::= DOLLAR variableIdentifier.

/* An expression substitution is a $dollar sign followed by an expression
 * enclosed in {braces}. */
substExpr ::= DOLLAR LBRACE expr RBRACE.

/* Value substitutions are two $dollar signs followed by a quoted, braced, or
 * list word.  Also, $$[script] is seen as shorthand for $$"[script]". */
substValue ::= DOLLAR_DOLLAR wordQuote.
substValue ::= DOLLAR_DOLLAR wordBrace.
substValue ::= DOLLAR_DOLLAR wordList.
substValue ::= DOLLAR_DOLLAR substScript.

/* Variable identifiers have an optional parent sequence, followed by a
 * namespace selector and/or a variable name.  To avoid ambiguity, the grammar
 * requires that the variable name not be omitted, so instead of omitting the
 * variable name, the tokenizer must emit an empty LITERAL. */
variableIdentifier ::= parentSeq namespace variableName.
variableIdentifier ::= parentSeq variableName.

/* A parent sequence is zero or more ^carets, equal to the number of parent
 * stack frames to ascend before beginning the namespace search. */
parentSeq ::= parentSeq CARET.
parentSeq ::= .

/* A namespace specifier selects which namespace to search when looking up a
 * variable. */
namespace ::= APOS.
namespace ::= STAR.
namespace ::= EXCLAM.

namespace ::= DOT.

/* Variable names may be bare literal strings or quoted words. */
variableName ::= LITERAL.
variableName ::= wordQuote.

/* An index sequence is zero or more index operators. */
indexSeq ::= indexSeq index.
indexSeq ::= .

/* Script substitutions are [brackets] surrounding a script. */
substScript ::= LBRACKET script RBRACKET.

/* Backslash substitutions are \backslash followed by one or more characters
 * having various purposes.  Backslash inhibits special interpretation of
 * metacharacters, and it replaces other characters with special characters. */
substBackslash ::= BACKSLASH BS_QUOTE.
substBackslash ::= BACKSLASH BS_SUBST.
substBackslash ::= BACKSLASH BS_NLWS.
substBackslash ::= BACKSLASH BS_OCT8.
substBackslash ::= BACKSLASH BS_HEX8.
substBackslash ::= BACKSLASH BS_HEX21.

/* The basic index operators may be used anywhere in an index sequence. */
index ::= indexScope.
index ::= indexDereference.
index ::= indexKey.
index ::= indexVector.
index ::= indexRange.
index ::= indexStride.

/* Scope indexes are .period followed by a variable name.  Scope indexes access
 * variables contained in nested namespaces. */
indexScope ::= DOT variableName.

/* The @at sign is the dereference index operator, which is used to access the
 * referenced variable or component thereof. */
indexDereference ::= AT.

/* A key index is a list of words surrounded by (parentheses). */
indexKey ::= wordList.

/* A vector index is a comma-delimited expression list or an expanded word. */
indexVector ::= LBRACE exprListCommaImplicit RBRACE.
indexVector ::= LBRACE wordExpand RBRACE.

/* An index range is {braces} surrounding two expressions separated by a :colon.
 * Index ranges access a contiguous sequence of list elements. */
indexRange ::= LBRACE expr COLON expr RBRACE.

/* A stride range is {braces} surrounding three expressions separated by
 * :colons.  Stride ranges access non-contiguous list elements. */







|
|
>



>

>









<

|
|


>
|


|






|
|
|
<
<
<

|
|
|
|
|



|



|
<
|
<
|
>
|









<
<
<



















|






|
|


|
|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91



92
93
94
95
96
97
98
99
100
101
102
103
104
105

106

107
108
109
110
111
112
113
114
115
116
117
118



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/* A list word is zero or more words and/or comments within (parentheses). */
wordList ::= LPAREN wordSeq RPAREN.

/* A reference word is an &ampersand followed by a variable identifier and any
 * number of index operators. */
wordReference ::= AMP variableIdentifier indexSeq.

/* Raw, quoted, braced, script, and list words may be preceded by *asterisk to
 * treat them as lists, each word of which becomes a separate word.  More than
 * one *asterisk may be used. */
wordExpand ::= STAR wordRaw.
wordExpand ::= STAR wordQuote.
wordExpand ::= STAR wordBrace.
wordExpand ::= STAR wordScript.
wordExpand ::= STAR wordList.
wordExpand ::= STAR wordExpand.

/* Zero or more syllables concatenated form a syllable sequence. */
syllableSeq ::= syllableSeq syllable.
syllableSeq ::= .

/* Syllables may be literal strings or any kind of substitution. */
syllable ::= LITERAL.
syllable ::= substBackslash.
syllable ::= substIndex.


/* Variable, expression, script, and list substitutions all start with a $dollar
 * sign and may be used in combination with index operators. */
substIndex ::= substVariable indexSeq.
substIndex ::= substExpr indexSeq.
substIndex ::= substScript indexSeq.
substIndex ::= substList indexSeq.

/* Variable substitutions are a $dollar sign followed by a parent specifier, a
 * scope specifier, a variable name, and any number of index operators. */
substVariable ::= DOLLAR variableIdentifier.

/* An expression substitution is a $dollar sign followed by an expression
 * enclosed in {braces}. */
substExpr ::= DOLLAR LBRACE expr RBRACE.

/* A script substitution is a $dollar sign followed by [brackets] surrounding a
 * script. */
substScript ::= DOLLAR LBRACKET script RBRACKET.




/* Variable identifiers have an optional parent sequence, followed by a scope
 * selector and/or a variable name.  To avoid ambiguity, the grammar requires
 * that the variable name not be omitted, so instead of omitting the variable
 * name, the tokenizer must emit an empty LITERAL. */
variableIdentifier ::= parentSeq scope variableName.
variableIdentifier ::= parentSeq variableName.

/* A parent sequence is zero or more ^carets, equal to the number of parent
 * stack frames to ascend before beginning the scope search. */
parentSeq ::= parentSeq CARET.
parentSeq ::= .

/* A scope specifier says which scope to search when looking up a variable. */

scope ::= APOS.

scope ::= EXCLAM.
scope ::= COLON.
scope ::= DOT.

/* Variable names may be bare literal strings or quoted words. */
variableName ::= LITERAL.
variableName ::= wordQuote.

/* An index sequence is zero or more index operators. */
indexSeq ::= indexSeq index.
indexSeq ::= .




/* Backslash substitutions are \backslash followed by one or more characters
 * having various purposes.  Backslash inhibits special interpretation of
 * metacharacters, and it replaces other characters with special characters. */
substBackslash ::= BACKSLASH BS_QUOTE.
substBackslash ::= BACKSLASH BS_SUBST.
substBackslash ::= BACKSLASH BS_NLWS.
substBackslash ::= BACKSLASH BS_OCT8.
substBackslash ::= BACKSLASH BS_HEX8.
substBackslash ::= BACKSLASH BS_HEX21.

/* The basic index operators may be used anywhere in an index sequence. */
index ::= indexScope.
index ::= indexDereference.
index ::= indexKey.
index ::= indexVector.
index ::= indexRange.
index ::= indexStride.

/* Scope indexes are .period followed by a variable name.  Scope indexes access
 * variables contained in nested scopes. */
indexScope ::= DOT variableName.

/* The @at sign is the dereference index operator, which is used to access the
 * referenced variable or component thereof. */
indexDereference ::= AT.

/* A key index is a list of words surrounded by {braces}. */
indexKey ::= LBRACE wordSeq RBRACE.

/* A vector index is a comma-delimited expression list or an expanded word. */
indexVector ::= LBRACKET exprListCommaImplicit RBRACKET.
indexVector ::= LBRACKET wordExpand RBRACKET.

/* An index range is {braces} surrounding two expressions separated by a :colon.
 * Index ranges access a contiguous sequence of list elements. */
indexRange ::= LBRACE expr COLON expr RBRACE.

/* A stride range is {braces} surrounding three expressions separated by
 * :colons.  Stride ranges access non-contiguous list elements. */