Move all attributes and other information that is attached to a token into a

structure named Token.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4910 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-01-16 16:05:43 +00:00
parent dbfae85f54
commit ddb7296b6c
23 changed files with 526 additions and 496 deletions

View 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, /* & */
@@ -258,6 +260,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 */
/*****************************************************************************/