package nxm.sys.intr;

import nxm.sys.lib.Intrinsic;

/** Handle a block ELSEIF control statement. <br>
    <br>
    The {@link If} intrinsic handles selection of the proper branch in an
    IF..ELSEIF..ELSE..ENDIF block, so this simply serves as an indicator that
    the preceding IF (or ELSEIF) is complete, and branches the code to the ENDIF.

    @author Jeff Schoen
 */
public class Elseif extends Intrinsic {

  /** default constructor */
  public Elseif () {}

  @Override
  public int process () {
    if (M.macro!=null) {
      int i,index=nextIndex;

      while ((i=((Intrinsic)M.macro.lines[index].cmd).nextIndex) > 0) {
        index=i;
      }

      M.macro.nextIndex=index;
    }
    return FINISH;
  }
}
