/* */
/* */
/* */
-/* (C) 2000 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* (C) 2000-2011, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
+/* common */
+#include "strbuf.h"
+
+/* ca65 */
+#include "scanner.h"
+
+
+
/*****************************************************************************/
/* Data */
/*****************************************************************************/
-
+
/* Struct holding a token */
typedef struct TokNode TokNode;
struct TokNode {
- TokNode* Next; /* For single linked list */
- enum Token Tok; /* Token value */
- int WS; /* Whitespace before token? */
- long IVal; /* Integer token attribute */
- char SVal [1]; /* String attribute, dyn. allocated */
+ TokNode* Next; /* For single linked list */
+ Token T; /* Token value */
};
/* Struct holding a token list */
typedef struct TokList TokList;
struct TokList {
- TokList* Next; /* Single linked list (for replay) */
- TokNode* Root; /* First node in list */
- TokNode* Last; /* Last node in list or replay */
- unsigned Repeat; /* Repeat counter (used for replay) */
- unsigned Count; /* Token count */
+ TokList* Next; /* Single linked list (for replay) */
+ TokNode* Root; /* First node in list */
+ TokNode* Last; /* Last node in list or replay */
+ unsigned RepCount; /* Repeat counter (used for replay) */
+ unsigned RepMax; /* Maximum repeat count for replay */
+ unsigned Count; /* Token count */
+ void (*Check)(TokList*); /* Token check function */
+ void* Data; /* Additional data for check */
};
TokNode* NewTokNode (void);
/* Create and return a token node with the current token value */
-void FreeTokNode (TokNode* T);
+void FreeTokNode (TokNode* N);
/* Free the given token node */
-void TokSet (TokNode* T);
+void TokSet (TokNode* N);
/* Set the scanner token from the given token node */
-enum TC TokCmp (const TokNode* T);
+enum TC TokCmp (const TokNode* N);
/* Compare the token given as parameter against the current token */
void InitTokList (TokList* T);
void FreeTokList (TokList* T);
/* Delete the token list including all token nodes */
+token_t GetTokListTerm (token_t Term);
+/* 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
+ * a closing brace, otherwise return Term.
+ */
+
void AddCurTok (TokList* T);
/* Add the current token to the token list */