Commit 2d7f93f
authored
Update AGR language extension syntax highlighting (#2087)
## Summary
Updates the VS Code AGR language extension to support all current
grammar features with proper syntax coloring.
### Syntax highlighting additions
- **Block comments** (`/* ... */`) — previously only line comments were
supported
- **`export` keyword** — for exported rule definitions
- **`[spacing=...]` annotations** — `required`, `optional`, `auto`,
`none` with distinct scopes
- **Value type annotations** — `: TypeName | TypeName` after rule names
- **Source-less entity imports** — `import { Ordinal, CalendarDate };`
(no `from` clause)
- **Value expression operators** — `===`, `!==`, `??`, `?.`, `||`, `&&`,
ternary `? :`, `typeof`, arithmetic, member access
- **Template literals** — `\`text \${expr} text\`` with recursive
expression highlighting inside `\${}`
- **Spread operator** — `...` in value positions
- **Capture quantifiers** — `?`, `*`, `+` on captures and rule
references
- **Grouped expressions** — `(expr)` and function call arguments in
value context
### Bug fixes
- **Single-quote handling** — Apostrophes in expression context (e.g.
`what('s | is)`) are now treated as literal characters, not string
delimiters. Previously this broke all highlighting from that point
onward.
- **Action object values** — Replaced embedded `source.js` grammar with
native AGR value syntax for correct highlighting of AGR-specific
constructs.
### Other changes
- **language-configuration.json** — Added `blockComment` support for `/*
*/` toggle
- **grammarRuleParser.ts** — Added comprehensive BNF for value
expressions to the parser documentation comment
- **sample.agr** — Updated with examples demonstrating all new features
### Files changed
- `extensions/agr-language/syntaxes/agr.tmLanguage.json`
- `extensions/agr-language/language-configuration.json`
- `extensions/agr-language/sample.agr`
- `packages/actionGrammar/src/grammarRuleParser.ts`1 parent d2170f4 commit 2d7f93f
File tree
4 files changed
+577
-69
lines changed- ts
- extensions/agr-language
- syntaxes
- packages/actionGrammar/src
4 files changed
+577
-69
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
8 | 14 | | |
| 15 | + | |
| 16 | + | |
9 | 17 | | |
| 18 | + | |
| 19 | + | |
10 | 20 | | |
11 | 21 | | |
12 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
13 | 27 | | |
14 | 28 | | |
15 | | - | |
| 29 | + | |
| 30 | + | |
16 | 31 | | |
17 | 32 | | |
18 | 33 | | |
| |||
22 | 37 | | |
23 | 38 | | |
24 | 39 | | |
25 | | - | |
| 40 | + | |
| 41 | + | |
26 | 42 | | |
27 | 43 | | |
28 | 44 | | |
| |||
34 | 50 | | |
35 | 51 | | |
36 | 52 | | |
37 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
38 | 72 | | |
39 | 73 | | |
40 | 74 | | |
| |||
43 | 77 | | |
44 | 78 | | |
45 | 79 | | |
46 | | - | |
| 80 | + | |
47 | 81 | | |
48 | 82 | | |
49 | 83 | | |
| |||
55 | 89 | | |
56 | 90 | | |
57 | 91 | | |
58 | | - | |
| 92 | + | |
| 93 | + | |
59 | 94 | | |
60 | 95 | | |
61 | 96 | | |
| |||
64 | 99 | | |
65 | 100 | | |
66 | 101 | | |
67 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
68 | 118 | | |
69 | 119 | | |
70 | 120 | | |
71 | 121 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | 122 | | |
77 | 123 | | |
78 | 124 | | |
| |||
96 | 142 | | |
97 | 143 | | |
98 | 144 | | |
99 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
100 | 162 | | |
101 | 163 | | |
102 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
0 commit comments