package nxm.sys.intr;

import nxm.sys.lib.Intrinsic;

/**
  Executes a jump to the named label in the macro language.

  @author Jeff Schoen

*/
public class Goto extends Intrinsic {

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

  public int process() {

    if (M.macro == null) {
      M.error("No macro executing ...");
      return FINISH;
    }
    String label = MA.getU("NAME");
    int index = M.macro.lookupIndex (label);
    if (index>0) M.macro.nextIndex = index;
    else M.error ("Label name "+label+" not found");
    return FINISH;
  }
}
