]> git.sur5r.net Git - cc65/blobdiff - src/ca65/token.h
Finished implemenation of commands to delete macros. Added the new commands to
[cc65] / src / ca65 / token.h
index b334c5bbf0e7fdb871229a85d4fb2abce56d1f48..ad22b885cd6fea9dc98e6735814dea6be79320c7 100644 (file)
@@ -39,7 +39,9 @@
 
 
 /* common */
+#include "filepos.h"
 #include "inline.h"
+#include "strbuf.h"
 
 
 
@@ -49,7 +51,7 @@
 
 
 
-/* Tokens */ 
+/* Tokens */
 typedef enum token_t {
     TOK_NONE,          /* Start value, invalid */
     TOK_EOF,                   /* End of input file */
@@ -71,7 +73,7 @@ typedef enum token_t {
     TOK_ULABEL,                /* :++ or :-- */
 
     TOK_EQ,            /* = */
-    TOK_NE,            /* <> */
+    TOK_NE,            /* <> */
     TOK_LT,            /* < */
     TOK_GT,            /* > */
     TOK_LE,            /* <= */
@@ -83,12 +85,12 @@ typedef enum token_t {
     TOK_BOOLNOT,       /* .not */
 
     TOK_PLUS,          /* + */
-    TOK_MINUS,         /* - */
+    TOK_MINUS,         /* - */
     TOK_MUL,           /* * */
     TOK_STAR = TOK_MUL,        /* Alias */
     TOK_DIV,           /* / */
     TOK_MOD,           /* ! */
-    TOK_OR,            /* | */
+    TOK_OR,            /* | */
     TOK_XOR,           /* ^ */
     TOK_BANK = TOK_XOR, /* Alias */
     TOK_AND,           /* & */
@@ -145,6 +147,7 @@ typedef enum token_t {
     TOK_DEBUGINFO,
     TOK_DEFINE,
     TOK_DEFINED,
+    TOK_DELMAC,
     TOK_DESTRUCTOR,
     TOK_DWORD,
     TOK_ELSE,
@@ -245,6 +248,7 @@ typedef enum token_t {
     TOK_TAG,
     TOK_TCOUNT,
     TOK_TIME,
+    TOK_UNDEF,
     TOK_UNION,
     TOK_VERSION,
     TOK_WARNING,
@@ -258,6 +262,27 @@ typedef enum token_t {
 
 
 
+/* Complete token including attributes and flags */
+typedef struct Token Token;
+struct Token {
+    token_t     Tok;            /* The actual token value */
+    int         WS;             /* Flag for "whitespace before token" */
+    long        IVal;           /* Integer attribute value */
+    StrBuf      SVal;           /* String attribute value */
+    FilePos     Pos;            /* Position from which token was read */
+};
+
+/* Initializer value for a token */
+#define STATIC_TOKEN_INITIALIZER {      \
+    TOK_NONE,                           \
+    0,                                  \
+    0,                                  \
+    STATIC_STRBUF_INITIALIZER,          \
+    STATIC_FILEPOS_INITIALIZER          \
+}
+
+
+
 /*****************************************************************************/
 /*                                          Code                                    */
 /*****************************************************************************/
@@ -280,6 +305,11 @@ INLINE int TokIsSep (enum token_t T)
 #  define TokIsSep(T)   ((T) == TOK_SEP || (T) == TOK_EOF)
 #endif
 
+void CopyToken (Token* Dst, const Token* Src);
+/* Copy a token. The current value of Dst.SVal is free'd, so Dst must be
+ * initialized.
+ */
+
 
 
 /* End of token.h */