commit 2d67137
zzo38
·
2022-11-15 06:08:07 +0000 UTC
parent c9189ad
If a macro name starts with a special character, then that character no longer has a special meaning.
M
asm.doc
+5,
-1
1@@ -123,9 +123,13 @@ The following nonstandard tokens are available:
2
3 ]\ acts like \: for the matching [@ command.
4
5-For the . , : ; commands, the name can optionally start with & to mean
6+For the . , : ; commands, the name can optionally start with & to mean
7 that it is interpreted the same as for a & command.
8
9+Another nonstandard feature is that if you define a macro whose name
10+starts with a character which has a special meaning, then that special
11+meaning is ignored in the rest of the file.
12+
13
14 === Special calculations ===
15
M
uxnasm.c
+3,
-0
1@@ -59,6 +59,7 @@ static int ssptr;
2 static Uint16 sstack[256];
3 static int bsptr,bcnt;
4 static Uint16 bstack[256];
5+static char spec_rune[128];
6
7 /* clang-format off */
8
9@@ -329,6 +330,7 @@ parse(char *w, FILE *f)
10 Label*l;
11 if(slen(w) >= 63)
12 return error("Invalid token", w);
13+ if(spec_rune[*w]) goto defa;
14 switch(w[0]) {
15 case '(': /* comment */
16 if(slen(w) != 1) fprintf(stderr, "-- Malformed comment: %s\n", w);
17@@ -347,6 +349,7 @@ parse(char *w, FILE *f)
18 return error("Invalid include", w);
19 break;
20 case '%': /* macro */
21+ spec_rune[w[1]&127]=1;
22 if(!makemacro(w + 1, f))
23 return error("Invalid macro", w);
24 break;