Renamed the Token enumeration to token_t.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4909 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2000-2010, Ullrich von Bassewitz */
|
/* (C) 2000-2011, Ullrich von Bassewitz */
|
||||||
/* Roemerstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2010, Ullrich von Bassewitz */
|
/* (C) 1998-2011, Ullrich von Bassewitz */
|
||||||
/* Roemerstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
@@ -333,7 +333,7 @@ static ExprNode* FuncBlank (void)
|
|||||||
/* We have a list of tokens that ends with the closing paren. Skip
|
/* We have a list of tokens that ends with the closing paren. Skip
|
||||||
* the tokens, and count them. Allow optionally curly braces.
|
* the tokens, and count them. Allow optionally curly braces.
|
||||||
*/
|
*/
|
||||||
Token Term = GetTokListTerm (TOK_RPAREN);
|
token_t Term = GetTokListTerm (TOK_RPAREN);
|
||||||
unsigned Count = 0;
|
unsigned Count = 0;
|
||||||
while (Tok != Term) {
|
while (Tok != Term) {
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ static ExprNode* DoMatch (enum TC EqualityLevel)
|
|||||||
* single linked list of tokens including attributes. The list is
|
* single linked list of tokens including attributes. The list is
|
||||||
* either enclosed in curly braces, or terminated by a comma.
|
* either enclosed in curly braces, or terminated by a comma.
|
||||||
*/
|
*/
|
||||||
Token Term = GetTokListTerm (TOK_COMMA);
|
token_t Term = GetTokListTerm (TOK_COMMA);
|
||||||
while (Tok != Term) {
|
while (Tok != Term) {
|
||||||
|
|
||||||
/* We may not end-of-line of end-of-file here */
|
/* We may not end-of-line of end-of-file here */
|
||||||
@@ -781,7 +781,7 @@ static ExprNode* FuncTCount (void)
|
|||||||
/* We have a list of tokens that ends with the closing paren. Skip
|
/* We have a list of tokens that ends with the closing paren. Skip
|
||||||
* the tokens, and count them. Allow optionally curly braces.
|
* the tokens, and count them. Allow optionally curly braces.
|
||||||
*/
|
*/
|
||||||
Token Term = GetTokListTerm (TOK_RPAREN);
|
token_t Term = GetTokListTerm (TOK_RPAREN);
|
||||||
int Count = 0;
|
int Count = 0;
|
||||||
while (Tok != Term) {
|
while (Tok != Term) {
|
||||||
|
|
||||||
@@ -1046,7 +1046,7 @@ static ExprNode* Term (void)
|
|||||||
ExprNode* Right;
|
ExprNode* Right;
|
||||||
|
|
||||||
/* Remember the token and skip it */
|
/* Remember the token and skip it */
|
||||||
Token T = Tok;
|
token_t T = Tok;
|
||||||
NextTok ();
|
NextTok ();
|
||||||
|
|
||||||
/* Move root to left side and read the right side */
|
/* Move root to left side and read the right side */
|
||||||
@@ -1147,7 +1147,7 @@ static ExprNode* SimpleExpr (void)
|
|||||||
ExprNode* Right;
|
ExprNode* Right;
|
||||||
|
|
||||||
/* Remember the token and skip it */
|
/* Remember the token and skip it */
|
||||||
Token T = Tok;
|
token_t T = Tok;
|
||||||
NextTok ();
|
NextTok ();
|
||||||
|
|
||||||
/* Move root to left side and read the right side */
|
/* Move root to left side and read the right side */
|
||||||
@@ -1209,7 +1209,7 @@ static ExprNode* BoolExpr (void)
|
|||||||
ExprNode* Right;
|
ExprNode* Right;
|
||||||
|
|
||||||
/* Remember the token and skip it */
|
/* Remember the token and skip it */
|
||||||
Token T = Tok;
|
token_t T = Tok;
|
||||||
NextTok ();
|
NextTok ();
|
||||||
|
|
||||||
/* Move root to left side and read the right side */
|
/* Move root to left side and read the right side */
|
||||||
@@ -1276,7 +1276,7 @@ static ExprNode* Expr2 (void)
|
|||||||
ExprNode* Right;
|
ExprNode* Right;
|
||||||
|
|
||||||
/* Remember the token and skip it */
|
/* Remember the token and skip it */
|
||||||
Token T = Tok;
|
token_t T = Tok;
|
||||||
NextTok ();
|
NextTok ();
|
||||||
|
|
||||||
/* Move root to left side and read the right side */
|
/* Move root to left side and read the right side */
|
||||||
@@ -1335,7 +1335,7 @@ static ExprNode* Expr1 (void)
|
|||||||
ExprNode* Right;
|
ExprNode* Right;
|
||||||
|
|
||||||
/* Remember the token and skip it */
|
/* Remember the token and skip it */
|
||||||
Token T = Tok;
|
token_t T = Tok;
|
||||||
NextTok ();
|
NextTok ();
|
||||||
|
|
||||||
/* Move root to left side and read the right side */
|
/* Move root to left side and read the right side */
|
||||||
|
|||||||
@@ -667,7 +667,7 @@ static void StartExpClassic (Macro* M)
|
|||||||
/* Start expanding the classic macro M */
|
/* Start expanding the classic macro M */
|
||||||
{
|
{
|
||||||
MacExp* E;
|
MacExp* E;
|
||||||
Token Term;
|
token_t Term;
|
||||||
|
|
||||||
|
|
||||||
/* Skip the macro name */
|
/* Skip the macro name */
|
||||||
@@ -769,7 +769,7 @@ static void StartExpDefine (Macro* M)
|
|||||||
TokNode* Last;
|
TokNode* Last;
|
||||||
|
|
||||||
/* The macro may optionally be enclosed in curly braces */
|
/* The macro may optionally be enclosed in curly braces */
|
||||||
Token Term = GetTokListTerm (TOK_COMMA);
|
token_t Term = GetTokListTerm (TOK_COMMA);
|
||||||
|
|
||||||
/* Check if there is really a parameter */
|
/* Check if there is really a parameter */
|
||||||
if (TokIsSep (Tok) || Tok == Term) {
|
if (TokIsSep (Tok) || Tok == Term) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2000-2010, Ullrich von Bassewitz */
|
/* (C) 2000-2011, Ullrich von Bassewitz */
|
||||||
/* Roemerstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
@@ -102,7 +102,7 @@ static TokList* CollectTokens (unsigned Start, unsigned Count)
|
|||||||
TokList* List = NewTokList ();
|
TokList* List = NewTokList ();
|
||||||
|
|
||||||
/* Determine if the list is enclosed in curly braces. */
|
/* Determine if the list is enclosed in curly braces. */
|
||||||
Token Term = GetTokListTerm (TOK_RPAREN);
|
token_t Term = GetTokListTerm (TOK_RPAREN);
|
||||||
|
|
||||||
/* Read the token list */
|
/* Read the token list */
|
||||||
unsigned Current = 0;
|
unsigned Current = 0;
|
||||||
@@ -203,7 +203,7 @@ static void FuncIdent (void)
|
|||||||
/* Handle the .IDENT function */
|
/* Handle the .IDENT function */
|
||||||
{
|
{
|
||||||
StrBuf Buf = STATIC_STRBUF_INITIALIZER;
|
StrBuf Buf = STATIC_STRBUF_INITIALIZER;
|
||||||
Token Id;
|
token_t Id;
|
||||||
unsigned I;
|
unsigned I;
|
||||||
|
|
||||||
/* Skip it */
|
/* Skip it */
|
||||||
@@ -701,7 +701,7 @@ void NextTok (void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Consume (Token Expected, const char* ErrMsg)
|
void Consume (token_t Expected, const char* ErrMsg)
|
||||||
/* Consume Expected, print an error if we don't find it */
|
/* Consume Expected, print an error if we don't find it */
|
||||||
{
|
{
|
||||||
if (Tok == Expected) {
|
if (Tok == Expected) {
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2000-2007 Ullrich von Bassewitz */
|
/* (C) 2000-2011, Ullrich von Bassewitz */
|
||||||
/* Roemerstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
void NextTok (void);
|
void NextTok (void);
|
||||||
/* Get next token and handle token level functions */
|
/* Get next token and handle token level functions */
|
||||||
|
|
||||||
void Consume (Token Expected, const char* ErrMsg);
|
void Consume (token_t Expected, const char* ErrMsg);
|
||||||
/* Consume Token, print an error if we don't find it */
|
/* Consume Token, print an error if we don't find it */
|
||||||
|
|
||||||
void ConsumeSep (void);
|
void ConsumeSep (void);
|
||||||
|
|||||||
@@ -70,12 +70,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Token Tok = TOK_NONE; /* Current token */
|
token_t Tok = TOK_NONE; /* Current token */
|
||||||
int WS; /* Flag: Whitespace before token */
|
int WS; /* Flag: Whitespace before token */
|
||||||
long IVal; /* Integer token attribute */
|
long IVal; /* Integer token attribute */
|
||||||
StrBuf SVal = STATIC_STRBUF_INITIALIZER;/* String token attribute */
|
StrBuf SVal = STATIC_STRBUF_INITIALIZER;/* String token attribute */
|
||||||
|
|
||||||
FilePos CurPos = { 0, 0, 0 }; /* Name and position in current file */
|
FilePos CurPos = STATIC_FILEPOS_INITIALIZER; /* Name and position in current file */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ typedef struct InputFile InputFile;
|
|||||||
struct InputFile {
|
struct InputFile {
|
||||||
FILE* F; /* Input file descriptor */
|
FILE* F; /* Input file descriptor */
|
||||||
FilePos Pos; /* Position in file */
|
FilePos Pos; /* Position in file */
|
||||||
Token Tok; /* Last token */
|
token_t Tok; /* Last token */
|
||||||
int C; /* Last character */
|
int C; /* Last character */
|
||||||
char Line[256]; /* The current input line */
|
char Line[256]; /* The current input line */
|
||||||
int IncSearchPath; /* True if we've added a search path */
|
int IncSearchPath; /* True if we've added a search path */
|
||||||
@@ -98,7 +98,7 @@ struct InputData {
|
|||||||
char* Text; /* Pointer to the text data */
|
char* Text; /* Pointer to the text data */
|
||||||
const char* Pos; /* Pointer to current position */
|
const char* Pos; /* Pointer to current position */
|
||||||
int Malloced; /* Memory was malloced */
|
int Malloced; /* Memory was malloced */
|
||||||
Token Tok; /* Last token */
|
token_t Tok; /* Last token */
|
||||||
int C; /* Last character */
|
int C; /* Last character */
|
||||||
InputData* Next; /* Linked list of input data */
|
InputData* Next; /* Linked list of input data */
|
||||||
};
|
};
|
||||||
@@ -117,7 +117,7 @@ struct CharSourceFunctions {
|
|||||||
/* Input source: Either file or data */
|
/* Input source: Either file or data */
|
||||||
struct CharSource {
|
struct CharSource {
|
||||||
CharSource* Next; /* Linked list of char sources */
|
CharSource* Next; /* Linked list of char sources */
|
||||||
Token Tok; /* Last token */
|
token_t Tok; /* Last token */
|
||||||
int C; /* Last character */
|
int C; /* Last character */
|
||||||
const CharSourceFunctions* Func; /* Pointer to function table */
|
const CharSourceFunctions* Func; /* Pointer to function table */
|
||||||
union {
|
union {
|
||||||
@@ -137,7 +137,7 @@ int ForcedEnd = 0;
|
|||||||
/* List of dot keywords with the corresponding tokens */
|
/* List of dot keywords with the corresponding tokens */
|
||||||
struct DotKeyword {
|
struct DotKeyword {
|
||||||
const char* Key; /* MUST be first field */
|
const char* Key; /* MUST be first field */
|
||||||
Token Tok;
|
token_t Tok;
|
||||||
} DotKeywords [] = {
|
} DotKeywords [] = {
|
||||||
{ ".A16", TOK_A16 },
|
{ ".A16", TOK_A16 },
|
||||||
{ ".A8", TOK_A8 },
|
{ ".A8", TOK_A8 },
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2007 Ullrich von Bassewitz */
|
/* (C) 1998-2011, Ullrich von Bassewitz */
|
||||||
/* Roemerstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Scanner variables */
|
/* Scanner variables */
|
||||||
extern Token Tok; /* Current token */
|
extern token_t Tok; /* Current token */
|
||||||
extern int WS; /* Flag: Whitespace before token */
|
extern int WS; /* Flag: Whitespace before token */
|
||||||
extern long IVal; /* Integer token attribute */
|
extern long IVal; /* Integer token attribute */
|
||||||
extern StrBuf SVal; /* String token attribute */
|
extern StrBuf SVal; /* String token attribute */
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2007 Ullrich von Bassewitz */
|
/* (C) 2007-2011, Ullrich von Bassewitz */
|
||||||
/* Roemerstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int TokHasSVal (Token Tok)
|
int TokHasSVal (token_t Tok)
|
||||||
/* Return true if the given token has an attached SVal */
|
/* Return true if the given token has an attached SVal */
|
||||||
{
|
{
|
||||||
return (Tok == TOK_IDENT || Tok == TOK_LOCAL_IDENT || Tok == TOK_STRCON);
|
return (Tok == TOK_IDENT || Tok == TOK_LOCAL_IDENT || Tok == TOK_STRCON);
|
||||||
@@ -52,7 +52,7 @@ int TokHasSVal (Token Tok)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int TokHasIVal (Token Tok)
|
int TokHasIVal (token_t Tok)
|
||||||
/* Return true if the given token has an attached IVal */
|
/* Return true if the given token has an attached IVal */
|
||||||
{
|
{
|
||||||
return (Tok == TOK_INTCON || Tok == TOK_CHARCON || Tok == TOK_REG);
|
return (Tok == TOK_INTCON || Tok == TOK_CHARCON || Tok == TOK_REG);
|
||||||
|
|||||||
@@ -49,8 +49,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Tokens */
|
/* Tokens */
|
||||||
typedef enum Token {
|
typedef enum token_t {
|
||||||
TOK_NONE, /* Start value, invalid */
|
TOK_NONE, /* Start value, invalid */
|
||||||
TOK_EOF, /* End of input file */
|
TOK_EOF, /* End of input file */
|
||||||
TOK_SEP, /* Separator (usually newline) */
|
TOK_SEP, /* Separator (usually newline) */
|
||||||
@@ -254,7 +254,7 @@ typedef enum Token {
|
|||||||
TOK_LASTPSEUDO = TOK_ZEROPAGE,
|
TOK_LASTPSEUDO = TOK_ZEROPAGE,
|
||||||
|
|
||||||
TOK_COUNT /* Count of tokens */
|
TOK_COUNT /* Count of tokens */
|
||||||
} Token;
|
} token_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -264,14 +264,14 @@ typedef enum Token {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int TokHasSVal (Token Tok);
|
int TokHasSVal (token_t Tok);
|
||||||
/* Return true if the given token has an attached SVal */
|
/* Return true if the given token has an attached SVal */
|
||||||
|
|
||||||
int TokHasIVal (Token Tok);
|
int TokHasIVal (token_t Tok);
|
||||||
/* Return true if the given token has an attached IVal */
|
/* Return true if the given token has an attached IVal */
|
||||||
|
|
||||||
#if defined(HAVE_INLINE)
|
#if defined(HAVE_INLINE)
|
||||||
INLINE int TokIsSep (enum Token T)
|
INLINE int TokIsSep (enum token_t T)
|
||||||
/* Return true if this is a separator token */
|
/* Return true if this is a separator token */
|
||||||
{
|
{
|
||||||
return (T == TOK_SEP || T == TOK_EOF);
|
return (T == TOK_SEP || T == TOK_EOF);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2010, Ullrich von Bassewitz */
|
/* (C) 1998-2011, Ullrich von Bassewitz */
|
||||||
/* Roemerstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
@@ -176,7 +176,7 @@ void FreeTokList (TokList* List)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum Token GetTokListTerm (enum Token Term)
|
enum token_t GetTokListTerm (enum token_t Term)
|
||||||
/* Determine if the following token list is enclosed in curly braces. This is
|
/* Determine if the following token list is enclosed in curly braces. This is
|
||||||
* the case if the next token is the opening brace. If so, skip it and return
|
* the case if the next token is the opening brace. If so, skip it and return
|
||||||
* a closing brace, otherwise return Term.
|
* a closing brace, otherwise return Term.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2000-2008, Ullrich von Bassewitz */
|
/* (C) 2000-2011, Ullrich von Bassewitz */
|
||||||
/* Roemerstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
typedef struct TokNode TokNode;
|
typedef struct TokNode TokNode;
|
||||||
struct TokNode {
|
struct TokNode {
|
||||||
TokNode* Next; /* For single linked list */
|
TokNode* Next; /* For single linked list */
|
||||||
Token Tok; /* Token value */
|
token_t Tok; /* Token value */
|
||||||
int WS; /* Whitespace before token? */
|
int WS; /* Whitespace before token? */
|
||||||
long IVal; /* Integer token attribute */
|
long IVal; /* Integer token attribute */
|
||||||
StrBuf SVal; /* String attribute, dyn. allocated */
|
StrBuf SVal; /* String attribute, dyn. allocated */
|
||||||
@@ -113,7 +113,7 @@ TokList* NewTokList (void);
|
|||||||
void FreeTokList (TokList* T);
|
void FreeTokList (TokList* T);
|
||||||
/* Delete the token list including all token nodes */
|
/* Delete the token list including all token nodes */
|
||||||
|
|
||||||
Token GetTokListTerm (Token Term);
|
token_t GetTokListTerm (token_t Term);
|
||||||
/* Determine if the following token list is enclosed in curly braces. This is
|
/* Determine if the following token list is enclosed in curly braces. This is
|
||||||
* the case if the next token is the opening brace. If so, skip it and return
|
* the case if the next token is the opening brace. If so, skip it and return
|
||||||
* a closing brace, otherwise return Term.
|
* a closing brace, otherwise return Term.
|
||||||
|
|||||||
Reference in New Issue
Block a user