001    /* Copyright 2000, 2001, Compaq Computer Corporation */
002    
003    /* IF THIS IS A JAVA FILE, DO NOT EDIT IT!  
004    
005       Most Java files in this directory which are part of the Javafe AST
006       are automatically generated using the astgen comment (see
007       ESCTools/Javafe/astgen) from the input file 'hierarchy.h'.  If you
008       wish to modify AST classes or introduce new ones, modify
009       'hierarchy.j.'
010     */
011    
012    package escjava.ast;
013    
014    import java.util.Hashtable;
015    import java.util.Set;
016    import java.util.ArrayList;
017    
018    import javafe.ast.*;
019    import javafe.util.Assert;
020    import javafe.util.Location;
021    import escjava.ParsedRoutineSpecs;
022    
023    // Convention: unless otherwise noted, integer fields named "loc" refer
024    // to the location of the first character of the syntactic unit
025    
026    //# TagBase javafe.tc.TagConstants.LAST_TAG + 1
027    //# VisitorRoot javafe.ast.Visitor
028    
029    
030    public class SimpleModifierPragma extends ModifierPragma
031    {
032      public int tag;
033    
034      public int loc;
035    
036    
037      public final int getTag() { return tag; }
038    
039      private void postCheck() {
040        boolean goodtag =
041          (tag == TagConstants.CODE_BIGINT_MATH
042           || tag == TagConstants.CODE_JAVA_MATH
043           || tag == TagConstants.CODE_SAFE_MATH
044           || tag == TagConstants.HELPER
045           || tag == TagConstants.IMMUTABLE
046           || tag == TagConstants.MAY_BE_NULL
047           || tag == TagConstants.MONITORED
048           || tag == TagConstants.NON_NULL
049           || tag == TagConstants.NON_NULL_REF_BY_DEFAULT
050           || tag == TagConstants.NULL_REF_BY_DEFAULT
051           || tag == TagConstants.OBS_PURE
052           || tag == TagConstants.PEER
053           || tag == TagConstants.READONLY
054           || tag == TagConstants.REP
055           || tag == TagConstants.SPEC_BIGINT_MATH
056           || tag == TagConstants.SPEC_JAVA_MATH
057           || tag == TagConstants.SPEC_PUBLIC
058           || tag == TagConstants.SPEC_SAFE_MATH
059           || tag == TagConstants.UNINITIALIZED
060           || tag == TagConstants.WRITABLE_DEFERRED
061           );
062        Assert.notFalse(goodtag);
063      }
064    
065      public int getStartLoc() { return loc; }
066    
067    
068    // Generated boilerplate constructors:
069    
070      /**
071       * Construct a raw SimpleModifierPragma whose class invariant(s) have not
072       * yet been established.  It is the caller's job to
073       * initialize the returned node's fields so that any
074       * class invariants hold.
075       */
076      //@ requires I_will_establish_invariants_afterwards;
077      protected SimpleModifierPragma() {}    //@ nowarn Invariant,NonNullInit;
078    
079    
080    // Generated boilerplate methods:
081    
082      public final int childCount() {
083         return 0;
084      }
085    
086      public final Object childAt(int index) {
087              /*throws IndexOutOfBoundsException*/
088         if (index < 0)
089            throw new IndexOutOfBoundsException("AST child index " + index);
090         int indexPre = index;
091    
092         int sz;
093    
094         throw new IndexOutOfBoundsException("AST child index " + indexPre);
095      }   //@ nowarn Exception;
096    
097      public final String toString() {
098         return "[SimpleModifierPragma"
099            + " tag = " + this.tag
100            + " loc = " + this.loc
101            + "]";
102      }
103    
104      public final void accept(javafe.ast.Visitor v) { 
105        if (v instanceof Visitor) ((Visitor)v).visitSimpleModifierPragma(this);
106      }
107    
108      public final Object accept(javafe.ast.VisitorArgResult v, Object o) { 
109        if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitSimpleModifierPragma(this, o); else return null;
110      }
111    
112      public void check() {
113         postCheck();
114      }
115    
116      //@ ensures \result != null;
117      public static SimpleModifierPragma make(int tag, int loc) {
118         //@ set I_will_establish_invariants_afterwards = true;
119         SimpleModifierPragma result = new SimpleModifierPragma();
120         result.tag = tag;
121         result.loc = loc;
122         return result;
123      }
124    }