Assembler: fixed bug where relative addressing failed parsing.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 01 Aug 2011 15:06:52 -0400
changeset 1057 4c5cb78c6cdd
parent 1056 73c697a7e950
child 1058 dcbe39bffedc
Assembler: fixed bug where relative addressing failed parsing.
mojoshader_assembler.c
--- a/mojoshader_assembler.c	Mon Jun 20 15:56:22 2011 -0400
+++ b/mojoshader_assembler.c	Mon Aug 01 15:06:52 2011 -0400
@@ -427,9 +427,11 @@
     // "c[5]" is the same as "c5", so if the token is done, see if next is '['.
     if ((neednum) && (ctx->tokenlen == 0))
     {
+        const int tlen = ctx->tokenlen;  // we need to protect this for later.
         if (nexttoken(ctx) == ((Token) '['))
             neednum = 0;  // don't need a number on register name itself.
         pushback(ctx);
+        ctx->tokenlen = tlen;
     } // if
 
     if (neednum)