From f57baed67bc2bae5b4247c6466ce1f8f5d79d8ac Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 18 Feb 2009 08:35:07 -0500 Subject: [PATCH] Lexer now stores token value to IncludeState. --- mojoshader_internal.h | 1 + mojoshader_lexer.re | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mojoshader_internal.h b/mojoshader_internal.h index 0c139475..dbfde684 100644 --- a/mojoshader_internal.h +++ b/mojoshader_internal.h @@ -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; diff --git a/mojoshader_lexer.re b/mojoshader_lexer.re index 334b6e06..0dcf11b1 100644 --- a/mojoshader_lexer.re +++ b/mojoshader_lexer.re @@ -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 @@ -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) { @@ -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)