001    // -*- mode: java -*-
002    /* Copyright 2000, 2001, Compaq Computer Corporation */
003    
004    /* IF THIS IS A JAVA FILE, DO NOT EDIT IT!  
005    
006       Most Java files in this directory which are part of the Javafe AST
007       are automatically generated using the astgen comment (see
008       ESCTools/Javafe/astgen) from the input file 'hierarchy.h'.  If you
009       wish to modify AST classes or introduce new ones, modify
010       'hierarchy.j.'
011     */
012    
013    package javafe.ast;
014    
015    import javafe.util.Assert;
016    import javafe.util.Location;
017    import javafe.util.ErrorSet;
018    
019    // Convention: unless otherwise noted, integer fields named "loc" refer
020    // to the location of the first character of the syntactic unit
021    
022    
023    public class BreakStmt extends BranchStmt
024    { 
025    
026    // Generated boilerplate constructors:
027    
028       //@ ensures this.label == label;
029       //@ ensures this.loc == loc;
030       protected BreakStmt(Identifier label, int loc) {
031          super(label, loc);
032       }
033    
034    // Generated boilerplate methods:
035    
036       public final int childCount() {
037          return 1;
038       }
039    
040       public final Object childAt(int index) {
041               /*throws IndexOutOfBoundsException*/
042          if (index < 0)
043             throw new IndexOutOfBoundsException("AST child index " + index);
044          int indexPre = index;
045    
046          int sz;
047    
048          if (index == 0) return this.label;
049          else index--;
050    
051          throw new IndexOutOfBoundsException("AST child index " + indexPre);
052       }   //@ nowarn Exception;
053    
054       public final /*@non_null*/String toString() {
055          return "[BreakStmt"
056             + " label = " + this.label
057             + " loc = " + this.loc
058             + "]";
059       }
060    
061       public final int getTag() {
062          return TagConstants.BREAKSTMT;
063       }
064    
065       public final void accept(Visitor v) { v.visitBreakStmt(this); }
066    
067       public final Object accept(VisitorArgResult v, Object o) {return v.visitBreakStmt(this, o); }
068    
069       public void check() {
070          super.check();
071       }
072    
073       //@ requires loc != javafe.util.Location.NULL;
074       //@ ensures \result != null;
075       public static BreakStmt make(Identifier label, int loc) {
076          BreakStmt result = new BreakStmt(label, loc);
077          return result;
078       }
079    }