commit c5f75ed

zzo38  ·  2023-05-03 21:35:30 +0000 UTC
parent eda03c2
Add nonstandard else block into uxnasm
2 files changed,  +12, -0
+3, -0
 1@@ -142,6 +142,9 @@ The following nonstandard tokens are available:
 2 
 3  ]\ acts like \: for the matching [@ command.
 4 
 5+ ][ is like [! corresponding to a later ] and then ]@ corresponding to a
 6+ earlier [ command (it can be used like a else block).
 7+
 8 For the . , : ; commands, the name can optionally start with & to mean
 9 that it is interpreted the same as for a & command.
10 
+9, -0
 1@@ -513,6 +513,15 @@ parse(char *w, FILE *f)
 2 		    default: return parse(w+1,f);
 3 		  }
 4 		  break;
 5+		} else if(w[1]=='[' && w[0]==']' && !w[2]) {
 6+		  if(!bsptr) return error("Stack underflow",w);
 7+		  i=bstack[bsptr-1];
 8+		  bstack[bsptr-1]=bcnt++;
 9+		  snprintf(w,10,"!\\%x\\",bstack[bsptr-1]);
10+		  if(!parse(w,f)) return 0;
11+		  snprintf(w,10,"\\%x\\",i);
12+		  if(!makelabel(w)) return error("Invalid label",w);
13+		  break;
14 		}
15 		/* fall through */
16 	default: defa: