Skip to content

Commit

Permalink
Lexer now stores token value to IncludeState.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 18, 2009
1 parent 43c99c4 commit f57baed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions mojoshader_internal.h
Expand Up @@ -395,6 +395,7 @@ typedef struct IncludeState
const char *source;
const char *token;
unsigned int tokenlen;
Token tokenval;
const unsigned char *lexer_marker;
int report_whitespace;
unsigned int orig_length;
Expand Down
8 changes: 5 additions & 3 deletions mojoshader_lexer.re
Expand Up @@ -25,7 +25,7 @@
typedef unsigned char uchar;

/*!max:re2c */
#define RET(t) do { update_state(s, eoi, cursor, token); return t; } while (0)
#define RET(t) do { return update_state(s, eoi, cursor, token, t); } while (0)
#define YYCTYPE uchar
#define YYCURSOR cursor
#define YYLIMIT limit
Expand All @@ -34,8 +34,8 @@ typedef unsigned char uchar;

static uchar sentinel[YYMAXFILL];

static void update_state(IncludeState *s, int eoi,
const uchar *cur, const uchar *tok)
static Token update_state(IncludeState *s, int eoi, const uchar *cur,
const uchar *tok, const Token val)
{
if (eoi)
{
Expand All @@ -53,6 +53,8 @@ static void update_state(IncludeState *s, int eoi,
s->token = (const char *) tok;
} // else
s->tokenlen = (unsigned int) (s->source - s->token);
s->tokenval = val;
return val;
} // update_state

Token preprocessor_lexer(IncludeState *s)
Expand Down

0 comments on commit f57baed

Please sign in to comment.