|
38 | 38 | % Check the main scopes |
39 | 39 | \def\macro{replacement} |
40 | 40 | % ^^^^ meta.function.tex keyword.declaration.function.tex |
41 | | -% ^^^^^^ meta.function.identifier.tex entity.name.function.tex |
42 | | -% ^^^^^^^^^^^^ meta.function.body.tex |
43 | | - |
44 | | -% Check punctuation scopes |
45 | | - \def\macro{replacement} |
46 | 41 | % ^ punctuation.definition.backslash.tex |
| 42 | +% ^^^^^^ meta.function.identifier.tex entity.name.function.tex |
47 | 43 | % ^ punctuation.definition.backslash.tex |
| 44 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
48 | 45 | % ^ punctuation.definition.group.brace.begin.tex |
49 | 46 | % ^ punctuation.definition.group.brace.end.tex |
50 | 47 |
|
51 | | - |
52 | | -% examples taken from https://en.wikibooks.org/wiki/TeX/def |
| 48 | +% Check missing macro name |
| 49 | + \def{replacement} |
| 50 | +% ^^^^ meta.function.tex keyword.declaration.function.tex |
| 51 | +% ^ punctuation.definition.backslash.tex |
| 52 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 53 | +% ^ punctuation.definition.group.brace.begin.tex |
| 54 | +% ^ punctuation.definition.group.brace.end.tex |
53 | 55 |
|
54 | 56 | % With spaces and parameter specification |
55 | 57 | \def \foo [#1]#2{The first argument is ``#1'', the second one is ``#2''} |
|
116 | 118 | % hash |
117 | 119 | \def\macro\#1#1{replacement} |
118 | 120 | % ^^^^^ meta.function.parameters.tex |
| 121 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
119 | 122 | % ^^ constant.character.escape.tex |
120 | | -% ^ - variable.parameter.tex |
121 | 123 | % ^^ variable.parameter.tex |
122 | 124 |
|
123 | 125 | % open-brace |
124 | 126 | \def\macro\{#1{replacement} |
125 | 127 | % ^^^^ meta.function.parameters.tex |
| 128 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
126 | 129 | % ^^ constant.character.escape.tex |
127 | 130 | % ^^ variable.parameter.tex |
128 | | -% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
129 | | - |
130 | 131 |
|
131 | 132 | % double escape |
132 | 133 | \def\macro\\#1{replacement} |
133 | 134 | % ^^^^ meta.function.parameters.tex |
134 | | -% ^^constant.character.escape.tex |
| 135 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 136 | +% ^^ constant.character.newline.tex |
135 | 137 | % ^^ variable.parameter.tex |
136 | 138 |
|
| 139 | +% hash in brackets |
| 140 | +\def \macro[\#1A]{replacement} |
| 141 | +% ^^^^^^ meta.function.parameters.tex meta.group.bracket.tex |
| 142 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 143 | +% ^ punctuation.definition.group.bracket.begin.tex |
| 144 | +% ^^ constant.character.escape.tex |
| 145 | +% ^ punctuation.definition.backslash.tex |
| 146 | +% ^^ - variable |
| 147 | +% ^ punctuation.definition.group.bracket.end.tex |
| 148 | + |
| 149 | +% open-brace in brackets |
| 150 | +\def \macro[\{#1A]{replacement} |
| 151 | +% ^^^^^^^ meta.function.parameters.tex meta.group.bracket.tex |
| 152 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 153 | +% ^ punctuation.definition.group.bracket.begin.tex |
| 154 | +% ^^ constant.character.escape.tex |
| 155 | +% ^ punctuation.definition.backslash.tex |
| 156 | +% ^^ variable.parameter.tex |
| 157 | +% ^ punctuation.definition.group.bracket.end.tex |
| 158 | + |
| 159 | +% double escape in brackets |
| 160 | +\def \macro[\\#1A]{replacement} |
| 161 | +% ^^^^^^^ meta.function.parameters.tex meta.group.bracket.tex |
| 162 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 163 | +% ^ punctuation.definition.group.bracket.begin.tex |
| 164 | +% ^^ constant.character.newline.tex |
| 165 | +% ^^ variable.parameter.tex |
| 166 | +% ^ punctuation.definition.group.bracket.end.tex |
| 167 | + |
| 168 | +% no commands in parameter text |
| 169 | +\def \macro\A[\A#1A]{replacement} |
| 170 | +% ^^ meta.function.parameters.tex - meta.group |
| 171 | +% ^^^^^^^ meta.function.parameters.tex meta.group.bracket.tex |
| 172 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 173 | +% ^^ - support - punctuation |
| 174 | +% ^ punctuation.definition.group.bracket.begin.tex |
| 175 | +% ^^ - support - punctuation |
| 176 | +% ^^ variable.parameter.tex |
| 177 | +% ^ punctuation.definition.group.bracket.end.tex |
| 178 | + |
| 179 | +% nested brackets in parameter text |
| 180 | +\def\macro[#1={#2,{key=[#4,#5]}}] {replacement} |
| 181 | +%^^^ meta.function.tex keyword.declaration.function.tex |
| 182 | +% ^^^^^^ meta.function.identifier.tex entity.name.function.tex |
| 183 | +% ^^^^ meta.function.parameters.tex meta.group.bracket.tex - meta.group meta.group |
| 184 | +% ^^^^ meta.function.parameters.tex meta.group.bracket.tex meta.group.brace.tex - meta.group meta.group meta.group |
| 185 | +% ^^^^^ meta.function.parameters.tex meta.group.bracket.tex meta.group.brace.tex meta.group.brace.tex - meta.group meta.group meta.group meta.group |
| 186 | +% ^^^^^^^ meta.function.parameters.tex meta.group.bracket.tex meta.group.brace.tex meta.group.brace.tex meta.group.bracket.tex |
| 187 | +% ^ meta.function.parameters.tex meta.group.bracket.tex meta.group.brace.tex meta.group.brace.tex - meta.group meta.group meta.group meta.group |
| 188 | +% ^ meta.function.parameters.tex meta.group.bracket.tex meta.group.brace.tex - meta.group meta.group meta.group |
| 189 | +% ^ meta.function.parameters.tex meta.group.bracket.tex - meta.group meta.group |
| 190 | +% ^ meta.function.parameters.tex - meta.group |
| 191 | +% ^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
137 | 192 |
|
138 | 193 | % defining special character macros |
139 | 194 | \def\_{underscore} |
|
144 | 199 | % stop scope for incomplete defs |
145 | 200 | \def\text |
146 | 201 |
|
147 | | -some other text |
148 | | -% ^^^^^^^^^^^^^^ - meta.function% |
| 202 | +any delimiter token |
| 203 | +%^^^^^^^^^^^^^^^^^^ meta.function.parameters.tex |
| 204 | + |
| 205 | +{replacement} |
| 206 | +% <- meta.function.body.tex meta.group.brace.tex punctuation.definition.group.brace.begin.tex |
| 207 | +%^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 208 | +% ^ punctuation.definition.group.brace.end.tex |
149 | 209 |
|
150 | 210 | % incomplete but with parameters; the { comes too late to open the function definition |
151 | | -\def\text A#1A |
| 211 | +\def\text \A#1A |
| 212 | +% ^^^^^^ meta.function.parameters.tex |
| 213 | +% ^^ - support |
| 214 | +% ^^ variable.parameter.tex |
152 | 215 |
|
153 | | - { some other text} |
154 | | -% ^^^^^^^^^^^^^^ - meta.function |
| 216 | + { some other text } |
| 217 | +% <- meta.function.parameters.tex |
| 218 | +%^ meta.function.parameters.tex |
| 219 | +% ^^^^^^^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 220 | +% ^ punctuation.definition.group.brace.begin.tex |
| 221 | +% ^ punctuation.definition.group.brace.end.tex |
155 | 222 |
|
156 | 223 | % command just prefixed with def. Needs to be picked up as a custom command |
157 | 224 | \deftext |
|
247 | 314 | % ^^ variable.other.readwrite.tex |
248 | 315 | % ^^^^^^ keyword.other.math.greek.tex |
249 | 316 |
|
| 317 | +% incomplete nested macro definitions |
| 318 | +\def \macro #1 { \def \incomplete #1 } |
| 319 | +% ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 320 | +% ^ punctuation.definition.group.brace.begin.tex |
| 321 | +% ^ punctuation.definition.group.brace.end.tex |
| 322 | + |
| 323 | +\def \macro #1 { \def \incomplete [#1 } |
| 324 | +% ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.body.tex meta.group.brace.tex |
| 325 | +% ^ punctuation.definition.group.brace.begin.tex |
| 326 | +% ^ punctuation.definition.group.brace.end.tex |
250 | 327 |
|
251 | 328 | % testing incomplete register specification |
252 | 329 | \def\test{\dimen} other text |
|
0 commit comments