Loading

Paste #pggrjmenp

  1. ;---------------------------------------
  2. ; IF ELIF ELSE ENDIF
  3. %imacro IF 1.listflow
  4. %push flow_if
  5.   j%+1 %$LABEL_ELSE
  6. %endmacro
  7.  
  8. %imacro ELSE 0.listflow
  9. %ifctx flow_if
  10. %$LABEL_ELSE:
  11.   %repl flow_else   ; will stop wrong ELSEIF after ELSE
  12. %else
  13.   FLOW_ERROR "ELSE without previous IF or ELSEIF"
  14. %endif
  15. %endmacro
  16.  
  17. %imacro ELSEIF 1.listflow
  18. %ifctx flow_if
  19. %$LABEL_ELSE:
  20.   %pop          ; change context, drop labels
  21.   %push flow_if
  22.   j%+1 %$LABEL_ELSE ; new context's label, not this one
  23. %else
  24.  FLOW_ERROR "ELSEIF without previous IF or ELSEIF"
  25. %endif
  26. %endmacro
  27.  
  28. %imacro ENDIF 0.listflow
  29. %ifctx flow_if ; no ELSE branch
  30. %$LABEL_ELSE:
  31. %pop
  32. %elifctx flow_else ; ELSE branch, have no label
  33. %pop
  34. %else
  35.  FLOW_ERROR "ENDIF without previous IF"
  36. %endif
  37. ; ENDIF has no %$LABEL_END: which is by design. BREAK can be used in blocks with IF conditional as expected
  38. %endmacro
  39.  
  40.