Currently, tokens beginning with a [ or ] character are completely
ignored, which forbids a macro from beginning with these characters.
Specifically, a macro can be declared eg. as `%[x { ... }` but cannot be
dereferenced as `[x`.
This patch only ignores these tokens if they have a length of 1;
otherwise the switch falls through to the default case.
... | ... |
@@ -343,8 +343,8 @@ parse(char *w, FILE *f) |
343 | 343 |
while((c = w[++i])) |
344 | 344 |
if(!writebyte(c)) return 0; |
345 | 345 |
break; |
346 |
- case '[': break; /* ignored */ |
|
347 |
- case ']': break; /* ignored */ |
|
346 |
+ case '[': if (slen(w) == 1) break; /* else FALLTHROUGH */ |
|
347 |
+ case ']': if (slen(w) == 1) break; /* else FALLTHROUGH */ |
|
348 | 348 |
default: |
349 | 349 |
/* opcode */ |
350 | 350 |
if(findopcode(w) || scmp(w, "BRK", 4)) { |