]> git.sur5r.net Git - cc65/blobdiff - src/cc65/scanner.h
Avoid a copy of the line contents
[cc65] / src / cc65 / scanner.h
index db10cb9b909b1f39c7e1ee636d4db6d4354812e6..97614b62ed13e45847cb9e7e6ea3ead354244bd7 100644 (file)
@@ -1,8 +1,35 @@
-/*
- * scanner.h
- *
- * Ullrich von Bassewitz, 07.06.1998
- */
+/*****************************************************************************/
+/*                                                                           */
+/*                                scanner.h                                 */
+/*                                                                           */
+/*                     Source file line info structure                      */
+/*                                                                           */
+/*                                                                           */
+/*                                                                           */
+/* (C) 1998-2001 Ullrich von Bassewitz                                       */
+/*               Wacholderweg 14                                             */
+/*               D-70597 Stuttgart                                           */
+/* EMail:        uz@musoftware.de                                            */
+/*                                                                           */
+/*                                                                           */
+/* This software is provided 'as-is', without any expressed or implied       */
+/* warranty.  In no event will the authors be held liable for any damages    */
+/* arising from the use of this software.                                    */
+/*                                                                           */
+/* Permission is granted to anyone to use this software for any purpose,     */
+/* including commercial applications, and to alter it and redistribute it    */
+/* freely, subject to the following restrictions:                            */
+/*                                                                           */
+/* 1. The origin of this software must not be misrepresented; you must not   */
+/*    claim that you wrote the original software. If you use this software   */
+/*    in a product, an acknowledgment in the product documentation would be  */
+/*    appreciated but is not required.                                       */
+/* 2. Altered source versions must be plainly marked as such, and must not   */
+/*    be misrepresented as being the original software.                      */
+/* 3. This notice may not be removed or altered from any source              */
+/*    distribution.                                                          */
+/*                                                                           */
+/*****************************************************************************/
 
 
 
 
 
 
+/* cc65 */
 #include "datatype.h"
 #include "ident.h"
+#include "lineinfo.h"
 
 
 
@@ -89,6 +118,7 @@ typedef enum token_t {
     TOK_MINUS,
     TOK_MUL_ASSIGN,
     TOK_STAR,
+    TOK_MUL = TOK_STAR,                /* Alias */
     TOK_DIV_ASSIGN,
     TOK_DIV,
     TOK_BOOL_AND,
@@ -101,8 +131,6 @@ typedef enum token_t {
     TOK_OR,
     TOK_EQ,
     TOK_ASSIGN,
-    TOK_SHL_ASSIGN,
-    TOK_SHL,
 
     /* Inequalities */
     TOK_LE,
@@ -110,6 +138,8 @@ typedef enum token_t {
     TOK_GE,
     TOK_GT,
 
+    TOK_SHL_ASSIGN,
+    TOK_SHL,
     TOK_SHR_ASSIGN,
     TOK_SHR,
     TOK_XOR_ASSIGN,
@@ -129,7 +159,7 @@ typedef enum token_t {
     TOK_FASTCALL,
     TOK_A,
     TOK_X,
-    TOK_Y,       
+    TOK_Y,
     TOK_AX,
     TOK_EAX,
 
@@ -145,29 +175,19 @@ typedef enum token_t {
 
 
 /* Token stuff */
-typedef struct Token_ Token;
-struct Token_ {
-    token_t    Tok;            /* The token itself */
-    long       IVal;           /* The integer attribute */
-    ident      Ident;          /* Identifier if IDENT */
-    unsigned   Pos;            /* Source line where the token comes from */
-    type*      IType;          /* Type if integer constant */
+typedef struct Token Token;
+struct Token {
+    token_t    Tok;            /* The token itself */
+    long       IVal;           /* The integer attribute */
+    double     FVal;           /* The float attribute */
+    ident      Ident;          /* Identifier if IDENT */
+    LineInfo*   LI;            /* Source line where the token comes from */
+    type*      Type;           /* Type if integer or float constant */
 };
 
 extern Token CurTok;           /* The current token */
 extern Token NextTok;          /* The next token */
 
-/* Defines to make the old code work */
-#define curtok         CurTok.Tok
-#define curval         CurTok.IVal
-#define curpos         CurTok.Pos
-#define curtype        CurTok.IType
-
-#define nxttok         NextTok.Tok
-#define nxtval         NextTok.IVal
-#define nxtpos         NextTok.Pos
-#define nxttype        NextTok.IType
-
 
 
 /*****************************************************************************/
@@ -185,7 +205,7 @@ int IsSym (char* s);
 void NextToken (void);
 /* Get next token from input stream */
 
-void Consume (token_t Token, unsigned ErrNum);
+void Consume (token_t Token, const char* ErrorMsg);
 /* Eat token if it is the next in the input stream, otherwise print an error
  * message.
  */
@@ -196,6 +216,9 @@ void ConsumeColon (void);
 void ConsumeSemi (void);
 /* Check for a semicolon and skip it. */
 
+void ConsumeComma (void);
+/* Check for a comma and skip it. */
+
 void ConsumeLParen (void);
 /* Check for a left parenthesis and skip it */