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

Labeled statements

Labeled statements[15]:
ATTR LblDepth: int;
CLASS SYMBOL LabelTree COMPUTE
  SYNT.LblDepth=ADD(INCLUDING LabelTree.LblDepth,1);
END;

TREE SYMBOL MethodDeclaration      INHERITS LabelTree END;
TREE SYMBOL ConstructorDeclaration INHERITS LabelTree END;
TREE SYMBOL ClassInitializer       INHERITS LabelTree END;
TREE SYMBOL Goal                   INHERITS LabelTree COMPUTE
  SYNT.LblDepth=0;
  SYNT.GotLblDepth="yes";
END;

TREE SYMBOL LabeledStatement: Sym: int;

TREE SYMBOL LabeledStatement INHERITS LblIdUseEnv COMPUTE
  IF(EQ(GetLblDepth(THIS.LblKey,0),INCLUDING LabelTree.LblDepth),
    message(
      ERROR,
      CatStrInd("Shadows another label: ",THIS.Sym),
      0,
      COORDREF))
  <- INCLUDING (LabeledStatement.GotLblDepth,Goal.GotLblDepth);
END;

RULE: LabeledStatement ::= LabelIdDef ':' Statement COMPUTE
  LabeledStatement.Sym=LabelIdDef.Sym;
  LabeledStatement.GotLblDepth=
    ResetLblDepth(LabelIdDef.LblKey,INCLUDING LabelTree.LblDepth);
END;
This macro is invoked in definition 14.

Property definitions[16]:
LblDepth: int;
This macro is defined in definitions 10, 16, 22, 36, and 40.
This macro is invoked in definition 3.



2008-09-11