next up previous
Next: The continue statement Up: Blocks and statements Previous: The switch statement

The break statement

The break statement[20]:
ATTR CannotBreak: int;
CLASS SYMBOL Breakable   COMPUTE SYNT.CannotBreak=0; END;
CLASS SYMBOL Unbreakable COMPUTE SYNT.CannotBreak=1; END;

TREE  SYMBOL LoopStatement    INHERITS Breakable   END;
TREE  SYMBOL SwitchStatement  INHERITS Breakable   END;
TREE  SYMBOL Goal             INHERITS Unbreakable END;
TREE  SYMBOL MethodBody       INHERITS Unbreakable END;
TREE  SYMBOL ClassInitializer INHERITS Unbreakable END;

RULE: Statement ::= 'break' ';' COMPUTE
  IF(INCLUDING (Breakable.CannotBreak,Unbreakable.CannotBreak),
    message(ERROR,"Plain break must occur in a loop or switch",0,COORDREF));

TREE SYMBOL LabeledStatement COMPUTE SYNT.CannotBreak=0; END;

RULE: Statement ::= 'break' LabelIdUse ';' COMPUTE
  IF(INCLUDING (Breakable.CannotBreak,Unbreakable.CannotBreak,
      "Labeled break must occur in a loop, switch, or labeled statement",
This macro is invoked in definition 14.