4 * Ullrich von Bassewitz, 07.06.1998
19 /*****************************************************************************/
20 /* Token definitions */
21 /*****************************************************************************/
25 typedef enum token_t {
37 /* Tokens denoting types */
39 TOK_CHAR = TOK_FIRSTTYPE,
50 TOK_LASTTYPE = TOK_VOID,
52 /* Control statements */
73 /* Primary operators */
137 /*****************************************************************************/
139 /*****************************************************************************/
144 typedef struct Token_ Token;
146 token_t Tok; /* The token itself */
147 long IVal; /* The integer attribute */
148 ident Ident; /* Identifier if IDENT */
149 unsigned Pos; /* Source line where the token comes from */
150 type* IType; /* Type if integer constant */
153 extern Token CurTok; /* The current token */
154 extern Token NextTok; /* The next token */
156 /* Defines to make the old code work */
157 #define curtok CurTok.Tok
158 #define curval CurTok.IVal
159 #define curpos CurTok.Pos
160 #define curtype CurTok.IType
162 #define nxttok NextTok.Tok
163 #define nxtval NextTok.IVal
164 #define nxtpos NextTok.Pos
165 #define nxttype NextTok.IType
169 /*****************************************************************************/
171 /*****************************************************************************/
175 void symname (char* s);
176 /* Get symbol from input stream */
179 /* Get symbol from input stream or return 0 if not a symbol. */
181 void NextToken (void);
182 /* Get next token from input stream */
184 void Consume (token_t Token, unsigned ErrNum);
185 /* Eat token if it is the next in the input stream, otherwise print an error
189 void ConsumeColon (void);
190 /* Check for a colon and skip it. */
192 void ConsumeSemi (void);
193 /* Check for a semicolon and skip it. */
195 void ConsumeLParen (void);
196 /* Check for a left parenthesis and skip it */
198 void ConsumeRParen (void);
199 /* Check for a right parenthesis and skip it */
201 void ConsumeLBrack (void);
202 /* Check for a left bracket and skip it */
204 void ConsumeRBrack (void);
205 /* Check for a right bracket and skip it */
207 void ConsumeLCurly (void);
208 /* Check for a left curly brace and skip it */
210 void ConsumeRCurly (void);
211 /* Check for a right curly brace and skip it */
215 /* End of scanner.h */