--- a/mojoshader_assembler.c Mon Feb 23 20:43:41 2009 -0500
+++ b/mojoshader_assembler.c Mon Feb 23 23:07:06 2009 -0500
@@ -197,62 +197,40 @@
ctx->pushedback = 1;
} // pushback
-static Token _nexttoken(Context *ctx)
-{
- while (1)
- {
- ctx->token = preprocessor_nexttoken(ctx->preprocessor, &ctx->tokenlen,
- &ctx->tokenval);
-
- if (preprocessor_outofmemory(ctx->preprocessor))
- {
- out_of_memory(ctx);
- ctx->tokenval = TOKEN_EOI;
- ctx->token = NULL;
- ctx->tokenlen = 0;
- break;
- } // if
-
- if (ctx->tokenval == TOKEN_PREPROCESSING_ERROR)
- {
- fail(ctx, ctx->token);
- continue;
- } // else
-
- break;
- } // while
-
- return ctx->tokenval;
-} // _nexttoken
-
static Token nexttoken(Context *ctx)
{
if (ctx->pushedback)
+ ctx->pushedback = 0;
+ else
{
- print_debug_token(ctx->token, ctx->tokenlen, ctx->tokenval);
- ctx->pushedback = 0;
- return ctx->tokenval;
- } // if
-
- Token token = _nexttoken(ctx);
-
- while (token == ((Token) '\n'))
- token = _nexttoken(ctx); // skip endlines.
+ while (1)
+ {
+ ctx->token = preprocessor_nexttoken(ctx->preprocessor,
+ &ctx->tokenlen,
+ &ctx->tokenval);
- if (token == ((Token) ';')) // single line comment in assembler.
- {
- do
- {
- token = _nexttoken(ctx);
- } while ((token != ((Token) '\n')) && (token != TOKEN_EOI));
+ if (preprocessor_outofmemory(ctx->preprocessor))
+ {
+ out_of_memory(ctx);
+ ctx->tokenval = TOKEN_EOI;
+ ctx->token = NULL;
+ ctx->tokenlen = 0;
+ break;
+ } // if
- while (token == ((Token) '\n'))
- token = _nexttoken(ctx); // skip endlines.
- } // if
+ else if (ctx->tokenval == TOKEN_PREPROCESSING_ERROR)
+ {
+ fail(ctx, ctx->token);
+ continue;
+ } // else if
+
+ break;
+ } // while
+ } // else
print_debug_token(ctx->token, ctx->tokenlen, ctx->tokenval);
- return token;
+ return ctx->tokenval;
} // nexttoken
@@ -1427,7 +1405,7 @@
ctx->parse_phase = MOJOSHADER_PARSEPHASE_NOTSTARTED;
ctx->preprocessor = preprocessor_start(filename, source, sourcelen,
include_open, include_close,
- defines, define_count, m, f, d);
+ defines, define_count, 1, m, f, d);
if (ctx->preprocessor == NULL)
{