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 escjava.ast;
014    
015    import java.util.Hashtable;
016    import java.util.Set;
017    import java.util.ArrayList;
018    
019    import javafe.ast.*;
020    import javafe.util.Assert;
021    import javafe.util.Location;
022    import escjava.ParsedRoutineSpecs;
023    
024    // Convention: unless otherwise noted, integer fields named "loc" refer
025    // to the location of the first character of the syntactic unit
026    
027    //# TagBase javafe.tc.TagConstants.LAST_TAG + 1
028    //# VisitorRoot javafe.ast.Visitor
029    
030    
031    public class SimpleModifierPragma extends ModifierPragma
032    {
033      public int tag;
034    
035      public int loc;
036    
037    
038      public final int getTag() { return tag; }
039    
040      private void postCheck() {
041        boolean goodtag =
042          (tag == TagConstants.CODE_BIGINT_MATH
043           || tag == TagConstants.CODE_JAVA_MATH
044           || tag == TagConstants.CODE_SAFE_MATH
045           || tag == TagConstants.HELPER
046           || tag == TagConstants.IMMUTABLE
047           || tag == TagConstants.NULLABLE
048           || tag == TagConstants.MONITORED
049           || tag == TagConstants.NON_NULL
050           || tag == TagConstants.NON_NULL_BY_DEFAULT
051           || tag == TagConstants.NULLABLE_BY_DEFAULT
052           || tag == TagConstants.OBS_PURE
053           || tag == TagConstants.PEER
054           || tag == TagConstants.READONLY
055           || tag == TagConstants.REP
056           || tag == TagConstants.SPEC_BIGINT_MATH
057           || tag == TagConstants.SPEC_JAVA_MATH
058           || tag == TagConstants.SPEC_PUBLIC
059           || tag == TagConstants.SPEC_SAFE_MATH
060           || tag == TagConstants.UNINITIALIZED
061           || tag == TagConstants.WRITABLE_DEFERRED
062           );
063        Assert.notFalse(goodtag);
064      }
065    
066      //@ public represents startLoc <- loc;
067      public /*@ pure @*/ int getStartLoc() { return loc; }
068    
069    
070    // Generated boilerplate constructors:
071    
072      //@ ensures this.tag == tag;
073      //@ ensures this.loc == loc;
074      protected SimpleModifierPragma(int tag, int loc) {
075         this.tag = tag;
076         this.loc = loc;
077      }
078    
079    // Generated boilerplate methods:
080    
081      public final int childCount() {
082         return 0;
083      }
084    
085      public final Object childAt(int index) {
086              /*throws IndexOutOfBoundsException*/
087         if (index < 0)
088            throw new IndexOutOfBoundsException("AST child index " + index);
089         int indexPre = index;
090    
091         int sz;
092    
093         throw new IndexOutOfBoundsException("AST child index " + indexPre);
094      }   //@ nowarn Exception;
095    
096      public final /*@non_null*/String toString() {
097         return "[SimpleModifierPragma"
098            + " tag = " + this.tag
099            + " loc = " + this.loc
100            + "]";
101      }
102    
103      public final void accept(javafe.ast.Visitor v) { 
104        if (v instanceof Visitor) ((Visitor)v).visitSimpleModifierPragma(this);
105      }
106    
107      public final Object accept(javafe.ast.VisitorArgResult v, Object o) { 
108        if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitSimpleModifierPragma(this, o); else return null;
109      }
110    
111      public void check() {
112         postCheck();
113      }
114    
115      //@ ensures \result != null;
116      public static SimpleModifierPragma make(int tag, int loc) {
117         SimpleModifierPragma result = new SimpleModifierPragma(tag, loc);
118         return result;
119      }
120    }