]> git.sur5r.net Git - cc65/blobdiff - src/ca65/scanner.c
Finished implemenation of commands to delete macros. Added the new commands to
[cc65] / src / ca65 / scanner.c
index 59fecbd1c36f0e786a7d37833d816765706d82a9..723978a864b492c68cac3b9eaba10cc8804999a1 100644 (file)
@@ -166,6 +166,8 @@ struct DotKeyword {
     { ".DEF",          TOK_DEFINED     },
     { ".DEFINE",       TOK_DEFINE      },
     { ".DEFINED",      TOK_DEFINED     },
+    { ".DELMAC",        TOK_DELMAC      },
+    { ".DELMACRO",      TOK_DELMAC      },
     { ".DESTRUCTOR",   TOK_DESTRUCTOR  },
     { ".DWORD",        TOK_DWORD       },
     { ".ELSE",         TOK_ELSE        },
@@ -265,8 +267,8 @@ struct DotKeyword {
     { ".SEGMENT",      TOK_SEGMENT     },
     { ".SET",           TOK_SET         },
     { ".SETCPU",       TOK_SETCPU      },
-    { ".SHL",          TOK_SHL         },
-    { ".SHR",          TOK_SHR         },
+    { ".SHL",                  TOK_SHL         },
+    { ".SHR",                  TOK_SHR         },
     { ".SIZEOF",        TOK_SIZEOF      },
     { ".SMART",                TOK_SMART       },
     { ".SPRINTF",       TOK_SPRINTF     },
@@ -278,6 +280,8 @@ struct DotKeyword {
     { ".TAG",           TOK_TAG         },
     { ".TCOUNT",       TOK_TCOUNT      },
     { ".TIME",                 TOK_TIME        },
+    { ".UNDEF",         TOK_UNDEF       },
+    { ".UNDEFINE",      TOK_UNDEF       },
     { ".UNION",         TOK_UNION       },
     { ".VERSION",       TOK_VERSION     },
     { ".WARNING",      TOK_WARNING     },
@@ -796,7 +800,12 @@ void NextRawTok (void)
 Restart:
     /* Check if we have tokens from another input source */
     if (InputFromStack ()) {
-       return;
+        if (CurTok.Tok == TOK_IDENT && IsDefine (&CurTok.SVal)) {
+            /* This is a define style macro - expand it */
+            MacExpandStart ();
+            goto Restart;
+        }
+        return;
     }
 
 Again:
@@ -813,6 +822,9 @@ Again:
     /* Clear the string attribute */
     SB_Clear (&CurTok.SVal);
 
+    /* Generate line info for the current token */
+    GenLineInfo (LI_SLOT_ASM, &CurTok.Pos);
+
     /* Hex number or PC symbol? */
     if (C == '$') {
        NextChar ();
@@ -1100,12 +1112,14 @@ CharAgain:
                 CurTok.Tok = TOK_DIV;
             } else if (CComments) {
                 /* Remember the position, then skip the '*' */
-                FilePos Pos = CurTok.Pos;
+                Collection LineInfos = STATIC_COLLECTION_INITIALIZER;
+                GetFullLineInfo (&LineInfos, 0);
                 NextChar ();
                 do {
                     while (C !=  '*') {
                         if (C == EOF) {
-                            PError (&Pos, "Unterminated comment");
+                            LIError (&LineInfos, "Unterminated comment");
+                            DoneCollection (&LineInfos);
                             goto CharAgain;
                         }
                         NextChar ();
@@ -1113,6 +1127,7 @@ CharAgain:
                     NextChar ();
                 } while (C != '/');
                 NextChar ();
+                DoneCollection (&LineInfos);
                 goto Again;
             }
            return;