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