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 IdentifierModifierPragma extends ModifierPragma 031 { 032 public int tag; 033 034 public /*@ non_null @*/ Identifier id; 035 036 public int loc; 037 038 039 private void postCheck() { 040 boolean goodtag = 041 (tag == TagConstants.IS_INITIALIZED); 042 Assert.notFalse(goodtag); 043 } 044 045 public int getStartLoc() { return loc; } 046 047 048 // Generated boilerplate constructors: 049 050 /** 051 * Construct a raw IdentifierModifierPragma whose class invariant(s) have not 052 * yet been established. It is the caller's job to 053 * initialize the returned node's fields so that any 054 * class invariants hold. 055 */ 056 //@ requires I_will_establish_invariants_afterwards; 057 protected IdentifierModifierPragma() {} //@ nowarn Invariant,NonNullInit; 058 059 060 // Generated boilerplate methods: 061 062 public final int childCount() { 063 return 1; 064 } 065 066 public final Object childAt(int index) { 067 /*throws IndexOutOfBoundsException*/ 068 if (index < 0) 069 throw new IndexOutOfBoundsException("AST child index " + index); 070 int indexPre = index; 071 072 int sz; 073 074 if (index == 0) return this.id; 075 else index--; 076 077 throw new IndexOutOfBoundsException("AST child index " + indexPre); 078 } //@ nowarn Exception; 079 080 public final String toString() { 081 return "[IdentifierModifierPragma" 082 + " tag = " + this.tag 083 + " id = " + this.id 084 + " loc = " + this.loc 085 + "]"; 086 } 087 088 public final int getTag() { 089 return TagConstants.IDENTIFIERMODIFIERPRAGMA; 090 } 091 092 public final void accept(javafe.ast.Visitor v) { 093 if (v instanceof Visitor) ((Visitor)v).visitIdentifierModifierPragma(this); 094 } 095 096 public final Object accept(javafe.ast.VisitorArgResult v, Object o) { 097 if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitIdentifierModifierPragma(this, o); else return null; 098 } 099 100 public void check() { 101 this.id.check(); 102 postCheck(); 103 } 104 105 //@ ensures \result != null; 106 public static IdentifierModifierPragma make(int tag, /*@ non_null @*/ Identifier id, int loc) { 107 //@ set I_will_establish_invariants_afterwards = true; 108 IdentifierModifierPragma result = new IdentifierModifierPragma(); 109 result.tag = tag; 110 result.id = id; 111 result.loc = loc; 112 return result; 113 } 114 }