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