]> Shamusworld >> Repos - rmac/blobdiff - token.c
Fix for assembly getting stuck in an infinite loop when a INCLUDEd file inside an...
[rmac] / token.c
diff --git a/token.c b/token.c
index c78d97ac6f0054d8ca02bf68b0a3a1c0c10406e4..3031895c1e5e63d5e451ab85166527ddb6b68da3 100644 (file)
--- a/token.c
+++ b/token.c
@@ -554,6 +554,9 @@ DEBUG printf("ExM: SYMBOL=\"%s\"", d);
                                                        case DOTL:
                                                                d = ".l";
                                                                break;
+                                                       case CR_ABSCOUNT:
+                                                               d = "^^abscount";
+                                                               break;
                                                        case CR_DATE:
                                                                d = "^^date";
                                                                break;
@@ -909,8 +912,13 @@ retry:
                if ((ln = GetNextLine()) == NULL)
                {
 if (verb_flag) printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n");
-                       fpop();                                                 // Pop input level
-                       goto retry;                                             // Try for more lines 
+                       if (fpop() == 0)                                // Pop input level
+                               goto retry;                                     // Try for more lines 
+                       else
+                       {
+                               ifent->if_prev = (IFENT *) - 1; //Signal Assemble() that we have reached EOF with unbalanced if/endifs
+                               return TKEOF;
+                       }
                }
 
                curlineno++;                                            // Bump line number
@@ -1641,6 +1649,8 @@ void DumpTokenBuffer(void)
                        printf("[DOTI]");
                else if (*t == ENDEXPR)
                        printf("[ENDEXPR]");
+               else if (*t == CR_ABSCOUNT)
+                       printf("[CR_ABSCOUNT]");
                else if (*t == CR_DEFINED)
                        printf("[CR_DEFINED]");
                else if (*t == CR_REFERENCED)