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 */
141 /*****************************************************************************/
143 /*****************************************************************************/
148 typedef struct Token_ Token;
150 token_t Tok; /* The token itself */
151 long IVal; /* The integer attribute */
152 ident Ident; /* Identifier if IDENT */
153 unsigned Pos; /* Source line where the token comes from */
154 type* IType; /* Type if integer constant */
157 extern Token CurTok; /* The current token */
158 extern Token NextTok; /* The next token */
160 /* Defines to make the old code work */
161 #define curtok CurTok.Tok
162 #define curval CurTok.IVal
163 #define curpos CurTok.Pos
164 #define curtype CurTok.IType
166 #define nxttok NextTok.Tok
167 #define nxtval NextTok.IVal
168 #define nxtpos NextTok.Pos
169 #define nxttype NextTok.IType
173 /*****************************************************************************/
175 /*****************************************************************************/
179 void SymName (char* s);
180 /* Get symbol from input stream */
183 /* Get symbol from input stream or return 0 if not a symbol. */
185 void NextToken (void);
186 /* Get next token from input stream */
188 void Consume (token_t Token, unsigned ErrNum);
189 /* Eat token if it is the next in the input stream, otherwise print an error
193 void ConsumeColon (void);
194 /* Check for a colon and skip it. */
196 void ConsumeSemi (void);
197 /* Check for a semicolon and skip it. */
199 void ConsumeLParen (void);
200 /* Check for a left parenthesis and skip it */
202 void ConsumeRParen (void);
203 /* Check for a right parenthesis and skip it */
205 void ConsumeLBrack (void);
206 /* Check for a left bracket and skip it */
208 void ConsumeRBrack (void);
209 /* Check for a right bracket and skip it */
211 void ConsumeLCurly (void);
212 /* Check for a left curly brace and skip it */
214 void ConsumeRCurly (void);
215 /* Check for a right curly brace and skip it */
219 /* End of scanner.h */