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 double FVal; /* The float attribute */
153 ident Ident; /* Identifier if IDENT */
154 unsigned Pos; /* Source line where the token comes from */
155 type* Type; /* Type if integer or float constant */
158 extern Token CurTok; /* The current token */
159 extern Token NextTok; /* The next token */
161 /* Defines to make the old code work */
162 #define curtok CurTok.Tok
163 #define curval CurTok.IVal
164 #define curpos CurTok.Pos
165 #define curtype CurTok.Type
167 #define nxttok NextTok.Tok
168 #define nxtval NextTok.IVal
169 #define nxtpos NextTok.Pos
170 #define nxttype NextTok.Type
174 /*****************************************************************************/
176 /*****************************************************************************/
180 void SymName (char* s);
181 /* Get symbol from input stream */
184 /* Get symbol from input stream or return 0 if not a symbol. */
186 void NextToken (void);
187 /* Get next token from input stream */
189 void Consume (token_t Token, unsigned ErrNum);
190 /* Eat token if it is the next in the input stream, otherwise print an error
194 void ConsumeColon (void);
195 /* Check for a colon and skip it. */
197 void ConsumeSemi (void);
198 /* Check for a semicolon and skip it. */
200 void ConsumeLParen (void);
201 /* Check for a left parenthesis and skip it */
203 void ConsumeRParen (void);
204 /* Check for a right parenthesis and skip it */
206 void ConsumeLBrack (void);
207 /* Check for a left bracket and skip it */
209 void ConsumeRBrack (void);
210 /* Check for a right bracket and skip it */
212 void ConsumeLCurly (void);
213 /* Check for a left curly brace and skip it */
215 void ConsumeRCurly (void);
216 /* Check for a right curly brace and skip it */
220 /* End of scanner.h */