]> Shamusworld >> Repos - rmac/blobdiff - token.c
Improved indexed reg error
[rmac] / token.c
diff --git a/token.c b/token.c
index 5b3d0737b02ea308f19938d86ec1ec3bfd3fcc53..30f529d018b95084e621a18c99cf272df071e5b7 100644 (file)
--- a/token.c
+++ b/token.c
@@ -314,6 +314,11 @@ int ExpandMacro(char * src, char * dest, int destsiz)
                        if (dst >= edst)
                                goto overflow;
 
+                       // Skip comments in case a loose @ or \ is in there
+                       // In that case the tokeniser was trying to expand it.
+                       if (*s == '*' || *s == ';' || ((*s == '/') && (*(s + 1) == '/')))
+                               goto skipcomments;
+
                        *dst++ = *s++;
                }
                // Do macro expansion
@@ -604,6 +609,8 @@ strcopy:
                }
        }
 
+skipcomments:
+
        *dst = EOS;
        DEBUG { printf("ExM: dst=\"%s\"\n", dest); }
        return OK;
@@ -1278,14 +1285,7 @@ if (debug) printf("TokenizeLine: Calling fpop() from SRC_IREPT...\n");
                                        // auto-optimise? I think it's ok for now...
                                        if (*ln == '.')
                                        {
-                                               if (obj_format == ALCYON)
-                                               {
-                                                       if ((*(ln + 1) == 'b') || (*(ln + 1) == 'B') || (*(ln + 1) == 'w') || (*(ln + 1) == 'W') || (*(ln + 1) == 'l') || (*(ln + 1) == 'L'))
-                                                       {
-                                                               ln += 2;
-                                                       }
-                                               }
-                                               else
+                                               if (obj_format == BSD)
                                                {
                                                        if ((*(ln + 1) & 0xDF) == 'B')
                                                        {
@@ -1306,6 +1306,20 @@ if (debug) printf("TokenizeLine: Calling fpop() from SRC_IREPT...\n");
 
                                        *tk++ = CONST;
                                        *tk++ = v;
+
+                                       if (obj_format == ALCYON)
+                                       {
+                                               if ((*(ln + 1) == 'w') || (*(ln + 1) == 'W'))
+                                               {
+                                                       *tk++ = DOTW;
+                                                       ln += 2;
+                                               }
+                                               else if ((*(ln + 1) == 'l') || (*(ln + 1) == 'L'))
+                                               {
+                                                       *tk++ = DOTL;
+                                                       ln += 2;
+                                               }
+                                       }
                                }
                                else
                                        *tk++ = '$';