summaryrefslogtreecommitdiff
path: root/test/raytracer/gmllexer.h
blob: 9b8d630f14847f3034b4658c0ef59468e1474af2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* Lexer for GML */

struct lexeme {
  enum {
    NONE,
    OPERATOR, IDENTIFIER, BINDER, BOOLEAN, INTEGER, REAL, STRING,
    LBRACE, RBRACE, LBRACKET, RBRACKET, END_OF_FILE
  } kind;
  union {
    int op;                     /* for operators */
    char * s;                   /* for identifiers, binders, strings */
    int i;                      /* for integer and boolean literals */
    flt d;                      /* for float literals */
  } u;
};

extern struct lexeme current_lexeme;

extern void get_lexeme(void);
extern void discard_lexeme(void);
extern void init_lexer(void);