code
stringlengths
3
1.18M
language
stringclasses
1 value
package gov.nasa.anml.utility; import java.util.Set; public interface iMap<V> extends pMap<V> { public static interface Entry<V> extends pMap.Entry<V> { public abstract int getKey(); } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * @see #put(int, V) */ public abstract V get(int key); /** Superfluous, but saves a few keystrokes. * * @param key The key whose presence in this map is to be tested * @return <tt>true</tt> if this map contains a mapping for the specified * key. */ public abstract boolean containsKey(int key); /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for the key, the old * value is replaced. * * If the specified value is null, the mapping is deleted -- null * cannot be mapped to. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public abstract V put(int key, V value); /** * Copies all of the mappings from the specified map to this map. * These mappings will replace any mappings that this map had for * any of the keys currently in the specified map. * * @param m mappings to be stored in this map * @throws NullPointerException if the specified map is null */ public abstract <W extends V> void putAll(iMap<W> m); /** * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public abstract V remove(int key); /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * * Nor does it allow modifying the wrapped keys. */ public abstract Set<SimpleInteger> keySet(); /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * * @return a set view of the mappings contained in this map */ public abstract Set<iMap.Entry<V>> entrySet(); }
Java
package gov.nasa.anml.utility; // mutable integers // but using these as keys in a hashtable requires not changing the value // i.e., be careful! public class SimpleBoolean implements SimpleObject<SimpleBoolean> { public static final SimpleBoolean True = new SimpleBoolean(true); public static final SimpleBoolean False = new SimpleBoolean(false); public static SimpleBoolean make(boolean v) { return v ? True : False; } public boolean v; protected SimpleBoolean() { v = false; } protected SimpleBoolean(boolean v) { this.v = v; } public int hashCode() { return v ? 1231 : 1237; } public static final int hash(boolean b) { return b ? 1231 : 1237; } public boolean equals(Object obj) { if (obj instanceof SimpleBoolean && v == ((SimpleBoolean) obj).v) return true; return false; } public boolean equals(SimpleBoolean obj) { if (v == obj.v) return true; return false; } public SimpleBoolean clone() { try { return (SimpleBoolean) super.clone(); } catch (CloneNotSupportedException e) { // assert false; } return null; } public int compareTo(SimpleObject<SimpleBoolean> b) { SimpleBoolean o = (SimpleBoolean) b; if (this == null || o == null) return 1; boolean w = o.v; if (v) { if (!w) return 1; } else { if (w) return -1; } return 0; } public String toString() { return java.lang.Boolean.toString(v); } public void assign(SimpleBoolean c) { v = c.v; } public void assign(boolean v) { this.v = v; } public SimpleBoolean value() { return this; } }
Java
package gov.nasa.anml.utility; import java.util.Arrays; public final class Utility { private Utility() { } public static boolean deepEquals(Object a,Object b) { if (a==b) return true; if (a==null || b==null) return false; Class aClass = a.getClass(); if (!aClass.isArray()) return a.equals(b); Class bClass = b.getClass(); if (aClass == byte[].class) { if (bClass != byte[].class) return false; byte[] aCast = (byte[]) a; byte[] bCast = (byte[]) b; int length = aCast.length; if (bCast.length != length) return false; for (int i=0; i<length; i++) if (aCast[i] != bCast[i]) return false; } else if (aClass == short[].class) { if (bClass != short[].class) return false; short[] aCast = (short[]) a; short[] bCast = (short[]) b; int length = aCast.length; if (bCast.length != length) return false; for (int i=0; i<length; i++) if (aCast[i] != bCast[i]) return false; } else if (aClass == int[].class) { if (bClass != int[].class) return false; int[] aCast = (int[]) a; int[] bCast = (int[]) b; int length = aCast.length; if (bCast.length != length) return false; for (int i=0; i<length; i++) if (aCast[i] != bCast[i]) return false; } else if (aClass == long[].class) { if (bClass != long[].class) return false; long[] aCast = (long[]) a; long[] bCast = (long[]) b; int length = aCast.length; if (bCast.length != length) return false; for (int i=0; i<length; i++) if (aCast[i] != bCast[i]) return false; } else if (aClass == char[].class) { if (bClass != char[].class) return false; char[] aCast = (char[]) a; char[] bCast = (char[]) b; int length = aCast.length; if (bCast.length != length) return false; for (int i=0; i<length; i++) if (aCast[i] != bCast[i]) return false; } else if (aClass == float[].class) { if (bClass != float[].class) return false; float[] aCast = (float[]) a; float[] bCast = (float[]) b; int length = aCast.length; if (bCast.length != length) return false; for (int i=0; i<length; i++) if (aCast[i] != bCast[i]) return false; } else if (aClass == double[].class) { if (bClass != double[].class) return false; double[] aCast = (double[]) a; double[] bCast = (double[]) b; int length = aCast.length; if (bCast.length != length) return false; for (int i=0; i<length; i++) if (aCast[i] != bCast[i]) return false; } else if (aClass == boolean[].class) { if (bClass != boolean[].class) return false; boolean[] aCast = (boolean[]) a; boolean[] bCast = (boolean[]) b; int length = aCast.length; if (bCast.length != length) return false; for (int i=0; i<length; i++) if (aCast[i] != bCast[i]) return false; } else { Object[] aCast = (Object[]) a; Object[] bCast = (Object[]) b; int length = aCast.length; if (bCast.length != length) return false; for (int i=0; i<length; i++) if (!aCast[i].equals(bCast[i])) return false; } return true; } // see Arrays.deepHashCode // this should be better than that public static int hash(Object o) { int result=1; if (o instanceof Object[]) { for (Object e : (Object[]) o) result = 31 * result + hash(e); return result; } Class<?> c = o.getClass(); // ids if (c == int[].class) { int[] a = (int[]) o; for (int e : a) result = 31 * result + e; return result; } // strings if (c == char[].class) { char[] a = (char[]) o; for (char e : a) result = 31 * result + e; return result; } // raw data (magic numbers, etc.) if (c == byte[].class) { byte[] a = (byte[]) o; for (byte e : a) result = 31 * result + e; return result; } // property vectors. Probably BitSet style is better than hashing though if (c == boolean[].class) { boolean[] a = (boolean[]) o; for (boolean e : a) result = 31 * result + (e ? 1231 : 1237); return result; } // uncommon variations on int if (c == short[].class) { short[] a = (short[]) o; for (short e : a) result = 31 * result + e; return result; } if (c == long[].class) { long[] a = (long[]) o; for (long e : a) result = 31 * result + (int) (e ^ (e >>> 32)); return result; } // brittle if (c == float[].class) { float[] a = (float[]) o; for (float e : a) result = 31 * result + Float.floatToIntBits(e); return result; } // still brittle if (c == double[].class) { double[] a = (double[]) o; for (double d : a) { long e = Double.doubleToLongBits(d); result = 31 * result + (int) (e ^ (e >>> 32)); } return result; } if (o != null) return o.hashCode(); return 0; } public static int hash(char[] val) { int h=0; int off = 0; int len = val.length; for (int i = 0; i < len; i++) { h = 31 * h + val[off++]; } return h; } public static int hash(char[] val,int len) { int h=0; int off = 0; for (int i = 0; i < len; i++) { h = 31 * h + val[off++]; } return h; } public static int hash(int[] val) { int h=0; int off = 0; int len = val.length; for (int i = 0; i < len; i++) { h = 31 * h + val[off++]; } return h; } public static int hash(int[] val,int len) { int h=0; int off = 0; for (int i = 0; i < len; i++) { h = 31 * h + val[off++]; } return h; } public static int hash(float[] val) { float h=0; int off = 0; int len = val.length; for (int i = 0; i < len; i++) { h = 31 * h + val[off++]; } return (int) h; } public static int hash(float[] val,int len) { float h=0; int off = 0; for (int i = 0; i < len; i++) { h = 31 * h + val[off++]; } return (int) h; } }
Java
package gov.nasa.anml.utility; import java.util.Set; public interface iArrMap<V> extends pMap<V> { public interface Entry<V> extends pMap.Entry<V> { public abstract int[] getKey(); } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * @see #put(int, V) */ public abstract V get(int[] key); /** Superfluous, but saves a few keystrokes. * * @param key The key whose presence in this map is to be tested * @return <tt>true</tt> if this map contains a mapping for the specified * key. */ public abstract boolean containsKey(int[] key); /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for the key, the old * value is replaced. * * If the specified value is null, the mapping is deleted -- null * cannot be mapped to. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public abstract V put(int[] key, V value); /** * Copies all of the mappings from the specified map to this map. * These mappings will replace any mappings that this map had for * any of the keys currently in the specified map. * * @param m mappings to be stored in this map * @throws NullPointerException if the specified map is null */ public abstract <W extends V> void putAll(iArrMap<W> m); /** * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public abstract V remove(int[] key); /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * * Nor does it allow modifying the wrapped keys. */ public abstract Set<int[]> keySet(); /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * * @return a set view of the mappings contained in this map */ public abstract Set<Entry<V>> entrySet(); }
Java
package gov.nasa.anml.utility; // The type ascribed to illegal operations, i.e., 'null' or 'void'. // Used for the l-values of expressions, for example. public class SimpleVoid implements SimpleObject<SimpleVoid> { public static final SimpleVoid instance = new SimpleVoid(); private SimpleVoid() { } public int hashCode() { return 0; } public boolean equals(Object obj) { if (obj == this) return true; return false; } public boolean equals(SimpleVoid obj) { if (this == obj) return true; return false; } public SimpleVoid clone() { return instance; } public int compareTo(SimpleVoid o) { if (this == null) return 1; if (o == null) return -1; return 0; } public int compareTo(SimpleObject<SimpleVoid> o) { SimpleVoid i = (SimpleVoid) o; if (this == null) return 1; if (o == null) return -1; return 0; } public String toString() { return "void"; } public void assign(SimpleVoid c) { assert false : "Assigning to a void type shouldn't happen"; } public SimpleVoid value() { return this; } }
Java
package gov.nasa.anml.utility; import java.io.IOException; import java.io.Serializable; import java.util.*; import static java.util.Arrays.*; /** Stolen ("adapted") from HashMap * * C-style; shoot-yourself-in-the-foot-style * * Fails slowly, does not attempt to correctly serialize if sub-classed. * i.e.: "Use at your own risk." * * * @see HashMap * * @param <V> */ public class cArrHashMap<V> implements Cloneable, Serializable, cArrMap<V> { /** * The default initial capacity - MUST be a power of two. */ static final int DEFAULT_INITIAL_CAPACITY = 16; /** * The maximum capacity, used if a higher value is implicitly specified * by either of the constructors with arguments. * MUST be a power of two <= 1<<30. */ static final int MAXIMUM_CAPACITY = 1 << 30; /** * The load factor used when none specified in constructor. */ static final float DEFAULT_LOAD_FACTOR = 0.75f; /** * The table, resized as necessary. Length MUST Always be a power of two. */ transient Entry[] table; /** * The number of key-value mappings contained in this map. */ transient int size; /** * The next size value at which to resize (capacity * load factor). * @serial */ int threshold; /** * The load factor for the hash table. * * @serial */ final float loadFactor; // Views transient EntrySet entrySet; transient KeySet keySet; transient Values values; /** * Constructs an empty <tt>iHashMap</tt> with the specified initial * capacity and load factor. * * @param initialCapacity the initial capacity * @param loadFactor the load factor * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ public cArrHashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal initial capacity: " + initialCapacity); if (initialCapacity > MAXIMUM_CAPACITY) initialCapacity = MAXIMUM_CAPACITY; if (loadFactor <= 0 || Float.isNaN(loadFactor)) throw new IllegalArgumentException("Illegal load factor: " + loadFactor); // Find a power of 2 >= initialCapacity int capacity = 1; while (capacity < initialCapacity) capacity <<= 1; this.loadFactor = loadFactor; threshold = (int)(capacity * loadFactor); table = new Entry<?>[capacity]; } /** * Constructs an empty <tt>iHashMap</tt> with the specified initial * capacity and the default load factor (0.75). * * @param initialCapacity the initial capacity. * @throws IllegalArgumentException if the initial capacity is negative. */ public cArrHashMap(int initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR); } /** * Constructs an empty <tt>iHashMap</tt> with the default initial capacity * (16) and the default load factor (0.75). */ public cArrHashMap() { this.loadFactor = DEFAULT_LOAD_FACTOR; threshold = (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); table = new Entry<?>[DEFAULT_INITIAL_CAPACITY]; } /** * Constructs a new <tt>iHashMap</tt> with the same mappings as the * specified <tt>Map</tt>. The <tt>iHashMap</tt> is created with * default load factor (0.75) and an initial capacity sufficient to * hold the mappings in the specified <tt>Map</tt>. * * @param m the map whose mappings are to be placed in this map * @throws NullPointerException if the specified map is null */ public <W extends V> cArrHashMap(cArrHashMap<W> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllForCreate(m); } public cArrHashMap(Map<List<? extends SimpleCharacter>, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllSimpleCharacter(m); } public cArrHashMap(SimpleString exampleKey, Map<? extends SimpleString, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllSimpleString(m); } public cArrHashMap(String exampleKey, Map<String, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllString(m); } public cArrHashMap(Character exampleKey, Map<List<Character>, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllCharacter(m); } public cArrHashMap(char[] exampleKey, Map<char[],?extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllArray(m); } // internal utilities /** * Applies the HashMap hash function to the key; ultimately * producing the same index as a HashMap<ArrayList<Character>> would. * * char[].hashCode() is just Object.hashCode(), i.e., memory address. * * @see HashMap#hash(int h) * @see HashMap#indexFor(int k, int length) * @see java.util.Arrays#hashCode(char[]) * @return index for key */ static int indexFor(char[] k, int length) { int h = Arrays.hashCode(k); h ^= (h >>> 20) ^ (h >>> 12); return (h ^ (h >>> 7) ^ (h >>> 4)) & (length-1); } /** * @return the number of key-value mappings in this map */ public int size() { return size; } /** * @return <tt>true</tt> if this map contains no key-value mappings */ public boolean isEmpty() { return size == 0; } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * @see #put(int, V) */ public V get(char[] key) { //int hash = hash(key); for (Entry<V> e = table[indexFor(key, table.length)]; e != null; e = e.next) { // wtf? testing to see if the hash matches?? // ahh....two levels of hashing -- keys to hashes to indices // sort of debatable whether e.hash == hash saves any time // for integer keys... // just doing simple key comparison... //if (e.hash == hash && e.key == key) if (Arrays.equals(e.key,key)) return e.value; } return null; } /** Superfluous, but saves a few keystrokes. * * @param key The key whose presence in this map is to be tested * @return <tt>true</tt> if this map contains a mapping for the specified * key. */ public final boolean containsKey(char[] key) { return get(key) != null; } /** * Returns the entry associated with the specified key in the * iHashMap. Returns null if the iHashMap contains no mapping * for the key. */ final Entry<V> getEntry(char[] key) { //int hash = hash(key); for (Entry<V> e = table[indexFor(key, table.length)]; e != null; e = e.next) { if (e.key == key) return e; } return null; } /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for the key, the old * value is replaced. * * If the specified value is null, the mapping is deleted -- null * cannot be mapped to. * * If the key changes, everything will break. Well, not if the * hashCode() somehow remains the same. * The same is true of HashMap<ArrayList<Character>,V>. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V put(char[] key, V value) { if (value == null) return remove(key); //int hash = hash(key); int i = indexFor(key, table.length); Entry<V> e = table[i]; V oldValue; if (e == null) { table[i] = new Entry<V>(key,value); ++size; return null; } if (Arrays.equals(e.key,key)) { oldValue = e.value; e.value = value; return oldValue; } if (e.next != null) { do { e = e.next; if (Arrays.equals(e.key,key)) { oldValue = e.value; e.value = value; return oldValue; } } while(e.next != null); } e.next = new Entry<V>(key,value); ++size; return null; } /** * This method is used instead of put by constructors and * pseudoconstructors (clone, readObject). It does not resize the table, * check for comodification, etc. It calls createEntry rather than * addEntry. * * @deprecated just use createEntry */ private void putForCreate(char[] key, V value) { //int hash = hash(key); int i = indexFor(key, table.length); createEntry(i, key, value); } // but note that such Maps are broken private <W extends V> void putAllArray(Map<char[],W> m) { int i,l=table.length; char[] k=null; for (Map.Entry<char[],W> e : m.entrySet()) { k = e.getKey(); i=indexFor(k,l); createEntry(i,k,e.getValue()); } } // have to copy, as can't access the backing array, which // is anyways of the wrong type private <K extends List<Character>, W extends V> void putAllCharacter(Map<K,W> m) { int i,l=table.length,keyLen; char[] k=null; K key; for (Map.Entry<K,W> e : m.entrySet()) { i=0; key = e.getKey(); keyLen = key.size(); k = new char[keyLen]; for(Character s : key) k[i++] = s.charValue(); i=indexFor(k,l); createEntry(i,k,e.getValue()); } } // have to copy, as can't access the backing array, which // is anyways of the wrong type private <K extends List<? extends SimpleCharacter>, W extends V> void putAllSimpleCharacter(Map<K,W> m) { int i,l=table.length,keyLen; char[] k=null; K key; for (Map.Entry<K,W> e : m.entrySet()) { i=0; key = e.getKey(); keyLen = key.size(); k = new char[keyLen]; for(SimpleCharacter s : key) k[i++] = s.v; i=indexFor(k,l); createEntry(i,k,e.getValue()); } } // uses the backing array. dangerous! private <K extends SimpleString, W extends V> void putAllSimpleString(Map<K,W> m) { int i,l=table.length; char[] k=null; for (Map.Entry<K,W> e : m.entrySet()) { k = e.getKey().v; i=indexFor(k,l); createEntry(i,k,e.getValue()); } } // have to copy, as can't access the backing array private <W extends V> void putAllString(Map<String,W> m) { int i,l=table.length; char[] k=null; String key; for (Map.Entry<String,W> e : m.entrySet()) { i=0; key = e.getKey(); k = key.toCharArray(); i=indexFor(k,l); createEntry(i,k,e.getValue()); } } // shares keys -- dangerous private <W extends V> void putAllForCreate(cArrHashMap<W> m) { int i,l=table.length; char[] k; for (Entry<W> e : m.table) { Entry<W> f; for (f=e;f!=null;f=f.next) { k = f.key; i=indexFor(k,l); createEntry(i,k,f.value); } } } /** * Rehashes the contents of this map into a new array with a * larger capacity. This method is called automatically when the * number of keys in this map reaches its threshold. * * If current capacity is MAXIMUM_CAPACITY, this method does not * resize the map, but sets threshold to Integer.MAX_VALUE. * This has the effect of preventing future calls. * * @param newCapacity the new capacity, MUST be a power of two; * must be greater than current capacity unless current * capacity is MAXIMUM_CAPACITY (in which case value * is irrelevant). */ void resize(int newCapacity) { Entry[] oldTable = table; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { threshold = Integer.MAX_VALUE; return; } Entry[] newTable = new Entry<?>[newCapacity]; transfer(newTable); table = newTable; threshold = (int)(newCapacity * loadFactor); } /** * Transfers all entries from current table to newTable. */ void transfer(Entry[] newTable) { Entry[] src = table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry<V> e = src[j]; if (e != null) { src[j] = null; do { Entry<V> next = e.next; int i = indexFor(e.key, newCapacity); e.next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } } /** * Copies all of the mappings from the specified map to this map. * These mappings will replace any mappings that this map had for * any of the keys currently in the specified map. * * @param m mappings to be stored in this map * @throws NullPointerException if the specified map is null */ public <W extends V> void putAll(cArrMap<W> m) { int numKeysToBeAdded = m.size(); if (numKeysToBeAdded == 0) return; /* * Expand the map if the map if the number of mappings to be added * is greater than or equal to threshold. This is conservative; the * obvious condition is (m.size() + size) >= threshold, but this * condition could result in a map with twice the appropriate capacity, * if the keys to be added overlap with the keys already in this map. * By using the conservative calculation, we subject ourself * to at most one extra resize. */ if (numKeysToBeAdded > threshold) { int targetCapacity = (int)(numKeysToBeAdded / loadFactor + 1); if (targetCapacity > MAXIMUM_CAPACITY) targetCapacity = MAXIMUM_CAPACITY; int newCapacity = table.length; while (newCapacity < targetCapacity) newCapacity <<= 1; if (newCapacity > table.length) resize(newCapacity); } // scan the table instead? // probably not...hashing can work differently for different sizes for (cArrMap.Entry<W> e : m.entrySet()) { put(e.getKey(), e.getValue()); } } /** * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V remove(char[] key) { int i = indexFor(key, table.length); Entry<V> e = table[i]; if (e == null) return null; if (e.key == key) { --size; table[i] = e.next; return e.value; } Entry<V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (e.key == key) { --size; prev.next = next; return e.value; } next = e.next; } while (next != null); } return null; } /** * Removes and returns the entry associated with the specified key * in the iHashMap. Returns null if the iHashMap contains no mapping * for this key. * * Only for inlining purposes? * @see #remove(int) */ final Entry<V> removeEntryForKey(char[] key) { //int hash = hash(key); int i = indexFor(key, table.length); Entry<V> e = table[i]; if (e == null) return null; if (e.key == key) { --size; table[i] = e.next; return e; } Entry<V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (e.key == key) { --size; prev.next = next; return e; } next = e.next; } while (next != null); } return null; } /** * Removes all of the mappings from this map. * The map will be empty after this call returns. */ public void clear() { Entry[] tab = table; for (int i = 0; i < tab.length; i++) tab[i] = null; size = 0; } /** * Returns <tt>true</tt> if this map maps one or more keys to the * specified value. * * @param v value whose presence in this map is to be tested * @return <tt>true</tt> if this map maps one or more keys to the * specified value */ public boolean containsObject(Object v) { return containsValue((V)v); } public boolean containsValue(V value) { if (value == null) return false; Entry[] tab = table; for (int i = 0; i < tab.length ; i++) for (Entry<V> e = tab[i] ; e != null ; e = e.next) if (value.equals(e.value)) return true; return false; } /** * Returns a deep-ish copy of this <tt>iHashMap</tt> instance; * the values are not cloned, but the references are. * * Changing a key-value mapping in a clone does not alter the original -- * but directly altering a value is reflected in all references to that * value, e.g., in all clones. * * The keys are primitives and therefore copied. * * @return a shallow copy of this map */ public cArrHashMap<V> clone() { cArrHashMap<V> result = null; try { result = (cArrHashMap<V>)super.clone(); } catch (CloneNotSupportedException e) { // assert false; } result.table = new Entry<?>[table.length]; result.entrySet = null; result.size = 0; result.putAllForCreate(this); return result; } public static class Entry<V> implements cArrMap.Entry<V> { public final char[] key; public V value; Entry<V> next; /** * Creates new entry. */ Entry(char[] key, V value) { this.key = key; this.value = value; } Entry(char[] key, V value, Entry<V> next) { this.key = key; this.value = value; this.next = next; } public final char[] getKey() { return key; } public final V getValue() { return value; } public final V setValue(V newValue) { V oldValue = value; value = newValue; return oldValue; } public final boolean equals(Object o) { if (!(o instanceof Entry)) return false; Entry<V> e = (Entry<V>)o; if (key == e.key) { V v1 = value, v2 = e.value; if (v1 == v2 || (v1 != null && v1.equals(v2))) return true; } return false; } public final int hashCode() { return (Arrays.hashCode(key)) ^ (value==null ? 0 : value.hashCode()); } public final String toString() { return key + "=" + value; } } /** * Used when creating entries * as part of Map construction or "pseudo-construction" (cloning, * deserialization). This version needn't worry about resizing the table. * * Subclass overrides this to alter the behavior of iHashMap(Map), * iHashMap(iHashMap), clone, and readObject. */ Entry<V> createEntry(int bucketIndex, char[] key, V value) { Entry<V> e = table[bucketIndex]; table[bucketIndex] = new Entry<V>(key, value, e); size++; return e; } private abstract class HashIterator<E> implements Iterator<E> { Entry<V> next; // next entry to return int index; // current slot Entry<V> current; // current entry HashIterator() { if (size > 0) { // advance to first entry Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } } public final boolean hasNext() { return next != null; } final Entry<V> nextEntry() { Entry<V> e = current = next; if (e == null) throw new NoSuchElementException(); if ((next = e.next) == null) { Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } return e; } public void remove() { if (current == null) throw new IllegalStateException(); char[] k = current.key; current = null; removeEntryForKey(k); } } private final class ValueIterator extends HashIterator<V> { public V next() { return nextEntry().value; } } private final class KeyIterator extends HashIterator<char[]> { public char[] next() { return nextEntry().key; } } private final class EntryIterator extends HashIterator<cArrMap.Entry<V>> { public cArrMap.Entry<V> next() { return nextEntry(); } } // Subclass overrides these to alter behavior of views' iterator() method Iterator<char[]> newKeyIterator() { return new KeyIterator(); } Iterator<V> newValueIterator() { return new ValueIterator(); } Iterator<cArrMap.Entry<V>> newEntryIterator() { return new EntryIterator(); } /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * * Nor does it allow modifying the wrapped keys. */ public Set<char[]> keySet() { Set<char[]> ks = keySet; return (ks != null ? ks : (keySet = new KeySet())); } private final class KeySet extends AbstractSet<char[]> { public Iterator<char[]> iterator() { return newKeyIterator(); } public int size() { return size; } public boolean contains(Object o) { if (o instanceof char[]) return contains((char[])o); return false; } public boolean contains(char[] k) { return containsKey(k); } public boolean remove(Object o) { if (o instanceof char[]) return remove((char[])o); return false; } public boolean remove(char[] k) { return cArrHashMap.this.removeEntryForKey(k) != null; } public void clear() { cArrHashMap.this.clear(); } } /** * Returns a {@link Collection} view of the values contained in this map. * The collection is backed by the map, so changes to the map are * reflected in the collection, and vice-versa. If the map is * modified while an iteration over the collection is in progress * (except through the iterator's own <tt>remove</tt> operation), * the results of the iteration are undefined. The collection * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Collection.remove</tt>, <tt>removeAll</tt>, * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not * support the <tt>add</tt> or <tt>addAll</tt> operations. */ public Collection<V> values() { Collection<V> vs = values; return (vs != null ? vs : (values = new Values())); } private final class Values extends AbstractCollection<V> { public Iterator<V> iterator() { return newValueIterator(); } public int size() { return size; } public boolean contains(Object o) { return containsObject(o); } public void clear() { cArrHashMap.this.clear(); } } /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * * @return a set view of the mappings contained in this map */ public Set<cArrMap.Entry<V>> entrySet() { Set<cArrMap.Entry<V>> es = entrySet; return es != null ? es : (entrySet = new EntrySet()); } private final class EntrySet extends AbstractSet<cArrMap.Entry<V>> { public Iterator<cArrMap.Entry<V>> iterator() { return newEntryIterator(); } public boolean contains(Object o) { if (!(o instanceof Entry)) return false; Entry<V> e = (Entry<V>) o; Entry<V> candidate = getEntry(e.key); return candidate != null && candidate.equals(e); } public boolean remove(Object o) { if (o instanceof Entry) { Entry<V> e = (Entry<V>) o; return cArrHashMap.this.remove(e.key) != null; } return false; } public int size() { return size; } public void clear() { cArrHashMap.this.clear(); } } /** * Save the state of the <tt>iHashMap</tt> instance to a stream (i.e., * serialize it). * * @serialData The <i>capacity</i> of the iHashMap (the length of the * bucket array) is emitted (int), followed by the * <i>size</i> (an int, the number of key-value * mappings), followed by the key (Object) and value (Object) * for each key-value mapping. The key-value mappings are * emitted in no particular order. */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { Iterator<cArrMap.Entry<V>> i = (size > 0) ? entrySet().iterator() : null; // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size (number of Mappings) s.writeInt(size); // Write out keys and values (alternating) if (i != null) { while (i.hasNext()) { cArrMap.Entry<V> e = i.next(); s.writeObject(e.getKey()); s.writeObject(e.getValue()); } } } private static final long serialVersionUID = 362498820763181265L; /** * Reconstitute the <tt>cArrHashMap</tt> instance from a stream (i.e., * deserialize it). */ private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { // Read in the threshold, loadfactor, and any hidden stuff s.defaultReadObject(); // Read in number of buckets and allocate the bucket array; int numBuckets = s.readInt(); table = new Entry<?>[numBuckets]; // Read in size (number of Mappings) // hides this.size, and that is important since createEntry increments it int size = s.readInt(); // Read the keys and values, and put the mappings in the iHashMap for (int i=0; i<size; i++) { char[] key = (char[]) s.readObject(); V value = (V) s.readObject(); createEntry(indexFor(key,numBuckets),key,value); } } // These methods are used when serializing HashSets int capacity() { return table.length; } float loadFactor() { return loadFactor; } }
Java
package gov.nasa.anml.utility; import java.io.IOException; import java.io.Serializable; import java.util.*; import static gov.nasa.anml.utility.Utility.*; /** Stolen ("adapted") from HashMap * * C-style; shoot-yourself-in-the-foot-style * * Fails slowly, does not attempt to correctly serialize if sub-classed. * i.e.: "Use at your own risk." * * * @see HashMap * * @param <V> */ // this should work for non-array keys too; i.e., it is just a better Hash Map. // except that for non-array keys, the hash function doesn't have to lookup // through Utility.hash(), so existing Hash Map would be slightly faster. // Given that, and that Utility.hash() is for this class only (in practice) // it would be good to optimize said function for the array key case. Which // it might be -- worth checking. public class ArrHashMap<K,V> implements Cloneable, Serializable, ArrMap<K,V> { /** * The default initial capacity - MUST be a power of two. */ protected static final int DEFAULT_INITIAL_CAPACITY = 16; /** * The maximum capacity, used if a higher value is implicitly specified * by either of the constructors with arguments. * MUST be a power of two <= 1<<30. */ protected static final int MAXIMUM_CAPACITY = 1 << 30; /** * The load factor used when none specified in constructor. */ protected static final float DEFAULT_LOAD_FACTOR = 0.75f; /** * The table, resized as necessary. Length MUST Always be a power of two. */ protected transient Entry[] table; /** * The number of key-value mappings contained in this map. */ protected transient int size; /** * The next size value at which to resize (capacity * load factor). * @serial */ protected int threshold; /** * The load factor for the hash table. * * @serial */ protected final float loadFactor; // Views protected transient EntrySet entrySet; protected transient KeySet keySet; protected transient Values values; /** * Constructs an empty <tt>iHashMap</tt> with the specified initial * capacity and load factor. * * @param initialCapacity the initial capacity * @param loadFactor the load factor * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ public ArrHashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal initial capacity: " + initialCapacity); if (initialCapacity > MAXIMUM_CAPACITY) initialCapacity = MAXIMUM_CAPACITY; if (loadFactor <= 0 || Float.isNaN(loadFactor)) throw new IllegalArgumentException("Illegal load factor: " + loadFactor); // Find a power of 2 >= initialCapacity int capacity = 1; while (capacity < initialCapacity) capacity <<= 1; this.loadFactor = loadFactor; threshold = (int)(capacity * loadFactor); table = new Entry<?,?>[capacity]; } /** * Constructs an empty <tt>iHashMap</tt> with the specified initial * capacity and the default load factor (0.75). * * @param initialCapacity the initial capacity. * @throws IllegalArgumentException if the initial capacity is negative. */ public ArrHashMap(int initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR); } /** * Constructs an empty <tt>iHashMap</tt> with the default initial capacity * (16) and the default load factor (0.75). */ public ArrHashMap() { this.loadFactor = DEFAULT_LOAD_FACTOR; threshold = (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); table = new Entry<?,?>[DEFAULT_INITIAL_CAPACITY]; } /** * Constructs a new <tt>iHashMap</tt> with the same mappings as the * specified <tt>Map</tt>. The <tt>iHashMap</tt> is created with * default load factor (0.75) and an initial capacity sufficient to * hold the mappings in the specified <tt>Map</tt>. * * @param m the map whose mappings are to be placed in this map * @throws NullPointerException if the specified map is null */ public ArrHashMap(ArrHashMap<K,? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllForCreate(m); } public ArrHashMap(Map<K,? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllArray(m); } // internal utilities /** * Applies the HashMap hash function to the key; ultimately * producing the same index as a HashMap<ArrayList<E>,V> would. * (where K = E[], except allowing E=int, etc.) * * K.hashCode() is just Object.hashCode(), i.e., memory address, i.e., broken. * * @see HashMap#hash(int h) * @see HashMap#indexFor(int k, int length) * @see java.util.Arrays#hashCode(K) * @return index for key */ static int indexFor(Object k, int length) { int h = hash(k); h ^= (h >>> 20) ^ (h >>> 12); return (h ^ (h >>> 7) ^ (h >>> 4)) & (length-1); } static int indexFor(int h, int length) { h ^= (h >>> 20) ^ (h >>> 12); return (h ^ (h >>> 7) ^ (h >>> 4)) & (length-1); } /** * @return the number of key-value mappings in this map */ public int size() { return size; } /** * @return <tt>true</tt> if this map contains no key-value mappings */ public boolean isEmpty() { return size == 0; } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * @see #put(int, V) */ public V get(Object k) { K key = (K) k; // this casts from object to object just to fudge type-checking int hash = hash(key); for (Entry<K,V> e = table[indexFor(hash, table.length)]; e != null; e = e.next) { // should probably re-enable hash checking before key checking if (e.hash == hash && deepEquals(e.key,key)) //if (deepEquals(e.key,key)) return e.value; } return null; } /** Superfluous, but saves a few keystrokes. * * @param key The key whose presence in this map is to be tested * @return <tt>true</tt> if this map contains a mapping for the specified * key. */ public final boolean containsKey(Object key) { return get(key) != null; } /** * Returns the entry associated with the specified key in the * iHashMap. Returns null if the iHashMap contains no mapping * for the key. */ final Entry<K,V> getEntry(K key) { //int hash = hash(key); for (Entry<K,V> e = table[indexFor(key, table.length)]; e != null; e = e.next) { if (e.key == key) return e; } return null; } /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for the key, the old * value is replaced. * * If the specified value is null, the mapping is deleted -- null * cannot be mapped to. * * If the key changes, everything will break. Well, not if the * hashCode() somehow remains the same. * The same is true of HashMap<ArrayList<Character>,V>. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V put(K key, V value) { if (value == null) return remove(key); int hash = hash(key); int i = indexFor(hash, table.length); Entry<K,V> e = table[i]; V oldValue; if (e == null) { table[i] = new Entry<K,V>(key,value,hash); ++size; return null; } if (hash == e.hash && deepEquals(key,e.key)) { oldValue = e.value; e.value = value; return oldValue; } if (e.next != null) { do { e = e.next; if (hash == e.hash && deepEquals(key,e.key)) { oldValue = e.value; e.value = value; return oldValue; } } while(e.next != null); } e.next = new Entry<K,V>(key,value,hash); ++size; return null; } // but note that such Maps are broken private <W extends V> void putAllArray(Map<K,W> m) { int i,l=table.length; K k=null; int h; for (Map.Entry<K,W> e : m.entrySet()) { k = e.getKey(); h = hash(k); i=indexFor(h,l); createEntry(i,k,e.getValue(),h); } } // shares keys -- dangerous private <W extends V> void putAllForCreate(ArrHashMap<K,W> m) { int i,l=table.length; K k; int h; for (Entry<K,W> e : m.table) { Entry<K,W> f; for (f=e;f!=null;f=f.next) { k = f.key; h = f.hash; i=indexFor(h,l); createEntry(i,k,f.value,h); } } } /** * Rehashes the contents of this map into a new array with a * larger capacity. This method is called automatically when the * number of keys in this map reaches its threshold. * * If current capacity is MAXIMUM_CAPACITY, this method does not * resize the map, but sets threshold to Integer.MAX_VALUE. * This has the effect of preventing future calls. * * @param newCapacity the new capacity, MUST be a power of two; * must be greater than current capacity unless current * capacity is MAXIMUM_CAPACITY (in which case value * is irrelevant). */ void resize(int newCapacity) { Entry[] oldTable = table; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { threshold = Integer.MAX_VALUE; return; } Entry[] newTable = new Entry<?,?>[newCapacity]; transfer(newTable); table = newTable; threshold = (int)(newCapacity * loadFactor); } /** * Transfers all entries from current table to newTable. */ void transfer(Entry[] newTable) { Entry[] src = table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry<K,V> e = src[j]; if (e != null) { src[j] = null; do { Entry<K,V> next = e.next; int i = indexFor(e.key, newCapacity); e.next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } } /** * Copies all of the mappings from the specified map to this map. * These mappings will replace any mappings that this map had for * any of the keys currently in the specified map. * * @param m mappings to be stored in this map * @throws NullPointerException if the specified map is null */ public void putAll(Map<? extends K,? extends V> m) { int numKeysToBeAdded = m.size(); if (numKeysToBeAdded == 0) return; /* * Expand the map if the map if the number of mappings to be added * is greater than or equal to threshold. This is conservative; the * obvious condition is (m.size() + size) >= threshold, but this * condition could result in a map with twice the appropriate capacity, * if the keys to be added overlap with the keys already in this map. * By using the conservative calculation, we subject ourself * to at most one extra resize. */ if (numKeysToBeAdded > threshold) { int targetCapacity = (int)(numKeysToBeAdded / loadFactor + 1); if (targetCapacity > MAXIMUM_CAPACITY) targetCapacity = MAXIMUM_CAPACITY; int newCapacity = table.length; while (newCapacity < targetCapacity) newCapacity <<= 1; if (newCapacity > table.length) resize(newCapacity); } // scan the table instead? // probably not...hashing can work differently for different sizes for (Map.Entry<? extends K,? extends V> e : m.entrySet()) { put(e.getKey(), e.getValue()); } } /** * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V remove(Object key) { int hash = hash(key); int i = indexFor(key, table.length); Entry<K,V> e = table[i]; if (e == null) return null; if (hash == e.hash && deepEquals(key,e.key)) { --size; table[i] = e.next; return e.value; } Entry<K,V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (hash == e.hash && deepEquals(key,e.key)) { --size; prev.next = next; return e.value; } next = e.next; } while (next != null); } return null; } /** * Removes and returns the entry associated with the specified key * in the iHashMap. Returns null if the iHashMap contains no mapping * for this key. * * Only for inlining purposes? * @see #remove(Object) */ final Entry<K,V> removeEntryForKey(Object key) { int hash = hash(key); int i = indexFor(hash, table.length); Entry<K,V> e = table[i]; if (e == null) return null; if (hash == e.hash && deepEquals(key,e.key)) { --size; table[i] = e.next; return e; } Entry<K,V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (hash == e.hash && deepEquals(key,e.key)) { --size; prev.next = next; return e; } next = e.next; } while (next != null); } return null; } /** * Removes all of the mappings from this map. * The map will be empty after this call returns. */ public void clear() { Entry[] tab = table; for (int i = 0; i < tab.length; i++) tab[i] = null; size = 0; } /** * Returns <tt>true</tt> if this map maps one or more keys to the * specified value. * * @param value value whose presence in this map is to be tested * @return <tt>true</tt> if this map maps one or more keys to the * specified value */ public boolean containsValue(Object value) { if (value == null) return false; Entry<?,?>[] tab = table; for (int i = 0; i < tab.length ; i++) for (Entry<?,?> e = tab[i] ; e != null ; e = e.next) if (deepEquals(value,e.value)) return true; return false; } /** * Returns a deep-ish copy of this <tt>iHashMap</tt> instance; * the values are not cloned, but the references are. * * Changing a key-value mapping in a clone does not alter the original -- * but directly altering a value is reflected in all references to that * value, e.g., in all clones. * * The keys are primitives and therefore copied. * * @return a shallow copy of this map */ public ArrHashMap<K,V> clone() { ArrHashMap<K,V> result = null; try { result = (ArrHashMap<K,V>)super.clone(); } catch (CloneNotSupportedException e) { // assert false; } result.table = new Entry<?,?>[table.length]; result.entrySet = null; result.size = 0; result.putAllForCreate(this); return result; } public static class Entry<K,V> implements ArrMap.Entry<K,V> { public final K key; public V value; int hash; Entry<K,V> next; /** * Creates new entry. */ public Entry(K key, V value, int hash) { this.key = key; this.value = value; this.hash = hash; } public Entry(K key, V value, int hash, Entry<K,V> next) { this.key = key; this.value = value; this.next = next; this.hash = hash; } public final K getKey() { return key; } public final V getValue() { return value; } public final V setValue(V newValue) { V oldValue = value; value = newValue; return oldValue; } public final boolean equals(Object o) { if (!(o instanceof Entry)) return false; Entry<K,V> e = (Entry<K,V>)o; // easy outs without walking the keys/values if (hash != e.hash) return false; if (value == null || e.value == null) return false; // real check if (deepEquals(key,e.key) && deepEquals(value,e.value)) return true; return false; } public final int hashCode() { return hash(key) ^ hash(value); } public final String toString() { return key + "=" + value; } } /** * Used when creating entries * as part of Map construction or "pseudo-construction" (cloning, * deserialization). This version needn't worry about resizing the table. * * Subclass overrides this to alter the behavior of iHashMap(Map), * iHashMap(iHashMap), clone, and readObject. */ protected Entry<K,V> createEntry(int bucketIndex, K key, V value,int h) { Entry<K,V> e = table[bucketIndex]; table[bucketIndex] = new Entry<K,V>(key, value, h, e); size++; return e; } private abstract class HashIterator<E> implements Iterator<E> { Entry<K,V> next; // next entry to return int index; // current slot Entry<K,V> current; // current entry HashIterator() { if (size > 0) { // advance to first entry Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } } public final boolean hasNext() { return next != null; } final Entry<K,V> nextEntry() { Entry<K,V> e = current = next; if (e == null) throw new NoSuchElementException(); if ((next = e.next) == null) { Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } return e; } public void remove() { if (current == null) throw new IllegalStateException(); K k = current.key; current = null; removeEntryForKey(k); } } private final class ValueIterator extends HashIterator<V> { public V next() { return nextEntry().value; } } private final class KeyIterator extends HashIterator<K> { public K next() { return nextEntry().key; } } private final class EntryIterator extends HashIterator<ArrMap.Entry<K,V>> { public ArrMap.Entry<K,V> next() { return nextEntry(); } } // Subclass overrides these to alter behavior of views' iterator() method Iterator<K> newKeyIterator() { return new KeyIterator(); } Iterator<V> newValueIterator() { return new ValueIterator(); } Iterator<ArrMap.Entry<K,V>> newEntryIterator() { return new EntryIterator(); } /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * * Nor does it allow modifying the wrapped keys. */ public Set<K> keySet() { Set<K> ks = keySet; return (ks != null ? ks : (keySet = new KeySet())); } private final class KeySet extends AbstractSet<K> { public Iterator<K> iterator() { return newKeyIterator(); } public int size() { return size; } public boolean contains(Object k) { return containsKey(k); } public boolean remove(Object o) { return ArrHashMap.this.removeEntryForKey(o) != null; } public void clear() { ArrHashMap.this.clear(); } } /** * Returns a {@link Collection} view of the values contained in this map. * The collection is backed by the map, so changes to the map are * reflected in the collection, and vice-versa. If the map is * modified while an iteration over the collection is in progress * (except through the iterator's own <tt>remove</tt> operation), * the results of the iteration are undefined. The collection * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Collection.remove</tt>, <tt>removeAll</tt>, * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not * support the <tt>add</tt> or <tt>addAll</tt> operations. */ public Collection<V> values() { Collection<V> vs = values; return (vs != null ? vs : (values = new Values())); } private final class Values extends AbstractCollection<V> { public Iterator<V> iterator() { return newValueIterator(); } public int size() { return size; } public boolean contains(Object o) { return containsValue(o); } public void clear() { ArrHashMap.this.clear(); } } /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * * @return a set view of the mappings contained in this map */ public Set<ArrMap.Entry<K,V>> entrySet() { Set<ArrMap.Entry<K,V>> es = entrySet; return es != null ? es : (entrySet = new EntrySet()); } private final class EntrySet extends AbstractSet<ArrMap.Entry<K,V>> { public Iterator<ArrMap.Entry<K,V>> iterator() { return newEntryIterator(); } public boolean contains(Object o) { if (!(o instanceof Entry)) return false; Entry<K,V> e = (Entry<K,V>) o; Entry<K,V> candidate = getEntry(e.key); return candidate != null && candidate.equals(e); } public boolean remove(Object o) { if (o instanceof Entry) { Entry<K,V> e = (Entry<K,V>) o; return ArrHashMap.this.remove(e.key) != null; } return false; } public int size() { return size; } public void clear() { ArrHashMap.this.clear(); } } /** * Save the state of the <tt>iHashMap</tt> instance to a stream (i.e., * serialize it). * * @serialData The <i>capacity</i> of the iHashMap (the length of the * bucket array) is emitted (int), followed by the * <i>size</i> (an int, the number of key-value * mappings), followed by the key (Object) and value (Object) * for each key-value mapping. The key-value mappings are * emitted in no particular order. */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { Iterator<ArrMap.Entry<K,V>> i = (size > 0) ? entrySet().iterator() : null; // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size (number of Mappings) s.writeInt(size); // Write out keys and values (alternating) if (i != null) { while (i.hasNext()) { ArrMap.Entry<K,V> e = i.next(); s.writeObject(e.getKey()); s.writeObject(e.getValue()); } } } private static final long serialVersionUID = 362498820763181265L; /** * Reconstitute the <tt>cArrHashMap</tt> instance from a stream (i.e., * deserialize it). */ private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { // Read in the threshold, loadfactor, and any hidden stuff s.defaultReadObject(); // Read in number of buckets and allocate the bucket array; int numBuckets = s.readInt(); table = new Entry<?,?>[numBuckets]; // Read in size (number of Mappings) // hides this.size, and that is important since createEntry increments it int size = s.readInt(); int h; // Read the keys and values, and put the mappings in the iHashMap for (int i=0; i<size; i++) { K key = (K) s.readObject(); V value = (V) s.readObject(); h = hash(key); createEntry(indexFor(key,numBuckets),key,value,h); } } // These methods are used when serializing HashSets int capacity() { return table.length; } float loadFactor() { return loadFactor; } }
Java
package gov.nasa.anml.utility; import static java.lang.Math.*; // mutable floats // but using these as keys in a hashtable requires not changing the value // i.e., be careful! public class SimpleFloat implements SimpleObject<SimpleFloat> { public float v; public SimpleFloat() { v = 0; } public SimpleFloat(float v) { this.v = v; } public int hashCode() { return Float.floatToIntBits(v); } public boolean equals(Object obj) { if (obj instanceof SimpleFloat && v == ((SimpleFloat) obj).v) return true; return false; } public boolean equals(SimpleFloat obj) { if (v == obj.v) return true; return false; } public SimpleFloat clone() { try { return (SimpleFloat) super.clone(); } catch (CloneNotSupportedException e) { // assert false; } return null; } public int compareTo(SimpleFloat o) { if (this == null || o == null) return 1; return (int) signum(v - o.v); } public int compareTo(SimpleObject<SimpleFloat> o) { SimpleFloat f = (SimpleFloat) o; if (this == null || f == null) return 1; return (int) signum(v - f.v); } public String toString() { return Float.toString(v); } public void assign(SimpleFloat c) { v = c.v; } public void assign(float v) { this.v = v; } public SimpleFloat value() { return this; } }
Java
package gov.nasa.anml.utility; // mutable integers // but using these as keys in a hashtable requires not changing the value // i.e., be careful! public class SimpleCharacter implements SimpleObject<SimpleCharacter> { public char v; public SimpleCharacter() { v = 0; } public SimpleCharacter(char v) { this.v = v; } public int hashCode() { return v; } public boolean equals(SimpleCharacter obj) { if (v == obj.v) return true; return false; } public boolean equals(Object obj) { if (obj instanceof SimpleCharacter && v == ((SimpleCharacter)obj).v) return true; return false; } public SimpleCharacter clone() { try { return (SimpleCharacter) super.clone(); } catch (CloneNotSupportedException e) { // assert false; } return null; } public int compareTo(SimpleCharacter o) { if (this == null || o == null) return 1; return v - o.v; } public int compareTo(SimpleObject<SimpleCharacter> o) { SimpleCharacter c = (SimpleCharacter) o; if (this == null || c == null) return 1; return v - c.v; } public String toString() { return java.lang.Character.toString(v); } public void assign(SimpleCharacter c) { v = c.v; } public void assign(char v) { this.v = v; } public SimpleCharacter value() { return this; } }
Java
package gov.nasa.anml.utility; import java.util.Set; public interface fMap<V> extends pMap<V> { public static interface Entry<V> extends pMap.Entry<V> { public abstract float getKey(); } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * @see #put(float, V) */ public abstract V get(float key); /** Superfluous, but saves a few keystrokes. * * @param key The key whose presence in this map is to be tested * @return <tt>true</tt> if this map contains a mapping for the specified * key. */ public abstract boolean containsKey(float key); /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for the key, the old * value is replaced. * * If the specified value is null, the mapping is deleted -- null * cannot be mapped to. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public abstract V put(float key, V value); /** * Copies all of the mappings from the specified map to this map. * These mappings will replace any mappings that this map had for * any of the keys currently in the specified map. * * @param m mappings to be stored in this map * @throws NullPointerException if the specified map is null */ public abstract <W extends V> void putAll(fMap<W> m); /** * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public abstract V remove(float key); /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * * Nor does it allow modifying the wrapped keys. */ public abstract Set<SimpleFloat> keySet(); /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * * @return a set view of the mappings contained in this map */ public abstract Set<fMap.Entry<V>> entrySet(); }
Java
package gov.nasa.anml.utility; public interface SimpleObject<T> extends Comparable<SimpleObject<T>>, Cloneable { public abstract void assign(T v); public abstract T value(); public abstract T clone(); }
Java
package gov.nasa.anml.utility; import java.util.Map; // like map, except that K is assumed to be an array public interface ArrMap<K,V> extends Map<K,V> { }
Java
package gov.nasa.anml.utility; public class SimpleString implements SimpleObject<SimpleString> { public char[] v; public int length; public static final SimpleString Empty = new SimpleString(""); public SimpleString() { v = new char[10]; length = 0; } /** Takes control of the array! * capacity = v.length = length */ public SimpleString(char[] v) { this.v = v; this.length = v.length; } /** Takes control of the array! * v.length = capacity * l <= v.length */ public SimpleString(char[] v, int l) { this.v = v; this.length = l; } // vacuum up integer arrays in order to enable hashCode and thus HashMaps // update: implemented ArrMap, so this isn't really necessary // note: but it's still useful, and raises the issue of using byte[] instead // (and then one would vacuum up ints in chunks of 4 and drop the high bytes // of chars [one hopes ASCII is represented as 0 high bytes, ascii in low byte] public SimpleString(int[] a) { int l = a.length,t; int j=l<<1; char[]v = new char[j--]; this.v = v; this.length = l--; for(;l>=0;--l) { t = a[l]; v[j--] = (char) (t<<16); v[j--] = (char) (t); } } // explicitly makes a copy, contrast with char[] constructor public SimpleString(SimpleString s) { char[]src=s.v; int c = src.length; int l = s.length; char[]dst = new char[c]; System.arraycopy(src,0,dst,0,l); this.length = l; this.v = dst; this.hash = s.hash; } // makes a copy. Inconsistent with this(char[]) and this(char[], int l) // in C we can use arrays like pointers and pointers like arrays // so we could just point into the middle -- and // then copying wouldn't be necessary here. // Java has no pointers, only references, and // no notion of subarrays as distinct objects that // can be referenced. Sadly. public SimpleString(char[] src, int start, int end) { int l = end-start; char[]dst = new char[l]; System.arraycopy(src,start,dst,0,l); this.length = l; this.v = dst; } public SimpleString(String n) { v = n.toCharArray(); length = v.length; hash = n.hashCode(); } private int hash = 0; public int hashCode() { int h = hash; if (h == 0) { int off = 0; char val[] = v; int len = length; for (int i = 0; i < len; i++) { h = 31 * h + val[off++]; } hash = h; } return h; } // don't call this unless you know types match. public boolean equals(Object o) { return equals((SimpleString)o); } public boolean equals(SimpleString s) { if (this == s) { return true; } int n = length; if (n == s.length) { char v1[] = v; char v2[] = s.v; while (n-- != 0) { if (v1[n] != v2[n]) return false; } return true; } return false; } public static int compareTo(SimpleString a, SimpleString b) { if (a == null) return 1; if (b == null) return -1; if (a == b) return 0; int n1 = a.length; int n2 = b.length; char v1[] = a.v; char v2[] = b.v; int i = 0; if (n1 < n2) { while (n1-- != 0) { char c1 = v1[i]; char c2 = v2[i]; ++i; if (c1 != c2) return c1 - c2; } return -1; } if (n1 > n2) { while (n2-- != 0) { char c1 = v1[i]; char c2 = v2[i]; ++i; if (c1 != c2) return c1 - c2; } return 1; } while (n1-- != 0) { char c1 = v1[i]; char c2 = v2[i]; ++i; if (c1 != c2) return c1 - c2; } return 0; } public static final boolean equals(SimpleString a, SimpleString b) { if (a == null || b == null) return false; if (a == b) return true; int n = a.length; if (n == b.length) { char v1[] = a.v; char v2[] = b.v; while (n-- != 0) { if (v1[n] != v2[n]) return false; } return true; } return false; } public SimpleString clone() { SimpleString s; try { s = (SimpleString) super.clone(); } catch (CloneNotSupportedException e) { return null; } s.v = v.clone(); return s; } public int compareTo(SimpleString s) { int n1 = length; int n2 = s.length; char v1[] = v; char v2[] = s.v; int i = 0; if (n1 < n2) { while (n1-- != 0) { char c1 = v1[i]; char c2 = v2[i]; ++i; if (c1 != c2) return c1 - c2; } return -1; } if (n1 > n2) { while (n2-- != 0) { char c1 = v1[i]; char c2 = v2[i]; ++i; if (c1 != c2) return c1 - c2; } return 1; } while (n1-- != 0) { char c1 = v1[i]; char c2 = v2[i]; ++i; if (c1 != c2) return c1 - c2; } return 0; } public final int compareTo(SimpleObject<SimpleString> o) { return compareTo((SimpleString)o); } public String toString() { return new String(v); } public void assign(SimpleString s) { hash = s.hash; int n2 = s.length; char[] v = this.v; if (v.length < n2) { v = new char[n2]; this.v = v; } System.arraycopy(s.v, 0, v, 0, n2); length = n2; } public void assign(String s) { int l = s.length(); hash = s.hashCode(); length = l; if (l > v.length) { v = new char[l]; } s.getChars(0,l,v,0); } public SimpleString value() { return this; } }
Java
package gov.nasa.anml.utility; import java.util.Set; public interface cArrMap<V> extends pMap<V> { public interface Entry<V> extends pMap.Entry<V> { public abstract char[] getKey(); } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * @see #put(int, V) */ public abstract V get(char[] key); /** Superfluous, but saves a few keystrokes. * * @param key The key whose presence in this map is to be tested * @return <tt>true</tt> if this map contains a mapping for the specified * key. */ public abstract boolean containsKey(char[] key); /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for the key, the old * value is replaced. * * If the specified value is null, the mapping is deleted -- null * cannot be mapped to. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public abstract V put(char[] key, V value); /** * Copies all of the mappings from the specified map to this map. * These mappings will replace any mappings that this map had for * any of the keys currently in the specified map. * * @param m mappings to be stored in this map * @throws NullPointerException if the specified map is null */ public abstract <W extends V> void putAll(cArrMap<W> m); /** * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public abstract V remove(char[] key); /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * * Nor does it allow modifying the wrapped keys. */ public abstract Set<char[]> keySet(); /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * * @return a set view of the mappings contained in this map */ public abstract Set<Entry<V>> entrySet(); }
Java
package gov.nasa.anml.utility; import java.io.IOException; import java.io.Serializable; import java.util.*; import static java.util.Arrays.*; /** Stolen ("adapted") from HashMap * * C-style; shoot-yourself-in-the-foot-style * * Fails slowly, does not attempt to correctly serialize if sub-classed. * i.e.: "Use at your own risk." * * * @see HashMap * * @param <V> */ public class iArrHashMap<V> implements Cloneable, Serializable, iArrMap<V> { /** * The default initial capacity - MUST be a power of two. */ static final int DEFAULT_INITIAL_CAPACITY = 16; /** * The maximum capacity, used if a higher value is implicitly specified * by either of the constructors with arguments. * MUST be a power of two <= 1<<30. */ static final int MAXIMUM_CAPACITY = 1 << 30; /** * The load factor used when none specified in constructor. */ static final float DEFAULT_LOAD_FACTOR = 0.75f; /** * The table, resized as necessary. Length MUST Always be a power of two. */ transient Entry[] table; /** * The number of key-value mappings contained in this map. */ transient int size; /** * The next size value at which to resize (capacity * load factor). * @serial */ int threshold; /** * The load factor for the hash table. * * @serial */ final float loadFactor; // Views transient EntrySet entrySet; transient KeySet keySet; transient Values values; /** * Constructs an empty <tt>iHashMap</tt> with the specified initial * capacity and load factor. * * @param initialCapacity the initial capacity * @param loadFactor the load factor * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ public iArrHashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal initial capacity: " + initialCapacity); if (initialCapacity > MAXIMUM_CAPACITY) initialCapacity = MAXIMUM_CAPACITY; if (loadFactor <= 0 || Float.isNaN(loadFactor)) throw new IllegalArgumentException("Illegal load factor: " + loadFactor); // Find a power of 2 >= initialCapacity int capacity = 1; while (capacity < initialCapacity) capacity <<= 1; this.loadFactor = loadFactor; threshold = (int)(capacity * loadFactor); table = new Entry<?>[capacity]; } /** * Constructs an empty <tt>iHashMap</tt> with the specified initial * capacity and the default load factor (0.75). * * @param initialCapacity the initial capacity. * @throws IllegalArgumentException if the initial capacity is negative. */ public iArrHashMap(int initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR); } /** * Constructs an empty <tt>iHashMap</tt> with the default initial capacity * (16) and the default load factor (0.75). */ public iArrHashMap() { this.loadFactor = DEFAULT_LOAD_FACTOR; threshold = (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); table = new Entry<?>[DEFAULT_INITIAL_CAPACITY]; } /** * Constructs a new <tt>iHashMap</tt> with the same mappings as the * specified <tt>Map</tt>. The <tt>iHashMap</tt> is created with * default load factor (0.75) and an initial capacity sufficient to * hold the mappings in the specified <tt>Map</tt>. * * @param m the map whose mappings are to be placed in this map * @throws NullPointerException if the specified map is null */ public <W extends V> iArrHashMap(iArrHashMap<W> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllForCreate(m); } public iArrHashMap(Map<List<? extends SimpleInteger>, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllSimpleInteger(m); } public iArrHashMap(Integer exampleKey, Map<List<Integer>, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllInteger(m); } public iArrHashMap(int[] exampleKey, Map<int[],?extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllArray(m); } // internal utilities /** * Applies the HashMap hash function to the key; ultimately * producing the same index as a HashMap<ArrayList<Integer>> would. * * int[].hashCode() is just Object.hashCode(), i.e., memory address. * * @see HashMap#hash(int h) * @see HashMap#indexFor(int k, int length) * @see java.util.Arrays#hashCode(int[]) * @return index for key */ static int indexFor(int[] k, int length) { int h = Arrays.hashCode(k); h ^= (h >>> 20) ^ (h >>> 12); return (h ^ (h >>> 7) ^ (h >>> 4)) & (length-1); } /** * @return the number of key-value mappings in this map */ public int size() { return size; } /** * @return <tt>true</tt> if this map contains no key-value mappings */ public boolean isEmpty() { return size == 0; } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * @see #put(int, V) */ public V get(int[] key) { //int hash = hash(key); for (Entry<V> e = table[indexFor(key, table.length)]; e != null; e = e.next) { // wtf? testing to see if the hash matches?? // ahh....two levels of hashing -- keys to hashes to indices // sort of debatable whether e.hash == hash saves any time // for integer keys... // just doing simple key comparison... //if (e.hash == hash && e.key == key) if (Arrays.equals(e.key,key)) return e.value; } return null; } /** Superfluous, but saves a few keystrokes. * * @param key The key whose presence in this map is to be tested * @return <tt>true</tt> if this map contains a mapping for the specified * key. */ public final boolean containsKey(int[] key) { return get(key) != null; } /** * Returns the entry associated with the specified key in the * iHashMap. Returns null if the iHashMap contains no mapping * for the key. */ final Entry<V> getEntry(int[] key) { //int hash = hash(key); for (Entry<V> e = table[indexFor(key, table.length)]; e != null; e = e.next) { if (e.key == key) return e; } return null; } /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for the key, the old * value is replaced. * * If the specified value is null, the mapping is deleted -- null * cannot be mapped to. * * If the key changes, everything will break. Well, not if the * hashCode() somehow remains the same. * The same is true of HashMap<ArrayList<Integer>,V>. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V put(int[] key, V value) { if (value == null) return remove(key); //int hash = hash(key); int i = indexFor(key, table.length); Entry<V> e = table[i]; V oldValue; if (e == null) { table[i] = new Entry<V>(key,value); ++size; return null; } if (Arrays.equals(e.key,key)) { oldValue = e.value; e.value = value; return oldValue; } if (e.next != null) { do { e = e.next; if (Arrays.equals(e.key,key)) { oldValue = e.value; e.value = value; return oldValue; } } while(e.next != null); } e.next = new Entry<V>(key,value); ++size; return null; } /** * This method is used instead of put by constructors and * pseudoconstructors (clone, readObject). It does not resize the table, * check for comodification, etc. It calls createEntry rather than * addEntry. * * @deprecated just use createEntry */ private void putForCreate(int[] key, V value) { //int hash = hash(key); int i = indexFor(key, table.length); createEntry(i, key, value); } // but note that such Maps are broken private <W extends V> void putAllArray(Map<int[],W> m) { int i,l=table.length; int[] k=null; for (Map.Entry<int[],W> e : m.entrySet()) { k = e.getKey(); i=indexFor(k,l); createEntry(i,k,e.getValue()); } } // have to copy, as can't access the backing array, which // is anyways of the wrong type private <K extends List<Integer>, W extends V> void putAllInteger(Map<K,W> m) { int i,l=table.length,keyLen; int[] k=null; K key; for (Map.Entry<K,W> e : m.entrySet()) { i=0; key = e.getKey(); keyLen = key.size(); k = new int[keyLen]; for(Integer s : key) k[i++] = s.intValue(); i=indexFor(k,l); createEntry(i,k,e.getValue()); } } // have to copy, as can't access the backing array, which // is anyways of the wrong type private <K extends List<? extends SimpleInteger>, W extends V> void putAllSimpleInteger(Map<K,W> m) { int i,l=table.length,keyLen; int[] k=null; K key; for (Map.Entry<K,W> e : m.entrySet()) { i=0; key = e.getKey(); keyLen = key.size(); k = new int[keyLen]; for(SimpleInteger s : key) k[i++] = s.v; i=indexFor(k,l); createEntry(i,k,e.getValue()); } } // shares keys -- dangerous private <W extends V> void putAllForCreate(iArrHashMap<W> m) { int i,l=table.length; int[] k; for (Entry<W> e : m.table) { Entry<W> f; for (f=e;f!=null;f=f.next) { k = f.key; i=indexFor(k,l); createEntry(i,k,f.value); } } } /** * Rehashes the contents of this map into a new array with a * larger capacity. This method is called automatically when the * number of keys in this map reaches its threshold. * * If current capacity is MAXIMUM_CAPACITY, this method does not * resize the map, but sets threshold to Integer.MAX_VALUE. * This has the effect of preventing future calls. * * @param newCapacity the new capacity, MUST be a power of two; * must be greater than current capacity unless current * capacity is MAXIMUM_CAPACITY (in which case value * is irrelevant). */ void resize(int newCapacity) { Entry[] oldTable = table; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { threshold = Integer.MAX_VALUE; return; } Entry[] newTable = new Entry<?>[newCapacity]; transfer(newTable); table = newTable; threshold = (int)(newCapacity * loadFactor); } /** * Transfers all entries from current table to newTable. */ void transfer(Entry[] newTable) { Entry[] src = table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry<V> e = src[j]; if (e != null) { src[j] = null; do { Entry<V> next = e.next; int i = indexFor(e.key, newCapacity); e.next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } } /** * Copies all of the mappings from the specified map to this map. * These mappings will replace any mappings that this map had for * any of the keys currently in the specified map. * * @param m mappings to be stored in this map * @throws NullPointerException if the specified map is null */ public <W extends V> void putAll(iArrMap<W> m) { int numKeysToBeAdded = m.size(); if (numKeysToBeAdded == 0) return; /* * Expand the map if the map if the number of mappings to be added * is greater than or equal to threshold. This is conservative; the * obvious condition is (m.size() + size) >= threshold, but this * condition could result in a map with twice the appropriate capacity, * if the keys to be added overlap with the keys already in this map. * By using the conservative calculation, we subject ourself * to at most one extra resize. */ if (numKeysToBeAdded > threshold) { int targetCapacity = (int)(numKeysToBeAdded / loadFactor + 1); if (targetCapacity > MAXIMUM_CAPACITY) targetCapacity = MAXIMUM_CAPACITY; int newCapacity = table.length; while (newCapacity < targetCapacity) newCapacity <<= 1; if (newCapacity > table.length) resize(newCapacity); } // scan the table instead? // probably not...hashing can work differently for different sizes for (iArrMap.Entry<W> e : m.entrySet()) { put(e.getKey(), e.getValue()); } } /** * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V remove(int[] key) { int i = indexFor(key, table.length); Entry<V> e = table[i]; if (e == null) return null; if (e.key == key) { --size; table[i] = e.next; return e.value; } Entry<V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (e.key == key) { --size; prev.next = next; return e.value; } next = e.next; } while (next != null); } return null; } /** * Removes and returns the entry associated with the specified key * in the iHashMap. Returns null if the iHashMap contains no mapping * for this key. * * Only for inlining purposes? * @see #remove(int) */ final Entry<V> removeEntryForKey(int[] key) { //int hash = hash(key); int i = indexFor(key, table.length); Entry<V> e = table[i]; if (e == null) return null; if (e.key == key) { --size; table[i] = e.next; return e; } Entry<V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (e.key == key) { --size; prev.next = next; return e; } next = e.next; } while (next != null); } return null; } /** * Removes all of the mappings from this map. * The map will be empty after this call returns. */ public void clear() { Entry[] tab = table; for (int i = 0; i < tab.length; i++) tab[i] = null; size = 0; } /** * Returns <tt>true</tt> if this map maps one or more keys to the * specified value. * * @param v value whose presence in this map is to be tested * @return <tt>true</tt> if this map maps one or more keys to the * specified value */ public boolean containsObject(Object v) { return containsValue((V)v); } public boolean containsValue(V value) { if (value == null) return false; Entry[] tab = table; for (int i = 0; i < tab.length ; i++) for (Entry<V> e = tab[i] ; e != null ; e = e.next) if (value.equals(e.value)) return true; return false; } /** * Returns a deep-ish copy of this <tt>iHashMap</tt> instance; * the values are not cloned, but the references are. * * Changing a key-value mapping in a clone does not alter the original -- * but directly altering a value is reflected in all references to that * value, e.g., in all clones. * * The keys are primitives and therefore copied. * * @return a shallow copy of this map */ public iArrHashMap<V> clone() { iArrHashMap<V> result = null; try { result = (iArrHashMap<V>)super.clone(); } catch (CloneNotSupportedException e) { // assert false; } result.table = new Entry<?>[table.length]; result.entrySet = null; result.size = 0; result.putAllForCreate(this); return result; } public static class Entry<V> implements iArrMap.Entry<V> { public final int[] key; public V value; Entry<V> next; /** * Creates new entry. */ Entry(int[] key, V value) { this.key = key; this.value = value; } Entry(int[] key, V value, Entry<V> next) { this.key = key; this.value = value; this.next = next; } public final int[] getKey() { return key; } public final V getValue() { return value; } public final V setValue(V newValue) { V oldValue = value; value = newValue; return oldValue; } public final boolean equals(Object o) { if (!(o instanceof Entry)) return false; Entry<V> e = (Entry<V>)o; if (key == e.key) { V v1 = value, v2 = e.value; if (v1 == v2 || (v1 != null && v1.equals(v2))) return true; } return false; } public final int hashCode() { return (Arrays.hashCode(key)) ^ (value==null ? 0 : value.hashCode()); } public final String toString() { return key + "=" + value; } } /** * Used when creating entries * as part of Map construction or "pseudo-construction" (cloning, * deserialization). This version needn't worry about resizing the table. * * Subclass overrides this to alter the behavior of iHashMap(Map), * iHashMap(iHashMap), clone, and readObject. */ Entry<V> createEntry(int bucketIndex, int[] key, V value) { Entry<V> e = table[bucketIndex]; table[bucketIndex] = new Entry<V>(key, value, e); size++; return e; } private abstract class HashIterator<E> implements Iterator<E> { Entry<V> next; // next entry to return int index; // current slot Entry<V> current; // current entry HashIterator() { if (size > 0) { // advance to first entry Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } } public final boolean hasNext() { return next != null; } final Entry<V> nextEntry() { Entry<V> e = current = next; if (e == null) throw new NoSuchElementException(); if ((next = e.next) == null) { Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } return e; } public void remove() { if (current == null) throw new IllegalStateException(); int[] k = current.key; current = null; removeEntryForKey(k); } } private final class ValueIterator extends HashIterator<V> { public V next() { return nextEntry().value; } } private final class KeyIterator extends HashIterator<int[]> { public int[] next() { return nextEntry().key; } } private final class EntryIterator extends HashIterator<iArrMap.Entry<V>> { public iArrMap.Entry<V> next() { return nextEntry(); } } // Subclass overrides these to alter behavior of views' iterator() method Iterator<int[]> newKeyIterator() { return new KeyIterator(); } Iterator<V> newValueIterator() { return new ValueIterator(); } Iterator<iArrMap.Entry<V>> newEntryIterator() { return new EntryIterator(); } /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * * Nor does it allow modifying the wrapped keys. */ public Set<int[]> keySet() { Set<int[]> ks = keySet; return (ks != null ? ks : (keySet = new KeySet())); } private final class KeySet extends AbstractSet<int[]> { public Iterator<int[]> iterator() { return newKeyIterator(); } public int size() { return size; } public boolean contains(Object o) { if (o instanceof int[]) return contains((int[])o); return false; } public boolean contains(int[] k) { return containsKey(k); } public boolean remove(Object o) { if (o instanceof int[]) return remove((int[])o); return false; } public boolean remove(int[] k) { return iArrHashMap.this.removeEntryForKey(k) != null; } public void clear() { iArrHashMap.this.clear(); } } /** * Returns a {@link Collection} view of the values contained in this map. * The collection is backed by the map, so changes to the map are * reflected in the collection, and vice-versa. If the map is * modified while an iteration over the collection is in progress * (except through the iterator's own <tt>remove</tt> operation), * the results of the iteration are undefined. The collection * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Collection.remove</tt>, <tt>removeAll</tt>, * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not * support the <tt>add</tt> or <tt>addAll</tt> operations. */ public Collection<V> values() { Collection<V> vs = values; return (vs != null ? vs : (values = new Values())); } private final class Values extends AbstractCollection<V> { public Iterator<V> iterator() { return newValueIterator(); } public int size() { return size; } public boolean contains(Object o) { return containsObject(o); } public void clear() { iArrHashMap.this.clear(); } } /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * * @return a set view of the mappings contained in this map */ public Set<iArrMap.Entry<V>> entrySet() { Set<iArrMap.Entry<V>> es = entrySet; return es != null ? es : (entrySet = new EntrySet()); } private final class EntrySet extends AbstractSet<iArrMap.Entry<V>> { public Iterator<iArrMap.Entry<V>> iterator() { return newEntryIterator(); } public boolean contains(Object o) { if (!(o instanceof Entry)) return false; Entry<V> e = (Entry<V>) o; Entry<V> candidate = getEntry(e.key); return candidate != null && candidate.equals(e); } public boolean remove(Object o) { if (o instanceof Entry) { Entry<V> e = (Entry<V>) o; return iArrHashMap.this.remove(e.key) != null; } return false; } public int size() { return size; } public void clear() { iArrHashMap.this.clear(); } } /** * Save the state of the <tt>iHashMap</tt> instance to a stream (i.e., * serialize it). * * @serialData The <i>capacity</i> of the iHashMap (the length of the * bucket array) is emitted (int), followed by the * <i>size</i> (an int, the number of key-value * mappings), followed by the key (Object) and value (Object) * for each key-value mapping. The key-value mappings are * emitted in no particular order. */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { Iterator<iArrMap.Entry<V>> i = (size > 0) ? entrySet().iterator() : null; // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size (number of Mappings) s.writeInt(size); // Write out keys and values (alternating) if (i != null) { while (i.hasNext()) { iArrMap.Entry<V> e = i.next(); s.writeObject(e.getKey()); s.writeObject(e.getValue()); } } } private static final long serialVersionUID = 362498820763181265L; /** * Reconstitute the <tt>iHashMap</tt> instance from a stream (i.e., * deserialize it). */ private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { // Read in the threshold, loadfactor, and any hidden stuff s.defaultReadObject(); // Read in number of buckets and allocate the bucket array; int numBuckets = s.readInt(); table = new Entry<?>[numBuckets]; // Read in size (number of Mappings) // hides this.size, and that is important since createEntry increments it int size = s.readInt(); // Read the keys and values, and put the mappings in the iHashMap for (int i=0; i<size; i++) { int[] key = (int[]) s.readObject(); V value = (V) s.readObject(); createEntry(indexFor(key,numBuckets),key,value); } } // These methods are used when serializing HashSets int capacity() { return table.length; } float loadFactor() { return loadFactor; } }
Java
package gov.nasa.anml.utility; import java.io.IOException; import java.io.Serializable; import java.util.*; /** Stolen ("adapted") from HashMap * * C-style; shoot-yourself-in-the-foot-style * * Fails slowly, does not attempt to correctly serialize if sub-classed. * i.e.: "Use at your own risk." * * Cannot map to null and cannot map NaN * * @see HashMap * * @param <V> */ public class fHashMap<V> implements Cloneable, Serializable, fMap<V> { /** * The default initial capacity - MUST be a power of two. */ static final int DEFAULT_INITIAL_CAPACITY = 16; /** * The maximum capacity, used if a higher value is implicitly specified * by either of the constructors with arguments. * MUST be a power of two <= 1<<30. */ static final int MAXIMUM_CAPACITY = 1 << 30; /** * The load factor used when none specified in constructor. */ static final float DEFAULT_LOAD_FACTOR = 0.75f; /** * The table, resized as necessary. Length MUST Always be a power of two. */ transient Entry[] table; /** * The number of key-value mappings contained in this map. */ transient int size; /** * The next size value at which to resize (capacity * load factor). * @serial */ int threshold; /** * The load factor for the hash table. * * @serial */ final float loadFactor; // Views transient EntrySet entrySet; transient KeySet keySet; transient Values values; /** * Constructs an empty <tt>fHashMap</tt> with the specified initial * capacity and load factor. * * @param initialCapacity the initial capacity * @param loadFactor the load factor * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ public fHashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal initial capacity: " + initialCapacity); if (initialCapacity > MAXIMUM_CAPACITY) initialCapacity = MAXIMUM_CAPACITY; if (loadFactor <= 0 || Float.isNaN(loadFactor)) throw new IllegalArgumentException("Illegal load factor: " + loadFactor); // Find a power of 2 >= initialCapacity int capacity = 1; while (capacity < initialCapacity) capacity <<= 1; this.loadFactor = loadFactor; threshold = (int)(capacity * loadFactor); table = new Entry<?>[capacity]; } /** * Constructs an empty <tt>fHashMap</tt> with the specified initial * capacity and the default load factor (0.75). * * @param initialCapacity the initial capacity. * @throws IllegalArgumentException if the initial capacity is negative. */ public fHashMap(int initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR); } /** * Constructs an empty <tt>fHashMap</tt> with the default initial capacity * (16) and the default load factor (0.75). */ public fHashMap() { this.loadFactor = DEFAULT_LOAD_FACTOR; threshold = (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); table = new Entry<?>[DEFAULT_INITIAL_CAPACITY]; } /** * Constructs a new <tt>fHashMap</tt> with the same mappings as the * specified <tt>Map</tt>. The <tt>fHashMap</tt> is created with * default load factor (0.75) and an initial capacity sufficient to * hold the mappings in the specified <tt>Map</tt>. * * @param m the map whose mappings are to be placed in this map * @throws NullPointerException if the specified map is null */ public <W extends V> fHashMap(fHashMap<W> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllForCreate(m); } public fHashMap(Map<? extends SimpleFloat, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllSimpleFloat(m); } public fHashMap(Float exampleKey, Map<Float, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllFloat(m); } // internal utilities /** * Applies the HashMap hash function to the key; producing the same * ultimate index as a HashMap<Float,?> would. * * @see HashMap#hash(int h) * @see HashMap#indexFor(int k, int length) * @see Float.hashCode() * @return index for key */ static int indexFor(float k, int length) { int h = Float.floatToIntBits(k); h ^= (h >>> 20) ^ (h >>> 12); return (h ^ (h >>> 7) ^ (h >>> 4)) & (length-1); } /** * @return the number of key-value mappings in this map */ public int size() { return size; } /** * @return <tt>true</tt> if this map contains no key-value mappings */ public boolean isEmpty() { return size == 0; } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * @see #put(int, V) */ public V get(float key) { //int hash = hash(key); for (Entry<V> e = table[indexFor(key, table.length)]; e != null; e = e.next) { if (e.key == key) return e.value; } return null; } /** Superfluous, but saves a few keystrokes. * * @param key The key whose presence in this map is to be tested * @return <tt>true</tt> if this map contains a mapping for the specified * key. */ public final boolean containsKey(float key) { return get(key) != null; } /** * Returns the entry associated with the specified key in the * fHashMap. Returns null if the fHashMap contains no mapping * for the key. */ final Entry<V> getEntry(float key) { //int hash = hash(key); for (Entry<V> e = table[indexFor(key, table.length)]; e != null; e = e.next) { if (e.key == key) return e; } return null; } /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for the key, the old * value is replaced. * * If the specified value is null, the mapping is deleted -- null * cannot be mapped to. * * Uses == to test keys, so cannot map NaN to anything useful. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V put(float key, V value) { if (value == null) return remove(key); if (key != key) return null; //int hash = hash(key); int i = indexFor(key, table.length); Entry<V> e = table[i]; V oldValue; if (e == null) { table[i] = new Entry<V>(key,value); ++size; return null; } if (e.key == key) { oldValue = e.value; e.value = value; return oldValue; } if (e.next != null) { do { e = e.next; if (e.key == key) { oldValue = e.value; e.value = value; return oldValue; } } while(e.next != null); } e.next = new Entry<V>(key,value); ++size; return null; } /** * This method is used instead of put by constructors and * pseudoconstructors (clone, readObject). It does not resize the table, * check for comodification, etc. It calls createEntry rather than * addEntry. * * @deprecated just use createEntry */ private void putForCreate(float key, V value) { //int hash = hash(key); int i = indexFor(key, table.length); createEntry(i, key, value); } private <W extends V> void putAllFloat(Map<Float,W> m) { int i,k,l=table.length; for (Map.Entry<Float,W> e : m.entrySet()) { //resizing can't happen k=e.getKey().intValue(); i=indexFor(k,l); createEntry(i,k,e.getValue()); } } private <K extends SimpleFloat, W extends V> void putAllSimpleFloat(Map<K,W> m) { int i,l=table.length; float k; for (Map.Entry<K,W> e : m.entrySet()) { k=e.getKey().v; i=indexFor(k,l); createEntry(i,k,e.getValue()); } } private <W extends V> void putAllForCreate(fHashMap<W> m) { int i,l=table.length; float k; for (Entry<W> e : m.table) { Entry<W> f; for (f=e;f!=null;f=f.next) { k=f.key; i=indexFor(k,l); createEntry(i,k,f.value); } } } /** * Rehashes the contents of this map into a new array with a * larger capacity. This method is called automatically when the * number of keys in this map reaches its threshold. * * If current capacity is MAXIMUM_CAPACITY, this method does not * resize the map, but sets threshold to Float.MAX_VALUE. * This has the effect of preventing future calls. * * @param newCapacity the new capacity, MUST be a power of two; * must be greater than current capacity unless current * capacity is MAXIMUM_CAPACITY (in which case value * is irrelevant). */ void resize(int newCapacity) { Entry[] oldTable = table; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { threshold = Integer.MAX_VALUE; return; } Entry[] newTable = new Entry<?>[newCapacity]; transfer(newTable); table = newTable; threshold = (int)(newCapacity * loadFactor); } /** * Transfers all entries from current table to newTable. */ void transfer(Entry[] newTable) { Entry[] src = table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry<V> e = src[j]; if (e != null) { src[j] = null; do { Entry<V> next = e.next; int i = indexFor(e.key, newCapacity); e.next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } } /** * Copies all of the mappings from the specified map to this map. * These mappings will replace any mappings that this map had for * any of the keys currently in the specified map. * * @param m mappings to be stored in this map * @throws NullPointerException if the specified map is null */ public <W extends V> void putAll(fMap<W> m) { int numKeysToBeAdded = m.size(); if (numKeysToBeAdded == 0) return; /* * Expand the map if the map if the number of mappings to be added * is greater than or equal to threshold. This is conservative; the * obvious condition is (m.size() + size) >= threshold, but this * condition could result in a map with twice the appropriate capacity, * if the keys to be added overlap with the keys already in this map. * By using the conservative calculation, we subject ourself * to at most one extra resize. */ if (numKeysToBeAdded > threshold) { int targetCapacity = (int)(numKeysToBeAdded / loadFactor + 1); if (targetCapacity > MAXIMUM_CAPACITY) targetCapacity = MAXIMUM_CAPACITY; int newCapacity = table.length; while (newCapacity < targetCapacity) newCapacity <<= 1; if (newCapacity > table.length) resize(newCapacity); } // scan the table instead? // probably not...hashing can work differently for different sizes for (fMap.Entry<W> e : m.entrySet()) { put(e.getKey(), e.getValue()); } } /** * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V remove(float key) { int i = indexFor(key, table.length); Entry<V> e = table[i]; if (e == null) return null; if (e.key == key) { --size; table[i] = e.next; return e.value; } Entry<V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (e.key == key) { --size; prev.next = next; return e.value; } next = e.next; } while (next != null); } return null; } /** * Removes and returns the entry associated with the specified key * in the fHashMap. Returns null if the fHashMap contains no mapping * for this key. * * Only for inlining purposes? * @see #remove(int) */ final Entry<V> removeEntryForKey(float key) { //int hash = hash(key); int i = indexFor(key, table.length); Entry<V> e = table[i]; if (e == null) return null; if (e.key == key) { --size; table[i] = e.next; return e; } Entry<V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (e.key == key) { --size; prev.next = next; return e; } next = e.next; } while (next != null); } return null; } /** * Removes all of the mappings from this map. * The map will be empty after this call returns. */ public void clear() { Entry[] tab = table; for (int i = 0; i < tab.length; i++) tab[i] = null; size = 0; } /** * Returns <tt>true</tt> if this map maps one or more keys to the * specified value. * * @param v value whose presence in this map is to be tested * @return <tt>true</tt> if this map maps one or more keys to the * specified value */ public boolean containsObject(Object v) { return containsValue((V)v); } public boolean containsValue(V value) { if (value == null) return false; Entry[] tab = table; for (int i = 0; i < tab.length ; i++) for (Entry<V> e = tab[i] ; e != null ; e = e.next) if (value.equals(e.value)) return true; return false; } /** * Returns a deep-ish copy of this <tt>fHashMap</tt> instance; * the values are not cloned, but the references are. * * Changing a key-value mapping in a clone does not alter the original -- * but directly altering a value is reflected in all references to that * value, e.g., in all clones. * * The keys are primitives and therefore copied. * * @return a shallow copy of this map */ public fHashMap<V> clone() { fHashMap<V> result = null; try { result = (fHashMap<V>)super.clone(); } catch (CloneNotSupportedException e) { // assert false; } result.table = new Entry<?>[table.length]; result.entrySet = null; result.size = 0; result.putAllForCreate(this); return result; } public static class Entry<V> implements fMap.Entry<V> { public final float key; public V value; Entry<V> next; /** * Creates new entry. */ Entry(float k, V v) { key = k; value = v; } Entry(float k, V v, Entry<V> n) { key = k; value = v; next = n; } public final float getKey() { return key; } public final V getValue() { return value; } public final V setValue(V newValue) { V oldValue = value; value = newValue; return oldValue; } public final boolean equals(Object o) { if (!(o instanceof Entry)) return false; Entry<V> e = (Entry<V>)o; if (key == e.key) { V v1 = value, v2 = e.value; if (v1 == v2 || (v1 != null && v1.equals(v2))) return true; } return false; } public final int hashCode() { return Float.floatToIntBits(key) ^ (value==null ? 0 : value.hashCode()); } public final String toString() { return key + "=" + value; } } /** * Used when creating entries * as part of Map construction or "pseudo-construction" (cloning, * deserialization). This version needn't worry about resizing the table. * * Subclass overrides this to alter the behavior of fHashMap(Map), * fHashMap(fHashMap), clone, and readObject. */ Entry<V> createEntry(int bucketIndex, float key, V value) { Entry<V> e = table[bucketIndex]; table[bucketIndex] = new Entry<V>(key, value, e); size++; return e; } private abstract class HashIterator<E> implements Iterator<E> { Entry<V> next; // next entry to return int index; // current slot Entry<V> current; // current entry HashIterator() { if (size > 0) { // advance to first entry Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } } public final boolean hasNext() { return next != null; } final Entry<V> nextEntry() { Entry<V> e = current = next; if (e == null) throw new NoSuchElementException(); if ((next = e.next) == null) { Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } return e; } public void remove() { if (current == null) throw new IllegalStateException(); float k = current.key; current = null; removeEntryForKey(k); } } private final class ValueIterator extends HashIterator<V> { public V next() { return nextEntry().value; } } /* Iterators have to return objects; the returned object is always the same, * the data keeps changing. So next().v has to be copied somewhere between * calls to this method. * */ private final class KeyIterator extends HashIterator<SimpleFloat> { SimpleFloat wrapper = new SimpleFloat(0); public SimpleFloat next() { wrapper.v = nextEntry().key; return wrapper; } } private final class EntryIterator extends HashIterator<fMap.Entry<V>> { public fMap.Entry<V> next() { return nextEntry(); } } // Subclass overrides these to alter behavior of views' iterator() method Iterator<SimpleFloat> newKeyIterator() { return new KeyIterator(); } Iterator<V> newValueIterator() { return new ValueIterator(); } Iterator<fMap.Entry<V>> newEntryIterator() { return new EntryIterator(); } /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * * Nor does it allow modifying the wrapped keys. */ public Set<SimpleFloat> keySet() { Set<SimpleFloat> ks = keySet; return (ks != null ? ks : (keySet = new KeySet())); } private final class KeySet extends AbstractSet<SimpleFloat> { public Iterator<SimpleFloat> iterator() { return newKeyIterator(); } public int size() { return size; } public boolean contains(Object o) { if (o instanceof SimpleFloat) return contains((SimpleFloat)o); return false; } public boolean contains(SimpleFloat o) { return containsKey(o.v); } public boolean remove(Object o) { if (o instanceof SimpleFloat) return remove((SimpleFloat)o); return false; } public boolean remove(SimpleFloat o) { return fHashMap.this.removeEntryForKey(o.v) != null; } public void clear() { fHashMap.this.clear(); } } /** * Returns a {@link Collection} view of the values contained in this map. * The collection is backed by the map, so changes to the map are * reflected in the collection, and vice-versa. If the map is * modified while an iteration over the collection is in progress * (except through the iterator's own <tt>remove</tt> operation), * the results of the iteration are undefined. The collection * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Collection.remove</tt>, <tt>removeAll</tt>, * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not * support the <tt>add</tt> or <tt>addAll</tt> operations. */ public Collection<V> values() { Collection<V> vs = values; return (vs != null ? vs : (values = new Values())); } private final class Values extends AbstractCollection<V> { public Iterator<V> iterator() { return newValueIterator(); } public int size() { return size; } public boolean contains(Object o) { return containsObject(o); } public void clear() { fHashMap.this.clear(); } } /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * * @return a set view of the mappings contained in this map */ public Set<fMap.Entry<V>> entrySet() { Set<fMap.Entry<V>> es = entrySet; return es != null ? es : (entrySet = new EntrySet()); } private final class EntrySet extends AbstractSet<fMap.Entry<V>> { public Iterator<fMap.Entry<V>> iterator() { return newEntryIterator(); } public boolean contains(Object o) { if (!(o instanceof Entry)) return false; Entry<V> e = (Entry<V>) o; Entry<V> candidate = getEntry(e.key); return candidate != null && candidate.equals(e); } public boolean remove(Object o) { if (o instanceof Entry) { Entry<V> e = (Entry<V>) o; return fHashMap.this.remove(e.key) != null; } return false; } public int size() { return size; } public void clear() { fHashMap.this.clear(); } } /** * Save the state of the <tt>fHashMap</tt> instance to a stream (i.e., * serialize it). * * @serialData The <i>capacity</i> of the fHashMap (the length of the * bucket array) is emitted (int), followed by the * <i>size</i> (an int, the number of key-value * mappings), followed by the key (Object) and value (Object) * for each key-value mapping. The key-value mappings are * emitted in no particular order. */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { Iterator<fMap.Entry<V>> i = (size > 0) ? entrySet().iterator() : null; // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size (number of Mappings) s.writeInt(size); // Write out keys and values (alternating) if (i != null) { while (i.hasNext()) { fMap.Entry<V> e = i.next(); s.writeFloat(e.getKey()); s.writeObject(e.getValue()); } } } private static final long serialVersionUID = 362498820763181265L; /** * Reconstitute the <tt>fHashMap</tt> instance from a stream (i.e., * deserialize it). */ private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { // Read in the threshold, loadfactor, and any hidden stuff s.defaultReadObject(); // Read in number of buckets and allocate the bucket array; int numBuckets = s.readInt(); table = new Entry<?>[numBuckets]; // Read in size (number of Mappings) // hides this.size, and that is important since createEntry increments it int size = s.readInt(); // Read the keys and values, and put the mappings in the fHashMap for (int i=0; i<size; i++) { float key = s.readFloat(); V value = (V) s.readObject(); createEntry(indexFor(key,numBuckets),key,value); } } // These methods are used when serializing HashSets int capacity() { return table.length; } float loadFactor() { return loadFactor; } }
Java
package gov.nasa.anml.utility; // mutable integers // but using these as keys in a hashtable requires not changing the value // i.e., be careful! public class SimpleInteger implements SimpleObject<SimpleInteger> { public int v; public SimpleInteger() { v = 0; } public SimpleInteger(int v) { this.v = v; } public int hashCode() { return v; } public boolean equals(Object obj) { if (obj instanceof SimpleInteger && v == ((SimpleInteger) obj).v) return true; return false; } public boolean equals(SimpleInteger obj) { if (v == obj.v) return true; return false; } public SimpleInteger clone() { try { return (SimpleInteger) super.clone(); } catch (CloneNotSupportedException e) { // assert false; } return null; } public int compareTo(SimpleInteger o) { if (this == null || o == null) return 1; return v - o.v; } public int compareTo(SimpleObject<SimpleInteger> o) { SimpleInteger i = (SimpleInteger) o; if (this == null || i == null) return 1; return v - i.v; } public String toString() { return java.lang.Integer.toString(v); } public void assign(SimpleInteger c) { v = c.v; } public void assign(int v) { this.v = v; } public SimpleInteger value() { return this; } }
Java
package gov.nasa.anml.utility; import java.io.IOException; import java.io.Serializable; import java.util.*; /** Stolen ("adapted") from HashMap * * C-style; shoot-yourself-in-the-foot-style * * Fails slowly, does not attempt to correctly serialize if sub-classed. * i.e.: "Use at your own risk." * * * @see HashMap * * @param <V> */ public class iHashMap<V> implements Cloneable, Serializable, iMap<V> { /** * The default initial capacity - MUST be a power of two. */ protected static final int DEFAULT_INITIAL_CAPACITY = 16; /** * The maximum capacity, used if a higher value is implicitly specified * by either of the constructors with arguments. * MUST be a power of two <= 1<<30. */ protected static final int MAXIMUM_CAPACITY = 1 << 30; /** * The load factor used when none specified in constructor. */ protected static final float DEFAULT_LOAD_FACTOR = 0.75f; /** * The table, resized as necessary. Length MUST Always be a power of two. */ protected transient Entry[] table; /** * The number of key-value mappings contained in this map. */ protected transient int size; /** * The next size value at which to resize (capacity * load factor). * @serial */ protected int threshold; /** * The load factor for the hash table. * * @serial */ protected final float loadFactor; // Views protected transient EntrySet entrySet; protected transient KeySet keySet; protected transient Values values; /** * Constructs an empty <tt>iHashMap</tt> with the specified initial * capacity and load factor. * * @param initialCapacity the initial capacity * @param loadFactor the load factor * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ public iHashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal initial capacity: " + initialCapacity); if (initialCapacity > MAXIMUM_CAPACITY) initialCapacity = MAXIMUM_CAPACITY; if (loadFactor <= 0 || Float.isNaN(loadFactor)) throw new IllegalArgumentException("Illegal load factor: " + loadFactor); // Find a power of 2 >= initialCapacity int capacity = 1; while (capacity < initialCapacity) capacity <<= 1; this.loadFactor = loadFactor; threshold = (int)(capacity * loadFactor); table = new Entry<?>[capacity]; } /** * Constructs an empty <tt>iHashMap</tt> with the specified initial * capacity and the default load factor (0.75). * * @param initialCapacity the initial capacity. * @throws IllegalArgumentException if the initial capacity is negative. */ public iHashMap(int initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR); } /** * Constructs an empty <tt>iHashMap</tt> with the default initial capacity * (16) and the default load factor (0.75). */ public iHashMap() { this.loadFactor = DEFAULT_LOAD_FACTOR; threshold = (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); table = new Entry<?>[DEFAULT_INITIAL_CAPACITY]; } /** * Constructs a new <tt>iHashMap</tt> with the same mappings as the * specified <tt>Map</tt>. The <tt>iHashMap</tt> is created with * default load factor (0.75) and an initial capacity sufficient to * hold the mappings in the specified <tt>Map</tt>. * * @param m the map whose mappings are to be placed in this map * @throws NullPointerException if the specified map is null */ public <W extends V> iHashMap(iHashMap<W> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllForCreate(m); } public iHashMap(Map<? extends SimpleInteger, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllSimpleInteger(m); } public iHashMap(Integer exampleKey, Map<Integer, ? extends V> m) { this(Math.max((int) (m.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAllInteger(m); } // internal utilities /** * Applies the HashMap hash function to the key; producing the same * ultimate index as a HashMap<Integer,?> would. * * @see HashMap#hash(int h) * @see HashMap#indexFor(int k, int length) * @see Integer.hashCode() * @return index for key */ static int indexFor(int k, int length) { k ^= (k >>> 20) ^ (k >>> 12); return (k ^ (k >>> 7) ^ (k >>> 4)) & (length-1); } /** * @return the number of key-value mappings in this map */ public int size() { return size; } /** * @return <tt>true</tt> if this map contains no key-value mappings */ public boolean isEmpty() { return size == 0; } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * @see #put(int, V) */ public V get(int key) { //int hash = hash(key); for (Entry<V> e = table[indexFor(key, table.length)]; e != null; e = e.next) { // wtf? testing to see if the hash matches?? // ahh....two levels of hashing -- keys to hashes to indices // sort of debatable whether e.hash == hash saves any time // for integer keys... // just doing simple key comparison... //if (e.hash == hash && e.key == key) if (e.key == key) return e.value; } return null; } /** Superfluous, but saves a few keystrokes. * * @param key The key whose presence in this map is to be tested * @return <tt>true</tt> if this map contains a mapping for the specified * key. */ public final boolean containsKey(int key) { return get(key) != null; } /** * Returns the entry associated with the specified key in the * iHashMap. Returns null if the iHashMap contains no mapping * for the key. */ final Entry<V> getEntry(int key) { //int hash = hash(key); for (Entry<V> e = table[indexFor(key, table.length)]; e != null; e = e.next) { if (e.key == key) return e; } return null; } /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for the key, the old * value is replaced. * * If the specified value is null, the mapping is deleted -- null * cannot be mapped to. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V put(int key, V value) { if (value == null) return remove(key); //int hash = hash(key); int i = indexFor(key, table.length); Entry<V> e = table[i]; V oldValue; if (e == null) { table[i] = new Entry<V>(key,value); ++size; return null; } if (e.key == key) { oldValue = e.value; e.value = value; return oldValue; } if (e.next != null) { do { e = e.next; if (e.key == key) { oldValue = e.value; e.value = value; return oldValue; } } while(e.next != null); } e.next = new Entry<V>(key,value); ++size; return null; } /** * This method is used instead of put by constructors and * pseudoconstructors (clone, readObject). It does not resize the table, * check for comodification, etc. It calls createEntry rather than * addEntry. * * @deprecated just use createEntry */ private void putForCreate(int key, V value) { //int hash = hash(key); int i = indexFor(key, table.length); createEntry(i, key, value); } private <W extends V> void putAllInteger(Map<Integer,W> m) { int i,k,l=table.length; for (Map.Entry<Integer,W> e : m.entrySet()) { //resizing can't happen k=e.getKey().intValue(); i=indexFor(k,l); createEntry(i,k,e.getValue()); } } private <K extends SimpleInteger, W extends V> void putAllSimpleInteger(Map<K,W> m) { int i,k,l=table.length; for (Map.Entry<K,W> e : m.entrySet()) { k=e.getKey().v; i=indexFor(k,l); createEntry(i,k,e.getValue()); } } private <W extends V> void putAllForCreate(iHashMap<W> m) { int i,k,l=table.length; for (Entry<W> e : m.table) { Entry<W> f; for (f=e;f!=null;f=f.next) { k=f.key; i=indexFor(k,l); createEntry(i,k,f.value); } } } /** * Rehashes the contents of this map into a new array with a * larger capacity. This method is called automatically when the * number of keys in this map reaches its threshold. * * If current capacity is MAXIMUM_CAPACITY, this method does not * resize the map, but sets threshold to Integer.MAX_VALUE. * This has the effect of preventing future calls. * * @param newCapacity the new capacity, MUST be a power of two; * must be greater than current capacity unless current * capacity is MAXIMUM_CAPACITY (in which case value * is irrelevant). */ void resize(int newCapacity) { Entry[] oldTable = table; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { threshold = Integer.MAX_VALUE; return; } Entry[] newTable = new Entry<?>[newCapacity]; transfer(newTable); table = newTable; threshold = (int)(newCapacity * loadFactor); } /** * Transfers all entries from current table to newTable. */ void transfer(Entry[] newTable) { Entry[] src = table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry<V> e = src[j]; if (e != null) { src[j] = null; do { Entry<V> next = e.next; int i = indexFor(e.key, newCapacity); e.next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } } /** * Copies all of the mappings from the specified map to this map. * These mappings will replace any mappings that this map had for * any of the keys currently in the specified map. * * @param m mappings to be stored in this map * @throws NullPointerException if the specified map is null */ public <W extends V> void putAll(iMap<W> m) { int numKeysToBeAdded = m.size(); if (numKeysToBeAdded == 0) return; /* * Expand the map if the map if the number of mappings to be added * is greater than or equal to threshold. This is conservative; the * obvious condition is (m.size() + size) >= threshold, but this * condition could result in a map with twice the appropriate capacity, * if the keys to be added overlap with the keys already in this map. * By using the conservative calculation, we subject ourself * to at most one extra resize. */ if (numKeysToBeAdded > threshold) { int targetCapacity = (int)(numKeysToBeAdded / loadFactor + 1); if (targetCapacity > MAXIMUM_CAPACITY) targetCapacity = MAXIMUM_CAPACITY; int newCapacity = table.length; while (newCapacity < targetCapacity) newCapacity <<= 1; if (newCapacity > table.length) resize(newCapacity); } // scan the table instead? // probably not...hashing can work differently for different sizes for (iMap.Entry<W> e : m.entrySet()) { put(e.getKey(), e.getValue()); } } /** * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. */ public V remove(int key) { int i = indexFor(key, table.length); Entry<V> e = table[i]; if (e == null) return null; if (e.key == key) { --size; table[i] = e.next; return e.value; } Entry<V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (e.key == key) { --size; prev.next = next; return e.value; } next = e.next; } while (next != null); } return null; } /** * Removes and returns the entry associated with the specified key * in the iHashMap. Returns null if the iHashMap contains no mapping * for this key. * * Only for inlining purposes? * @see #remove(int) */ final Entry<V> removeEntryForKey(int key) { //int hash = hash(key); int i = indexFor(key, table.length); Entry<V> e = table[i]; if (e == null) return null; if (e.key == key) { --size; table[i] = e.next; return e; } Entry<V> prev, next=e.next; if (next != null) { do { prev = e; e = next; if (e.key == key) { --size; prev.next = next; return e; } next = e.next; } while (next != null); } return null; } /** * Removes all of the mappings from this map. * The map will be empty after this call returns. */ public void clear() { Entry[] tab = table; for (int i = 0; i < tab.length; i++) tab[i] = null; size = 0; } /** * Returns <tt>true</tt> if this map maps one or more keys to the * specified value. * * @param v value whose presence in this map is to be tested * @return <tt>true</tt> if this map maps one or more keys to the * specified value */ public boolean containsObject(Object v) { return containsValue((V)v); } public boolean containsValue(V value) { if (value == null) return false; Entry[] tab = table; for (int i = 0; i < tab.length ; i++) for (Entry<V> e = tab[i] ; e != null ; e = e.next) if (value.equals(e.value)) return true; return false; } /** * Returns a deep-ish copy of this <tt>iHashMap</tt> instance; * the values are not cloned, but the references are. * * Changing a key-value mapping in a clone does not alter the original -- * but directly altering a value is reflected in all references to that * value, e.g., in all clones. * * The keys are primitives and therefore copied. * * @return a shallow copy of this map */ public iHashMap<V> clone() { iHashMap<V> result = null; try { result = (iHashMap<V>)super.clone(); } catch (CloneNotSupportedException e) { // assert false; } result.table = new Entry<?>[table.length]; result.entrySet = null; result.size = 0; result.putAllForCreate(this); return result; } public static class Entry<V> implements iMap.Entry<V> { public final int key; public V value; Entry<V> next; /** * Creates new entry. */ public Entry(int k, V v) { key = k; value = v; } public Entry(int k, V v, Entry<V> n) { key = k; value = v; next = n; } public final int getKey() { return key; } public final V getValue() { return value; } public final V setValue(V newValue) { V oldValue = value; value = newValue; return oldValue; } public final boolean equals(Object o) { if (!(o instanceof Entry)) return false; Entry<V> e = (Entry<V>)o; if (key == e.key) { V v1 = value, v2 = e.value; if (v1 == v2 || (v1 != null && v1.equals(v2))) return true; } return false; } public final int hashCode() { return (key) ^ (value==null ? 0 : value.hashCode()); } public final String toString() { return key + "=" + value; } } /** * Used when creating entries * as part of Map construction or "pseudo-construction" (cloning, * deserialization). This version needn't worry about resizing the table. * * Subclass overrides this to alter the behavior of iHashMap(Map), * iHashMap(iHashMap), clone, and readObject. */ protected Entry<V> createEntry(int bucketIndex, int key, V value) { Entry<V> e = table[bucketIndex]; table[bucketIndex] = new Entry<V>(key, value, e); size++; return e; } private abstract class HashIterator<E> implements Iterator<E> { Entry<V> next; // next entry to return int index; // current slot Entry<V> current; // current entry HashIterator() { if (size > 0) { // advance to first entry Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } } public final boolean hasNext() { return next != null; } final Entry<V> nextEntry() { Entry<V> e = current = next; if (e == null) throw new NoSuchElementException(); if ((next = e.next) == null) { Entry[] t = table; do {} while (index < t.length && (next = t[index++]) == null); } return e; } public void remove() { if (current == null) throw new IllegalStateException(); int k = current.key; current = null; removeEntryForKey(k); } } private final class ValueIterator extends HashIterator<V> { public V next() { return nextEntry().value; } } /* Iterators have to return objects; the returned object is always the same, * the data keeps changing. So next().v has to be copied somewhere between * calls to this method. * */ private final class KeyIterator extends HashIterator<SimpleInteger> { SimpleInteger wrapper = new SimpleInteger(0); public SimpleInteger next() { wrapper.v = nextEntry().key; return wrapper; } } private final class EntryIterator extends HashIterator<iMap.Entry<V>> { public iMap.Entry<V> next() { return nextEntry(); } } // Subclass overrides these to alter behavior of views' iterator() method Iterator<SimpleInteger> newKeyIterator() { return new KeyIterator(); } Iterator<V> newValueIterator() { return new ValueIterator(); } Iterator<iMap.Entry<V>> newEntryIterator() { return new EntryIterator(); } /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * * Nor does it allow modifying the wrapped keys. */ public Set<SimpleInteger> keySet() { Set<SimpleInteger> ks = keySet; return (ks != null ? ks : (keySet = new KeySet())); } private final class KeySet extends AbstractSet<SimpleInteger> { public Iterator<SimpleInteger> iterator() { return newKeyIterator(); } public int size() { return size; } public boolean contains(Object o) { if (o instanceof SimpleInteger) return contains((SimpleInteger)o); return false; } public boolean contains(SimpleInteger o) { return containsKey(o.v); } public boolean remove(Object o) { if (o instanceof SimpleInteger) return remove((SimpleInteger)o); return false; } public boolean remove(SimpleInteger o) { return iHashMap.this.removeEntryForKey(o.v) != null; } public void clear() { iHashMap.this.clear(); } } /** * Returns a {@link Collection} view of the values contained in this map. * The collection is backed by the map, so changes to the map are * reflected in the collection, and vice-versa. If the map is * modified while an iteration over the collection is in progress * (except through the iterator's own <tt>remove</tt> operation), * the results of the iteration are undefined. The collection * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Collection.remove</tt>, <tt>removeAll</tt>, * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not * support the <tt>add</tt> or <tt>addAll</tt> operations. */ public Collection<V> values() { Collection<V> vs = values; return (vs != null ? vs : (values = new Values())); } private final class Values extends AbstractCollection<V> { public Iterator<V> iterator() { return newValueIterator(); } public int size() { return size; } public boolean contains(Object o) { return containsObject(o); } public void clear() { iHashMap.this.clear(); } } /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * * @return a set view of the mappings contained in this map */ public Set<iMap.Entry<V>> entrySet() { Set<iMap.Entry<V>> es = entrySet; return es != null ? es : (entrySet = new EntrySet()); } private final class EntrySet extends AbstractSet<iMap.Entry<V>> { public Iterator<iMap.Entry<V>> iterator() { return newEntryIterator(); } public boolean contains(Object o) { if (!(o instanceof Entry)) return false; Entry<V> e = (Entry<V>) o; Entry<V> candidate = getEntry(e.key); return candidate != null && candidate.equals(e); } public boolean remove(Object o) { if (o instanceof Entry) { Entry<V> e = (Entry<V>) o; return iHashMap.this.remove(e.key) != null; } return false; } public int size() { return size; } public void clear() { iHashMap.this.clear(); } } /** * Save the state of the <tt>iHashMap</tt> instance to a stream (i.e., * serialize it). * * @serialData The <i>capacity</i> of the iHashMap (the length of the * bucket array) is emitted (int), followed by the * <i>size</i> (an int, the number of key-value * mappings), followed by the key (Object) and value (Object) * for each key-value mapping. The key-value mappings are * emitted in no particular order. */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { Iterator<iMap.Entry<V>> i = (size > 0) ? entrySet().iterator() : null; // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size (number of Mappings) s.writeInt(size); // Write out keys and values (alternating) if (i != null) { while (i.hasNext()) { iMap.Entry<V> e = i.next(); s.writeInt(e.getKey()); s.writeObject(e.getValue()); } } } private static final long serialVersionUID = 362498820763181265L; /** * Reconstitute the <tt>iHashMap</tt> instance from a stream (i.e., * deserialize it). */ private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { // Read in the threshold, loadfactor, and any hidden stuff s.defaultReadObject(); // Read in number of buckets and allocate the bucket array; int numBuckets = s.readInt(); table = new Entry<?>[numBuckets]; // Read in size (number of Mappings) // hides this.size, and that is important since createEntry increments it int size = s.readInt(); // Read the keys and values, and put the mappings in the iHashMap for (int i=0; i<size; i++) { int key = s.readInt(); V value = (V) s.readObject(); createEntry(indexFor(key,numBuckets),key,value); } } // These methods are used when serializing HashSets int capacity() { return table.length; } float loadFactor() { return loadFactor; } }
Java
package gov.nasa.anml.utility; public class Pair<A, B> { public A left; public B right; public Pair() { } public Pair(A l, B r) { left = l; right = r; } }
Java
package gov.nasa.anml; import java.util.*; import gov.nasa.anml.lifted.*; import gov.nasa.anml.utility.*; import static gov.nasa.anml.lifted.Time.*; public class State extends LocalState implements Cloneable { // either this way public Step step; // how we got generated public State parent; // from what public int bra; // where exactly in time; (Context).start gives the float // this gives before/at/after (latter two only used during advance-time) // or... // public Step[] plan; // accumulate the whole plan // // second way allows forgetting the closed list public void clear() { constants.clear(); fluents.clear(); functions.clear(); contexts.clear(); // unnecessary? contexts.put(-1,this); step = null; parent = null; } // not exactly a clone. Really prepares a child. public State clone() { State c; try { c = (State) super.clone(); } catch (CloneNotSupportedException e) { return null; } c.constants = (iHashMap<? extends SimpleObject<?>>) constants.clone(); c.fluents = (iFluentHistoryMap) fluents.clone(); c.functions = (iFunctionHistoryMap) functions.clone(); c.contexts = (iHashMap<LocalState>) contexts.clone(); c.contexts.put(-1,c); c.parent = this; return c; } public History<?> resolveFluent(int key) { return fluents.get(key); } public BindingHistoryMap<?> resolveFunction(int id) { return functions.get(id); } @Deprecated public History<? extends SimpleObject<?>> addFluent(int key) { History<? extends SimpleObject<?>> place = ((History<? extends SimpleObject<?>>)fluents.get(key)); if (place == null) { place = new History<SimpleObject<Object>>(); fluents.put(key,place); } return place; } public <T extends SimpleObject<? super T>> BindingHistoryMap<T> makeFunction(FluentFunction<T> f) { BindingHistoryMap<T> extension = new BindingHistoryMap<T>(); functions.put(f.id,extension); return extension; } public int hashCode() { return fluents.hashCode() ^ functions.hashCode(); } /** * * @param <T> * @param key * @param value * * @deprecated Use resolveFluent() to get the history, and manipulate * the history manually */ public <T extends SimpleObject<T>> void setFluent(int key, T value) { History<T> place = ((History<T>)fluents.get(key)); if (place == null) { place = new History<T>(); place.value = value.clone(); fluents.put(key,place); } else { place.value.assign(value); } } public <W extends SimpleObject<W>> void putFluents(iMap<History<W>> m) { fluents.putAll(m); } public SimpleObject<?> removeFluent(int key) { return fluents.remove(key).value; } public int size() { return fluents.size(); } public String toString() { return fluents.toString(); } public LocalState getLocalState(int contextID) { return contexts.get(contextID); } /* public SimpleFloat getStart(int contextID) { return contexts.get(contextID).start; } public SimpleFloat getEnd(int contextID) { return contexts.get(contextID).end; } */ }
Java
package gov.nasa.anml; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.iHashMap; import gov.nasa.anml.utility.iHashMap.Entry; //implements cloning of the values of the map. History does a shallow clone. public class iFunctionHistoryMap extends iHashMap<BindingHistoryMap<? extends SimpleObject<?>>> { public Entry<BindingHistoryMap<? extends SimpleObject<?>>> createEntry(int index, int key, BindingHistoryMap<? extends SimpleObject<?>> value) { Entry<BindingHistoryMap<? extends SimpleObject<?>>> e = table[index]; table[index] = new Entry<BindingHistoryMap<? extends SimpleObject<?>>>(key, value.clone(), e); size++; return e; } public iFunctionHistoryMap clone() { return (iFunctionHistoryMap) super.clone(); } }
Java
package gov.nasa.anml; import java.util.ArrayList; import gov.nasa.anml.lifted.*; import gov.nasa.anml.utility.*; public class Context { // Action a; public SimpleFloat start; public SimpleFloat end; // absolute deadline for global states (more useful for local states) public int bra; public int ket; public Context outer; // lexically enclosing context public History<?> resolveFluent(int id) { if (outer != null) return outer.resolveFluent(id); return null; } public BindingHistoryMap<?> resolveFunction(int id) { if (outer != null) return outer.resolveFunction(id); return null; } public History<? extends SimpleObject<?>> addFluent(int id) { return outer.addFluent(id); } public <T extends SimpleObject<? super T>> BindingHistoryMap<T> makeFunction(FluentFunction<T> f) { return outer.makeFunction(f); } public ArrayList<Statement> beforeStart; public ArrayList<Statement> atStart; public ArrayList<Statement> afterStart; public ArrayList<Statement> beforeEnd; public ArrayList<Statement> atEnd; public ArrayList<Statement> afterEnd; }
Java
package gov.nasa.anml; import gov.nasa.anml.lifted.History; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.iHashMap; import gov.nasa.anml.utility.iHashMap.Entry; //implements cloning of the values of the map. History does a shallow clone. public class iFluentHistoryMap extends iHashMap<History<? extends SimpleObject>> { public Entry<History<? extends SimpleObject>> createEntry(int index, int key, History<? extends SimpleObject> value) { Entry<History<? extends SimpleObject>> e = table[index]; table[index] = new Entry<History<? extends SimpleObject>>(key, value.clone(), e); size++; return e; } public iFluentHistoryMap clone() { return (iFluentHistoryMap) super.clone(); } }
Java
package gov.nasa.anml.parsing; import gov.nasa.anml.utility.SimpleString; import org.antlr.runtime.CharStream; public interface ANMLCharStream extends CharStream { SimpleString makeSimpleString(int start, int stop); char[] getData(); }
Java
package gov.nasa.anml.parsing; import java.io.IOException; import java.io.InputStream; import gov.nasa.anml.utility.SimpleString; import org.antlr.runtime.*; public class ANMLInputStream extends ANTLRInputStream implements ANMLCharStream { public ANMLInputStream() { super(); } public ANMLInputStream(InputStream input, int size, int readBufferSize, String encoding) throws IOException { super(input, size, readBufferSize, encoding); } public ANMLInputStream(InputStream input, int size, String encoding) throws IOException { super(input, size, encoding); } public ANMLInputStream(InputStream input, int size) throws IOException { super(input, size); } public ANMLInputStream(InputStream input, String encoding) throws IOException { super(input, encoding); } public ANMLInputStream(InputStream input) throws IOException { super(input); } public char[] getData() { return data; } public SimpleString makeSimpleString(int start, int stop) { return new SimpleString(data,start,stop+1); } @Override public void consume() { if ( p < n ) { if ( data[p]=='\n' ) { line++; charPositionInLine=0; } else if (data[p]=='\t') { charPositionInLine+=4; } else { charPositionInLine+=1; } p++; } } }
Java
// $ANTLR 3.1.1 ANMLTree.g 2010-06-01 17:08:43 package gov.nasa.anml.parsing; import gov.nasa.anml.lifted.*; import gov.nasa.anml.utility.*; import org.antlr.runtime.*; import org.antlr.runtime.tree.*;import java.util.Stack; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; public class ANMLTree extends TreeParser { public static final String[] tokenNames = new String[] { "<invalid>", "<EOR>", "<DOWN>", "<UP>", "Types", "Constants", "Fluents", "Actions", "Parameters", "Arguments", "Stmts", "Block", "Decompositions", "TypeRef", "LabelRef", "Ref", "Bind", "Access", "TypeRefine", "Type", "Fluent", "FluentFunction", "Constant", "ConstantFunction", "Parameter", "Action", "Label", "DefiniteInterval", "DefinitePoint", "IndefiniteInterval", "IndefinitePoint", "Bra", "Ket", "Before", "At", "After", "TBra", "TKet", "TStart", "TEnd", "TDuration", "Chain", "TimedStmt", "TimedExpr", "ContainsSomeStmt", "ContainsAllStmt", "ContainsSomeExpr", "ContainsAllExpr", "ForAllExpr", "ForAllStmt", "ExistsExpr", "ExistsStmt", "When", "WhenElse", "Enum", "Range", "ID", "This", "Boolean", "Integer", "Float", "Symbol", "String", "Object", "Vector", "Predicate", "LessThan", "Assign", "With", "Semi", "Comma", "Undefined", "Undefine", "LeftP", "RightP", "Variable", "Function", "Fact", "LeftC", "RightC", "NotLog", "NotBit", "EqualLog", "Equal", "Goal", "LeftB", "Duration", "RightB", "Decomposition", "Contains", "Else", "ForAll", "Exists", "Change", "Produce", "Consume", "Lend", "Use", "Within", "SetAssign", "Skip", "Delta", "All", "Dots", "Colon", "Implies", "XorLog", "OrLog", "AndLog", "XorBit", "Plus", "Minus", "OrBit", "Times", "Divide", "AndBit", "Unordered", "Ordered", "Dot", "Start", "End", "INT", "FLOAT", "STRING", "True", "False", "Infinity", "NotEqual", "GreaterThan", "LessThanE", "GreaterThanE", "DIGIT", "ESC", "LETTER", "WS", "SLC", "MLC", "ForallExpr" }; public static final int IndefinitePoint=30; public static final int LessThan=66; public static final int Ket=32; public static final int Implies=105; public static final int OrBit=112; public static final int AndLog=108; public static final int TDuration=40; public static final int Stmts=10; public static final int LETTER=133; public static final int Before=33; public static final int Fluents=6; public static final int Constants=5; public static final int Bind=16; public static final int After=35; public static final int DefinitePoint=28; public static final int XorLog=106; public static final int LabelRef=14; public static final int Lend=96; public static final int Actions=7; public static final int EOF=-1; public static final int LessThanE=129; public static final int AndBit=115; public static final int Variable=75; public static final int NotLog=80; public static final int ForAll=91; public static final int When=52; public static final int TEnd=39; public static final int NotBit=81; public static final int Access=17; public static final int Undefined=71; public static final int Use=97; public static final int ContainsAllExpr=47; public static final int ExistsExpr=50; public static final int Decompositions=12; public static final int ForAllStmt=49; public static final int This=57; public static final int ContainsSomeExpr=46; public static final int TimedStmt=42; public static final int DefiniteInterval=27; public static final int Colon=104; public static final int INT=121; public static final int Action=25; public static final int NotEqual=127; public static final int TimedExpr=43; public static final int Equal=83; public static final int Fluent=20; public static final int With=68; public static final int Block=11; public static final int Object=63; public static final int Float=60; public static final int LeftC=78; public static final int Range=55; public static final int Minus=111; public static final int WS=134; public static final int Semi=69; public static final int LeftB=85; public static final int Function=76; public static final int Times=113; public static final int OrLog=107; public static final int MLC=136; public static final int TypeRefine=18; public static final int ExistsStmt=51; public static final int TBra=36; public static final int IndefiniteInterval=29; public static final int Else=90; public static final int Label=26; public static final int ForAllExpr=48; public static final int Types=4; public static final int End=120; public static final int Parameters=8; public static final int Fact=77; public static final int Unordered=116; public static final int Undefine=72; public static final int Within=98; public static final int LeftP=73; public static final int ForallExpr=137; public static final int ESC=132; public static final int All=102; public static final int TStart=38; public static final int SLC=135; public static final int Decomposition=88; public static final int False=125; public static final int GreaterThanE=130; public static final int Constant=22; public static final int FLOAT=122; public static final int Enum=54; public static final int ID=56; public static final int GreaterThan=128; public static final int Consume=95; public static final int Arguments=9; public static final int Assign=67; public static final int Change=93; public static final int Chain=41; public static final int TypeRef=13; public static final int Produce=94; public static final int WhenElse=53; public static final int Ordered=117; public static final int ConstantFunction=23; public static final int Bra=31; public static final int Exists=92; public static final int String=62; public static final int Symbol=61; public static final int DIGIT=131; public static final int Predicate=65; public static final int ContainsSomeStmt=44; public static final int True=124; public static final int Vector=64; public static final int RightP=74; public static final int Start=119; public static final int Type=19; public static final int At=34; public static final int Delta=101; public static final int XorBit=109; public static final int Contains=89; public static final int TKet=37; public static final int ContainsAllStmt=45; public static final int RightC=79; public static final int RightB=87; public static final int SetAssign=99; public static final int Duration=86; public static final int Divide=114; public static final int Parameter=24; public static final int Goal=84; public static final int Ref=15; public static final int Skip=100; public static final int Plus=110; public static final int Boolean=58; public static final int Dot=118; public static final int EqualLog=82; public static final int Dots=103; public static final int Infinity=126; public static final int Comma=70; public static final int Integer=59; public static final int STRING=123; public static final int FluentFunction=21; // delegates // delegators protected static class A_scope { Unit d; // The difference between Scope and Unit is small: Units have names.; } protected Stack A_stack = new Stack(); protected static class S_scope { Scope d; // capital Scope is ANML-defined --- lowercase is ANTLR-defined.; } protected Stack S_stack = new Stack(); protected static class O_scope { ObjectType d; // are we within the definition of an object (type)? This may include field references in expressions.; } protected Stack O_stack = new Stack(); protected static class I_scope { Interval i; } protected Stack I_stack = new Stack(); public ANMLTree(TreeNodeStream input) { this(input, new RecognizerSharedState()); } public ANMLTree(TreeNodeStream input, RecognizerSharedState state) { super(input, state); } public String[] getTokenNames() { return ANMLTree.tokenNames; } public String getGrammarFileName() { return "ANMLTree.g"; } /* // ^(Boolean) public static CommonTree booleanTree = new CommonTree(new CommonTree(new CommonToken(Boolean,"Boolean"))); // ^(Delta) // intended to be ^(Delta fluent_ref) by .setChild(0,fluent_ref.tree) public static CommonTree deltaTree = new CommonTree(new CommonToken(Delta,"^")); public int LA(int i) { return input.LA(i); } public boolean LA(int i,int t) { return input.LA(i)==t; } */ public static int size(CommonTree t) { if (t.isNil()) { return t.getChildCount(); } return 1; } public String text(ANMLToken t) { if (t.startIndex <0 || t.stopIndex <0) return "null"; return input.getTokenStream().toString(t.startIndex,t.stopIndex); } Domain domain ;//= new Domain(); // $ANTLR start "model" // ANMLTree.g:81:1: model[Domain d] : ^( Block types constants fluents actions stmts ) ; public final void model(Domain d) throws RecognitionException { I_stack.push(new I_scope()); A_stack.push(new A_scope()); S_stack.push(new S_scope()); domain=d; ((S_scope)S_stack.peek()).d = d; ((A_scope)A_stack.peek()).d = d; ((I_scope)I_stack.peek()).i =d; try { // ANMLTree.g:84:2: ( ^( Block types constants fluents actions stmts ) ) // ANMLTree.g:84:4: ^( Block types constants fluents actions stmts ) { match(input,Block,FOLLOW_Block_in_model138); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_types_in_model143); types(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_constants_in_model148); constants(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_fluents_in_model153); fluents(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_actions_in_model158); actions(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_stmts_in_model163); stmts(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { I_stack.pop(); A_stack.pop(); S_stack.pop(); } return ; } // $ANTLR end "model" // $ANTLR start "term_arg_decl_list" // ANMLTree.g:95:1: term_arg_decl_list[Term t] : ( ^( Parameter id type_ref ) )* ; public final void term_arg_decl_list(Term t) throws RecognitionException { SimpleString id1 = null; Type type_ref2 = null; try { // ANMLTree.g:96:2: ( ( ^( Parameter id type_ref ) )* ) // ANMLTree.g:96:4: ( ^( Parameter id type_ref ) )* { // ANMLTree.g:96:4: ( ^( Parameter id type_ref ) )* loop1: do { int alt1=2; int LA1_0 = input.LA(1); if ( (LA1_0==Parameter) ) { alt1=1; } switch (alt1) { case 1 : // ANMLTree.g:96:5: ^( Parameter id type_ref ) { match(input,Parameter,FOLLOW_Parameter_in_term_arg_decl_list181); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_id_in_term_arg_decl_list183); id1=id(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_type_ref_in_term_arg_decl_list185); type_ref2=type_ref(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { t.parameters.put(new Parameter(id1,type_ref2)); } match(input, Token.UP, null); if (state.failed) return ; } break; default : break loop1; } } while (true); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "term_arg_decl_list" // $ANTLR start "scope_arg_decl_list" // ANMLTree.g:101:1: scope_arg_decl_list[Scope d] : ( ^( Parameter id type_ref ) )* ; public final void scope_arg_decl_list(Scope d) throws RecognitionException { SimpleString id3 = null; Type type_ref4 = null; try { // ANMLTree.g:102:2: ( ( ^( Parameter id type_ref ) )* ) // ANMLTree.g:102:4: ( ^( Parameter id type_ref ) )* { // ANMLTree.g:102:4: ( ^( Parameter id type_ref ) )* loop2: do { int alt2=2; int LA2_0 = input.LA(1); if ( (LA2_0==Parameter) ) { alt2=1; } switch (alt2) { case 1 : // ANMLTree.g:102:5: ^( Parameter id type_ref ) { match(input,Parameter,FOLLOW_Parameter_in_scope_arg_decl_list211); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_id_in_scope_arg_decl_list213); id3=id(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_type_ref_in_scope_arg_decl_list215); type_ref4=type_ref(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { d.addParameter(new Parameter(id3,type_ref4)); } match(input, Token.UP, null); if (state.failed) return ; } break; default : break loop2; } } while (true); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "scope_arg_decl_list" // $ANTLR start "builtinType" // ANMLTree.g:108:1: builtinType returns [TypeCode typeCode] : (t= Boolean | t= Integer | t= Float | t= Symbol | t= String | t= Object ) ; public final TypeCode builtinType() throws RecognitionException { TypeCode typeCode = null; ANMLToken t=null; try { // ANMLTree.g:110:2: ( (t= Boolean | t= Integer | t= Float | t= Symbol | t= String | t= Object ) ) // ANMLTree.g:111:2: (t= Boolean | t= Integer | t= Float | t= Symbol | t= String | t= Object ) { // ANMLTree.g:111:2: (t= Boolean | t= Integer | t= Float | t= Symbol | t= String | t= Object ) int alt3=6; switch ( input.LA(1) ) { case Boolean: { alt3=1; } break; case Integer: { alt3=2; } break; case Float: { alt3=3; } break; case Symbol: { alt3=4; } break; case String: { alt3=5; } break; case Object: { alt3=6; } break; default: if (state.backtracking>0) {state.failed=true; return typeCode;} NoViableAltException nvae = new NoViableAltException("", 3, 0, input); throw nvae; } switch (alt3) { case 1 : // ANMLTree.g:111:4: t= Boolean { t=(ANMLToken)match(input,Boolean,FOLLOW_Boolean_in_builtinType250); if (state.failed) return typeCode; if ( state.backtracking==0 ) { typeCode =TypeCode.Boolean; } } break; case 2 : // ANMLTree.g:112:4: t= Integer { t=(ANMLToken)match(input,Integer,FOLLOW_Integer_in_builtinType259); if (state.failed) return typeCode; if ( state.backtracking==0 ) { typeCode =TypeCode.Integer; } } break; case 3 : // ANMLTree.g:113:4: t= Float { t=(ANMLToken)match(input,Float,FOLLOW_Float_in_builtinType268); if (state.failed) return typeCode; if ( state.backtracking==0 ) { typeCode =TypeCode.Float; } } break; case 4 : // ANMLTree.g:114:4: t= Symbol { t=(ANMLToken)match(input,Symbol,FOLLOW_Symbol_in_builtinType277); if (state.failed) return typeCode; if ( state.backtracking==0 ) { typeCode =TypeCode.Symbol; } } break; case 5 : // ANMLTree.g:115:4: t= String { t=(ANMLToken)match(input,String,FOLLOW_String_in_builtinType286); if (state.failed) return typeCode; if ( state.backtracking==0 ) { typeCode =TypeCode.String; } } break; case 6 : // ANMLTree.g:116:4: t= Object { t=(ANMLToken)match(input,Object,FOLLOW_Object_in_builtinType295); if (state.failed) return typeCode; if ( state.backtracking==0 ) { typeCode =TypeCode.Object; } } break; } if ( state.backtracking==0 ) { //System.out.println("Builtin: " + text(t)); } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return typeCode; } // $ANTLR end "builtinType" // $ANTLR start "id" // ANMLTree.g:122:1: id returns [SimpleString text] : ( ID | This ); public final SimpleString id() throws RecognitionException { SimpleString text = null; ANMLToken ID5=null; try { // ANMLTree.g:123:5: ( ID | This ) int alt4=2; int LA4_0 = input.LA(1); if ( (LA4_0==ID) ) { alt4=1; } else if ( (LA4_0==This) ) { alt4=2; } else { if (state.backtracking>0) {state.failed=true; return text;} NoViableAltException nvae = new NoViableAltException("", 4, 0, input); throw nvae; } switch (alt4) { case 1 : // ANMLTree.g:123:7: ID { ID5=(ANMLToken)match(input,ID,FOLLOW_ID_in_id319); if (state.failed) return text; if ( state.backtracking==0 ) { text =ID5.getSimpleText(); } } break; case 2 : // ANMLTree.g:124:7: This { match(input,This,FOLLOW_This_in_id329); if (state.failed) return text; if ( state.backtracking==0 ) { text =((A_scope)A_stack.peek()).d.name(); } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return text; } // $ANTLR end "id" // $ANTLR start "type_spec" // ANMLTree.g:127:1: type_spec returns [Type d] : ( ^( Vector ( ^( Parameters term_arg_decl_list[(VectorType)$d] ) | Parameters ) ) | ^( TypeRef builtinType ( set )? ) | ^( TypeRef id ( set )? ) | enumeration ); public final Type type_spec() throws RecognitionException { Type d = null; TypeCode builtinType6 = null; Constraint set7 = null; SimpleString id8 = null; Constraint set9 = null; ANMLTree.enumeration_return enumeration10 = null; Constraint c = null; try { // ANMLTree.g:129:5: ( ^( Vector ( ^( Parameters term_arg_decl_list[(VectorType)$d] ) | Parameters ) ) | ^( TypeRef builtinType ( set )? ) | ^( TypeRef id ( set )? ) | enumeration ) int alt8=4; switch ( input.LA(1) ) { case Vector: { alt8=1; } break; case TypeRef: { int LA8_2 = input.LA(2); if ( (LA8_2==DOWN) ) { int LA8_4 = input.LA(3); if ( ((LA8_4>=Boolean && LA8_4<=Object)) ) { alt8=2; } else if ( ((LA8_4>=ID && LA8_4<=This)) ) { alt8=3; } else { if (state.backtracking>0) {state.failed=true; return d;} NoViableAltException nvae = new NoViableAltException("", 8, 4, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return d;} NoViableAltException nvae = new NoViableAltException("", 8, 2, input); throw nvae; } } break; case Enum: { alt8=4; } break; default: if (state.backtracking>0) {state.failed=true; return d;} NoViableAltException nvae = new NoViableAltException("", 8, 0, input); throw nvae; } switch (alt8) { case 1 : // ANMLTree.g:129:7: ^( Vector ( ^( Parameters term_arg_decl_list[(VectorType)$d] ) | Parameters ) ) { match(input,Vector,FOLLOW_Vector_in_type_spec355); if (state.failed) return d; if ( state.backtracking==0 ) { d =new VectorType(); } match(input, Token.DOWN, null); if (state.failed) return d; // ANMLTree.g:130:6: ( ^( Parameters term_arg_decl_list[(VectorType)$d] ) | Parameters ) int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0==Parameters) ) { int LA5_1 = input.LA(2); if ( (LA5_1==DOWN) ) { alt5=1; } else if ( (LA5_1==UP) ) { alt5=2; } else { if (state.backtracking>0) {state.failed=true; return d;} NoViableAltException nvae = new NoViableAltException("", 5, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return d;} NoViableAltException nvae = new NoViableAltException("", 5, 0, input); throw nvae; } switch (alt5) { case 1 : // ANMLTree.g:130:7: ^( Parameters term_arg_decl_list[(VectorType)$d] ) { match(input,Parameters,FOLLOW_Parameters_in_type_spec367); if (state.failed) return d; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return d; pushFollow(FOLLOW_term_arg_decl_list_in_type_spec369); term_arg_decl_list((VectorType)d); state._fsp--; if (state.failed) return d; match(input, Token.UP, null); if (state.failed) return d; } } break; case 2 : // ANMLTree.g:130:58: Parameters { match(input,Parameters,FOLLOW_Parameters_in_type_spec375); if (state.failed) return d; } break; } match(input, Token.UP, null); if (state.failed) return d; } break; case 2 : // ANMLTree.g:132:4: ^( TypeRef builtinType ( set )? ) { match(input,TypeRef,FOLLOW_TypeRef_in_type_spec389); if (state.failed) return d; match(input, Token.DOWN, null); if (state.failed) return d; pushFollow(FOLLOW_builtinType_in_type_spec391); builtinType6=builtinType(); state._fsp--; if (state.failed) return d; if ( state.backtracking==0 ) { d =domain.getType(builtinType6); } // ANMLTree.g:133:8: ( set )? int alt6=2; int LA6_0 = input.LA(1); if ( ((LA6_0>=Enum && LA6_0<=Range)) ) { alt6=1; } switch (alt6) { case 1 : // ANMLTree.g:133:9: set { pushFollow(FOLLOW_set_in_type_spec404); set7=set(); state._fsp--; if (state.failed) return d; if ( state.backtracking==0 ) { d =d.constrain(set7); } } break; } match(input, Token.UP, null); if (state.failed) return d; } break; case 3 : // ANMLTree.g:135:4: ^( TypeRef id ( set )? ) { match(input,TypeRef,FOLLOW_TypeRef_in_type_spec420); if (state.failed) return d; match(input, Token.DOWN, null); if (state.failed) return d; pushFollow(FOLLOW_id_in_type_spec422); id8=id(); state._fsp--; if (state.failed) return d; if ( state.backtracking==0 ) { d =((S_scope)S_stack.peek()).d.resolveType(id8); } // ANMLTree.g:136:11: ( set )? int alt7=2; int LA7_0 = input.LA(1); if ( ((LA7_0>=Enum && LA7_0<=Range)) ) { alt7=1; } switch (alt7) { case 1 : // ANMLTree.g:136:12: set { pushFollow(FOLLOW_set_in_type_spec438); set9=set(); state._fsp--; if (state.failed) return d; if ( state.backtracking==0 ) { d =d.constrain(set9); if (d instanceof ExtensibleType) { Enumeration<? extends Identifier<?,?>> values = (Enumeration<? extends Identifier<?,?>>) set9.values(); for (Identifier i : values) { ((S_scope)S_stack.peek()).d.addSymbol(i); } } } } break; } match(input, Token.UP, null); if (state.failed) return d; } break; case 4 : // ANMLTree.g:146:4: enumeration { pushFollow(FOLLOW_enumeration_in_type_spec453); enumeration10=enumeration(); state._fsp--; if (state.failed) return d; if ( state.backtracking==0 ) { c = (enumeration10!=null?enumeration10.constraint:null); switch ((enumeration10!=null?enumeration10.typeCode:null)) { case Object: Enumeration<ObjectLiteral> objectValues = (Enumeration<ObjectLiteral>) c; d = new ObjectType(((S_scope)S_stack.peek()).d,objectValues); for (Identifier<?,?> i : objectValues) { ((S_scope)S_stack.peek()).d.addSymbol(i); } break; case Symbol: Enumeration<SymbolLiteral> symbolValues = (Enumeration<SymbolLiteral>) c; d = new SymbolType(symbolValues); for (Identifier<?,?> i : symbolValues) { ((S_scope)S_stack.peek()).d.addSymbol(i); } break; case Vector: d = new VectorType(c); break; default: d = new PrimitiveType((enumeration10!=null?enumeration10.typeCode:null),c); } } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return d; } // $ANTLR end "type_spec" // $ANTLR start "type_decl" // ANMLTree.g:173:1: type_decl : ^( Type id ( Assign | ^( Assign type_spec ) ) ( LessThan | ^( LessThan (t= type_ref )* ) ) ( With | ^( With ( object_block[p] )* ) ) ) ; public final void type_decl() throws RecognitionException { Type t = null; SimpleString id11 = null; Type type_spec12 = null; Type d=null; ObjectType p=null; SymbolType q=null; boolean symbol = false; boolean object = false; try { // ANMLTree.g:175:2: ( ^( Type id ( Assign | ^( Assign type_spec ) ) ( LessThan | ^( LessThan (t= type_ref )* ) ) ( With | ^( With ( object_block[p] )* ) ) ) ) // ANMLTree.g:175:4: ^( Type id ( Assign | ^( Assign type_spec ) ) ( LessThan | ^( LessThan (t= type_ref )* ) ) ( With | ^( With ( object_block[p] )* ) ) ) { match(input,Type,FOLLOW_Type_in_type_decl473); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_id_in_type_decl475); id11=id(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { if (((S_scope)S_stack.peek()).d.getType(id11) != null) System.err.println("Error: Type \"" + id11 + "\" redefined."); //else System.err.println(id11); } // ANMLTree.g:180:3: ( Assign | ^( Assign type_spec ) ) int alt9=2; int LA9_0 = input.LA(1); if ( (LA9_0==Assign) ) { int LA9_1 = input.LA(2); if ( (LA9_1==DOWN) ) { alt9=2; } else if ( (LA9_1==LessThan) ) { alt9=1; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 9, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 9, 0, input); throw nvae; } switch (alt9) { case 1 : // ANMLTree.g:180:5: Assign { match(input,Assign,FOLLOW_Assign_in_type_decl483); if (state.failed) return ; if ( state.backtracking==0 ) { p = new ObjectType(((S_scope)S_stack.peek()).d,id11); q = new SymbolType(id11); } } break; case 2 : // ANMLTree.g:184:5: ^( Assign type_spec ) { match(input,Assign,FOLLOW_Assign_in_type_decl492); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_type_spec_in_type_decl494); type_spec12=type_spec(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; if ( state.backtracking==0 ) { d = type_spec12; if (d.name() == null) { d.name(id11); } else { // aliasing. could do something better than cloning. d = d.clone(); d.name(id11); } if (d.typeCode() == TypeCode.Object) { object = true; (p=(ObjectType) d).setParent(((S_scope)S_stack.peek()).d); } else if (d.typeCode() == TypeCode.Symbol) { symbol = true; q = (SymbolType) d; } } } break; } // ANMLTree.g:202:3: ( LessThan | ^( LessThan (t= type_ref )* ) ) int alt11=2; int LA11_0 = input.LA(1); if ( (LA11_0==LessThan) ) { int LA11_1 = input.LA(2); if ( (LA11_1==DOWN) ) { alt11=2; } else if ( (LA11_1==With) ) { alt11=1; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 11, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 11, 0, input); throw nvae; } switch (alt11) { case 1 : // ANMLTree.g:202:5: LessThan { match(input,LessThan,FOLLOW_LessThan_in_type_decl508); if (state.failed) return ; } break; case 2 : // ANMLTree.g:203:5: ^( LessThan (t= type_ref )* ) { match(input,LessThan,FOLLOW_LessThan_in_type_decl515); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; // ANMLTree.g:203:16: (t= type_ref )* loop10: do { int alt10=2; int LA10_0 = input.LA(1); if ( (LA10_0==TypeRef) ) { alt10=1; } switch (alt10) { case 1 : // ANMLTree.g:203:17: t= type_ref { pushFollow(FOLLOW_type_ref_in_type_decl520); t=type_ref(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { if (t.typeCode() == TypeCode.Object) { if (symbol) { System.err.println("Symbols and Objects are disjoint types: " + id11 + "."); symbol = false; } object = true; p.extend((ObjectType)t); } else if (t.typeCode() == TypeCode.Symbol) { if (object) { System.err.println("Symbols and Objects are disjoint types: " + id11 + "."); object = false; } symbol = true; q.extend((SymbolType)t); } else { System.err.println("Type: " + t.id() + " is not extensible."); } } } break; default : break loop10; } } while (true); match(input, Token.UP, null); if (state.failed) return ; } } break; } // ANMLTree.g:226:3: ( With | ^( With ( object_block[p] )* ) ) int alt13=2; int LA13_0 = input.LA(1); if ( (LA13_0==With) ) { int LA13_1 = input.LA(2); if ( (LA13_1==DOWN) ) { alt13=2; } else if ( (LA13_1==UP) ) { alt13=1; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 13, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 13, 0, input); throw nvae; } switch (alt13) { case 1 : // ANMLTree.g:226:5: With { match(input,With,FOLLOW_With_in_type_decl544); if (state.failed) return ; if ( state.backtracking==0 ) { if (d == null) { if (symbol) d = q; else d = p; } ((S_scope)S_stack.peek()).d.addType(d); } } break; case 2 : // ANMLTree.g:235:5: ^( With ( object_block[p] )* ) { match(input,With,FOLLOW_With_in_type_decl553); if (state.failed) return ; if ( state.backtracking==0 ) { if (symbol) { System.err.println("Symbols and Objects are disjoint types: " + id11 + "."); symbol = false; } object = true; d = p; ((S_scope)S_stack.peek()).d.addType(d); } if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; // ANMLTree.g:244:4: ( object_block[p] )* loop12: do { int alt12=2; int LA12_0 = input.LA(1); if ( (LA12_0==Block) ) { alt12=1; } switch (alt12) { case 1 : // ANMLTree.g:244:4: object_block[p] { pushFollow(FOLLOW_object_block_in_type_decl560); object_block(p); state._fsp--; if (state.failed) return ; } break; default : break loop12; } } while (true); match(input, Token.UP, null); if (state.failed) return ; } } break; } match(input, Token.UP, null); if (state.failed) return ; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "type_decl" // $ANTLR start "type_refine" // ANMLTree.g:249:1: type_refine : ^( TypeRefine r= type_ref ( ^( Assign type_spec ) | ^( LessThan t= type_ref ) | ^( With object_block[p] ) | ( id )+ ) ) ; public final void type_refine() throws RecognitionException { ANMLToken TypeRefine13=null; Type r = null; Type t = null; Type type_spec14 = null; SimpleString id15 = null; Type d; ExtensibleType o=null; ObjectType p=null; SymbolType q=null; try { // ANMLTree.g:251:2: ( ^( TypeRefine r= type_ref ( ^( Assign type_spec ) | ^( LessThan t= type_ref ) | ^( With object_block[p] ) | ( id )+ ) ) ) // ANMLTree.g:251:4: ^( TypeRefine r= type_ref ( ^( Assign type_spec ) | ^( LessThan t= type_ref ) | ^( With object_block[p] ) | ( id )+ ) ) { TypeRefine13=(ANMLToken)match(input,TypeRefine,FOLLOW_TypeRefine_in_type_refine586); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_type_ref_in_type_refine590); r=type_ref(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { d = r; if (d.name() == null) System.err.println("Error: Cannot refine anonymous types"); // well, actually, you can, it just doesn't do any good if (d.typeCode() != TypeCode.Object && d.typeCode() != TypeCode.Symbol) { System.err.println("Error (line " + TypeRefine13.getLine() + "): " + d.name() + " is not an extensible type."); } else { o = (ExtensibleType) d; if (o.typeCode() == TypeCode.Object) p = (ObjectType) o; else q = (SymbolType) o; } } // ANMLTree.g:267:2: ( ^( Assign type_spec ) | ^( LessThan t= type_ref ) | ^( With object_block[p] ) | ( id )+ ) int alt15=4; switch ( input.LA(1) ) { case Assign: { alt15=1; } break; case LessThan: { alt15=2; } break; case With: { alt15=3; } break; case ID: case This: { alt15=4; } break; default: if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 15, 0, input); throw nvae; } switch (alt15) { case 1 : // ANMLTree.g:267:4: ^( Assign type_spec ) { match(input,Assign,FOLLOW_Assign_in_type_refine598); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_type_spec_in_type_refine600); type_spec14=type_spec(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; if ( state.backtracking==0 ) { d = type_spec14; if (o != null) { if (d.typeCode() == TypeCode.Object) p.set(((ObjectType)d).members()); else if (d.typeCode() == TypeCode.Symbol) q.set(((SymbolType)d).members()); } } } break; case 2 : // ANMLTree.g:276:4: ^( LessThan t= type_ref ) { match(input,LessThan,FOLLOW_LessThan_in_type_refine610); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_type_ref_in_type_refine614); t=type_ref(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { d = t; if (o != null) { if (d.typeCode() == TypeCode.Object) p.extend((ObjectType)d); else if (d.typeCode() == TypeCode.Symbol) q.extend((SymbolType)d); } } match(input, Token.UP, null); if (state.failed) return ; } break; case 3 : // ANMLTree.g:285:4: ^( With object_block[p] ) { match(input,With,FOLLOW_With_in_type_refine623); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_object_block_in_type_refine625); object_block(p); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; } break; case 4 : // ANMLTree.g:286:5: ( id )+ { // ANMLTree.g:286:5: ( id )+ int cnt14=0; loop14: do { int alt14=2; int LA14_0 = input.LA(1); if ( ((LA14_0>=ID && LA14_0<=This)) ) { alt14=1; } switch (alt14) { case 1 : // ANMLTree.g:286:6: id { pushFollow(FOLLOW_id_in_type_refine634); id15=id(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { if (p != null) { ObjectLiteral l = new ObjectLiteral(id15); ((S_scope)S_stack.peek()).d.addSymbol(l); p.add(l); } else if (q != null) { SymbolLiteral m = new SymbolLiteral(id15); ((S_scope)S_stack.peek()).d.addSymbol(m); q.add(m); } else { SymbolLiteral m = new SymbolLiteral(id15); ((S_scope)S_stack.peek()).d.addSymbol(m); } } } break; default : if ( cnt14 >= 1 ) break loop14; if (state.backtracking>0) {state.failed=true; return ;} EarlyExitException eee = new EarlyExitException(14, input); throw eee; } cnt14++; } while (true); } break; } match(input, Token.UP, null); if (state.failed) return ; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "type_refine" // $ANTLR start "type_ref" // ANMLTree.g:313:1: type_ref returns [Type d] : ( ^( TypeRef builtinType ) | ^( TypeRef builtinType set ) | ^( TypeRef id ) ); public final Type type_ref() throws RecognitionException { Type d = null; TypeCode builtinType16 = null; TypeCode builtinType17 = null; Constraint set18 = null; SimpleString id19 = null; Constraint c; try { // ANMLTree.g:315:2: ( ^( TypeRef builtinType ) | ^( TypeRef builtinType set ) | ^( TypeRef id ) ) int alt16=3; alt16 = dfa16.predict(input); switch (alt16) { case 1 : // ANMLTree.g:315:4: ^( TypeRef builtinType ) { match(input,TypeRef,FOLLOW_TypeRef_in_type_ref677); if (state.failed) return d; match(input, Token.DOWN, null); if (state.failed) return d; pushFollow(FOLLOW_builtinType_in_type_ref679); builtinType16=builtinType(); state._fsp--; if (state.failed) return d; match(input, Token.UP, null); if (state.failed) return d; if ( state.backtracking==0 ) { d = domain.getType(builtinType16); //System.out.println("TypeRef: " + d); } } break; case 2 : // ANMLTree.g:319:4: ^( TypeRef builtinType set ) { match(input,TypeRef,FOLLOW_TypeRef_in_type_ref688); if (state.failed) return d; match(input, Token.DOWN, null); if (state.failed) return d; pushFollow(FOLLOW_builtinType_in_type_ref690); builtinType17=builtinType(); state._fsp--; if (state.failed) return d; pushFollow(FOLLOW_set_in_type_ref692); set18=set(); state._fsp--; if (state.failed) return d; match(input, Token.UP, null); if (state.failed) return d; if ( state.backtracking==0 ) { d = domain.getType(builtinType17).constrain(set18); //System.out.println("TypeRef: " + d); } } break; case 3 : // ANMLTree.g:323:4: ^( TypeRef id ) { match(input,TypeRef,FOLLOW_TypeRef_in_type_ref701); if (state.failed) return d; match(input, Token.DOWN, null); if (state.failed) return d; pushFollow(FOLLOW_id_in_type_ref703); id19=id(); state._fsp--; if (state.failed) return d; match(input, Token.UP, null); if (state.failed) return d; if ( state.backtracking==0 ) { d = ((S_scope)S_stack.peek()).d.resolveType(id19); if (d == null) { d = domain.objectType; System.err.println("Type: " + id19 + " is undeclared at its first reference."); } //System.out.println("TypeRef: " + id19 + " " + d); } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return d; } // $ANTLR end "type_ref" // $ANTLR start "const_decl" // ANMLTree.g:334:1: const_decl : ( ^( Constant id type_ref (i= expression )? ) | ^( ConstantFunction id type_ref ( ^( Parameters term_arg_decl_list[f] ) | Parameters ) ) ); public final void const_decl() throws RecognitionException { ANMLToken Constant21=null; ANMLToken ConstantFunction24=null; Expression<?,?> i = null; SimpleString id20 = null; Type type_ref22 = null; SimpleString id23 = null; Type type_ref25 = null; Expression<?,?> init=null;ConstantFunction f=null; try { // ANMLTree.g:336:2: ( ^( Constant id type_ref (i= expression )? ) | ^( ConstantFunction id type_ref ( ^( Parameters term_arg_decl_list[f] ) | Parameters ) ) ) int alt19=2; int LA19_0 = input.LA(1); if ( (LA19_0==Constant) ) { alt19=1; } else if ( (LA19_0==ConstantFunction) ) { alt19=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 19, 0, input); throw nvae; } switch (alt19) { case 1 : // ANMLTree.g:336:4: ^( Constant id type_ref (i= expression )? ) { Constant21=(ANMLToken)match(input,Constant,FOLLOW_Constant_in_const_decl748); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_id_in_const_decl750); id20=id(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { if (((S_scope)S_stack.peek()).d.getSymbol(id20) != null) System.err.println("Error (line " + Constant21.getLine() + "): \"" + id20 + "\" redefined."); } pushFollow(FOLLOW_type_ref_in_const_decl756); type_ref22=type_ref(); state._fsp--; if (state.failed) return ; // ANMLTree.g:340:12: (i= expression )? int alt17=2; int LA17_0 = input.LA(1); if ( ((LA17_0>=LabelRef && LA17_0<=Access)||LA17_0==Label||(LA17_0>=Bra && LA17_0<=Ket)||LA17_0==TimedExpr||(LA17_0>=ContainsSomeExpr && LA17_0<=ContainsAllExpr)||LA17_0==ExistsExpr||LA17_0==ID||(LA17_0>=LessThan && LA17_0<=Assign)||LA17_0==Undefine||(LA17_0>=NotLog && LA17_0<=Equal)||LA17_0==Duration||(LA17_0>=Change && LA17_0<=Delta)||(LA17_0>=Implies && LA17_0<=Ordered)||(LA17_0>=Start && LA17_0<=GreaterThanE)||LA17_0==ForallExpr) ) { alt17=1; } switch (alt17) { case 1 : // ANMLTree.g:340:13: i= expression { pushFollow(FOLLOW_expression_in_const_decl761); i=expression(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { init = i; } } break; } match(input, Token.UP, null); if (state.failed) return ; if ( state.backtracking==0 ) { ((S_scope)S_stack.peek()).d.addConstant(new Constant(id20,type_ref22,init)); } } break; case 2 : // ANMLTree.g:342:4: ^( ConstantFunction id type_ref ( ^( Parameters term_arg_decl_list[f] ) | Parameters ) ) { ConstantFunction24=(ANMLToken)match(input,ConstantFunction,FOLLOW_ConstantFunction_in_const_decl776); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_id_in_const_decl778); id23=id(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { if (((S_scope)S_stack.peek()).d.getSymbol(id23) != null) System.err.println("Error (line " + ConstantFunction24.getLine() + "): \"" + id23 + "\" redefined."); } pushFollow(FOLLOW_type_ref_in_const_decl784); type_ref25=type_ref(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { f=new ConstantFunction(id23,type_ref25);((S_scope)S_stack.peek()).d.addConstantFunction(f); } // ANMLTree.g:347:6: ( ^( Parameters term_arg_decl_list[f] ) | Parameters ) int alt18=2; int LA18_0 = input.LA(1); if ( (LA18_0==Parameters) ) { int LA18_1 = input.LA(2); if ( (LA18_1==DOWN) ) { alt18=1; } else if ( (LA18_1==UP) ) { alt18=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 18, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 18, 0, input); throw nvae; } switch (alt18) { case 1 : // ANMLTree.g:347:7: ^( Parameters term_arg_decl_list[f] ) { match(input,Parameters,FOLLOW_Parameters_in_const_decl796); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_term_arg_decl_list_in_const_decl798); term_arg_decl_list(f); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:347:45: Parameters { match(input,Parameters,FOLLOW_Parameters_in_const_decl804); if (state.failed) return ; } break; } match(input, Token.UP, null); if (state.failed) return ; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "const_decl" // $ANTLR start "fluent_decl" // ANMLTree.g:351:1: fluent_decl : ( ^( Fluent id type_ref (i= expression )? ) | ^( FluentFunction id type_ref ( ^( Parameters term_arg_decl_list[f] ) | Parameters ) ) ); public final void fluent_decl() throws RecognitionException { ANMLToken Fluent27=null; ANMLToken FluentFunction30=null; Expression<?,?> i = null; SimpleString id26 = null; Type type_ref28 = null; SimpleString id29 = null; Type type_ref31 = null; Expression<?,?> init=null;FluentFunction f=null; try { // ANMLTree.g:353:2: ( ^( Fluent id type_ref (i= expression )? ) | ^( FluentFunction id type_ref ( ^( Parameters term_arg_decl_list[f] ) | Parameters ) ) ) int alt22=2; int LA22_0 = input.LA(1); if ( (LA22_0==Fluent) ) { alt22=1; } else if ( (LA22_0==FluentFunction) ) { alt22=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 22, 0, input); throw nvae; } switch (alt22) { case 1 : // ANMLTree.g:353:4: ^( Fluent id type_ref (i= expression )? ) { Fluent27=(ANMLToken)match(input,Fluent,FOLLOW_Fluent_in_fluent_decl827); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_id_in_fluent_decl829); id26=id(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { if (((S_scope)S_stack.peek()).d.getSymbol(id26) != null) System.err.println("Error (line " + Fluent27.getLine() + "): \"" + id26 + "\" redefined."); } pushFollow(FOLLOW_type_ref_in_fluent_decl835); type_ref28=type_ref(); state._fsp--; if (state.failed) return ; // ANMLTree.g:357:12: (i= expression )? int alt20=2; int LA20_0 = input.LA(1); if ( ((LA20_0>=LabelRef && LA20_0<=Access)||LA20_0==Label||(LA20_0>=Bra && LA20_0<=Ket)||LA20_0==TimedExpr||(LA20_0>=ContainsSomeExpr && LA20_0<=ContainsAllExpr)||LA20_0==ExistsExpr||LA20_0==ID||(LA20_0>=LessThan && LA20_0<=Assign)||LA20_0==Undefine||(LA20_0>=NotLog && LA20_0<=Equal)||LA20_0==Duration||(LA20_0>=Change && LA20_0<=Delta)||(LA20_0>=Implies && LA20_0<=Ordered)||(LA20_0>=Start && LA20_0<=GreaterThanE)||LA20_0==ForallExpr) ) { alt20=1; } switch (alt20) { case 1 : // ANMLTree.g:357:13: i= expression { pushFollow(FOLLOW_expression_in_fluent_decl840); i=expression(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { init = i; } } break; } match(input, Token.UP, null); if (state.failed) return ; if ( state.backtracking==0 ) { ((S_scope)S_stack.peek()).d.addFluent(new Fluent(id26,type_ref28,init)); } } break; case 2 : // ANMLTree.g:359:4: ^( FluentFunction id type_ref ( ^( Parameters term_arg_decl_list[f] ) | Parameters ) ) { FluentFunction30=(ANMLToken)match(input,FluentFunction,FOLLOW_FluentFunction_in_fluent_decl855); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_id_in_fluent_decl857); id29=id(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { if (((S_scope)S_stack.peek()).d.getSymbol(id29) != null) System.err.println("Error (line " + FluentFunction30.getLine() + "): \"" + id29 + "\" redefined."); } pushFollow(FOLLOW_type_ref_in_fluent_decl863); type_ref31=type_ref(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { f=new FluentFunction(id29,type_ref31); ((S_scope)S_stack.peek()).d.addFluentFunction(f); } // ANMLTree.g:367:6: ( ^( Parameters term_arg_decl_list[f] ) | Parameters ) int alt21=2; int LA21_0 = input.LA(1); if ( (LA21_0==Parameters) ) { int LA21_1 = input.LA(2); if ( (LA21_1==DOWN) ) { alt21=1; } else if ( (LA21_1==UP) ) { alt21=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 21, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 21, 0, input); throw nvae; } switch (alt21) { case 1 : // ANMLTree.g:367:7: ^( Parameters term_arg_decl_list[f] ) { match(input,Parameters,FOLLOW_Parameters_in_fluent_decl874); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_term_arg_decl_list_in_fluent_decl876); term_arg_decl_list(f); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:367:45: Parameters { match(input,Parameters,FOLLOW_Parameters_in_fluent_decl882); if (state.failed) return ; } break; } match(input, Token.UP, null); if (state.failed) return ; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "fluent_decl" // $ANTLR start "object_block" // ANMLTree.g:376:1: object_block[Scope d] : ^( Block types constants fluents actions stmts ) ; public final void object_block(Scope d) throws RecognitionException { S_stack.push(new S_scope()); ((S_scope)S_stack.peek()).d =d; try { // ANMLTree.g:379:3: ( ^( Block types constants fluents actions stmts ) ) // ANMLTree.g:379:5: ^( Block types constants fluents actions stmts ) { match(input,Block,FOLLOW_Block_in_object_block917); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_types_in_object_block924); types(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_constants_in_object_block930); constants(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_fluents_in_object_block936); fluents(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_actions_in_object_block942); actions(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_stmts_in_object_block948); stmts(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { S_stack.pop(); } return ; } // $ANTLR end "object_block" // $ANTLR start "action_decl" // ANMLTree.g:392:1: action_decl : ^( Action id ( ^( Parameters scope_arg_decl_list[a] ) | Parameters ) start_parameter[a] ( duration_parameter[a] )? action_block[a] ) ; public final void action_decl() throws RecognitionException { SimpleString id32 = null; Action a=null; try { // ANMLTree.g:394:1: ( ^( Action id ( ^( Parameters scope_arg_decl_list[a] ) | Parameters ) start_parameter[a] ( duration_parameter[a] )? action_block[a] ) ) // ANMLTree.g:395:2: ^( Action id ( ^( Parameters scope_arg_decl_list[a] ) | Parameters ) start_parameter[a] ( duration_parameter[a] )? action_block[a] ) { match(input,Action,FOLLOW_Action_in_action_decl974); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_id_in_action_decl976); id32=id(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { a=((S_scope)S_stack.peek()).d.resolveAction(id32); assert a != null; a.setParent(((S_scope)S_stack.peek()).d); // just in case scope pointer was wrong } // ANMLTree.g:400:3: ( ^( Parameters scope_arg_decl_list[a] ) | Parameters ) int alt23=2; int LA23_0 = input.LA(1); if ( (LA23_0==Parameters) ) { int LA23_1 = input.LA(2); if ( (LA23_1==DOWN) ) { alt23=1; } else if ( (LA23_1==Types||LA23_1==Duration) ) { alt23=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 23, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 23, 0, input); throw nvae; } switch (alt23) { case 1 : // ANMLTree.g:400:4: ^( Parameters scope_arg_decl_list[a] ) { match(input,Parameters,FOLLOW_Parameters_in_action_decl984); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_scope_arg_decl_list_in_action_decl986); scope_arg_decl_list(a); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:400:43: Parameters { match(input,Parameters,FOLLOW_Parameters_in_action_decl992); if (state.failed) return ; } break; } pushFollow(FOLLOW_start_parameter_in_action_decl998); start_parameter(a); state._fsp--; if (state.failed) return ; // ANMLTree.g:402:3: ( duration_parameter[a] )? int alt24=2; int LA24_0 = input.LA(1); if ( (LA24_0==Duration) ) { alt24=1; } switch (alt24) { case 1 : // ANMLTree.g:402:3: duration_parameter[a] { pushFollow(FOLLOW_duration_parameter_in_action_decl1003); duration_parameter(a); state._fsp--; if (state.failed) return ; } break; } pushFollow(FOLLOW_action_block_in_action_decl1011); action_block(a); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "action_decl" // $ANTLR start "start_parameter" // ANMLTree.g:407:1: start_parameter[Action a] : ; public final void start_parameter(Action a) throws RecognitionException { Parameter<SimpleFloat> s = new Parameter<SimpleFloat>(IntervalImp.startName,Unit.floatType); a.addParameter(s); a.start.init = s; try { // ANMLTree.g:413:1: () // ANMLTree.g:414:1: { } } finally { } return ; } // $ANTLR end "start_parameter" // $ANTLR start "duration_parameter" // ANMLTree.g:416:1: duration_parameter[Action a] : Duration ; public final void duration_parameter(Action a) throws RecognitionException { Parameter<SimpleFloat> d = new Parameter<SimpleFloat>(IntervalImp.durationName,Unit.floatType); a.addParameter(d); a.duration.init = d; try { // ANMLTree.g:422:1: ( Duration ) // ANMLTree.g:423:2: Duration { match(input,Duration,FOLLOW_Duration_in_duration_parameter1063); if (state.failed) return ; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "duration_parameter" // $ANTLR start "action_block" // ANMLTree.g:426:1: action_block[Action a] : types constants fluents actions stmts decompositions ; public final void action_block(Action a) throws RecognitionException { S_stack.push(new S_scope()); A_stack.push(new A_scope()); I_stack.push(new I_scope()); ((S_scope)S_stack.peek()).d =a;((A_scope)A_stack.peek()).d =a;((I_scope)I_stack.peek()).i =a; try { // ANMLTree.g:429:1: ( types constants fluents actions stmts decompositions ) // ANMLTree.g:430:2: types constants fluents actions stmts decompositions { pushFollow(FOLLOW_types_in_action_block1091); types(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_constants_in_action_block1094); constants(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_fluents_in_action_block1097); fluents(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_actions_in_action_block1100); actions(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_stmts_in_action_block1103); stmts(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_decompositions_in_action_block1106); decompositions(); state._fsp--; if (state.failed) return ; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { S_stack.pop(); A_stack.pop(); I_stack.pop(); } return ; } // $ANTLR end "action_block" // $ANTLR start "types" // ANMLTree.g:438:1: types : ( ^( Types ( type_decl | type_refine )* ) | Types ); public final void types() throws RecognitionException { try { // ANMLTree.g:438:7: ( ^( Types ( type_decl | type_refine )* ) | Types ) int alt26=2; int LA26_0 = input.LA(1); if ( (LA26_0==Types) ) { int LA26_1 = input.LA(2); if ( (LA26_1==DOWN) ) { alt26=1; } else if ( (LA26_1==Constants) ) { alt26=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 26, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 26, 0, input); throw nvae; } switch (alt26) { case 1 : // ANMLTree.g:439:2: ^( Types ( type_decl | type_refine )* ) { match(input,Types,FOLLOW_Types_in_types1117); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; // ANMLTree.g:439:10: ( type_decl | type_refine )* loop25: do { int alt25=3; int LA25_0 = input.LA(1); if ( (LA25_0==Type) ) { alt25=1; } else if ( (LA25_0==TypeRefine) ) { alt25=2; } switch (alt25) { case 1 : // ANMLTree.g:439:11: type_decl { pushFollow(FOLLOW_type_decl_in_types1120); type_decl(); state._fsp--; if (state.failed) return ; } break; case 2 : // ANMLTree.g:439:21: type_refine { pushFollow(FOLLOW_type_refine_in_types1122); type_refine(); state._fsp--; if (state.failed) return ; } break; default : break loop25; } } while (true); match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:440:4: Types { match(input,Types,FOLLOW_Types_in_types1130); if (state.failed) return ; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "types" // $ANTLR start "constants" // ANMLTree.g:442:1: constants : ( ^( Constants ( const_decl )* ) | Constants ); public final void constants() throws RecognitionException { try { // ANMLTree.g:442:11: ( ^( Constants ( const_decl )* ) | Constants ) int alt28=2; int LA28_0 = input.LA(1); if ( (LA28_0==Constants) ) { int LA28_1 = input.LA(2); if ( (LA28_1==DOWN) ) { alt28=1; } else if ( (LA28_1==Fluents) ) { alt28=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 28, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 28, 0, input); throw nvae; } switch (alt28) { case 1 : // ANMLTree.g:443:2: ^( Constants ( const_decl )* ) { match(input,Constants,FOLLOW_Constants_in_constants1140); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; // ANMLTree.g:443:14: ( const_decl )* loop27: do { int alt27=2; int LA27_0 = input.LA(1); if ( ((LA27_0>=Constant && LA27_0<=ConstantFunction)) ) { alt27=1; } switch (alt27) { case 1 : // ANMLTree.g:443:14: const_decl { pushFollow(FOLLOW_const_decl_in_constants1142); const_decl(); state._fsp--; if (state.failed) return ; } break; default : break loop27; } } while (true); match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:444:4: Constants { match(input,Constants,FOLLOW_Constants_in_constants1150); if (state.failed) return ; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "constants" // $ANTLR start "fluents" // ANMLTree.g:446:1: fluents : ( ^( Fluents ( fluent_decl )* ) | Fluents ); public final void fluents() throws RecognitionException { try { // ANMLTree.g:446:9: ( ^( Fluents ( fluent_decl )* ) | Fluents ) int alt30=2; int LA30_0 = input.LA(1); if ( (LA30_0==Fluents) ) { int LA30_1 = input.LA(2); if ( (LA30_1==DOWN) ) { alt30=1; } else if ( (LA30_1==Actions) ) { alt30=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 30, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 30, 0, input); throw nvae; } switch (alt30) { case 1 : // ANMLTree.g:447:2: ^( Fluents ( fluent_decl )* ) { match(input,Fluents,FOLLOW_Fluents_in_fluents1160); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; // ANMLTree.g:447:12: ( fluent_decl )* loop29: do { int alt29=2; int LA29_0 = input.LA(1); if ( ((LA29_0>=Fluent && LA29_0<=FluentFunction)) ) { alt29=1; } switch (alt29) { case 1 : // ANMLTree.g:447:12: fluent_decl { pushFollow(FOLLOW_fluent_decl_in_fluents1162); fluent_decl(); state._fsp--; if (state.failed) return ; } break; default : break loop29; } } while (true); match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:448:4: Fluents { match(input,Fluents,FOLLOW_Fluents_in_fluents1170); if (state.failed) return ; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "fluents" // $ANTLR start "actions" // ANMLTree.g:451:1: actions : ( ^( Actions ( action_decl )* ) | Actions ); public final void actions() throws RecognitionException { try { // ANMLTree.g:451:9: ( ^( Actions ( action_decl )* ) | Actions ) int alt32=2; int LA32_0 = input.LA(1); if ( (LA32_0==Actions) ) { int LA32_1 = input.LA(2); if ( (LA32_1==DOWN) ) { alt32=1; } else if ( (LA32_1==Stmts) ) { alt32=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 32, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 32, 0, input); throw nvae; } switch (alt32) { case 1 : // ANMLTree.g:452:2: ^( Actions ( action_decl )* ) { match(input,Actions,FOLLOW_Actions_in_actions1181); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; // ANMLTree.g:452:12: ( action_decl )* loop31: do { int alt31=2; int LA31_0 = input.LA(1); if ( (LA31_0==Action) ) { alt31=1; } switch (alt31) { case 1 : // ANMLTree.g:452:12: action_decl { pushFollow(FOLLOW_action_decl_in_actions1183); action_decl(); state._fsp--; if (state.failed) return ; } break; default : break loop31; } } while (true); match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:453:4: Actions { match(input,Actions,FOLLOW_Actions_in_actions1190); if (state.failed) return ; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "actions" // $ANTLR start "stmts" // ANMLTree.g:456:1: stmts : ( ^( Stmts ( stmts_helper )* ) | Stmts ); public final void stmts() throws RecognitionException { try { // ANMLTree.g:456:7: ( ^( Stmts ( stmts_helper )* ) | Stmts ) int alt34=2; int LA34_0 = input.LA(1); if ( (LA34_0==Stmts) ) { int LA34_1 = input.LA(2); if ( (LA34_1==DOWN) ) { alt34=1; } else if ( (LA34_1==UP||LA34_1==Decompositions) ) { alt34=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 34, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 34, 0, input); throw nvae; } switch (alt34) { case 1 : // ANMLTree.g:457:2: ^( Stmts ( stmts_helper )* ) { match(input,Stmts,FOLLOW_Stmts_in_stmts1201); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; // ANMLTree.g:457:10: ( stmts_helper )* loop33: do { int alt33=2; int LA33_0 = input.LA(1); if ( (LA33_0==Block||(LA33_0>=LabelRef && LA33_0<=Access)||LA33_0==Label||(LA33_0>=Bra && LA33_0<=Ket)||(LA33_0>=Chain && LA33_0<=ContainsAllExpr)||(LA33_0>=ForAllStmt && LA33_0<=WhenElse)||LA33_0==ID||(LA33_0>=LessThan && LA33_0<=Assign)||LA33_0==Undefine||(LA33_0>=NotLog && LA33_0<=Equal)||LA33_0==Duration||(LA33_0>=Change && LA33_0<=Delta)||(LA33_0>=Implies && LA33_0<=Ordered)||(LA33_0>=Start && LA33_0<=GreaterThanE)||LA33_0==ForallExpr) ) { alt33=1; } switch (alt33) { case 1 : // ANMLTree.g:457:10: stmts_helper { pushFollow(FOLLOW_stmts_helper_in_stmts1203); stmts_helper(); state._fsp--; if (state.failed) return ; } break; default : break loop33; } } while (true); match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:458:4: Stmts { match(input,Stmts,FOLLOW_Stmts_in_stmts1211); if (state.failed) return ; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "stmts" // $ANTLR start "stmts_helper" // ANMLTree.g:460:1: stmts_helper : stmt ; public final void stmts_helper() throws RecognitionException { Statement stmt33 = null; try { // ANMLTree.g:460:14: ( stmt ) // ANMLTree.g:460:16: stmt { pushFollow(FOLLOW_stmt_in_stmts_helper1219); stmt33=stmt(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { ((S_scope)S_stack.peek()).d.addStatement(stmt33); } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "stmts_helper" // $ANTLR start "decompositions" // ANMLTree.g:462:1: decompositions : ( ^( Decompositions ( decomps_helper )* ) | Decompositions ); public final void decompositions() throws RecognitionException { try { // ANMLTree.g:462:16: ( ^( Decompositions ( decomps_helper )* ) | Decompositions ) int alt36=2; int LA36_0 = input.LA(1); if ( (LA36_0==Decompositions) ) { int LA36_1 = input.LA(2); if ( (LA36_1==DOWN) ) { alt36=1; } else if ( (LA36_1==UP) ) { alt36=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 36, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 36, 0, input); throw nvae; } switch (alt36) { case 1 : // ANMLTree.g:463:2: ^( Decompositions ( decomps_helper )* ) { match(input,Decompositions,FOLLOW_Decompositions_in_decompositions1232); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; // ANMLTree.g:463:19: ( decomps_helper )* loop35: do { int alt35=2; int LA35_0 = input.LA(1); if ( (LA35_0==Block) ) { alt35=1; } switch (alt35) { case 1 : // ANMLTree.g:463:19: decomps_helper { pushFollow(FOLLOW_decomps_helper_in_decompositions1234); decomps_helper(); state._fsp--; if (state.failed) return ; } break; default : break loop35; } } while (true); match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:464:4: Decompositions { match(input,Decompositions,FOLLOW_Decompositions_in_decompositions1242); if (state.failed) return ; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "decompositions" // $ANTLR start "decomps_helper" // ANMLTree.g:466:1: decomps_helper : decomp[$S::d] ; public final void decomps_helper() throws RecognitionException { Decomposition decomp34 = null; try { // ANMLTree.g:466:16: ( decomp[$S::d] ) // ANMLTree.g:466:18: decomp[$S::d] { pushFollow(FOLLOW_decomp_in_decomps_helper1250); decomp34=decomp(((S_scope)S_stack.peek()).d); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { ((A_scope)A_stack.peek()).d.addDecomposition(decomp34); } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "decomps_helper" // $ANTLR start "decomp" // ANMLTree.g:468:1: decomp[Scope parent] returns [Decomposition s] : ^( Block types constants fluents actions stmts ) ; public final Decomposition decomp(Scope parent) throws RecognitionException { S_stack.push(new S_scope()); Decomposition s = null; ANMLToken Block35=null; try { // ANMLTree.g:470:2: ( ^( Block types constants fluents actions stmts ) ) // ANMLTree.g:470:4: ^( Block types constants fluents actions stmts ) { Block35=(ANMLToken)match(input,Block,FOLLOW_Block_in_decomp1274); if (state.failed) return s; if ( state.backtracking==0 ) { ((S_scope)S_stack.peek()).d =s=new Decomposition(parent,Block35.textSimple); } match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_types_in_decomp1281); types(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_constants_in_decomp1285); constants(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_fluents_in_decomp1289); fluents(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_actions_in_decomp1293); actions(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_stmts_in_decomp1297); stmts(); state._fsp--; if (state.failed) return s; match(input, Token.UP, null); if (state.failed) return s; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { S_stack.pop(); } return s; } // $ANTLR end "decomp" // $ANTLR start "block" // ANMLTree.g:479:1: block[Scope parent] returns [Block s] : ^( Block types constants fluents actions stmts ) ; public final Block block(Scope parent) throws RecognitionException { S_stack.push(new S_scope()); Block s = null; ANMLToken Block36=null; try { // ANMLTree.g:481:2: ( ^( Block types constants fluents actions stmts ) ) // ANMLTree.g:481:4: ^( Block types constants fluents actions stmts ) { Block36=(ANMLToken)match(input,Block,FOLLOW_Block_in_block1323); if (state.failed) return s; if ( state.backtracking==0 ) { ((S_scope)S_stack.peek()).d =s=new Block(parent,Block36.textSimple); } match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_types_in_block1330); types(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_constants_in_block1334); constants(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_fluents_in_block1338); fluents(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_actions_in_block1342); actions(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_stmts_in_block1346); stmts(); state._fsp--; if (state.failed) return s; match(input, Token.UP, null); if (state.failed) return s; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { S_stack.pop(); } return s; } // $ANTLR end "block" // $ANTLR start "sub_block" // ANMLTree.g:490:1: sub_block[Block b] : ^( Block types constants fluents actions stmts ) ; public final void sub_block(Block b) throws RecognitionException { S_stack.push(new S_scope()); ((S_scope)S_stack.peek()).d =b; try { // ANMLTree.g:493:2: ( ^( Block types constants fluents actions stmts ) ) // ANMLTree.g:493:4: ^( Block types constants fluents actions stmts ) { match(input,Block,FOLLOW_Block_in_sub_block1372); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_types_in_sub_block1377); types(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_constants_in_sub_block1381); constants(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_fluents_in_sub_block1385); fluents(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_actions_in_sub_block1389); actions(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_stmts_in_sub_block1393); stmts(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { S_stack.pop(); } return ; } // $ANTLR end "sub_block" // $ANTLR start "stmt" // ANMLTree.g:502:1: stmt returns [Statement s] : ( simple_stmt | block[$S::d] ); public final Statement stmt() throws RecognitionException { Statement s = null; Statement simple_stmt37 = null; Block block38 = null; try { // ANMLTree.g:503:2: ( simple_stmt | block[$S::d] ) int alt37=2; int LA37_0 = input.LA(1); if ( ((LA37_0>=LabelRef && LA37_0<=Access)||LA37_0==Label||(LA37_0>=Bra && LA37_0<=Ket)||(LA37_0>=Chain && LA37_0<=ContainsAllExpr)||(LA37_0>=ForAllStmt && LA37_0<=WhenElse)||LA37_0==ID||(LA37_0>=LessThan && LA37_0<=Assign)||LA37_0==Undefine||(LA37_0>=NotLog && LA37_0<=Equal)||LA37_0==Duration||(LA37_0>=Change && LA37_0<=Delta)||(LA37_0>=Implies && LA37_0<=Ordered)||(LA37_0>=Start && LA37_0<=GreaterThanE)||LA37_0==ForallExpr) ) { alt37=1; } else if ( (LA37_0==Block) ) { alt37=2; } else { if (state.backtracking>0) {state.failed=true; return s;} NoViableAltException nvae = new NoViableAltException("", 37, 0, input); throw nvae; } switch (alt37) { case 1 : // ANMLTree.g:503:4: simple_stmt { pushFollow(FOLLOW_simple_stmt_in_stmt1412); simple_stmt37=simple_stmt(); state._fsp--; if (state.failed) return s; if ( state.backtracking==0 ) { s=simple_stmt37; } } break; case 2 : // ANMLTree.g:504:4: block[$S::d] { pushFollow(FOLLOW_block_in_stmt1419); block38=block(((S_scope)S_stack.peek()).d); state._fsp--; if (state.failed) return s; if ( state.backtracking==0 ) { s=block38; } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return s; } // $ANTLR end "stmt" // $ANTLR start "timed_stmt" // ANMLTree.g:507:1: timed_stmt[Interval i] returns [Statement s] : stmt ; public final Statement timed_stmt(Interval i) throws RecognitionException { I_stack.push(new I_scope()); Statement s = null; Statement stmt39 = null; ((I_scope)I_stack.peek()).i = i; try { // ANMLTree.g:510:2: ( stmt ) // ANMLTree.g:510:4: stmt { pushFollow(FOLLOW_stmt_in_timed_stmt1447); stmt39=stmt(); state._fsp--; if (state.failed) return s; if ( state.backtracking==0 ) { s = stmt39; } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { I_stack.pop(); } return s; } // $ANTLR end "timed_stmt" // $ANTLR start "simple_stmt" // ANMLTree.g:514:1: simple_stmt returns [Statement s] : ( ^( When guard= expression then= stmt ) | ^( WhenElse guard= expression then= stmt elsel= stmt ) | ^( ForAllStmt ^( Parameters scope_arg_decl_list[forall] ) ( sub_block[forall] | sDo= simple_stmt ) ) | ^( ExistsStmt ^( Parameters scope_arg_decl_list[exists] ) ( sub_block[exists] | sHolds= simple_stmt ) ) | ^( ContainsSomeStmt interval[ts] timed_stmt[ts] ) | ^( ContainsAllStmt stmt ) | ^( TimedStmt interval[ts] timed_stmt[ts] ) | ^( Chain chain_stmt ) | expr= expression ); public final Statement simple_stmt() throws RecognitionException { Statement s = null; ANMLToken ForAllStmt40=null; ANMLToken ExistsStmt41=null; Expression<?,?> guard = null; Statement then = null; Statement elsel = null; Statement sDo = null; Statement sHolds = null; Expression<?,?> expr = null; Statement timed_stmt42 = null; Chain chain_stmt43 = null; ForAll forall=null; Exists exists=null; s = null; Expression<SimpleBoolean,?> g; TimedStatement ts=null; try { // ANMLTree.g:522:2: ( ^( When guard= expression then= stmt ) | ^( WhenElse guard= expression then= stmt elsel= stmt ) | ^( ForAllStmt ^( Parameters scope_arg_decl_list[forall] ) ( sub_block[forall] | sDo= simple_stmt ) ) | ^( ExistsStmt ^( Parameters scope_arg_decl_list[exists] ) ( sub_block[exists] | sHolds= simple_stmt ) ) | ^( ContainsSomeStmt interval[ts] timed_stmt[ts] ) | ^( ContainsAllStmt stmt ) | ^( TimedStmt interval[ts] timed_stmt[ts] ) | ^( Chain chain_stmt ) | expr= expression ) int alt40=9; switch ( input.LA(1) ) { case When: { alt40=1; } break; case WhenElse: { alt40=2; } break; case ForAllStmt: { alt40=3; } break; case ExistsStmt: { alt40=4; } break; case ContainsSomeStmt: { alt40=5; } break; case ContainsAllStmt: { alt40=6; } break; case TimedStmt: { alt40=7; } break; case Chain: { alt40=8; } break; case LabelRef: case Ref: case Bind: case Access: case Label: case Bra: case Ket: case TimedExpr: case ContainsSomeExpr: case ContainsAllExpr: case ExistsExpr: case ID: case LessThan: case Assign: case Undefine: case NotLog: case NotBit: case EqualLog: case Equal: case Duration: case Change: case Produce: case Consume: case Lend: case Use: case Within: case SetAssign: case Skip: case Delta: case Implies: case XorLog: case OrLog: case AndLog: case XorBit: case Plus: case Minus: case OrBit: case Times: case Divide: case AndBit: case Unordered: case Ordered: case Start: case End: case INT: case FLOAT: case STRING: case True: case False: case Infinity: case NotEqual: case GreaterThan: case LessThanE: case GreaterThanE: case ForallExpr: { alt40=9; } break; default: if (state.backtracking>0) {state.failed=true; return s;} NoViableAltException nvae = new NoViableAltException("", 40, 0, input); throw nvae; } switch (alt40) { case 1 : // ANMLTree.g:522:4: ^( When guard= expression then= stmt ) { match(input,When,FOLLOW_When_in_simple_stmt1470); if (state.failed) return s; match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_expression_in_simple_stmt1474); guard=expression(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_stmt_in_simple_stmt1478); then=stmt(); state._fsp--; if (state.failed) return s; match(input, Token.UP, null); if (state.failed) return s; if ( state.backtracking==0 ) { s =new WhenStatement((Expression<SimpleBoolean,?>) guard,then); } } break; case 2 : // ANMLTree.g:523:4: ^( WhenElse guard= expression then= stmt elsel= stmt ) { match(input,WhenElse,FOLLOW_WhenElse_in_simple_stmt1487); if (state.failed) return s; match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_expression_in_simple_stmt1491); guard=expression(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_stmt_in_simple_stmt1495); then=stmt(); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_stmt_in_simple_stmt1499); elsel=stmt(); state._fsp--; if (state.failed) return s; match(input, Token.UP, null); if (state.failed) return s; if ( state.backtracking==0 ) { s =new WhenElseStatement((Expression<SimpleBoolean,?>) guard,then,elsel); } } break; case 3 : // ANMLTree.g:524:4: ^( ForAllStmt ^( Parameters scope_arg_decl_list[forall] ) ( sub_block[forall] | sDo= simple_stmt ) ) { ForAllStmt40=(ANMLToken)match(input,ForAllStmt,FOLLOW_ForAllStmt_in_simple_stmt1508); if (state.failed) return s; if ( state.backtracking==0 ) { s = forall = new ForAll(((S_scope)S_stack.peek()).d,ForAllStmt40.getSimpleText()); } match(input, Token.DOWN, null); if (state.failed) return s; match(input,Parameters,FOLLOW_Parameters_in_simple_stmt1519); if (state.failed) return s; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_scope_arg_decl_list_in_simple_stmt1521); scope_arg_decl_list(forall); state._fsp--; if (state.failed) return s; match(input, Token.UP, null); if (state.failed) return s; } // ANMLTree.g:526:6: ( sub_block[forall] | sDo= simple_stmt ) int alt38=2; int LA38_0 = input.LA(1); if ( (LA38_0==Block) ) { alt38=1; } else if ( ((LA38_0>=LabelRef && LA38_0<=Access)||LA38_0==Label||(LA38_0>=Bra && LA38_0<=Ket)||(LA38_0>=Chain && LA38_0<=ContainsAllExpr)||(LA38_0>=ForAllStmt && LA38_0<=WhenElse)||LA38_0==ID||(LA38_0>=LessThan && LA38_0<=Assign)||LA38_0==Undefine||(LA38_0>=NotLog && LA38_0<=Equal)||LA38_0==Duration||(LA38_0>=Change && LA38_0<=Delta)||(LA38_0>=Implies && LA38_0<=Ordered)||(LA38_0>=Start && LA38_0<=GreaterThanE)||LA38_0==ForallExpr) ) { alt38=2; } else { if (state.backtracking>0) {state.failed=true; return s;} NoViableAltException nvae = new NoViableAltException("", 38, 0, input); throw nvae; } switch (alt38) { case 1 : // ANMLTree.g:526:8: sub_block[forall] { pushFollow(FOLLOW_sub_block_in_simple_stmt1533); sub_block(forall); state._fsp--; if (state.failed) return s; } break; case 2 : // ANMLTree.g:527:8: sDo= simple_stmt { pushFollow(FOLLOW_simple_stmt_in_simple_stmt1545); sDo=simple_stmt(); state._fsp--; if (state.failed) return s; if ( state.backtracking==0 ) { forall.addStatement(sDo); } } break; } match(input, Token.UP, null); if (state.failed) return s; } break; case 4 : // ANMLTree.g:530:4: ^( ExistsStmt ^( Parameters scope_arg_decl_list[exists] ) ( sub_block[exists] | sHolds= simple_stmt ) ) { ExistsStmt41=(ANMLToken)match(input,ExistsStmt,FOLLOW_ExistsStmt_in_simple_stmt1565); if (state.failed) return s; if ( state.backtracking==0 ) { s = exists = new Exists(((S_scope)S_stack.peek()).d,ExistsStmt41.getSimpleText()); } match(input, Token.DOWN, null); if (state.failed) return s; match(input,Parameters,FOLLOW_Parameters_in_simple_stmt1576); if (state.failed) return s; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_scope_arg_decl_list_in_simple_stmt1578); scope_arg_decl_list(exists); state._fsp--; if (state.failed) return s; match(input, Token.UP, null); if (state.failed) return s; } // ANMLTree.g:532:6: ( sub_block[exists] | sHolds= simple_stmt ) int alt39=2; int LA39_0 = input.LA(1); if ( (LA39_0==Block) ) { alt39=1; } else if ( ((LA39_0>=LabelRef && LA39_0<=Access)||LA39_0==Label||(LA39_0>=Bra && LA39_0<=Ket)||(LA39_0>=Chain && LA39_0<=ContainsAllExpr)||(LA39_0>=ForAllStmt && LA39_0<=WhenElse)||LA39_0==ID||(LA39_0>=LessThan && LA39_0<=Assign)||LA39_0==Undefine||(LA39_0>=NotLog && LA39_0<=Equal)||LA39_0==Duration||(LA39_0>=Change && LA39_0<=Delta)||(LA39_0>=Implies && LA39_0<=Ordered)||(LA39_0>=Start && LA39_0<=GreaterThanE)||LA39_0==ForallExpr) ) { alt39=2; } else { if (state.backtracking>0) {state.failed=true; return s;} NoViableAltException nvae = new NoViableAltException("", 39, 0, input); throw nvae; } switch (alt39) { case 1 : // ANMLTree.g:532:8: sub_block[exists] { pushFollow(FOLLOW_sub_block_in_simple_stmt1589); sub_block(exists); state._fsp--; if (state.failed) return s; } break; case 2 : // ANMLTree.g:533:8: sHolds= simple_stmt { pushFollow(FOLLOW_simple_stmt_in_simple_stmt1603); sHolds=simple_stmt(); state._fsp--; if (state.failed) return s; if ( state.backtracking==0 ) { exists.addStatement(sHolds); } } break; } match(input, Token.UP, null); if (state.failed) return s; } break; case 5 : // ANMLTree.g:536:4: ^( ContainsSomeStmt interval[ts] timed_stmt[ts] ) { match(input,ContainsSomeStmt,FOLLOW_ContainsSomeStmt_in_simple_stmt1623); if (state.failed) return s; match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_interval_in_simple_stmt1625); interval(ts); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_timed_stmt_in_simple_stmt1628); timed_stmt(ts); state._fsp--; if (state.failed) return s; match(input, Token.UP, null); if (state.failed) return s; } break; case 6 : // ANMLTree.g:537:4: ^( ContainsAllStmt stmt ) { match(input,ContainsAllStmt,FOLLOW_ContainsAllStmt_in_simple_stmt1636); if (state.failed) return s; match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_stmt_in_simple_stmt1638); stmt(); state._fsp--; if (state.failed) return s; match(input, Token.UP, null); if (state.failed) return s; } break; case 7 : // ANMLTree.g:538:4: ^( TimedStmt interval[ts] timed_stmt[ts] ) { match(input,TimedStmt,FOLLOW_TimedStmt_in_simple_stmt1645); if (state.failed) return s; if ( state.backtracking==0 ) { s = ts = new TimedStatement(); } match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_interval_in_simple_stmt1653); interval(ts); state._fsp--; if (state.failed) return s; pushFollow(FOLLOW_timed_stmt_in_simple_stmt1656); timed_stmt42=timed_stmt(ts); state._fsp--; if (state.failed) return s; if ( state.backtracking==0 ) { ts.s = timed_stmt42; } match(input, Token.UP, null); if (state.failed) return s; } break; case 8 : // ANMLTree.g:541:4: ^( Chain chain_stmt ) { match(input,Chain,FOLLOW_Chain_in_simple_stmt1669); if (state.failed) return s; match(input, Token.DOWN, null); if (state.failed) return s; pushFollow(FOLLOW_chain_stmt_in_simple_stmt1671); chain_stmt43=chain_stmt(); state._fsp--; if (state.failed) return s; match(input, Token.UP, null); if (state.failed) return s; if ( state.backtracking==0 ) { s = chain_stmt43; } } break; case 9 : // ANMLTree.g:542:4: expr= expression { pushFollow(FOLLOW_expression_in_simple_stmt1681); expr=expression(); state._fsp--; if (state.failed) return s; if ( state.backtracking==0 ) { s = expr; } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return s; } // $ANTLR end "simple_stmt" // $ANTLR start "chain_stmt" // ANMLTree.g:545:1: chain_stmt returns [Chain c] : interval[c] ref ( ^( Equal r= expression ) | ^( NotEqual r= expression ) | ^( LessThan r= expression ) | ^( GreaterThan r= expression ) | ^( LessThanE r= expression ) | ^( GreaterThanE r= expression ) | ^( Assign r= expression ) | ^( Change r= expression ) | ^( Lend r= expression ) | ^( Use r= expression ) | ^( Produce r= expression ) | ^( Consume r= expression ) | ^( SetAssign set ) | ^( Within set ) | Undefine | Skip )+ ; public final Chain chain_stmt() throws RecognitionException { Chain c = null; Expression<?,?> r = null; OpUnary ref44 = null; c = new Chain(); Expression<?,?> l=null; try { // ANMLTree.g:550:5: ( interval[c] ref ( ^( Equal r= expression ) | ^( NotEqual r= expression ) | ^( LessThan r= expression ) | ^( GreaterThan r= expression ) | ^( LessThanE r= expression ) | ^( GreaterThanE r= expression ) | ^( Assign r= expression ) | ^( Change r= expression ) | ^( Lend r= expression ) | ^( Use r= expression ) | ^( Produce r= expression ) | ^( Consume r= expression ) | ^( SetAssign set ) | ^( Within set ) | Undefine | Skip )+ ) // ANMLTree.g:550:7: interval[c] ref ( ^( Equal r= expression ) | ^( NotEqual r= expression ) | ^( LessThan r= expression ) | ^( GreaterThan r= expression ) | ^( LessThanE r= expression ) | ^( GreaterThanE r= expression ) | ^( Assign r= expression ) | ^( Change r= expression ) | ^( Lend r= expression ) | ^( Use r= expression ) | ^( Produce r= expression ) | ^( Consume r= expression ) | ^( SetAssign set ) | ^( Within set ) | Undefine | Skip )+ { pushFollow(FOLLOW_interval_in_chain_stmt1705); interval(c); state._fsp--; if (state.failed) return c; pushFollow(FOLLOW_ref_in_chain_stmt1708); ref44=ref(); state._fsp--; if (state.failed) return c; if ( state.backtracking==0 ) { l = ref44; } // ANMLTree.g:551:2: ( ^( Equal r= expression ) | ^( NotEqual r= expression ) | ^( LessThan r= expression ) | ^( GreaterThan r= expression ) | ^( LessThanE r= expression ) | ^( GreaterThanE r= expression ) | ^( Assign r= expression ) | ^( Change r= expression ) | ^( Lend r= expression ) | ^( Use r= expression ) | ^( Produce r= expression ) | ^( Consume r= expression ) | ^( SetAssign set ) | ^( Within set ) | Undefine | Skip )+ int cnt41=0; loop41: do { int alt41=17; switch ( input.LA(1) ) { case Equal: { alt41=1; } break; case NotEqual: { alt41=2; } break; case LessThan: { alt41=3; } break; case GreaterThan: { alt41=4; } break; case LessThanE: { alt41=5; } break; case GreaterThanE: { alt41=6; } break; case Assign: { alt41=7; } break; case Change: { alt41=8; } break; case Lend: { alt41=9; } break; case Use: { alt41=10; } break; case Produce: { alt41=11; } break; case Consume: { alt41=12; } break; case SetAssign: { alt41=13; } break; case Within: { alt41=14; } break; case Undefine: { alt41=15; } break; case Skip: { alt41=16; } break; } switch (alt41) { case 1 : // ANMLTree.g:551:4: ^( Equal r= expression ) { match(input,Equal,FOLLOW_Equal_in_chain_stmt1716); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1720); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new OpBinary(TypeCode.Boolean,Op.equal,l,r)); } } break; case 2 : // ANMLTree.g:554:4: ^( NotEqual r= expression ) { match(input,NotEqual,FOLLOW_NotEqual_in_chain_stmt1729); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1733); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new OpBinary(TypeCode.Boolean,Op.notEqual,l,r)); } } break; case 3 : // ANMLTree.g:557:4: ^( LessThan r= expression ) { match(input,LessThan,FOLLOW_LessThan_in_chain_stmt1742); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1746); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new OpBinary(TypeCode.Boolean,Op.lessThan,l,r)); } } break; case 4 : // ANMLTree.g:560:4: ^( GreaterThan r= expression ) { match(input,GreaterThan,FOLLOW_GreaterThan_in_chain_stmt1755); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1759); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new OpBinary(TypeCode.Boolean,Op.greaterThan,l,r)); } } break; case 5 : // ANMLTree.g:563:4: ^( LessThanE r= expression ) { match(input,LessThanE,FOLLOW_LessThanE_in_chain_stmt1768); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1772); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new OpBinary(TypeCode.Boolean,Op.lessThanE,l,r)); } } break; case 6 : // ANMLTree.g:566:4: ^( GreaterThanE r= expression ) { match(input,GreaterThanE,FOLLOW_GreaterThanE_in_chain_stmt1781); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1785); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new OpBinary(TypeCode.Boolean,Op.greaterThanE,l,r)); } } break; case 7 : // ANMLTree.g:569:4: ^( Assign r= expression ) { match(input,Assign,FOLLOW_Assign_in_chain_stmt1794); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1798); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { if (l instanceof Constant) { Constant lc = (Constant) l; if (lc.name == IntervalImp.startName || lc.name == IntervalImp.endName || lc.name == IntervalImp.durationName) { if (lc.init == null) lc.init = r; else System.err.println("Can only set time parameters once."); c.expressions.add(new Skip()); } else { c.expressions.add(new Assign(l,r)); // might be nested within when statements and similar, so that one has to dynamically check whether multiple inits have happened if (lc.init != null) System.err.println("Constant " + lc.name + " is defined twice?\n"); } } else { c.expressions.add(new Assign(l,r)); } } } break; case 8 : // ANMLTree.g:588:4: ^( Change r= expression ) { match(input,Change,FOLLOW_Change_in_chain_stmt1807); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1811); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new Change(l,r)); } } break; case 9 : // ANMLTree.g:591:4: ^( Lend r= expression ) { match(input,Lend,FOLLOW_Lend_in_chain_stmt1820); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1824); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new Lend(l,r)); } } break; case 10 : // ANMLTree.g:594:4: ^( Use r= expression ) { match(input,Use,FOLLOW_Use_in_chain_stmt1833); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1837); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new Use(l,r)); } } break; case 11 : // ANMLTree.g:597:4: ^( Produce r= expression ) { match(input,Produce,FOLLOW_Produce_in_chain_stmt1846); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1850); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new Produce(l,r)); } } break; case 12 : // ANMLTree.g:600:4: ^( Consume r= expression ) { match(input,Consume,FOLLOW_Consume_in_chain_stmt1859); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_expression_in_chain_stmt1863); r=expression(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new Consume(l,r)); } } break; case 13 : // ANMLTree.g:603:4: ^( SetAssign set ) { match(input,SetAssign,FOLLOW_SetAssign_in_chain_stmt1872); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_set_in_chain_stmt1874); set(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new Undefine(l)); } } break; case 14 : // ANMLTree.g:606:4: ^( Within set ) { match(input,Within,FOLLOW_Within_in_chain_stmt1883); if (state.failed) return c; match(input, Token.DOWN, null); if (state.failed) return c; pushFollow(FOLLOW_set_in_chain_stmt1885); set(); state._fsp--; if (state.failed) return c; match(input, Token.UP, null); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new Skip()); } } break; case 15 : // ANMLTree.g:609:4: Undefine { match(input,Undefine,FOLLOW_Undefine_in_chain_stmt1893); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new Undefine(l)); } } break; case 16 : // ANMLTree.g:612:4: Skip { match(input,Skip,FOLLOW_Skip_in_chain_stmt1900); if (state.failed) return c; if ( state.backtracking==0 ) { c.expressions.add(new Skip()); } } break; default : if ( cnt41 >= 1 ) break loop41; if (state.backtracking>0) {state.failed=true; return c;} EarlyExitException eee = new EarlyExitException(41, input); throw eee; } cnt41++; } while (true); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return c; } // $ANTLR end "chain_stmt" // $ANTLR start "float_expression" // ANMLTree.g:618:1: float_expression returns [Expression<SimpleFloat,?> e] : expression {...}?; public final Expression<SimpleFloat,?> float_expression() throws RecognitionException { Expression<SimpleFloat,?> e = null; Expression<?,?> expression45 = null; try { // ANMLTree.g:619:1: ( expression {...}?) // ANMLTree.g:620:2: expression {...}? { pushFollow(FOLLOW_expression_in_float_expression1920); expression45=expression(); state._fsp--; if (state.failed) return e; if ( !((expression45.typeCode() == TypeCode.Float)) ) { if (state.backtracking>0) {state.failed=true; return e;} throw new FailedPredicateException(input, "float_expression", "$expression.e.typeCode() == TypeCode.Float"); } if ( state.backtracking==0 ) { e = (Expression<SimpleFloat,?>) expression45; } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return e; } // $ANTLR end "float_expression" // $ANTLR start "boolean_expression" // ANMLTree.g:623:1: boolean_expression returns [Expression<SimpleBoolean,?> e] : expression {...}?; public final Expression<SimpleBoolean,?> boolean_expression() throws RecognitionException { Expression<SimpleBoolean,?> e = null; Expression<?,?> expression46 = null; try { // ANMLTree.g:624:1: ( expression {...}?) // ANMLTree.g:625:2: expression {...}? { pushFollow(FOLLOW_expression_in_boolean_expression1938); expression46=expression(); state._fsp--; if (state.failed) return e; if ( !((expression46.typeCode() == TypeCode.Boolean)) ) { if (state.backtracking>0) {state.failed=true; return e;} throw new FailedPredicateException(input, "boolean_expression", "$expression.e.typeCode() == TypeCode.Boolean"); } if ( state.backtracking==0 ) { e = (Expression<SimpleBoolean,?>) expression46; } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return e; } // $ANTLR end "boolean_expression" // $ANTLR start "interval" // ANMLTree.g:632:1: interval[IntervalImp i] : ( ^( DefiniteInterval b= bra ( ^( TDuration d= float_expression ) ^( TEnd e= float_expression ) k1= ket | ^( TStart s= float_expression ) ( ^( TDuration d= float_expression ) ( ^( TEnd e= float_expression ) k2= ket | k2= ket ) | ^( TEnd e= float_expression ) k2= ket ) ) ) | ^( DefinitePoint ^( TStart s= float_expression ) ) | ^( IndefiniteInterval b= bra ( ^( TDuration d= float_expression ) k1= ket | ^( TEnd e= float_expression ) k2= ket | ^( TStart s= float_expression ) k3= ket | k4= ket ) ) | IndefinitePoint ); public final void interval(IntervalImp i) throws RecognitionException { Expression b = null; Expression<SimpleFloat,?> d = null; Expression<SimpleFloat,?> e = null; Expression k1 = null; Expression<SimpleFloat,?> s = null; Expression k2 = null; Expression k3 = null; Expression k4 = null; try { // ANMLTree.g:633:2: ( ^( DefiniteInterval b= bra ( ^( TDuration d= float_expression ) ^( TEnd e= float_expression ) k1= ket | ^( TStart s= float_expression ) ( ^( TDuration d= float_expression ) ( ^( TEnd e= float_expression ) k2= ket | k2= ket ) | ^( TEnd e= float_expression ) k2= ket ) ) ) | ^( DefinitePoint ^( TStart s= float_expression ) ) | ^( IndefiniteInterval b= bra ( ^( TDuration d= float_expression ) k1= ket | ^( TEnd e= float_expression ) k2= ket | ^( TStart s= float_expression ) k3= ket | k4= ket ) ) | IndefinitePoint ) int alt46=4; switch ( input.LA(1) ) { case DefiniteInterval: { alt46=1; } break; case DefinitePoint: { alt46=2; } break; case IndefiniteInterval: { alt46=3; } break; case IndefinitePoint: { alt46=4; } break; default: if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 46, 0, input); throw nvae; } switch (alt46) { case 1 : // ANMLTree.g:633:4: ^( DefiniteInterval b= bra ( ^( TDuration d= float_expression ) ^( TEnd e= float_expression ) k1= ket | ^( TStart s= float_expression ) ( ^( TDuration d= float_expression ) ( ^( TEnd e= float_expression ) k2= ket | k2= ket ) | ^( TEnd e= float_expression ) k2= ket ) ) ) { match(input,DefiniteInterval,FOLLOW_DefiniteInterval_in_interval1958); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_bra_in_interval1962); b=bra(); state._fsp--; if (state.failed) return ; // ANMLTree.g:634:3: ( ^( TDuration d= float_expression ) ^( TEnd e= float_expression ) k1= ket | ^( TStart s= float_expression ) ( ^( TDuration d= float_expression ) ( ^( TEnd e= float_expression ) k2= ket | k2= ket ) | ^( TEnd e= float_expression ) k2= ket ) ) int alt44=2; int LA44_0 = input.LA(1); if ( (LA44_0==TDuration) ) { alt44=1; } else if ( (LA44_0==TStart) ) { alt44=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 44, 0, input); throw nvae; } switch (alt44) { case 1 : // ANMLTree.g:634:5: ^( TDuration d= float_expression ) ^( TEnd e= float_expression ) k1= ket { match(input,TDuration,FOLLOW_TDuration_in_interval1970); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval1974); d=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; match(input,TEnd,FOLLOW_TEnd_in_interval1978); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval1982); e=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; pushFollow(FOLLOW_ket_in_interval1987); k1=ket(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(b,k1); i.makeDuration(d); i.makeEnd(e); i.inferStart(); } } break; case 2 : // ANMLTree.g:640:5: ^( TStart s= float_expression ) ( ^( TDuration d= float_expression ) ( ^( TEnd e= float_expression ) k2= ket | k2= ket ) | ^( TEnd e= float_expression ) k2= ket ) { match(input,TStart,FOLLOW_TStart_in_interval1997); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval2001); s=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; // ANMLTree.g:641:7: ( ^( TDuration d= float_expression ) ( ^( TEnd e= float_expression ) k2= ket | k2= ket ) | ^( TEnd e= float_expression ) k2= ket ) int alt43=2; int LA43_0 = input.LA(1); if ( (LA43_0==TDuration) ) { alt43=1; } else if ( (LA43_0==TEnd) ) { alt43=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 43, 0, input); throw nvae; } switch (alt43) { case 1 : // ANMLTree.g:641:9: ^( TDuration d= float_expression ) ( ^( TEnd e= float_expression ) k2= ket | k2= ket ) { match(input,TDuration,FOLLOW_TDuration_in_interval2013); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval2017); d=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; // ANMLTree.g:642:8: ( ^( TEnd e= float_expression ) k2= ket | k2= ket ) int alt42=2; int LA42_0 = input.LA(1); if ( (LA42_0==TEnd) ) { alt42=1; } else if ( (LA42_0==TKet) ) { alt42=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 42, 0, input); throw nvae; } switch (alt42) { case 1 : // ANMLTree.g:642:10: ^( TEnd e= float_expression ) k2= ket { match(input,TEnd,FOLLOW_TEnd_in_interval2031); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval2035); e=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; pushFollow(FOLLOW_ket_in_interval2040); k2=ket(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(b,k2); i.makeStart(s); i.makeDuration(d); i.makeEnd(e); } } break; case 2 : // ANMLTree.g:648:10: k2= ket { pushFollow(FOLLOW_ket_in_interval2055); k2=ket(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(b,k2); i.makeStart(s); i.makeDuration(d); i.inferEnd(); } } break; } } break; case 2 : // ANMLTree.g:655:9: ^( TEnd e= float_expression ) k2= ket { match(input,TEnd,FOLLOW_TEnd_in_interval2077); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval2081); e=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; pushFollow(FOLLOW_ket_in_interval2086); k2=ket(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(b,k2); i.makeStart(s); i.makeEnd(e); i.inferDuration(); } } break; } } break; } match(input, Token.UP, null); if (state.failed) return ; } break; case 2 : // ANMLTree.g:664:4: ^( DefinitePoint ^( TStart s= float_expression ) ) { match(input,DefinitePoint,FOLLOW_DefinitePoint_in_interval2113); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; match(input,TStart,FOLLOW_TStart_in_interval2116); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval2120); s=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(0,0); i.makeStart(s); i.makeEnd(s); i.inferDuration(); // surely the following should work? //i.duration = IntervalImp.constantDurationZero; } match(input, Token.UP, null); if (state.failed) return ; } break; case 3 : // ANMLTree.g:673:4: ^( IndefiniteInterval b= bra ( ^( TDuration d= float_expression ) k1= ket | ^( TEnd e= float_expression ) k2= ket | ^( TStart s= float_expression ) k3= ket | k4= ket ) ) { match(input,IndefiniteInterval,FOLLOW_IndefiniteInterval_in_interval2135); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_bra_in_interval2139); b=bra(); state._fsp--; if (state.failed) return ; // ANMLTree.g:674:3: ( ^( TDuration d= float_expression ) k1= ket | ^( TEnd e= float_expression ) k2= ket | ^( TStart s= float_expression ) k3= ket | k4= ket ) int alt45=4; switch ( input.LA(1) ) { case TDuration: { alt45=1; } break; case TEnd: { alt45=2; } break; case TStart: { alt45=3; } break; case TKet: { alt45=4; } break; default: if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 45, 0, input); throw nvae; } switch (alt45) { case 1 : // ANMLTree.g:674:5: ^( TDuration d= float_expression ) k1= ket { match(input,TDuration,FOLLOW_TDuration_in_interval2147); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval2151); d=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; pushFollow(FOLLOW_ket_in_interval2156); k1=ket(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(b,k1); i.makeDuration(d); i.start = new Constant<SimpleFloat>(IntervalImp.startName,Unit.floatType); i.end = new Constant<SimpleFloat>(IntervalImp.endName,Unit.floatType); } } break; case 2 : // ANMLTree.g:680:5: ^( TEnd e= float_expression ) k2= ket { match(input,TEnd,FOLLOW_TEnd_in_interval2165); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval2169); e=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; pushFollow(FOLLOW_ket_in_interval2174); k2=ket(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(b,k2); i.makeEnd(e); i.start = new Constant<SimpleFloat>(IntervalImp.startName,Unit.floatType); i.duration = new Constant<SimpleFloat>(IntervalImp.durationName,Unit.floatType); } } break; case 3 : // ANMLTree.g:686:5: ^( TStart s= float_expression ) k3= ket { match(input,TStart,FOLLOW_TStart_in_interval2183); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; pushFollow(FOLLOW_float_expression_in_interval2187); s=float_expression(); state._fsp--; if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; pushFollow(FOLLOW_ket_in_interval2192); k3=ket(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(b,k3); i.makeStart(s); i.duration = new Constant<SimpleFloat>(IntervalImp.durationName,Unit.floatType); i.end = new Constant<SimpleFloat>(IntervalImp.endName,Unit.floatType); } } break; case 4 : // ANMLTree.g:692:5: k4= ket { pushFollow(FOLLOW_ket_in_interval2202); k4=ket(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(b,k4); i.start = new Constant<SimpleFloat>(IntervalImp.startName,Unit.floatType); i.duration = new Constant<SimpleFloat>(IntervalImp.durationName,Unit.floatType); i.end = new Constant<SimpleFloat>(IntervalImp.endName,Unit.floatType); } } break; } match(input, Token.UP, null); if (state.failed) return ; } break; case 4 : // ANMLTree.g:700:4: IndefinitePoint { match(input,IndefinitePoint,FOLLOW_IndefinitePoint_in_interval2218); if (state.failed) return ; if ( state.backtracking==0 ) { i.setShape(0,0); i.duration = IntervalImp.constantDurationZero; i.start = i.end = new Constant<SimpleFloat>(IntervalImp.startName,Unit.floatType); } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "interval" // $ANTLR start "bra" // ANMLTree.g:707:1: bra returns [Expression b] : ^( TBra ( At | After | Before | expression ) ) ; public final Expression bra() throws RecognitionException { Expression b = null; Expression<?,?> expression47 = null; try { // ANMLTree.g:708:2: ( ^( TBra ( At | After | Before | expression ) ) ) // ANMLTree.g:708:4: ^( TBra ( At | After | Before | expression ) ) { match(input,TBra,FOLLOW_TBra_in_bra2236); if (state.failed) return b; match(input, Token.DOWN, null); if (state.failed) return b; // ANMLTree.g:709:3: ( At | After | Before | expression ) int alt47=4; switch ( input.LA(1) ) { case At: { alt47=1; } break; case After: { alt47=2; } break; case Before: { alt47=3; } break; case LabelRef: case Ref: case Bind: case Access: case Label: case Bra: case Ket: case TimedExpr: case ContainsSomeExpr: case ContainsAllExpr: case ExistsExpr: case ID: case LessThan: case Assign: case Undefine: case NotLog: case NotBit: case EqualLog: case Equal: case Duration: case Change: case Produce: case Consume: case Lend: case Use: case Within: case SetAssign: case Skip: case Delta: case Implies: case XorLog: case OrLog: case AndLog: case XorBit: case Plus: case Minus: case OrBit: case Times: case Divide: case AndBit: case Unordered: case Ordered: case Start: case End: case INT: case FLOAT: case STRING: case True: case False: case Infinity: case NotEqual: case GreaterThan: case LessThanE: case GreaterThanE: case ForallExpr: { alt47=4; } break; default: if (state.backtracking>0) {state.failed=true; return b;} NoViableAltException nvae = new NoViableAltException("", 47, 0, input); throw nvae; } switch (alt47) { case 1 : // ANMLTree.g:709:5: At { match(input,At,FOLLOW_At_in_bra2243); if (state.failed) return b; if ( state.backtracking==0 ) { b=IntervalImp.makeBra(Time.At); } } break; case 2 : // ANMLTree.g:710:5: After { match(input,After,FOLLOW_After_in_bra2252); if (state.failed) return b; if ( state.backtracking==0 ) { b=IntervalImp.makeBra(Time.After); } } break; case 3 : // ANMLTree.g:711:5: Before { match(input,Before,FOLLOW_Before_in_bra2261); if (state.failed) return b; if ( state.backtracking==0 ) { b=IntervalImp.makeBra(Time.Before); } } break; case 4 : // ANMLTree.g:712:5: expression { pushFollow(FOLLOW_expression_in_bra2269); expression47=expression(); state._fsp--; if (state.failed) return b; if ( state.backtracking==0 ) { b = expression47; } } break; } match(input, Token.UP, null); if (state.failed) return b; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return b; } // $ANTLR end "bra" // $ANTLR start "ket" // ANMLTree.g:716:1: ket returns [Expression k] : ^( TKet ( At | Before | After | expression ) ) ; public final Expression ket() throws RecognitionException { Expression k = null; Expression<?,?> expression48 = null; try { // ANMLTree.g:717:2: ( ^( TKet ( At | Before | After | expression ) ) ) // ANMLTree.g:717:4: ^( TKet ( At | Before | After | expression ) ) { match(input,TKet,FOLLOW_TKet_in_ket2295); if (state.failed) return k; match(input, Token.DOWN, null); if (state.failed) return k; // ANMLTree.g:718:3: ( At | Before | After | expression ) int alt48=4; switch ( input.LA(1) ) { case At: { alt48=1; } break; case Before: { alt48=2; } break; case After: { alt48=3; } break; case LabelRef: case Ref: case Bind: case Access: case Label: case Bra: case Ket: case TimedExpr: case ContainsSomeExpr: case ContainsAllExpr: case ExistsExpr: case ID: case LessThan: case Assign: case Undefine: case NotLog: case NotBit: case EqualLog: case Equal: case Duration: case Change: case Produce: case Consume: case Lend: case Use: case Within: case SetAssign: case Skip: case Delta: case Implies: case XorLog: case OrLog: case AndLog: case XorBit: case Plus: case Minus: case OrBit: case Times: case Divide: case AndBit: case Unordered: case Ordered: case Start: case End: case INT: case FLOAT: case STRING: case True: case False: case Infinity: case NotEqual: case GreaterThan: case LessThanE: case GreaterThanE: case ForallExpr: { alt48=4; } break; default: if (state.backtracking>0) {state.failed=true; return k;} NoViableAltException nvae = new NoViableAltException("", 48, 0, input); throw nvae; } switch (alt48) { case 1 : // ANMLTree.g:718:5: At { match(input,At,FOLLOW_At_in_ket2302); if (state.failed) return k; if ( state.backtracking==0 ) { k=IntervalImp.makeKet(Time.At); } } break; case 2 : // ANMLTree.g:719:5: Before { match(input,Before,FOLLOW_Before_in_ket2311); if (state.failed) return k; if ( state.backtracking==0 ) { k=IntervalImp.makeKet(Time.Before); } } break; case 3 : // ANMLTree.g:720:5: After { match(input,After,FOLLOW_After_in_ket2320); if (state.failed) return k; if ( state.backtracking==0 ) { k=IntervalImp.makeKet(Time.After); } } break; case 4 : // ANMLTree.g:721:5: expression { pushFollow(FOLLOW_expression_in_ket2328); expression48=expression(); state._fsp--; if (state.failed) return k; if ( state.backtracking==0 ) { k=expression48; } } break; } match(input, Token.UP, null); if (state.failed) return k; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return k; } // $ANTLR end "ket" // $ANTLR start "timed_expression" // ANMLTree.g:728:1: timed_expression[Interval i] returns [Expression<?,?> e] : expression ; public final Expression<?,?> timed_expression(Interval i) throws RecognitionException { I_stack.push(new I_scope()); Expression<?,?> e = null; Expression<?,?> expression49 = null; ((I_scope)I_stack.peek()).i = i; try { // ANMLTree.g:731:2: ( expression ) // ANMLTree.g:731:4: expression { pushFollow(FOLLOW_expression_in_timed_expression2366); expression49=expression(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e = expression49; } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { I_stack.pop(); } return e; } // $ANTLR end "timed_expression" // $ANTLR start "expression" // ANMLTree.g:734:1: expression returns [Expression<?,?> e] : ( ^( Label id f= expression ) | ^( ( Equal | EqualLog ) l= expression r= expression ) | ^( NotEqual l= expression r= expression ) | ^( LessThan l= expression r= expression ) | ^( GreaterThan l= expression r= expression ) | ^( LessThanE l= expression r= expression ) | ^( GreaterThanE l= expression r= expression ) | ^( Assign l= expression r= expression ) | ^( Undefine l= expression ) | Skip | ^( Change l= expression r= expression ) | ^( Lend l= expression r= expression ) | ^( Use l= expression r= expression ) | ^( Produce l= expression r= expression ) | ^( Consume l= expression r= expression ) | ^( Within expression set ) | ^( SetAssign expression set ) | ^( Implies l= expression r= expression ) | ^( ( XorLog | XorBit ) l= expression r= expression ) | ^( ( AndLog | AndBit ) l= expression r= expression ) | ^( ( OrLog | OrBit ) l= expression r= expression ) | ^( Plus l= expression r= expression ) | ^( Minus l= expression r= expression ) | ^( Times l= expression r= expression ) | ^( Divide l= expression r= expression ) | ^( ForallExpr ^( Parameters scope_arg_decl_list[forall] ) l= expression ) | ^( ExistsExpr ^( Parameters scope_arg_decl_list[exists] ) l= expression ) | ^( ContainsSomeExpr interval[te] tl= timed_expression[te] ) | ^( ContainsAllExpr b= boolean_expression ) | ^( TimedExpr interval[te] tl= timed_expression[te] ) | ^( Unordered (b= boolean_expression )* ) | ^( Ordered (b= boolean_expression )* ) | ^( ( NotLog | NotBit ) ( ( ref )=> ref | l= expression ) ) | ref | ^( Delta ref ) | literal | time_primitive ); public final Expression<?,?> expression() throws RecognitionException { Expression<?,?> e = null; ANMLToken Label50=null; ANMLToken ForallExpr52=null; ANMLToken ExistsExpr53=null; Expression<?,?> f = null; Expression<?,?> l = null; Expression<?,?> r = null; Expression<?,?> tl = null; Expression<SimpleBoolean,?> b = null; SimpleString id51 = null; OpUnary ref54 = null; OpUnary ref55 = null; Expression literal56 = null; Expression time_primitive57 = null; LabeledExpression label; ForAll forall=null; Exists exists=null; Ordered ordered=null; Unordered unordered=null; TimedExpression te=null; try { // ANMLTree.g:743:2: ( ^( Label id f= expression ) | ^( ( Equal | EqualLog ) l= expression r= expression ) | ^( NotEqual l= expression r= expression ) | ^( LessThan l= expression r= expression ) | ^( GreaterThan l= expression r= expression ) | ^( LessThanE l= expression r= expression ) | ^( GreaterThanE l= expression r= expression ) | ^( Assign l= expression r= expression ) | ^( Undefine l= expression ) | Skip | ^( Change l= expression r= expression ) | ^( Lend l= expression r= expression ) | ^( Use l= expression r= expression ) | ^( Produce l= expression r= expression ) | ^( Consume l= expression r= expression ) | ^( Within expression set ) | ^( SetAssign expression set ) | ^( Implies l= expression r= expression ) | ^( ( XorLog | XorBit ) l= expression r= expression ) | ^( ( AndLog | AndBit ) l= expression r= expression ) | ^( ( OrLog | OrBit ) l= expression r= expression ) | ^( Plus l= expression r= expression ) | ^( Minus l= expression r= expression ) | ^( Times l= expression r= expression ) | ^( Divide l= expression r= expression ) | ^( ForallExpr ^( Parameters scope_arg_decl_list[forall] ) l= expression ) | ^( ExistsExpr ^( Parameters scope_arg_decl_list[exists] ) l= expression ) | ^( ContainsSomeExpr interval[te] tl= timed_expression[te] ) | ^( ContainsAllExpr b= boolean_expression ) | ^( TimedExpr interval[te] tl= timed_expression[te] ) | ^( Unordered (b= boolean_expression )* ) | ^( Ordered (b= boolean_expression )* ) | ^( ( NotLog | NotBit ) ( ( ref )=> ref | l= expression ) ) | ref | ^( Delta ref ) | literal | time_primitive ) int alt52=37; switch ( input.LA(1) ) { case Label: { alt52=1; } break; case EqualLog: case Equal: { alt52=2; } break; case NotEqual: { alt52=3; } break; case LessThan: { alt52=4; } break; case GreaterThan: { alt52=5; } break; case LessThanE: { alt52=6; } break; case GreaterThanE: { alt52=7; } break; case Assign: { alt52=8; } break; case Undefine: { alt52=9; } break; case Skip: { alt52=10; } break; case Change: { alt52=11; } break; case Lend: { alt52=12; } break; case Use: { alt52=13; } break; case Produce: { alt52=14; } break; case Consume: { alt52=15; } break; case Within: { alt52=16; } break; case SetAssign: { alt52=17; } break; case Implies: { alt52=18; } break; case XorLog: case XorBit: { alt52=19; } break; case AndLog: case AndBit: { alt52=20; } break; case OrLog: case OrBit: { alt52=21; } break; case Plus: { alt52=22; } break; case Minus: { alt52=23; } break; case Times: { alt52=24; } break; case Divide: { alt52=25; } break; case ForallExpr: { alt52=26; } break; case ExistsExpr: { alt52=27; } break; case ContainsSomeExpr: { alt52=28; } break; case ContainsAllExpr: { alt52=29; } break; case TimedExpr: { alt52=30; } break; case Unordered: { alt52=31; } break; case Ordered: { alt52=32; } break; case NotLog: case NotBit: { alt52=33; } break; case Ref: case Bind: case Access: { alt52=34; } break; case Delta: { alt52=35; } break; case ID: case INT: case FLOAT: case STRING: case True: case False: case Infinity: { alt52=36; } break; case LabelRef: case Bra: case Ket: case Duration: case Start: case End: { alt52=37; } break; default: if (state.backtracking>0) {state.failed=true; return e;} NoViableAltException nvae = new NoViableAltException("", 52, 0, input); throw nvae; } switch (alt52) { case 1 : // ANMLTree.g:743:4: ^( Label id f= expression ) { Label50=(ANMLToken)match(input,Label,FOLLOW_Label_in_expression2388); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_id_in_expression2390); id51=id(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2394); f=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { if (f == null || f.typeCode() != TypeCode.Boolean) { System.err.println("Error (line " + Label50.getLine() + "): Cannot label non-boolean expressions. [label: " + id51 + "]"); // suppress undefined errors later. e = label = new LabeledExpression(id51,ANMLBoolean.False); ((A_scope)A_stack.peek()).d.labels.put(label); } else { e = label = new LabeledExpression(id51,(Expression<SimpleBoolean,?>)f); ((A_scope)A_stack.peek()).d.labels.put(label); } } } break; case 2 : // ANMLTree.g:754:4: ^( ( Equal | EqualLog ) l= expression r= expression ) { if ( (input.LA(1)>=EqualLog && input.LA(1)<=Equal) ) { input.consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return e;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2411); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2415); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.equal,l,r); } } break; case 3 : // ANMLTree.g:757:4: ^( NotEqual l= expression r= expression ) { match(input,NotEqual,FOLLOW_NotEqual_in_expression2424); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2428); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2432); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.notEqual,l,r); } } break; case 4 : // ANMLTree.g:760:4: ^( LessThan l= expression r= expression ) { match(input,LessThan,FOLLOW_LessThan_in_expression2441); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2445); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2449); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.lessThan,l,r); } } break; case 5 : // ANMLTree.g:763:4: ^( GreaterThan l= expression r= expression ) { match(input,GreaterThan,FOLLOW_GreaterThan_in_expression2458); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2462); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2466); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.greaterThan,l,r); } } break; case 6 : // ANMLTree.g:766:4: ^( LessThanE l= expression r= expression ) { match(input,LessThanE,FOLLOW_LessThanE_in_expression2475); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2479); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2483); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.lessThanE,l,r); } } break; case 7 : // ANMLTree.g:769:4: ^( GreaterThanE l= expression r= expression ) { match(input,GreaterThanE,FOLLOW_GreaterThanE_in_expression2492); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2496); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2500); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.greaterThanE,l,r); } } break; case 8 : // ANMLTree.g:772:4: ^( Assign l= expression r= expression ) { match(input,Assign,FOLLOW_Assign_in_expression2509); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2513); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2517); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { if (l instanceof Constant) { Constant c = (Constant) l; if (c.name == IntervalImp.startName || c.name == IntervalImp.endName || c.name == IntervalImp.durationName) { if (c.init == null) c.init = r; else System.err.println("Can only set time parameters once."); e = new Skip(); // shouldn't be needed... } else { // might be nested within when statements and similar, so that one has to dynamically check whether multiple inits have happened e = new Assign(l,r); if (c.init != null) System.err.println("Constant " + c.name + " is defined twice?\n"); } } else { e = new Assign(l,r); } } } break; case 9 : // ANMLTree.g:791:4: ^( Undefine l= expression ) { match(input,Undefine,FOLLOW_Undefine_in_expression2526); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2530); l=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new Undefine(l); } } break; case 10 : // ANMLTree.g:794:4: Skip { match(input,Skip,FOLLOW_Skip_in_expression2538); if (state.failed) return e; if ( state.backtracking==0 ) { e = new Skip(); } } break; case 11 : // ANMLTree.g:797:4: ^( Change l= expression r= expression ) { match(input,Change,FOLLOW_Change_in_expression2546); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2550); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2554); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new Change(l,r); } } break; case 12 : // ANMLTree.g:800:4: ^( Lend l= expression r= expression ) { match(input,Lend,FOLLOW_Lend_in_expression2563); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2567); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2571); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new Lend(l,r); } } break; case 13 : // ANMLTree.g:803:4: ^( Use l= expression r= expression ) { match(input,Use,FOLLOW_Use_in_expression2580); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2584); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2588); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new Use(l,r); } } break; case 14 : // ANMLTree.g:806:4: ^( Produce l= expression r= expression ) { match(input,Produce,FOLLOW_Produce_in_expression2597); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2601); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2605); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new Produce(l,r); } } break; case 15 : // ANMLTree.g:809:4: ^( Consume l= expression r= expression ) { match(input,Consume,FOLLOW_Consume_in_expression2614); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2618); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2622); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new Consume(l,r); } } break; case 16 : // ANMLTree.g:812:4: ^( Within expression set ) { match(input,Within,FOLLOW_Within_in_expression2631); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2633); expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_set_in_expression2635); set(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { } } break; case 17 : // ANMLTree.g:814:4: ^( SetAssign expression set ) { match(input,SetAssign,FOLLOW_SetAssign_in_expression2644); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2646); expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_set_in_expression2648); set(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { } } break; case 18 : // ANMLTree.g:816:4: ^( Implies l= expression r= expression ) { match(input,Implies,FOLLOW_Implies_in_expression2657); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2661); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2665); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.implies,l,r); } } break; case 19 : // ANMLTree.g:819:4: ^( ( XorLog | XorBit ) l= expression r= expression ) { if ( input.LA(1)==XorLog||input.LA(1)==XorBit ) { input.consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return e;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2682); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2686); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.xor,l,r); } } break; case 20 : // ANMLTree.g:822:4: ^( ( AndLog | AndBit ) l= expression r= expression ) { if ( input.LA(1)==AndLog||input.LA(1)==AndBit ) { input.consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return e;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2703); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2707); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.and,l,r); } } break; case 21 : // ANMLTree.g:825:4: ^( ( OrLog | OrBit ) l= expression r= expression ) { if ( input.LA(1)==OrLog||input.LA(1)==OrBit ) { input.consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return e;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2724); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2728); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(TypeCode.Boolean,Op.or,l,r); } } break; case 22 : // ANMLTree.g:828:4: ^( Plus l= expression r= expression ) { match(input,Plus,FOLLOW_Plus_in_expression2737); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2741); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2745); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(l.typeCode(),Op.add,l,r); } } break; case 23 : // ANMLTree.g:831:4: ^( Minus l= expression r= expression ) { match(input,Minus,FOLLOW_Minus_in_expression2754); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2758); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2762); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(l.typeCode(),Op.subtract,l,r); } } break; case 24 : // ANMLTree.g:834:4: ^( Times l= expression r= expression ) { match(input,Times,FOLLOW_Times_in_expression2771); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2775); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2779); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(l.typeCode(),Op.multiply,l,r); } } break; case 25 : // ANMLTree.g:837:4: ^( Divide l= expression r= expression ) { match(input,Divide,FOLLOW_Divide_in_expression2788); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2792); l=expression(); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_expression_in_expression2796); r=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpBinary(l.typeCode(),Op.divide,l,r); } } break; case 26 : // ANMLTree.g:840:4: ^( ForallExpr ^( Parameters scope_arg_decl_list[forall] ) l= expression ) { ForallExpr52=(ANMLToken)match(input,ForallExpr,FOLLOW_ForallExpr_in_expression2805); if (state.failed) return e; if ( state.backtracking==0 ) { e = forall = new ForAll(((S_scope)S_stack.peek()).d,ForallExpr52.getSimpleText()); } match(input, Token.DOWN, null); if (state.failed) return e; match(input,Parameters,FOLLOW_Parameters_in_expression2814); if (state.failed) return e; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_scope_arg_decl_list_in_expression2816); scope_arg_decl_list(forall); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; } pushFollow(FOLLOW_expression_in_expression2822); l=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { forall.addStatement(l); } } break; case 27 : // ANMLTree.g:844:4: ^( ExistsExpr ^( Parameters scope_arg_decl_list[exists] ) l= expression ) { ExistsExpr53=(ANMLToken)match(input,ExistsExpr,FOLLOW_ExistsExpr_in_expression2831); if (state.failed) return e; if ( state.backtracking==0 ) { e = exists = new Exists(((S_scope)S_stack.peek()).d,ExistsExpr53.getSimpleText()); } match(input, Token.DOWN, null); if (state.failed) return e; match(input,Parameters,FOLLOW_Parameters_in_expression2839); if (state.failed) return e; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_scope_arg_decl_list_in_expression2841); scope_arg_decl_list(exists); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; } pushFollow(FOLLOW_expression_in_expression2847); l=expression(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; if ( state.backtracking==0 ) { exists.addStatement(l); } } break; case 28 : // ANMLTree.g:848:4: ^( ContainsSomeExpr interval[te] tl= timed_expression[te] ) { match(input,ContainsSomeExpr,FOLLOW_ContainsSomeExpr_in_expression2856); if (state.failed) return e; if ( state.backtracking==0 ) { te = new TimedExpression(); e = new ContainsExpression(te); } match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_interval_in_expression2862); interval(te); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_timed_expression_in_expression2867); tl=timed_expression(te); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { te.e = tl; } match(input, Token.UP, null); if (state.failed) return e; } break; case 29 : // ANMLTree.g:853:4: ^( ContainsAllExpr b= boolean_expression ) { match(input,ContainsAllExpr,FOLLOW_ContainsAllExpr_in_expression2881); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_boolean_expression_in_expression2885); b=boolean_expression(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e = new ContainsExpression(new TimeOfExpression(b)); } match(input, Token.UP, null); if (state.failed) return e; } break; case 30 : // ANMLTree.g:857:4: ^( TimedExpr interval[te] tl= timed_expression[te] ) { match(input,TimedExpr,FOLLOW_TimedExpr_in_expression2898); if (state.failed) return e; if ( state.backtracking==0 ) { e = te = new TimedExpression(); } match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_interval_in_expression2902); interval(te); state._fsp--; if (state.failed) return e; pushFollow(FOLLOW_timed_expression_in_expression2907); tl=timed_expression(te); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { te.e = tl; } match(input, Token.UP, null); if (state.failed) return e; } break; case 31 : // ANMLTree.g:858:4: ^( Unordered (b= boolean_expression )* ) { match(input,Unordered,FOLLOW_Unordered_in_expression2917); if (state.failed) return e; if ( state.backtracking==0 ) { e = unordered = new Unordered(); } if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return e; // ANMLTree.g:858:52: (b= boolean_expression )* loop49: do { int alt49=2; int LA49_0 = input.LA(1); if ( ((LA49_0>=LabelRef && LA49_0<=Access)||LA49_0==Label||(LA49_0>=Bra && LA49_0<=Ket)||LA49_0==TimedExpr||(LA49_0>=ContainsSomeExpr && LA49_0<=ContainsAllExpr)||LA49_0==ExistsExpr||LA49_0==ID||(LA49_0>=LessThan && LA49_0<=Assign)||LA49_0==Undefine||(LA49_0>=NotLog && LA49_0<=Equal)||LA49_0==Duration||(LA49_0>=Change && LA49_0<=Delta)||(LA49_0>=Implies && LA49_0<=Ordered)||(LA49_0>=Start && LA49_0<=GreaterThanE)||LA49_0==ForallExpr) ) { alt49=1; } switch (alt49) { case 1 : // ANMLTree.g:858:53: b= boolean_expression { pushFollow(FOLLOW_boolean_expression_in_expression2924); b=boolean_expression(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { unordered.add(b); } } break; default : break loop49; } } while (true); match(input, Token.UP, null); if (state.failed) return e; } } break; case 32 : // ANMLTree.g:859:4: ^( Ordered (b= boolean_expression )* ) { match(input,Ordered,FOLLOW_Ordered_in_expression2935); if (state.failed) return e; if ( state.backtracking==0 ) { e = ordered = new Ordered(); } if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return e; // ANMLTree.g:859:46: (b= boolean_expression )* loop50: do { int alt50=2; int LA50_0 = input.LA(1); if ( ((LA50_0>=LabelRef && LA50_0<=Access)||LA50_0==Label||(LA50_0>=Bra && LA50_0<=Ket)||LA50_0==TimedExpr||(LA50_0>=ContainsSomeExpr && LA50_0<=ContainsAllExpr)||LA50_0==ExistsExpr||LA50_0==ID||(LA50_0>=LessThan && LA50_0<=Assign)||LA50_0==Undefine||(LA50_0>=NotLog && LA50_0<=Equal)||LA50_0==Duration||(LA50_0>=Change && LA50_0<=Delta)||(LA50_0>=Implies && LA50_0<=Ordered)||(LA50_0>=Start && LA50_0<=GreaterThanE)||LA50_0==ForallExpr) ) { alt50=1; } switch (alt50) { case 1 : // ANMLTree.g:859:47: b= boolean_expression { pushFollow(FOLLOW_boolean_expression_in_expression2942); b=boolean_expression(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { ordered.add(b); } } break; default : break loop50; } } while (true); match(input, Token.UP, null); if (state.failed) return e; } } break; case 33 : // ANMLTree.g:860:4: ^( ( NotLog | NotBit ) ( ( ref )=> ref | l= expression ) ) { if ( (input.LA(1)>=NotLog && input.LA(1)<=NotBit) ) { input.consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return e;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } match(input, Token.DOWN, null); if (state.failed) return e; // ANMLTree.g:861:3: ( ( ref )=> ref | l= expression ) int alt51=2; alt51 = dfa51.predict(input); switch (alt51) { case 1 : // ANMLTree.g:861:5: ( ref )=> ref { pushFollow(FOLLOW_ref_in_expression2969); ref54=ref(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e = ref54; ref54.op = Op.refNot; } } break; case 2 : // ANMLTree.g:865:5: l= expression { pushFollow(FOLLOW_expression_in_expression2979); l=expression(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e = new OpUnary(TypeCode.Boolean,Op.not,l); } } break; } match(input, Token.UP, null); if (state.failed) return e; } break; case 34 : // ANMLTree.g:870:4: ref { pushFollow(FOLLOW_ref_in_expression2995); ref55=ref(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e = ref55; } } break; case 35 : // ANMLTree.g:871:4: ^( Delta ref ) { match(input,Delta,FOLLOW_Delta_in_expression3003); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_ref_in_expression3005); ref(); state._fsp--; if (state.failed) return e; match(input, Token.UP, null); if (state.failed) return e; } break; case 36 : // ANMLTree.g:872:4: literal { pushFollow(FOLLOW_literal_in_expression3011); literal56=literal(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e = literal56; } } break; case 37 : // ANMLTree.g:873:4: time_primitive { pushFollow(FOLLOW_time_primitive_in_expression3018); time_primitive57=time_primitive(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e = time_primitive57; } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return e; } // $ANTLR end "expression" // $ANTLR start "ref" // ANMLTree.g:876:1: ref returns [OpUnary e] : ( identifier_ref | field_ref | term_ref ); public final OpUnary ref() throws RecognitionException { OpUnary e = null; Identifier<?,?> identifier_ref58 = null; Expression field_ref59 = null; Expression term_ref60 = null; e = new OpUnary(TypeCode.Boolean,Op.ref,null); try { // ANMLTree.g:878:1: ( identifier_ref | field_ref | term_ref ) int alt53=3; switch ( input.LA(1) ) { case Ref: { alt53=1; } break; case Access: { alt53=2; } break; case Bind: { alt53=3; } break; default: if (state.backtracking>0) {state.failed=true; return e;} NoViableAltException nvae = new NoViableAltException("", 53, 0, input); throw nvae; } switch (alt53) { case 1 : // ANMLTree.g:879:4: identifier_ref { pushFollow(FOLLOW_identifier_ref_in_ref3041); identifier_ref58=identifier_ref(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e.exp = identifier_ref58; e.baseType = e.exp.typeCode(); } } break; case 2 : // ANMLTree.g:880:4: field_ref { pushFollow(FOLLOW_field_ref_in_ref3048); field_ref59=field_ref(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e.exp = field_ref59; e.baseType = e.exp.typeCode(); } } break; case 3 : // ANMLTree.g:881:4: term_ref { pushFollow(FOLLOW_term_ref_in_ref3055); term_ref60=term_ref(); state._fsp--; if (state.failed) return e; if ( state.backtracking==0 ) { e.exp = term_ref60; e.baseType = e.exp.typeCode(); } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return e; } // $ANTLR end "ref" // $ANTLR start "identifier_ref" // ANMLTree.g:884:1: identifier_ref returns [Identifier<?,?> i] : ^( Ref id ) ; public final Identifier<?,?> identifier_ref() throws RecognitionException { Identifier<?,?> i = null; SimpleString id61 = null; try { // ANMLTree.g:885:1: ( ^( Ref id ) ) // ANMLTree.g:886:2: ^( Ref id ) { match(input,Ref,FOLLOW_Ref_in_identifier_ref3073); if (state.failed) return i; match(input, Token.DOWN, null); if (state.failed) return i; pushFollow(FOLLOW_id_in_identifier_ref3075); id61=id(); state._fsp--; if (state.failed) return i; match(input, Token.UP, null); if (state.failed) return i; if ( state.backtracking==0 ) { i =((S_scope)S_stack.peek()).d.resolveSymbol(id61); if (i == null) { System.err.println("Undeclared identifier in " + ((A_scope)A_stack.peek()).d.name() + ": " + id61); ((S_scope)S_stack.peek()).d.addSymbol(i=new SymbolLiteral(id61)); } //System.out.println(((Domain)((A_scope)A_stack.peek()).d.parent).name()); } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return i; } // $ANTLR end "identifier_ref" // $ANTLR start "field_ref" // ANMLTree.g:897:1: field_ref returns [Expression f] : ^( Access ref identifier_ref ) ; public final Expression field_ref() throws RecognitionException { Expression f = null; Identifier<?,?> identifier_ref62 = null; try { // ANMLTree.g:898:1: ( ^( Access ref identifier_ref ) ) // ANMLTree.g:899:2: ^( Access ref identifier_ref ) { match(input,Access,FOLLOW_Access_in_field_ref3094); if (state.failed) return f; match(input, Token.DOWN, null); if (state.failed) return f; pushFollow(FOLLOW_ref_in_field_ref3096); ref(); state._fsp--; if (state.failed) return f; pushFollow(FOLLOW_identifier_ref_in_field_ref3098); identifier_ref62=identifier_ref(); state._fsp--; if (state.failed) return f; match(input, Token.UP, null); if (state.failed) return f; if ( state.backtracking==0 ) { f = identifier_ref62; } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return f; } // $ANTLR end "field_ref" // $ANTLR start "term_ref" // ANMLTree.g:907:1: term_ref returns [Expression t] : ^( Bind r= identifier_ref bind_arg_list[b] ) ; public final Expression term_ref() throws RecognitionException { Expression t = null; Identifier<?,?> r = null; Bind<?,?,?> b=null; LabeledExpression l; try { // ANMLTree.g:909:1: ( ^( Bind r= identifier_ref bind_arg_list[b] ) ) // ANMLTree.g:910:2: ^( Bind r= identifier_ref bind_arg_list[b] ) { match(input,Bind,FOLLOW_Bind_in_term_ref3124); if (state.failed) return t; match(input, Token.DOWN, null); if (state.failed) return t; pushFollow(FOLLOW_identifier_ref_in_term_ref3128); r=identifier_ref(); state._fsp--; if (state.failed) return t; if ( state.backtracking==0 ) { switch (r.idCode()) { case Action: ActionReference ar; t = b = ar = new ActionReference((Action) r); if (((A_scope)A_stack.peek()).d.labels.get(r.name()) == null) { l = new LabeledExpression(r.name(),ar); ((A_scope)A_stack.peek()).d.labels.put(l); } break; case FluentFunction: t = b = new FluentFunctionReference((FluentFunction)r); break; case ConstantFunction: t = b = new ConstantFunctionReference((ConstantFunction)r); break; // just in case we (partially) realize that a 0-arity function is not a function case Fluent: t = r; break; case Constant: t = r; break; default: t = null; } } pushFollow(FOLLOW_bind_arg_list_in_term_ref3135); bind_arg_list(b); state._fsp--; if (state.failed) return t; match(input, Token.UP, null); if (state.failed) return t; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return t; } // $ANTLR end "term_ref" // $ANTLR start "bind_arg_list" // ANMLTree.g:942:1: bind_arg_list[Bind<?,?,?> b] : ( ^( Arguments ( expression )* ) | Arguments ); public final void bind_arg_list(Bind<?,?,?> b) throws RecognitionException { Expression<?,?> expression63 = null; try { // ANMLTree.g:943:1: ( ^( Arguments ( expression )* ) | Arguments ) int alt55=2; int LA55_0 = input.LA(1); if ( (LA55_0==Arguments) ) { int LA55_1 = input.LA(2); if ( (LA55_1==DOWN) ) { alt55=1; } else if ( (LA55_1==UP) ) { alt55=2; } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 55, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return ;} NoViableAltException nvae = new NoViableAltException("", 55, 0, input); throw nvae; } switch (alt55) { case 1 : // ANMLTree.g:944:2: ^( Arguments ( expression )* ) { match(input,Arguments,FOLLOW_Arguments_in_bind_arg_list3154); if (state.failed) return ; if ( input.LA(1)==Token.DOWN ) { match(input, Token.DOWN, null); if (state.failed) return ; // ANMLTree.g:944:14: ( expression )* loop54: do { int alt54=2; int LA54_0 = input.LA(1); if ( ((LA54_0>=LabelRef && LA54_0<=Access)||LA54_0==Label||(LA54_0>=Bra && LA54_0<=Ket)||LA54_0==TimedExpr||(LA54_0>=ContainsSomeExpr && LA54_0<=ContainsAllExpr)||LA54_0==ExistsExpr||LA54_0==ID||(LA54_0>=LessThan && LA54_0<=Assign)||LA54_0==Undefine||(LA54_0>=NotLog && LA54_0<=Equal)||LA54_0==Duration||(LA54_0>=Change && LA54_0<=Delta)||(LA54_0>=Implies && LA54_0<=Ordered)||(LA54_0>=Start && LA54_0<=GreaterThanE)||LA54_0==ForallExpr) ) { alt54=1; } switch (alt54) { case 1 : // ANMLTree.g:944:15: expression { pushFollow(FOLLOW_expression_in_bind_arg_list3157); expression63=expression(); state._fsp--; if (state.failed) return ; if ( state.backtracking==0 ) { b.addArgument((Expression<? extends SimpleObject<?>,?>)expression63); } } break; default : break loop54; } } while (true); match(input, Token.UP, null); if (state.failed) return ; } } break; case 2 : // ANMLTree.g:945:4: Arguments { match(input,Arguments,FOLLOW_Arguments_in_bind_arg_list3168); if (state.failed) return ; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "bind_arg_list" // $ANTLR start "time_primitive" // ANMLTree.g:949:1: time_primitive returns [Expression e] : ( ^( LabelRef id ( Start | End | Duration | Bra | Ket ) ) | Start | End | Duration | Bra | Ket ); public final Expression time_primitive() throws RecognitionException { Expression e = null; SimpleString id64 = null; try { // ANMLTree.g:950:2: ( ^( LabelRef id ( Start | End | Duration | Bra | Ket ) ) | Start | End | Duration | Bra | Ket ) int alt57=6; switch ( input.LA(1) ) { case LabelRef: { alt57=1; } break; case Start: { alt57=2; } break; case End: { alt57=3; } break; case Duration: { alt57=4; } break; case Bra: { alt57=5; } break; case Ket: { alt57=6; } break; default: if (state.backtracking>0) {state.failed=true; return e;} NoViableAltException nvae = new NoViableAltException("", 57, 0, input); throw nvae; } switch (alt57) { case 1 : // ANMLTree.g:950:4: ^( LabelRef id ( Start | End | Duration | Bra | Ket ) ) { match(input,LabelRef,FOLLOW_LabelRef_in_time_primitive3184); if (state.failed) return e; match(input, Token.DOWN, null); if (state.failed) return e; pushFollow(FOLLOW_id_in_time_primitive3186); id64=id(); state._fsp--; if (state.failed) return e; // ANMLTree.g:951:4: ( Start | End | Duration | Bra | Ket ) int alt56=5; switch ( input.LA(1) ) { case Start: { alt56=1; } break; case End: { alt56=2; } break; case Duration: { alt56=3; } break; case Bra: { alt56=4; } break; case Ket: { alt56=5; } break; default: if (state.backtracking>0) {state.failed=true; return e;} NoViableAltException nvae = new NoViableAltException("", 56, 0, input); throw nvae; } switch (alt56) { case 1 : // ANMLTree.g:951:6: Start { match(input,Start,FOLLOW_Start_in_time_primitive3194); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((A_scope)A_stack.peek()).d.labels.get(id64).getStart(); } } break; case 2 : // ANMLTree.g:952:6: End { match(input,End,FOLLOW_End_in_time_primitive3203); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((A_scope)A_stack.peek()).d.labels.get(id64).getEnd(); } } break; case 3 : // ANMLTree.g:953:6: Duration { match(input,Duration,FOLLOW_Duration_in_time_primitive3212); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((A_scope)A_stack.peek()).d.labels.get(id64).getDuration(); } } break; case 4 : // ANMLTree.g:954:6: Bra { match(input,Bra,FOLLOW_Bra_in_time_primitive3221); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((A_scope)A_stack.peek()).d.labels.get(id64).getBra(); } } break; case 5 : // ANMLTree.g:955:6: Ket { match(input,Ket,FOLLOW_Ket_in_time_primitive3230); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((A_scope)A_stack.peek()).d.labels.get(id64).getKet(); } } break; } match(input, Token.UP, null); if (state.failed) return e; } break; case 2 : // ANMLTree.g:958:4: Start { match(input,Start,FOLLOW_Start_in_time_primitive3246); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((I_scope)I_stack.peek()).i.getStart(); } } break; case 3 : // ANMLTree.g:959:4: End { match(input,End,FOLLOW_End_in_time_primitive3253); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((I_scope)I_stack.peek()).i.getEnd(); } } break; case 4 : // ANMLTree.g:960:4: Duration { match(input,Duration,FOLLOW_Duration_in_time_primitive3261); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((I_scope)I_stack.peek()).i.getDuration(); } } break; case 5 : // ANMLTree.g:961:4: Bra { match(input,Bra,FOLLOW_Bra_in_time_primitive3268); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((I_scope)I_stack.peek()).i.getBra(); } } break; case 6 : // ANMLTree.g:962:4: Ket { match(input,Ket,FOLLOW_Ket_in_time_primitive3275); if (state.failed) return e; if ( state.backtracking==0 ) { e = ((I_scope)I_stack.peek()).i.getKet(); } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return e; } // $ANTLR end "time_primitive" // $ANTLR start "set" // ANMLTree.g:965:1: set returns [Constraint constraint] : ( enumeration | range ); public final Constraint set() throws RecognitionException { Constraint constraint = null; ANMLTree.enumeration_return enumeration65 = null; Range range66 = null; try { // ANMLTree.g:966:1: ( enumeration | range ) int alt58=2; int LA58_0 = input.LA(1); if ( (LA58_0==Enum) ) { alt58=1; } else if ( (LA58_0==Range) ) { alt58=2; } else { if (state.backtracking>0) {state.failed=true; return constraint;} NoViableAltException nvae = new NoViableAltException("", 58, 0, input); throw nvae; } switch (alt58) { case 1 : // ANMLTree.g:967:4: enumeration { pushFollow(FOLLOW_enumeration_in_set3295); enumeration65=enumeration(); state._fsp--; if (state.failed) return constraint; if ( state.backtracking==0 ) { constraint = (enumeration65!=null?enumeration65.constraint:null); } } break; case 2 : // ANMLTree.g:968:4: range { pushFollow(FOLLOW_range_in_set3302); range66=range(); state._fsp--; if (state.failed) return constraint; if ( state.backtracking==0 ) { constraint = range66; } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return constraint; } // $ANTLR end "set" public static class enumeration_return extends TreeRuleReturnScope { public Enumeration constraint; public TypeCode typeCode; }; // $ANTLR start "enumeration" // ANMLTree.g:971:1: enumeration returns [Enumeration constraint, TypeCode typeCode] : ^( Enum f= expression (n= expression )* ) ; public final ANMLTree.enumeration_return enumeration() throws RecognitionException { ANMLTree.enumeration_return retval = new ANMLTree.enumeration_return(); retval.start = input.LT(1); Expression<?,?> f = null; Expression<?,?> n = null; Expression<?,?> e; try { // ANMLTree.g:973:1: ( ^( Enum f= expression (n= expression )* ) ) // ANMLTree.g:974:2: ^( Enum f= expression (n= expression )* ) { match(input,Enum,FOLLOW_Enum_in_enumeration3325); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval; pushFollow(FOLLOW_expression_in_enumeration3329); f=expression(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) { e = f; retval.typeCode = e.typeCode(); retval.constraint = new Enumeration(); retval.constraint.add(e.value(null)); } // ANMLTree.g:980:3: (n= expression )* loop59: do { int alt59=2; int LA59_0 = input.LA(1); if ( ((LA59_0>=LabelRef && LA59_0<=Access)||LA59_0==Label||(LA59_0>=Bra && LA59_0<=Ket)||LA59_0==TimedExpr||(LA59_0>=ContainsSomeExpr && LA59_0<=ContainsAllExpr)||LA59_0==ExistsExpr||LA59_0==ID||(LA59_0>=LessThan && LA59_0<=Assign)||LA59_0==Undefine||(LA59_0>=NotLog && LA59_0<=Equal)||LA59_0==Duration||(LA59_0>=Change && LA59_0<=Delta)||(LA59_0>=Implies && LA59_0<=Ordered)||(LA59_0>=Start && LA59_0<=GreaterThanE)||LA59_0==ForallExpr) ) { alt59=1; } switch (alt59) { case 1 : // ANMLTree.g:980:4: n= expression { pushFollow(FOLLOW_expression_in_enumeration3339); n=expression(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) { e = n; retval.constraint.add(e.value(null)); } } break; default : break loop59; } } while (true); match(input, Token.UP, null); if (state.failed) return retval; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end "enumeration" // $ANTLR start "range" // ANMLTree.g:988:1: range returns [Range constraint] : ^( Range l= expression h= expression ) ; public final Range range() throws RecognitionException { Range constraint = null; Expression<?,?> l = null; Expression<?,?> h = null; try { // ANMLTree.g:989:1: ( ^( Range l= expression h= expression ) ) // ANMLTree.g:990:2: ^( Range l= expression h= expression ) { match(input,Range,FOLLOW_Range_in_range3365); if (state.failed) return constraint; match(input, Token.DOWN, null); if (state.failed) return constraint; pushFollow(FOLLOW_expression_in_range3369); l=expression(); state._fsp--; if (state.failed) return constraint; pushFollow(FOLLOW_expression_in_range3373); h=expression(); state._fsp--; if (state.failed) return constraint; if ( state.backtracking==0 ) { constraint = new Range<SimpleObject>((SimpleObject)l.value(null),(SimpleObject)h.value(null)); } match(input, Token.UP, null); if (state.failed) return constraint; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return constraint; } // $ANTLR end "range" // $ANTLR start "literal" // ANMLTree.g:996:1: literal returns [Expression e] : (t= INT | t= FLOAT | t= STRING | t= True | t= False | t= Infinity | t= ID ); public final Expression literal() throws RecognitionException { Expression e = null; ANMLToken t=null; try { // ANMLTree.g:997:2: (t= INT | t= FLOAT | t= STRING | t= True | t= False | t= Infinity | t= ID ) int alt60=7; switch ( input.LA(1) ) { case INT: { alt60=1; } break; case FLOAT: { alt60=2; } break; case STRING: { alt60=3; } break; case True: { alt60=4; } break; case False: { alt60=5; } break; case Infinity: { alt60=6; } break; case ID: { alt60=7; } break; default: if (state.backtracking>0) {state.failed=true; return e;} NoViableAltException nvae = new NoViableAltException("", 60, 0, input); throw nvae; } switch (alt60) { case 1 : // ANMLTree.g:997:4: t= INT { t=(ANMLToken)match(input,INT,FOLLOW_INT_in_literal3395); if (state.failed) return e; if ( state.backtracking==0 ) { e = ANMLInteger.make(java.lang.Integer.parseInt(t.getText())); } } break; case 2 : // ANMLTree.g:998:4: t= FLOAT { t=(ANMLToken)match(input,FLOAT,FOLLOW_FLOAT_in_literal3404); if (state.failed) return e; if ( state.backtracking==0 ) { e = ANMLFloat.make(java.lang.Float.parseFloat(t.getText())); } } break; case 3 : // ANMLTree.g:999:4: t= STRING { t=(ANMLToken)match(input,STRING,FOLLOW_STRING_in_literal3413); if (state.failed) return e; if ( state.backtracking==0 ) { e = ANMLString.make(t.getSimpleText().v); } } break; case 4 : // ANMLTree.g:1000:4: t= True { t=(ANMLToken)match(input,True,FOLLOW_True_in_literal3423); if (state.failed) return e; if ( state.backtracking==0 ) { e = ANMLBoolean.True; } } break; case 5 : // ANMLTree.g:1001:4: t= False { t=(ANMLToken)match(input,False,FOLLOW_False_in_literal3432); if (state.failed) return e; if ( state.backtracking==0 ) { e = ANMLBoolean.False; } } break; case 6 : // ANMLTree.g:1002:4: t= Infinity { t=(ANMLToken)match(input,Infinity,FOLLOW_Infinity_in_literal3441); if (state.failed) return e; if ( state.backtracking==0 ) { e = ANMLFloat.PInf; } } break; case 7 : // ANMLTree.g:1003:4: t= ID { t=(ANMLToken)match(input,ID,FOLLOW_ID_in_literal3451); if (state.failed) return e; if ( state.backtracking==0 ) { e = ANMLString.make(t.getSimpleText().v); } } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return e; } // $ANTLR end "literal" // $ANTLR start synpred1_ANMLTree public final void synpred1_ANMLTree_fragment() throws RecognitionException { // ANMLTree.g:861:5: ( ref ) // ANMLTree.g:861:6: ref { pushFollow(FOLLOW_ref_in_synpred1_ANMLTree2965); ref(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred1_ANMLTree // Delegated rules public final boolean synpred1_ANMLTree() { state.backtracking++; int start = input.mark(); try { synpred1_ANMLTree_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } protected DFA16 dfa16 = new DFA16(this); protected DFA51 dfa51 = new DFA51(this); static final String DFA16_eotS = "\14\uffff"; static final String DFA16_eofS = "\14\uffff"; static final String DFA16_minS = "\1\15\1\2\1\70\6\3\3\uffff"; static final String DFA16_maxS = "\1\15\1\2\1\77\6\67\3\uffff"; static final String DFA16_acceptS = "\11\uffff\1\3\1\1\1\2"; static final String DFA16_specialS = "\14\uffff}>"; static final String[] DFA16_transitionS = { "\1\1", "\1\2", "\2\11\1\3\1\4\1\5\1\6\1\7\1\10", "\1\12\62\uffff\2\13", "\1\12\62\uffff\2\13", "\1\12\62\uffff\2\13", "\1\12\62\uffff\2\13", "\1\12\62\uffff\2\13", "\1\12\62\uffff\2\13", "", "", "" }; static final short[] DFA16_eot = DFA.unpackEncodedString(DFA16_eotS); static final short[] DFA16_eof = DFA.unpackEncodedString(DFA16_eofS); static final char[] DFA16_min = DFA.unpackEncodedStringToUnsignedChars(DFA16_minS); static final char[] DFA16_max = DFA.unpackEncodedStringToUnsignedChars(DFA16_maxS); static final short[] DFA16_accept = DFA.unpackEncodedString(DFA16_acceptS); static final short[] DFA16_special = DFA.unpackEncodedString(DFA16_specialS); static final short[][] DFA16_transition; static { int numStates = DFA16_transitionS.length; DFA16_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA16_transition[i] = DFA.unpackEncodedString(DFA16_transitionS[i]); } } class DFA16 extends DFA { public DFA16(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 16; this.eot = DFA16_eot; this.eof = DFA16_eof; this.min = DFA16_min; this.max = DFA16_max; this.accept = DFA16_accept; this.special = DFA16_special; this.transition = DFA16_transition; } public String getDescription() { return "313:1: type_ref returns [Type d] : ( ^( TypeRef builtinType ) | ^( TypeRef builtinType set ) | ^( TypeRef id ) );"; } } static final String DFA51_eotS = "\64\uffff"; static final String DFA51_eofS = "\64\uffff"; static final String DFA51_minS = "\1\16\3\0\60\uffff"; static final String DFA51_maxS = "\1\u0089\3\0\60\uffff"; static final String DFA51_acceptS = "\4\uffff\1\2\56\uffff\1\1"; static final String DFA51_specialS = "\1\uffff\1\0\1\1\1\2\60\uffff}>"; static final String[] DFA51_transitionS = { "\1\4\1\1\1\3\1\2\10\uffff\1\4\4\uffff\2\4\12\uffff\1\4\2\uffff"+ "\2\4\2\uffff\1\4\5\uffff\1\4\11\uffff\2\4\4\uffff\1\4\7\uffff"+ "\4\4\2\uffff\1\4\6\uffff\11\4\3\uffff\15\4\1\uffff\14\4\6\uffff"+ "\1\4", "\1\uffff", "\1\uffff", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA51_eot = DFA.unpackEncodedString(DFA51_eotS); static final short[] DFA51_eof = DFA.unpackEncodedString(DFA51_eofS); static final char[] DFA51_min = DFA.unpackEncodedStringToUnsignedChars(DFA51_minS); static final char[] DFA51_max = DFA.unpackEncodedStringToUnsignedChars(DFA51_maxS); static final short[] DFA51_accept = DFA.unpackEncodedString(DFA51_acceptS); static final short[] DFA51_special = DFA.unpackEncodedString(DFA51_specialS); static final short[][] DFA51_transition; static { int numStates = DFA51_transitionS.length; DFA51_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA51_transition[i] = DFA.unpackEncodedString(DFA51_transitionS[i]); } } class DFA51 extends DFA { public DFA51(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 51; this.eot = DFA51_eot; this.eof = DFA51_eof; this.min = DFA51_min; this.max = DFA51_max; this.accept = DFA51_accept; this.special = DFA51_special; this.transition = DFA51_transition; } public String getDescription() { return "861:3: ( ( ref )=> ref | l= expression )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TreeNodeStream input = (TreeNodeStream)_input; int _s = s; switch ( s ) { case 0 : int LA51_1 = input.LA(1); int index51_1 = input.index(); input.rewind(); s = -1; if ( (synpred1_ANMLTree()) ) {s = 51;} else if ( (true) ) {s = 4;} input.seek(index51_1); if ( s>=0 ) return s; break; case 1 : int LA51_2 = input.LA(1); int index51_2 = input.index(); input.rewind(); s = -1; if ( (synpred1_ANMLTree()) ) {s = 51;} else if ( (true) ) {s = 4;} input.seek(index51_2); if ( s>=0 ) return s; break; case 2 : int LA51_3 = input.LA(1); int index51_3 = input.index(); input.rewind(); s = -1; if ( (synpred1_ANMLTree()) ) {s = 51;} else if ( (true) ) {s = 4;} input.seek(index51_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 51, _s, input); error(nvae); throw nvae; } } public static final BitSet FOLLOW_Block_in_model138 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_types_in_model143 = new BitSet(new long[]{0x0000000000000020L}); public static final BitSet FOLLOW_constants_in_model148 = new BitSet(new long[]{0x0000000000000040L}); public static final BitSet FOLLOW_fluents_in_model153 = new BitSet(new long[]{0x0000000000000080L}); public static final BitSet FOLLOW_actions_in_model158 = new BitSet(new long[]{0x0000000000000400L}); public static final BitSet FOLLOW_stmts_in_model163 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Parameter_in_term_arg_decl_list181 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_term_arg_decl_list183 = new BitSet(new long[]{0x0000000000002000L}); public static final BitSet FOLLOW_type_ref_in_term_arg_decl_list185 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Parameter_in_scope_arg_decl_list211 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_scope_arg_decl_list213 = new BitSet(new long[]{0x0000000000002000L}); public static final BitSet FOLLOW_type_ref_in_scope_arg_decl_list215 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Boolean_in_builtinType250 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Integer_in_builtinType259 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Float_in_builtinType268 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Symbol_in_builtinType277 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_String_in_builtinType286 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Object_in_builtinType295 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_id319 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_This_in_id329 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Vector_in_type_spec355 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_Parameters_in_type_spec367 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_term_arg_decl_list_in_type_spec369 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Parameters_in_type_spec375 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TypeRef_in_type_spec389 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_builtinType_in_type_spec391 = new BitSet(new long[]{0x00C0000000000008L}); public static final BitSet FOLLOW_set_in_type_spec404 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TypeRef_in_type_spec420 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_type_spec422 = new BitSet(new long[]{0x00C0000000000008L}); public static final BitSet FOLLOW_set_in_type_spec438 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_enumeration_in_type_spec453 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Type_in_type_decl473 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_type_decl475 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_Assign_in_type_decl483 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L}); public static final BitSet FOLLOW_Assign_in_type_decl492 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_type_spec_in_type_decl494 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_LessThan_in_type_decl508 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000010L}); public static final BitSet FOLLOW_LessThan_in_type_decl515 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_type_ref_in_type_decl520 = new BitSet(new long[]{0x0000000000002008L}); public static final BitSet FOLLOW_With_in_type_decl544 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_With_in_type_decl553 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_object_block_in_type_decl560 = new BitSet(new long[]{0x0000000000000808L}); public static final BitSet FOLLOW_TypeRefine_in_type_refine586 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_type_ref_in_type_refine590 = new BitSet(new long[]{0x0300000000000000L,0x000000000000001CL}); public static final BitSet FOLLOW_Assign_in_type_refine598 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_type_spec_in_type_refine600 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_LessThan_in_type_refine610 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_type_ref_in_type_refine614 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_With_in_type_refine623 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_object_block_in_type_refine625 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_id_in_type_refine634 = new BitSet(new long[]{0x0300000000000008L,0x000000000000001CL}); public static final BitSet FOLLOW_TypeRef_in_type_ref677 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_builtinType_in_type_ref679 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TypeRef_in_type_ref688 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_builtinType_in_type_ref690 = new BitSet(new long[]{0x00C0000000000000L}); public static final BitSet FOLLOW_set_in_type_ref692 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TypeRef_in_type_ref701 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_type_ref703 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Constant_in_const_decl748 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_const_decl750 = new BitSet(new long[]{0x0000000000002000L}); public static final BitSet FOLLOW_type_ref_in_const_decl756 = new BitSet(new long[]{0x0104C8018403C008L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_const_decl761 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ConstantFunction_in_const_decl776 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_const_decl778 = new BitSet(new long[]{0x0000000000002000L}); public static final BitSet FOLLOW_type_ref_in_const_decl784 = new BitSet(new long[]{0x0000000000000100L}); public static final BitSet FOLLOW_Parameters_in_const_decl796 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_term_arg_decl_list_in_const_decl798 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Parameters_in_const_decl804 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Fluent_in_fluent_decl827 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_fluent_decl829 = new BitSet(new long[]{0x0000000000002000L}); public static final BitSet FOLLOW_type_ref_in_fluent_decl835 = new BitSet(new long[]{0x0104C8018403C008L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_fluent_decl840 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_FluentFunction_in_fluent_decl855 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_fluent_decl857 = new BitSet(new long[]{0x0000000000002000L}); public static final BitSet FOLLOW_type_ref_in_fluent_decl863 = new BitSet(new long[]{0x0000000000000100L}); public static final BitSet FOLLOW_Parameters_in_fluent_decl874 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_term_arg_decl_list_in_fluent_decl876 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Parameters_in_fluent_decl882 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Block_in_object_block917 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_types_in_object_block924 = new BitSet(new long[]{0x0000000000000020L}); public static final BitSet FOLLOW_constants_in_object_block930 = new BitSet(new long[]{0x0000000000000040L}); public static final BitSet FOLLOW_fluents_in_object_block936 = new BitSet(new long[]{0x0000000000000080L}); public static final BitSet FOLLOW_actions_in_object_block942 = new BitSet(new long[]{0x0000000000000400L}); public static final BitSet FOLLOW_stmts_in_object_block948 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Action_in_action_decl974 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_action_decl976 = new BitSet(new long[]{0x0000000000000100L}); public static final BitSet FOLLOW_Parameters_in_action_decl984 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_scope_arg_decl_list_in_action_decl986 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Parameters_in_action_decl992 = new BitSet(new long[]{0x0000000000000010L,0x0000000000400000L}); public static final BitSet FOLLOW_start_parameter_in_action_decl998 = new BitSet(new long[]{0x0000000000000010L,0x0000000000400000L}); public static final BitSet FOLLOW_duration_parameter_in_action_decl1003 = new BitSet(new long[]{0x0000000000000010L,0x0000000000400000L}); public static final BitSet FOLLOW_action_block_in_action_decl1011 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Duration_in_duration_parameter1063 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_types_in_action_block1091 = new BitSet(new long[]{0x0000000000000020L}); public static final BitSet FOLLOW_constants_in_action_block1094 = new BitSet(new long[]{0x0000000000000040L}); public static final BitSet FOLLOW_fluents_in_action_block1097 = new BitSet(new long[]{0x0000000000000080L}); public static final BitSet FOLLOW_actions_in_action_block1100 = new BitSet(new long[]{0x0000000000000400L}); public static final BitSet FOLLOW_stmts_in_action_block1103 = new BitSet(new long[]{0x0000000000001000L}); public static final BitSet FOLLOW_decompositions_in_action_block1106 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Types_in_types1117 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_type_decl_in_types1120 = new BitSet(new long[]{0x00000000000C0008L}); public static final BitSet FOLLOW_type_refine_in_types1122 = new BitSet(new long[]{0x00000000000C0008L}); public static final BitSet FOLLOW_Types_in_types1130 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Constants_in_constants1140 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_const_decl_in_constants1142 = new BitSet(new long[]{0x0000000000C00008L}); public static final BitSet FOLLOW_Constants_in_constants1150 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Fluents_in_fluents1160 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_fluent_decl_in_fluents1162 = new BitSet(new long[]{0x0000000000300008L}); public static final BitSet FOLLOW_Fluents_in_fluents1170 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Actions_in_actions1181 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_action_decl_in_actions1183 = new BitSet(new long[]{0x0000000002000008L}); public static final BitSet FOLLOW_Actions_in_actions1190 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Stmts_in_stmts1201 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_stmts_helper_in_stmts1203 = new BitSet(new long[]{0x013EFE018403C808L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_Stmts_in_stmts1211 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_in_stmts_helper1219 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Decompositions_in_decompositions1232 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_decomps_helper_in_decompositions1234 = new BitSet(new long[]{0x0000000000000808L}); public static final BitSet FOLLOW_Decompositions_in_decompositions1242 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_decomp_in_decomps_helper1250 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Block_in_decomp1274 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_types_in_decomp1281 = new BitSet(new long[]{0x0000000000000020L}); public static final BitSet FOLLOW_constants_in_decomp1285 = new BitSet(new long[]{0x0000000000000040L}); public static final BitSet FOLLOW_fluents_in_decomp1289 = new BitSet(new long[]{0x0000000000000080L}); public static final BitSet FOLLOW_actions_in_decomp1293 = new BitSet(new long[]{0x0000000000000400L}); public static final BitSet FOLLOW_stmts_in_decomp1297 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Block_in_block1323 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_types_in_block1330 = new BitSet(new long[]{0x0000000000000020L}); public static final BitSet FOLLOW_constants_in_block1334 = new BitSet(new long[]{0x0000000000000040L}); public static final BitSet FOLLOW_fluents_in_block1338 = new BitSet(new long[]{0x0000000000000080L}); public static final BitSet FOLLOW_actions_in_block1342 = new BitSet(new long[]{0x0000000000000400L}); public static final BitSet FOLLOW_stmts_in_block1346 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Block_in_sub_block1372 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_types_in_sub_block1377 = new BitSet(new long[]{0x0000000000000020L}); public static final BitSet FOLLOW_constants_in_sub_block1381 = new BitSet(new long[]{0x0000000000000040L}); public static final BitSet FOLLOW_fluents_in_sub_block1385 = new BitSet(new long[]{0x0000000000000080L}); public static final BitSet FOLLOW_actions_in_sub_block1389 = new BitSet(new long[]{0x0000000000000400L}); public static final BitSet FOLLOW_stmts_in_sub_block1393 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_simple_stmt_in_stmt1412 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_block_in_stmt1419 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_in_timed_stmt1447 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_When_in_simple_stmt1470 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_simple_stmt1474 = new BitSet(new long[]{0x013EFE018403C808L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_stmt_in_simple_stmt1478 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_WhenElse_in_simple_stmt1487 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_simple_stmt1491 = new BitSet(new long[]{0x013EFE018403C808L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_stmt_in_simple_stmt1495 = new BitSet(new long[]{0x013EFE018403C808L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_stmt_in_simple_stmt1499 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ForAllStmt_in_simple_stmt1508 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_Parameters_in_simple_stmt1519 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_scope_arg_decl_list_in_simple_stmt1521 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_sub_block_in_simple_stmt1533 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_simple_stmt_in_simple_stmt1545 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ExistsStmt_in_simple_stmt1565 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_Parameters_in_simple_stmt1576 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_scope_arg_decl_list_in_simple_stmt1578 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_sub_block_in_simple_stmt1589 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_simple_stmt_in_simple_stmt1603 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ContainsSomeStmt_in_simple_stmt1623 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_interval_in_simple_stmt1625 = new BitSet(new long[]{0x013EFE018403C808L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_timed_stmt_in_simple_stmt1628 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ContainsAllStmt_in_simple_stmt1636 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_stmt_in_simple_stmt1638 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TimedStmt_in_simple_stmt1645 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_interval_in_simple_stmt1653 = new BitSet(new long[]{0x013EFE018403C808L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_timed_stmt_in_simple_stmt1656 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Chain_in_simple_stmt1669 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_chain_stmt_in_simple_stmt1671 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_expression_in_simple_stmt1681 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_interval_in_chain_stmt1705 = new BitSet(new long[]{0x0000000000038000L}); public static final BitSet FOLLOW_ref_in_chain_stmt1708 = new BitSet(new long[]{0x0000000000000000L,0x8000001FE008010CL,0x0000000000000007L}); public static final BitSet FOLLOW_Equal_in_chain_stmt1716 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1720 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_NotEqual_in_chain_stmt1729 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1733 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_LessThan_in_chain_stmt1742 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1746 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_GreaterThan_in_chain_stmt1755 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1759 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_LessThanE_in_chain_stmt1768 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1772 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_GreaterThanE_in_chain_stmt1781 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1785 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Assign_in_chain_stmt1794 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1798 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Change_in_chain_stmt1807 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1811 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Lend_in_chain_stmt1820 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1824 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Use_in_chain_stmt1833 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1837 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Produce_in_chain_stmt1846 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1850 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Consume_in_chain_stmt1859 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_chain_stmt1863 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_SetAssign_in_chain_stmt1872 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_set_in_chain_stmt1874 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Within_in_chain_stmt1883 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_set_in_chain_stmt1885 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Undefine_in_chain_stmt1893 = new BitSet(new long[]{0x0000000000000002L,0x8000001FE008010CL,0x0000000000000007L}); public static final BitSet FOLLOW_Skip_in_chain_stmt1900 = new BitSet(new long[]{0x0000000000000002L,0x8000001FE008010CL,0x0000000000000007L}); public static final BitSet FOLLOW_expression_in_float_expression1920 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expression_in_boolean_expression1938 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_DefiniteInterval_in_interval1958 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_bra_in_interval1962 = new BitSet(new long[]{0x0000014000000000L}); public static final BitSet FOLLOW_TDuration_in_interval1970 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval1974 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TEnd_in_interval1978 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval1982 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ket_in_interval1987 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TStart_in_interval1997 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval2001 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TDuration_in_interval2013 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval2017 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TEnd_in_interval2031 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval2035 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ket_in_interval2040 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ket_in_interval2055 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TEnd_in_interval2077 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval2081 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ket_in_interval2086 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_DefinitePoint_in_interval2113 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TStart_in_interval2116 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval2120 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_IndefiniteInterval_in_interval2135 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_bra_in_interval2139 = new BitSet(new long[]{0x000001E000000000L}); public static final BitSet FOLLOW_TDuration_in_interval2147 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval2151 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ket_in_interval2156 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TEnd_in_interval2165 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval2169 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ket_in_interval2174 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TStart_in_interval2183 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_float_expression_in_interval2187 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ket_in_interval2192 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ket_in_interval2202 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_IndefinitePoint_in_interval2218 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_TBra_in_bra2236 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_At_in_bra2243 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_After_in_bra2252 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Before_in_bra2261 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_expression_in_bra2269 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TKet_in_ket2295 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_At_in_ket2302 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Before_in_ket2311 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_After_in_ket2320 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_expression_in_ket2328 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_expression_in_timed_expression2366 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Label_in_expression2388 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_expression2390 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2394 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_set_in_expression2403 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2411 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2415 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_NotEqual_in_expression2424 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2428 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2432 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_LessThan_in_expression2441 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2445 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2449 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_GreaterThan_in_expression2458 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2462 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2466 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_LessThanE_in_expression2475 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2479 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2483 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_GreaterThanE_in_expression2492 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2496 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2500 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Assign_in_expression2509 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2513 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2517 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Undefine_in_expression2526 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2530 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Skip_in_expression2538 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Change_in_expression2546 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2550 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2554 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Lend_in_expression2563 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2567 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2571 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Use_in_expression2580 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2584 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2588 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Produce_in_expression2597 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2601 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2605 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Consume_in_expression2614 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2618 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2622 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Within_in_expression2631 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2633 = new BitSet(new long[]{0x00C0000000000000L}); public static final BitSet FOLLOW_set_in_expression2635 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_SetAssign_in_expression2644 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2646 = new BitSet(new long[]{0x00C0000000000000L}); public static final BitSet FOLLOW_set_in_expression2648 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Implies_in_expression2657 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2661 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2665 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_set_in_expression2674 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2682 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2686 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_set_in_expression2695 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2703 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2707 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_set_in_expression2716 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2724 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2728 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Plus_in_expression2737 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2741 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2745 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Minus_in_expression2754 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2758 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2762 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Times_in_expression2771 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2775 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2779 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Divide_in_expression2788 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_expression2792 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_expression2796 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ForallExpr_in_expression2805 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_Parameters_in_expression2814 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_scope_arg_decl_list_in_expression2816 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_expression_in_expression2822 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ExistsExpr_in_expression2831 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_Parameters_in_expression2839 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_scope_arg_decl_list_in_expression2841 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_expression_in_expression2847 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ContainsSomeExpr_in_expression2856 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_interval_in_expression2862 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_timed_expression_in_expression2867 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ContainsAllExpr_in_expression2881 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_boolean_expression_in_expression2885 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_TimedExpr_in_expression2898 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_interval_in_expression2902 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_timed_expression_in_expression2907 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Unordered_in_expression2917 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_boolean_expression_in_expression2924 = new BitSet(new long[]{0x0104C8018403C008L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_Ordered_in_expression2935 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_boolean_expression_in_expression2942 = new BitSet(new long[]{0x0104C8018403C008L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_set_in_expression2953 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ref_in_expression2969 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_expression_in_expression2979 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ref_in_expression2995 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Delta_in_expression3003 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ref_in_expression3005 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_literal_in_expression3011 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_time_primitive_in_expression3018 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_identifier_ref_in_ref3041 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_field_ref_in_ref3048 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_term_ref_in_ref3055 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Ref_in_identifier_ref3073 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_identifier_ref3075 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Access_in_field_ref3094 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ref_in_field_ref3096 = new BitSet(new long[]{0x0000000000008000L}); public static final BitSet FOLLOW_identifier_ref_in_field_ref3098 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Bind_in_term_ref3124 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_identifier_ref_in_term_ref3128 = new BitSet(new long[]{0x0000000000000200L}); public static final BitSet FOLLOW_bind_arg_list_in_term_ref3135 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Arguments_in_bind_arg_list3154 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_bind_arg_list3157 = new BitSet(new long[]{0x0104C8018403C008L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_Arguments_in_bind_arg_list3168 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LabelRef_in_time_primitive3184 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_id_in_time_primitive3186 = new BitSet(new long[]{0x0000000180000000L,0x0180000000400000L}); public static final BitSet FOLLOW_Start_in_time_primitive3194 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_End_in_time_primitive3203 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Duration_in_time_primitive3212 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Bra_in_time_primitive3221 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Ket_in_time_primitive3230 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_Start_in_time_primitive3246 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_End_in_time_primitive3253 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Duration_in_time_primitive3261 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Bra_in_time_primitive3268 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Ket_in_time_primitive3275 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_enumeration_in_set3295 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_range_in_set3302 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Enum_in_enumeration3325 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_enumeration3329 = new BitSet(new long[]{0x0104C8018403C008L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_enumeration3339 = new BitSet(new long[]{0x0104C8018403C008L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_Range_in_range3365 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_expression_in_range3369 = new BitSet(new long[]{0x0104C8018403C000L,0xFFBFFE3FE04F010CL,0x0000000000000207L}); public static final BitSet FOLLOW_expression_in_range3373 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_INT_in_literal3395 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_FLOAT_in_literal3404 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_STRING_in_literal3413 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_True_in_literal3423 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_False_in_literal3432 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Infinity_in_literal3441 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_literal3451 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ref_in_synpred1_ANMLTree2965 = new BitSet(new long[]{0x0000000000000002L}); }
Java
package gov.nasa.anml.parsing; import org.antlr.runtime.*; import org.antlr.runtime.tree.*; /** A TreeAdaptor that works with any Tree implementation. It provides * really just factory methods; all the work is done by BaseTreeAdaptor. * If you would like to have different tokens created than ClassicToken * objects, you need to override this and then set the parser tree adaptor to * use your subclass. * * To get your parser to build nodes of a different type, override * create(Token). */ public class ANMLTreeAdaptor extends BaseTreeAdaptor { /** Duplicate a node. This is part of the factory; * override if you want another kind of node to be built. * * I could use reflection to prevent having to override this * but reflection is slow. */ public String[] tokenNames=null; public ANMLTreeAdaptor(String[] tokenNames) { this.tokenNames = tokenNames; } public ANMLToken dupNode(Object t) { if ( t==null ) { return null; } return ((ANMLToken)t).dupNode(); } // might not be necessary to copy?? public ANMLToken create(Token payload) { return new ANMLToken(payload); } @Override public ANMLToken create(int tokenType, Token fromToken) { if (tokenType != fromToken.getType()) { ANMLToken tree = new ANMLToken(tokenType,tokenNames[tokenType]+"_l"+fromToken.getLine()+"_c"+fromToken.getCharPositionInLine()); return tree; } return new ANMLToken(fromToken); } @Override public ANMLToken create(int tokenType, String text) { return createToken(tokenType,text); } @Override public ANMLToken create(int tokenType, Token fromToken, String text) { ANMLToken ret = new ANMLToken(fromToken); ret.setType(tokenType); ret.setText(text); return ret; } /** Tell me how to create a token for use with imaginary token nodes. * For example, there is probably no input symbol associated with imaginary * token DECL, but you need to create it as a payload or whatever for * the DECL node as in ^(DECL type ID). * * If you care what the token payload objects' type is, you should * override this method and any other createToken variant. */ @Override public ANMLToken createToken(int tokenType, String text) { return new ANMLToken(tokenType, text); } /** Tell me how to create a token for use with imaginary token nodes. * For example, there is probably no input symbol associated with imaginary * token DECL, but you need to create it as a payload or whatever for * the DECL node as in ^(DECL type ID). * * This is a variant of createToken where the new token is derived from * an actual real input token. Typically this is for converting '{' * tokens to BLOCK etc... You'll see * * r : lc='{' ID+ '}' -> ^(BLOCK[$lc] ID+) ; * * If you care what the token payload objects' type is, you should * override this method and any other createToken variant. */ @Override public ANMLToken createToken(Token fromToken) { return new ANMLToken(fromToken); } /** Track start/stop token for subtree root created for a rule. * Only works with Tree nodes. For rules that match nothing, * seems like this will yield start=i and stop=i-1 in a nil node. * Might be useful info so I'll not force to be i..i. */ public void setTokenBoundaries(Object t, Token startToken, Token stopToken) { if ( t==null ) { return; } int start = 0; int stop = 0; if ( startToken!=null ) { start = startToken.getTokenIndex(); } if ( stopToken!=null ) { stop = stopToken.getTokenIndex(); } ((Tree)t).setTokenStartIndex(start); ((Tree)t).setTokenStopIndex(stop); } public int getTokenStartIndex(Object t) { if ( t==null ) { return -1; } return ((Tree)t).getTokenStartIndex(); } public int getTokenStopIndex(Object t) { if ( t==null ) { return -1; } return ((Tree)t).getTokenStopIndex(); } public String getText(Object t) { if ( t==null ) { return null; } return ((Tree)t).getText(); } public int getType(Object t) { if ( t==null ) { return Token.INVALID_TOKEN_TYPE; } return ((Tree)t).getType(); } /** What is the Token associated with this node? If * you are not using ANMLToken, then you must * override this in your own adaptor. */ public Token getToken(Object t) { if ( t instanceof ANMLToken ) { return ((ANMLToken)t).getToken(); } return null; // no idea what to do } public Object getChild(Object t, int i) { if ( t==null ) { return null; } return ((Tree)t).getChild(i); } public int getChildCount(Object t) { if ( t==null ) { return 0; } return ((Tree)t).getChildCount(); } public Object getParent(Object t) { return ((Tree)t).getParent(); } public void setParent(Object t, Object parent) { ((Tree)t).setParent((Tree)parent); } public int getChildIndex(Object t) { return ((Tree)t).getChildIndex(); } public void setChildIndex(Object t, int index) { ((Tree)t).setChildIndex(index); } public void replaceChildren(Object parent, int startChildIndex, int stopChildIndex, Object t) { if ( parent!=null ) { ((Tree)parent).replaceChildren(startChildIndex, stopChildIndex, t); } } public Object errorNode(TokenStream input, Token start, Token stop, RecognitionException e) { ANMLErrorNode t = new ANMLErrorNode(input, start, stop, e); // System.out.println("returning error node '"+t+"' @index="+input.index()); return t; } }
Java
package gov.nasa.anml.parsing; import java.io.IOException; import gov.nasa.anml.utility.SimpleString; import org.antlr.runtime.*; public class ANMLFileStream extends ANTLRFileStream implements ANMLCharStream { public ANMLFileStream(String fileName) throws IOException { super(fileName); } public ANMLFileStream(String fileName, String encoding) throws IOException { super(fileName, encoding); } public char[] getData() { return data; } public SimpleString makeSimpleString(int start, int stop) { return new SimpleString(data,start,stop+1); } @Override public void consume() { if ( p < n ) { if ( data[p]=='\n' ) { line++; charPositionInLine=0; } else if (data[p]=='\t') { charPositionInLine+=4; } else { charPositionInLine+=1; } p++; } } }
Java
// $ANTLR 3.1.1 ANML.g 2010-06-01 19:37:48 package gov.nasa.anml.parsing; import org.antlr.runtime.*; import java.util.Stack; import java.util.List; import java.util.ArrayList; public class ANMLLexer extends Lexer { public static final int IndefinitePoint=30; public static final int LessThan=66; public static final int Ket=32; public static final int Implies=105; public static final int OrBit=112; public static final int AndLog=108; public static final int TDuration=40; public static final int Stmts=10; public static final int LETTER=133; public static final int Before=33; public static final int Fluents=6; public static final int Constants=5; public static final int Bind=16; public static final int After=35; public static final int DefinitePoint=28; public static final int XorLog=106; public static final int LabelRef=14; public static final int Lend=96; public static final int Actions=7; public static final int EOF=-1; public static final int LessThanE=129; public static final int AndBit=115; public static final int Variable=75; public static final int NotLog=80; public static final int ForAll=91; public static final int When=52; public static final int TEnd=39; public static final int NotBit=81; public static final int Access=17; public static final int Undefined=71; public static final int Use=97; public static final int ContainsAllExpr=47; public static final int ExistsExpr=50; public static final int Decompositions=12; public static final int ForAllStmt=49; public static final int This=57; public static final int ContainsSomeExpr=46; public static final int TimedStmt=42; public static final int DefiniteInterval=27; public static final int Colon=104; public static final int INT=121; public static final int Action=25; public static final int NotEqual=127; public static final int TimedExpr=43; public static final int Equal=83; public static final int Fluent=20; public static final int With=68; public static final int Block=11; public static final int Object=63; public static final int Float=60; public static final int LeftC=78; public static final int Range=55; public static final int Minus=111; public static final int WS=134; public static final int Semi=69; public static final int LeftB=85; public static final int Function=76; public static final int Times=113; public static final int OrLog=107; public static final int MLC=136; public static final int TypeRefine=18; public static final int ExistsStmt=51; public static final int TBra=36; public static final int IndefiniteInterval=29; public static final int Else=90; public static final int Label=26; public static final int ForAllExpr=48; public static final int Types=4; public static final int End=120; public static final int Parameters=8; public static final int Fact=77; public static final int Unordered=116; public static final int Undefine=72; public static final int Within=98; public static final int LeftP=73; public static final int ESC=132; public static final int All=102; public static final int TStart=38; public static final int SLC=135; public static final int Decomposition=88; public static final int False=125; public static final int GreaterThanE=130; public static final int Constant=22; public static final int FLOAT=122; public static final int Enum=54; public static final int ID=56; public static final int GreaterThan=128; public static final int Consume=95; public static final int Arguments=9; public static final int Assign=67; public static final int Change=93; public static final int Chain=41; public static final int TypeRef=13; public static final int Produce=94; public static final int WhenElse=53; public static final int Ordered=117; public static final int ConstantFunction=23; public static final int Bra=31; public static final int Exists=92; public static final int String=62; public static final int Symbol=61; public static final int DIGIT=131; public static final int Predicate=65; public static final int ContainsSomeStmt=44; public static final int True=124; public static final int Vector=64; public static final int RightP=74; public static final int Start=119; public static final int Type=19; public static final int At=34; public static final int Delta=101; public static final int XorBit=109; public static final int Contains=89; public static final int TKet=37; public static final int ContainsAllStmt=45; public static final int RightC=79; public static final int RightB=87; public static final int SetAssign=99; public static final int Duration=86; public static final int Divide=114; public static final int Parameter=24; public static final int Goal=84; public static final int Ref=15; public static final int Skip=100; public static final int Plus=110; public static final int Boolean=58; public static final int Dot=118; public static final int EqualLog=82; public static final int Dots=103; public static final int Infinity=126; public static final int Comma=70; public static final int Integer=59; public static final int STRING=123; public static final int FluentFunction=21; public Token emit() { Token t = new ANMLToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; } // delegates // delegators public ANMLLexer() {;} public ANMLLexer(CharStream input) { this(input, new RecognizerSharedState()); } public ANMLLexer(CharStream input, RecognizerSharedState state) { super(input,state); } public String getGrammarFileName() { return "ANML.g"; } // $ANTLR start "NotLog" public final void mNotLog() throws RecognitionException { try { int _type = NotLog; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:880:7: ( 'not' | 'Not' | 'NOT' ) int alt1=3; int LA1_0 = input.LA(1); if ( (LA1_0=='n') ) { alt1=1; } else if ( (LA1_0=='N') ) { int LA1_2 = input.LA(2); if ( (LA1_2=='o') ) { alt1=2; } else if ( (LA1_2=='O') ) { alt1=3; } else { NoViableAltException nvae = new NoViableAltException("", 1, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 1, 0, input); throw nvae; } switch (alt1) { case 1 : // ANML.g:880:9: 'not' { match("not"); } break; case 2 : // ANML.g:881:4: 'Not' { match("Not"); } break; case 3 : // ANML.g:881:12: 'NOT' { match("NOT"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "NotLog" // $ANTLR start "AndLog" public final void mAndLog() throws RecognitionException { try { int _type = AndLog; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:883:8: ( 'and' | 'And' | 'AND' ) int alt2=3; int LA2_0 = input.LA(1); if ( (LA2_0=='a') ) { alt2=1; } else if ( (LA2_0=='A') ) { int LA2_2 = input.LA(2); if ( (LA2_2=='n') ) { alt2=2; } else if ( (LA2_2=='N') ) { alt2=3; } else { NoViableAltException nvae = new NoViableAltException("", 2, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 2, 0, input); throw nvae; } switch (alt2) { case 1 : // ANML.g:883:10: 'and' { match("and"); } break; case 2 : // ANML.g:884:4: 'And' { match("And"); } break; case 3 : // ANML.g:884:12: 'AND' { match("AND"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "AndLog" // $ANTLR start "OrLog" public final void mOrLog() throws RecognitionException { try { int _type = OrLog; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:886:7: ( 'or' | 'Or' | 'OR' ) int alt3=3; int LA3_0 = input.LA(1); if ( (LA3_0=='o') ) { alt3=1; } else if ( (LA3_0=='O') ) { int LA3_2 = input.LA(2); if ( (LA3_2=='r') ) { alt3=2; } else if ( (LA3_2=='R') ) { alt3=3; } else { NoViableAltException nvae = new NoViableAltException("", 3, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 3, 0, input); throw nvae; } switch (alt3) { case 1 : // ANML.g:886:9: 'or' { match("or"); } break; case 2 : // ANML.g:887:4: 'Or' { match("Or"); } break; case 3 : // ANML.g:887:11: 'OR' { match("OR"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "OrLog" // $ANTLR start "XorLog" public final void mXorLog() throws RecognitionException { try { int _type = XorLog; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:889:8: ( 'xor' | 'Xor' | 'XOR' ) int alt4=3; int LA4_0 = input.LA(1); if ( (LA4_0=='x') ) { alt4=1; } else if ( (LA4_0=='X') ) { int LA4_2 = input.LA(2); if ( (LA4_2=='o') ) { alt4=2; } else if ( (LA4_2=='O') ) { alt4=3; } else { NoViableAltException nvae = new NoViableAltException("", 4, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 4, 0, input); throw nvae; } switch (alt4) { case 1 : // ANML.g:889:10: 'xor' { match("xor"); } break; case 2 : // ANML.g:890:4: 'Xor' { match("Xor"); } break; case 3 : // ANML.g:890:12: 'XOR' { match("XOR"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "XorLog" // $ANTLR start "EqualLog" public final void mEqualLog() throws RecognitionException { try { int _type = EqualLog; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:892:9: ( 'equals' | 'iff' | 'Equals' | 'EQUALS' ) int alt5=4; switch ( input.LA(1) ) { case 'e': { alt5=1; } break; case 'i': { alt5=2; } break; case 'E': { int LA5_3 = input.LA(2); if ( (LA5_3=='q') ) { alt5=3; } else if ( (LA5_3=='Q') ) { alt5=4; } else { NoViableAltException nvae = new NoViableAltException("", 5, 3, input); throw nvae; } } break; default: NoViableAltException nvae = new NoViableAltException("", 5, 0, input); throw nvae; } switch (alt5) { case 1 : // ANML.g:892:11: 'equals' { match("equals"); } break; case 2 : // ANML.g:893:4: 'iff' { match("iff"); } break; case 3 : // ANML.g:893:12: 'Equals' { match("Equals"); } break; case 4 : // ANML.g:893:23: 'EQUALS' { match("EQUALS"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "EqualLog" // $ANTLR start "Implies" public final void mImplies() throws RecognitionException { try { int _type = Implies; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:895:8: ( 'implies' | 'Implies' | 'IMPLIES' ) int alt6=3; int LA6_0 = input.LA(1); if ( (LA6_0=='i') ) { alt6=1; } else if ( (LA6_0=='I') ) { int LA6_2 = input.LA(2); if ( (LA6_2=='m') ) { alt6=2; } else if ( (LA6_2=='M') ) { alt6=3; } else { NoViableAltException nvae = new NoViableAltException("", 6, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 6, 0, input); throw nvae; } switch (alt6) { case 1 : // ANML.g:895:10: 'implies' { match("implies"); } break; case 2 : // ANML.g:896:4: 'Implies' { match("Implies"); } break; case 3 : // ANML.g:896:16: 'IMPLIES' { match("IMPLIES"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Implies" // $ANTLR start "NotBit" public final void mNotBit() throws RecognitionException { try { int _type = NotBit; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:899:7: ( '!' | '~' ) // ANML.g: { if ( input.LA(1)=='!'||input.LA(1)=='~' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "NotBit" // $ANTLR start "AndBit" public final void mAndBit() throws RecognitionException { try { int _type = AndBit; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:900:7: ( '&' ) // ANML.g:900:9: '&' { match('&'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "AndBit" // $ANTLR start "OrBit" public final void mOrBit() throws RecognitionException { try { int _type = OrBit; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:901:6: ( '|' ) // ANML.g:901:8: '|' { match('|'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "OrBit" // $ANTLR start "XorBit" public final void mXorBit() throws RecognitionException { try { int _type = XorBit; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:902:8: ( '~&|' ) // ANML.g:902:10: '~&|' { match("~&|"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "XorBit" // $ANTLR start "Times" public final void mTimes() throws RecognitionException { try { int _type = Times; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:908:6: ( '*' ) // ANML.g:908:8: '*' { match('*'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Times" // $ANTLR start "Divide" public final void mDivide() throws RecognitionException { try { int _type = Divide; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:909:7: ( '/' ) // ANML.g:909:9: '/' { match('/'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Divide" // $ANTLR start "Plus" public final void mPlus() throws RecognitionException { try { int _type = Plus; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:910:5: ( '+' ) // ANML.g:910:7: '+' { match('+'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Plus" // $ANTLR start "Minus" public final void mMinus() throws RecognitionException { try { int _type = Minus; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:911:6: ( '-' ) // ANML.g:911:8: '-' { match('-'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Minus" // $ANTLR start "Equal" public final void mEqual() throws RecognitionException { try { int _type = Equal; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:913:7: ( '==' ) // ANML.g:913:9: '==' { match("=="); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Equal" // $ANTLR start "NotEqual" public final void mNotEqual() throws RecognitionException { try { int _type = NotEqual; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:914:10: ( '!=' | '~=' ) int alt7=2; int LA7_0 = input.LA(1); if ( (LA7_0=='!') ) { alt7=1; } else if ( (LA7_0=='~') ) { alt7=2; } else { NoViableAltException nvae = new NoViableAltException("", 7, 0, input); throw nvae; } switch (alt7) { case 1 : // ANML.g:914:12: '!=' { match("!="); } break; case 2 : // ANML.g:914:19: '~=' { match("~="); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "NotEqual" // $ANTLR start "LessThan" public final void mLessThan() throws RecognitionException { try { int _type = LessThan; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:915:10: ( '<' ) // ANML.g:915:12: '<' { match('<'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "LessThan" // $ANTLR start "LessThanE" public final void mLessThanE() throws RecognitionException { try { int _type = LessThanE; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:916:11: ( '<=' ) // ANML.g:916:13: '<=' { match("<="); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "LessThanE" // $ANTLR start "GreaterThan" public final void mGreaterThan() throws RecognitionException { try { int _type = GreaterThan; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:917:12: ( '>' ) // ANML.g:917:14: '>' { match('>'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "GreaterThan" // $ANTLR start "GreaterThanE" public final void mGreaterThanE() throws RecognitionException { try { int _type = GreaterThanE; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:918:13: ( '>=' ) // ANML.g:918:15: '>=' { match(">="); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "GreaterThanE" // $ANTLR start "SetAssign" public final void mSetAssign() throws RecognitionException { try { int _type = SetAssign; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:920:10: ( ':in' ) // ANML.g:920:12: ':in' { match(":in"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "SetAssign" // $ANTLR start "Assign" public final void mAssign() throws RecognitionException { try { int _type = Assign; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:922:8: ( ':=' ) // ANML.g:922:10: ':=' { match(":="); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Assign" // $ANTLR start "Consume" public final void mConsume() throws RecognitionException { try { int _type = Consume; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:924:8: ( ':consume' ) // ANML.g:924:10: ':consume' { match(":consume"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Consume" // $ANTLR start "Produce" public final void mProduce() throws RecognitionException { try { int _type = Produce; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:925:8: ( ':produce' ) // ANML.g:925:10: ':produce' { match(":produce"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Produce" // $ANTLR start "Use" public final void mUse() throws RecognitionException { try { int _type = Use; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:926:4: ( ':use' ) // ANML.g:926:6: ':use' { match(":use"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Use" // $ANTLR start "Lend" public final void mLend() throws RecognitionException { try { int _type = Lend; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:927:5: ( ':lend' ) // ANML.g:927:7: ':lend' { match(":lend"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Lend" // $ANTLR start "Change" public final void mChange() throws RecognitionException { try { int _type = Change; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:929:7: ( ':->' ) // ANML.g:929:9: ':->' { match(":->"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Change" // $ANTLR start "When" public final void mWhen() throws RecognitionException { try { int _type = When; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:932:5: ( 'when' ) // ANML.g:932:7: 'when' { match("when"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "When" // $ANTLR start "Else" public final void mElse() throws RecognitionException { try { int _type = Else; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:933:5: ( 'else' ) // ANML.g:933:7: 'else' { match("else"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Else" // $ANTLR start "Exists" public final void mExists() throws RecognitionException { try { int _type = Exists; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:934:7: ( 'exists' ) // ANML.g:934:9: 'exists' { match("exists"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Exists" // $ANTLR start "ForAll" public final void mForAll() throws RecognitionException { try { int _type = ForAll; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:935:7: ( 'forall' ) // ANML.g:935:9: 'forall' { match("forall"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "ForAll" // $ANTLR start "With" public final void mWith() throws RecognitionException { try { int _type = With; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:937:5: ( 'with' ) // ANML.g:937:7: 'with' { match("with"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "With" // $ANTLR start "Within" public final void mWithin() throws RecognitionException { try { int _type = Within; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:938:7: ( 'in' ) // ANML.g:938:9: 'in' { match("in"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Within" // $ANTLR start "Contains" public final void mContains() throws RecognitionException { try { int _type = Contains; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:939:9: ( 'contains' ) // ANML.g:939:11: 'contains' { match("contains"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Contains" // $ANTLR start "Constant" public final void mConstant() throws RecognitionException { try { int _type = Constant; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:941:9: ( 'constant' | 'const' ) int alt8=2; int LA8_0 = input.LA(1); if ( (LA8_0=='c') ) { int LA8_1 = input.LA(2); if ( (LA8_1=='o') ) { int LA8_2 = input.LA(3); if ( (LA8_2=='n') ) { int LA8_3 = input.LA(4); if ( (LA8_3=='s') ) { int LA8_4 = input.LA(5); if ( (LA8_4=='t') ) { int LA8_5 = input.LA(6); if ( (LA8_5=='a') ) { alt8=1; } else { alt8=2;} } else { NoViableAltException nvae = new NoViableAltException("", 8, 4, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 8, 3, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 8, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 8, 1, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 8, 0, input); throw nvae; } switch (alt8) { case 1 : // ANML.g:941:11: 'constant' { match("constant"); } break; case 2 : // ANML.g:941:24: 'const' { match("const"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Constant" // $ANTLR start "Fluent" public final void mFluent() throws RecognitionException { try { int _type = Fluent; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:942:7: ( 'fluent' ) // ANML.g:942:9: 'fluent' { match("fluent"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Fluent" // $ANTLR start "Function" public final void mFunction() throws RecognitionException { try { int _type = Function; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:943:9: ( 'function' ) // ANML.g:943:11: 'function' { match("function"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Function" // $ANTLR start "Predicate" public final void mPredicate() throws RecognitionException { try { int _type = Predicate; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:944:10: ( 'predicate' ) // ANML.g:944:12: 'predicate' { match("predicate"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Predicate" // $ANTLR start "Variable" public final void mVariable() throws RecognitionException { try { int _type = Variable; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:945:9: ( 'variable' | 'var' ) int alt9=2; int LA9_0 = input.LA(1); if ( (LA9_0=='v') ) { int LA9_1 = input.LA(2); if ( (LA9_1=='a') ) { int LA9_2 = input.LA(3); if ( (LA9_2=='r') ) { int LA9_3 = input.LA(4); if ( (LA9_3=='i') ) { alt9=1; } else { alt9=2;} } else { NoViableAltException nvae = new NoViableAltException("", 9, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 9, 1, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 9, 0, input); throw nvae; } switch (alt9) { case 1 : // ANML.g:945:11: 'variable' { match("variable"); } break; case 2 : // ANML.g:945:24: 'var' { match("var"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Variable" // $ANTLR start "Type" public final void mType() throws RecognitionException { try { int _type = Type; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:946:5: ( 'type' ) // ANML.g:946:7: 'type' { match("type"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Type" // $ANTLR start "Action" public final void mAction() throws RecognitionException { try { int _type = Action; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:947:7: ( 'action' ) // ANML.g:947:9: 'action' { match("action"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Action" // $ANTLR start "Fact" public final void mFact() throws RecognitionException { try { int _type = Fact; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:948:5: ( 'fact' ) // ANML.g:948:7: 'fact' { match("fact"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Fact" // $ANTLR start "Goal" public final void mGoal() throws RecognitionException { try { int _type = Goal; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:949:5: ( 'goal' ) // ANML.g:949:7: 'goal' { match("goal"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Goal" // $ANTLR start "Decomposition" public final void mDecomposition() throws RecognitionException { try { int _type = Decomposition; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:950:14: ( ':decomposition' ) // ANML.g:950:16: ':decomposition' { match(":decomposition"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Decomposition" // $ANTLR start "Ordered" public final void mOrdered() throws RecognitionException { try { int _type = Ordered; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:951:8: ( 'ordered' ) // ANML.g:951:10: 'ordered' { match("ordered"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Ordered" // $ANTLR start "Unordered" public final void mUnordered() throws RecognitionException { try { int _type = Unordered; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:952:10: ( 'unordered' ) // ANML.g:952:12: 'unordered' { match("unordered"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Unordered" // $ANTLR start "Boolean" public final void mBoolean() throws RecognitionException { try { int _type = Boolean; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:955:2: ( 'bool' | 'boolean' ) int alt10=2; int LA10_0 = input.LA(1); if ( (LA10_0=='b') ) { int LA10_1 = input.LA(2); if ( (LA10_1=='o') ) { int LA10_2 = input.LA(3); if ( (LA10_2=='o') ) { int LA10_3 = input.LA(4); if ( (LA10_3=='l') ) { int LA10_4 = input.LA(5); if ( (LA10_4=='e') ) { alt10=2; } else { alt10=1;} } else { NoViableAltException nvae = new NoViableAltException("", 10, 3, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 10, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 10, 1, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 10, 0, input); throw nvae; } switch (alt10) { case 1 : // ANML.g:955:4: 'bool' { match("bool"); } break; case 2 : // ANML.g:956:4: 'boolean' { match("boolean"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Boolean" // $ANTLR start "Integer" public final void mInteger() throws RecognitionException { try { int _type = Integer; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:958:9: ( 'int' | 'integer' ) int alt11=2; int LA11_0 = input.LA(1); if ( (LA11_0=='i') ) { int LA11_1 = input.LA(2); if ( (LA11_1=='n') ) { int LA11_2 = input.LA(3); if ( (LA11_2=='t') ) { int LA11_3 = input.LA(4); if ( (LA11_3=='e') ) { alt11=2; } else { alt11=1;} } else { NoViableAltException nvae = new NoViableAltException("", 11, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 11, 1, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("", 11, 0, input); throw nvae; } switch (alt11) { case 1 : // ANML.g:958:11: 'int' { match("int"); } break; case 2 : // ANML.g:958:19: 'integer' { match("integer"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Integer" // $ANTLR start "Float" public final void mFloat() throws RecognitionException { try { int _type = Float; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:959:7: ( 'float' ) // ANML.g:959:9: 'float' { match("float"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Float" // $ANTLR start "Symbol" public final void mSymbol() throws RecognitionException { try { int _type = Symbol; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:960:8: ( 'symbol' ) // ANML.g:960:10: 'symbol' { match("symbol"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Symbol" // $ANTLR start "String" public final void mString() throws RecognitionException { try { int _type = String; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:961:8: ( 'string' ) // ANML.g:961:10: 'string' { match("string"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "String" // $ANTLR start "Object" public final void mObject() throws RecognitionException { try { int _type = Object; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:962:8: ( 'object' ) // ANML.g:962:10: 'object' { match("object"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Object" // $ANTLR start "Vector" public final void mVector() throws RecognitionException { try { int _type = Vector; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:964:8: ( 'vector' ) // ANML.g:964:10: 'vector' { match("vector"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Vector" // $ANTLR start "Delta" public final void mDelta() throws RecognitionException { try { int _type = Delta; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:966:7: ( '^' ) // ANML.g:966:9: '^' { match('^'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Delta" // $ANTLR start "Undefined" public final void mUndefined() throws RecognitionException { try { int _type = Undefined; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:968:10: ( 'undefined' | 'U' | 'UNDEFINED' | 'Undefined' ) int alt12=4; int LA12_0 = input.LA(1); if ( (LA12_0=='u') ) { alt12=1; } else if ( (LA12_0=='U') ) { switch ( input.LA(2) ) { case 'N': { alt12=3; } break; case 'n': { alt12=4; } break; default: alt12=2;} } else { NoViableAltException nvae = new NoViableAltException("", 12, 0, input); throw nvae; } switch (alt12) { case 1 : // ANML.g:968:12: 'undefined' { match("undefined"); } break; case 2 : // ANML.g:969:4: 'U' { match('U'); } break; case 3 : // ANML.g:969:10: 'UNDEFINED' { match("UNDEFINED"); } break; case 4 : // ANML.g:969:24: 'Undefined' { match("Undefined"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Undefined" // $ANTLR start "All" public final void mAll() throws RecognitionException { try { int _type = All; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:971:4: ( 'all' ) // ANML.g:971:6: 'all' { match("all"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "All" // $ANTLR start "Start" public final void mStart() throws RecognitionException { try { int _type = Start; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:972:6: ( 'start' ) // ANML.g:972:8: 'start' { match("start"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Start" // $ANTLR start "End" public final void mEnd() throws RecognitionException { try { int _type = End; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:973:4: ( 'end' ) // ANML.g:973:6: 'end' { match("end"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "End" // $ANTLR start "Duration" public final void mDuration() throws RecognitionException { try { int _type = Duration; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:974:9: ( 'duration' ) // ANML.g:974:11: 'duration' { match("duration"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Duration" // $ANTLR start "Infinity" public final void mInfinity() throws RecognitionException { try { int _type = Infinity; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:975:9: ( 'infinity' | 'Infinity' | 'INFINITY' | 'infty' | 'INFTY' | 'inff' | 'INFF' ) int alt13=7; alt13 = dfa13.predict(input); switch (alt13) { case 1 : // ANML.g:975:11: 'infinity' { match("infinity"); } break; case 2 : // ANML.g:975:24: 'Infinity' { match("Infinity"); } break; case 3 : // ANML.g:975:37: 'INFINITY' { match("INFINITY"); } break; case 4 : // ANML.g:975:50: 'infty' { match("infty"); } break; case 5 : // ANML.g:975:60: 'INFTY' { match("INFTY"); } break; case 6 : // ANML.g:975:70: 'inff' { match("inff"); } break; case 7 : // ANML.g:975:79: 'INFF' { match("INFF"); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Infinity" // $ANTLR start "True" public final void mTrue() throws RecognitionException { try { int _type = True; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:979:5: ( ( 'T' | 'TRUE' | 'true' | 'True' ) ) // ANML.g:979:7: ( 'T' | 'TRUE' | 'true' | 'True' ) { // ANML.g:979:7: ( 'T' | 'TRUE' | 'true' | 'True' ) int alt14=4; int LA14_0 = input.LA(1); if ( (LA14_0=='T') ) { switch ( input.LA(2) ) { case 'R': { alt14=2; } break; case 'r': { alt14=4; } break; default: alt14=1;} } else if ( (LA14_0=='t') ) { alt14=3; } else { NoViableAltException nvae = new NoViableAltException("", 14, 0, input); throw nvae; } switch (alt14) { case 1 : // ANML.g:979:8: 'T' { match('T'); } break; case 2 : // ANML.g:979:14: 'TRUE' { match("TRUE"); } break; case 3 : // ANML.g:979:23: 'true' { match("true"); } break; case 4 : // ANML.g:979:32: 'True' { match("True"); } break; } } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "True" // $ANTLR start "False" public final void mFalse() throws RecognitionException { try { int _type = False; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:980:6: ( ( 'F' | 'FALSE' | 'false' | 'False' ) ) // ANML.g:980:8: ( 'F' | 'FALSE' | 'false' | 'False' ) { // ANML.g:980:8: ( 'F' | 'FALSE' | 'false' | 'False' ) int alt15=4; int LA15_0 = input.LA(1); if ( (LA15_0=='F') ) { switch ( input.LA(2) ) { case 'A': { alt15=2; } break; case 'a': { alt15=4; } break; default: alt15=1;} } else if ( (LA15_0=='f') ) { alt15=3; } else { NoViableAltException nvae = new NoViableAltException("", 15, 0, input); throw nvae; } switch (alt15) { case 1 : // ANML.g:980:9: 'F' { match('F'); } break; case 2 : // ANML.g:980:15: 'FALSE' { match("FALSE"); } break; case 3 : // ANML.g:980:25: 'false' { match("false"); } break; case 4 : // ANML.g:980:35: 'False' { match("False"); } break; } } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "False" // $ANTLR start "INT" public final void mINT() throws RecognitionException { try { int _type = INT; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:981:4: ( ( DIGIT )+ ) // ANML.g:981:6: ( DIGIT )+ { // ANML.g:981:6: ( DIGIT )+ int cnt16=0; loop16: do { int alt16=2; int LA16_0 = input.LA(1); if ( ((LA16_0>='0' && LA16_0<='9')) ) { alt16=1; } switch (alt16) { case 1 : // ANML.g:981:6: DIGIT { mDIGIT(); } break; default : if ( cnt16 >= 1 ) break loop16; EarlyExitException eee = new EarlyExitException(16, input); throw eee; } cnt16++; } while (true); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "INT" // $ANTLR start "FLOAT" public final void mFLOAT() throws RecognitionException { try { int _type = FLOAT; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:983:2: ( ( DIGIT )+ Dot ( DIGIT )+ | ( DIGIT )+ 'f' ) int alt20=2; alt20 = dfa20.predict(input); switch (alt20) { case 1 : // ANML.g:983:4: ( DIGIT )+ Dot ( DIGIT )+ { // ANML.g:983:4: ( DIGIT )+ int cnt17=0; loop17: do { int alt17=2; int LA17_0 = input.LA(1); if ( ((LA17_0>='0' && LA17_0<='9')) ) { alt17=1; } switch (alt17) { case 1 : // ANML.g:983:4: DIGIT { mDIGIT(); } break; default : if ( cnt17 >= 1 ) break loop17; EarlyExitException eee = new EarlyExitException(17, input); throw eee; } cnt17++; } while (true); mDot(); // ANML.g:983:15: ( DIGIT )+ int cnt18=0; loop18: do { int alt18=2; int LA18_0 = input.LA(1); if ( ((LA18_0>='0' && LA18_0<='9')) ) { alt18=1; } switch (alt18) { case 1 : // ANML.g:983:15: DIGIT { mDIGIT(); } break; default : if ( cnt18 >= 1 ) break loop18; EarlyExitException eee = new EarlyExitException(18, input); throw eee; } cnt18++; } while (true); } break; case 2 : // ANML.g:984:4: ( DIGIT )+ 'f' { // ANML.g:984:4: ( DIGIT )+ int cnt19=0; loop19: do { int alt19=2; int LA19_0 = input.LA(1); if ( ((LA19_0>='0' && LA19_0<='9')) ) { alt19=1; } switch (alt19) { case 1 : // ANML.g:984:4: DIGIT { mDIGIT(); } break; default : if ( cnt19 >= 1 ) break loop19; EarlyExitException eee = new EarlyExitException(19, input); throw eee; } cnt19++; } while (true); match('f'); } break; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "FLOAT" // $ANTLR start "STRING" public final void mSTRING() throws RecognitionException { try { int _type = STRING; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:986:7: ( '\"' ( ESC )* '\"' ) // ANML.g:986:10: '\"' ( ESC )* '\"' { match('\"'); // ANML.g:986:14: ( ESC )* loop21: do { int alt21=2; int LA21_0 = input.LA(1); if ( ((LA21_0>='\u0000' && LA21_0<='!')||(LA21_0>='#' && LA21_0<='\uFFFF')) ) { alt21=1; } switch (alt21) { case 1 : // ANML.g:986:14: ESC { mESC(); } break; default : break loop21; } } while (true); match('\"'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "STRING" // $ANTLR start "ID" public final void mID() throws RecognitionException { try { int _type = ID; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:989:4: ( LETTER ( LETTER | DIGIT | '_' )* ) // ANML.g:989:6: LETTER ( LETTER | DIGIT | '_' )* { mLETTER(); // ANML.g:989:13: ( LETTER | DIGIT | '_' )* loop22: do { int alt22=2; int LA22_0 = input.LA(1); if ( ((LA22_0>='0' && LA22_0<='9')||(LA22_0>='A' && LA22_0<='Z')||LA22_0=='_'||(LA22_0>='a' && LA22_0<='z')) ) { alt22=1; } switch (alt22) { case 1 : // ANML.g: { if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } break; default : break loop22; } } while (true); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "ID" // $ANTLR start "ESC" public final void mESC() throws RecognitionException { try { // ANML.g:991:14: ( '\\\\' . | ~ '\\\"' ) int alt23=2; int LA23_0 = input.LA(1); if ( (LA23_0=='\\') ) { int LA23_1 = input.LA(2); if ( ((LA23_1>='\u0000' && LA23_1<='\uFFFF')) ) { alt23=1; } else { alt23=2;} } else if ( ((LA23_0>='\u0000' && LA23_0<='!')||(LA23_0>='#' && LA23_0<='[')||(LA23_0>=']' && LA23_0<='\uFFFF')) ) { alt23=2; } else { NoViableAltException nvae = new NoViableAltException("", 23, 0, input); throw nvae; } switch (alt23) { case 1 : // ANML.g:991:16: '\\\\' . { match('\\'); matchAny(); } break; case 2 : // ANML.g:991:24: ~ '\\\"' { if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='\uFFFF') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } break; } } finally { } } // $ANTLR end "ESC" // $ANTLR start "LETTER" public final void mLETTER() throws RecognitionException { try { // ANML.g:992:18: ( 'a' .. 'z' | 'A' .. 'Z' ) // ANML.g: { if ( (input.LA(1)>='A' && input.LA(1)<='Z')||(input.LA(1)>='a' && input.LA(1)<='z') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } } finally { } } // $ANTLR end "LETTER" // $ANTLR start "DIGIT" public final void mDIGIT() throws RecognitionException { try { // ANML.g:993:16: ( '0' .. '9' ) // ANML.g:993:19: '0' .. '9' { matchRange('0','9'); } } finally { } } // $ANTLR end "DIGIT" // $ANTLR start "WS" public final void mWS() throws RecognitionException { try { int _type = WS; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:995:5: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' )+ ) // ANML.g:995:8: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' )+ { // ANML.g:995:8: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' )+ int cnt24=0; loop24: do { int alt24=2; int LA24_0 = input.LA(1); if ( ((LA24_0>='\t' && LA24_0<='\n')||(LA24_0>='\f' && LA24_0<='\r')||LA24_0==' ') ) { alt24=1; } switch (alt24) { case 1 : // ANML.g: { if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||(input.LA(1)>='\f' && input.LA(1)<='\r')||input.LA(1)==' ' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } break; default : if ( cnt24 >= 1 ) break loop24; EarlyExitException eee = new EarlyExitException(24, input); throw eee; } cnt24++; } while (true); _channel=HIDDEN; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "WS" // $ANTLR start "SLC" public final void mSLC() throws RecognitionException { try { int _type = SLC; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:996:5: ( '//' (~ '\\n' )* '\\n' ) // ANML.g:996:7: '//' (~ '\\n' )* '\\n' { match("//"); // ANML.g:996:12: (~ '\\n' )* loop25: do { int alt25=2; int LA25_0 = input.LA(1); if ( ((LA25_0>='\u0000' && LA25_0<='\t')||(LA25_0>='\u000B' && LA25_0<='\uFFFF')) ) { alt25=1; } switch (alt25) { case 1 : // ANML.g:996:13: ~ '\\n' { if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\uFFFF') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } break; default : break loop25; } } while (true); match('\n'); _channel=HIDDEN; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "SLC" // $ANTLR start "MLC" public final void mMLC() throws RecognitionException { try { int _type = MLC; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:997:5: ( '/*' (~ '*' | ( '*' )+ (~ ( '*' | '/' ) ) )* ( '*' )+ '/' ) // ANML.g:997:7: '/*' (~ '*' | ( '*' )+ (~ ( '*' | '/' ) ) )* ( '*' )+ '/' { match("/*"); // ANML.g:997:12: (~ '*' | ( '*' )+ (~ ( '*' | '/' ) ) )* loop27: do { int alt27=3; alt27 = dfa27.predict(input); switch (alt27) { case 1 : // ANML.g:997:13: ~ '*' { if ( (input.LA(1)>='\u0000' && input.LA(1)<=')')||(input.LA(1)>='+' && input.LA(1)<='\uFFFF') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } break; case 2 : // ANML.g:997:20: ( '*' )+ (~ ( '*' | '/' ) ) { // ANML.g:997:20: ( '*' )+ int cnt26=0; loop26: do { int alt26=2; int LA26_0 = input.LA(1); if ( (LA26_0=='*') ) { alt26=1; } switch (alt26) { case 1 : // ANML.g:997:20: '*' { match('*'); } break; default : if ( cnt26 >= 1 ) break loop26; EarlyExitException eee = new EarlyExitException(26, input); throw eee; } cnt26++; } while (true); // ANML.g:997:24: (~ ( '*' | '/' ) ) // ANML.g:997:25: ~ ( '*' | '/' ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<=')')||(input.LA(1)>='+' && input.LA(1)<='.')||(input.LA(1)>='0' && input.LA(1)<='\uFFFF') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } } break; default : break loop27; } } while (true); // ANML.g:997:39: ( '*' )+ int cnt28=0; loop28: do { int alt28=2; int LA28_0 = input.LA(1); if ( (LA28_0=='*') ) { alt28=1; } switch (alt28) { case 1 : // ANML.g:997:39: '*' { match('*'); } break; default : if ( cnt28 >= 1 ) break loop28; EarlyExitException eee = new EarlyExitException(28, input); throw eee; } cnt28++; } while (true); match('/'); _channel=HIDDEN; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "MLC" // $ANTLR start "Dot" public final void mDot() throws RecognitionException { try { int _type = Dot; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:999:4: ( '.' ) // ANML.g:999:6: '.' { match('.'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Dot" // $ANTLR start "Dots" public final void mDots() throws RecognitionException { try { int _type = Dots; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1000:5: ( '...' ) // ANML.g:1000:7: '...' { match("..."); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Dots" // $ANTLR start "Comma" public final void mComma() throws RecognitionException { try { int _type = Comma; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1001:6: ( ',' ) // ANML.g:1001:8: ',' { match(','); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Comma" // $ANTLR start "Semi" public final void mSemi() throws RecognitionException { try { int _type = Semi; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1002:5: ( ';' ) // ANML.g:1002:7: ';' { match(';'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Semi" // $ANTLR start "Colon" public final void mColon() throws RecognitionException { try { int _type = Colon; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1003:6: ( ':' ) // ANML.g:1003:8: ':' { match(':'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Colon" // $ANTLR start "LeftP" public final void mLeftP() throws RecognitionException { try { int _type = LeftP; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1004:6: ( '(' ) // ANML.g:1004:8: '(' { match('('); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "LeftP" // $ANTLR start "RightP" public final void mRightP() throws RecognitionException { try { int _type = RightP; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1005:7: ( ')' ) // ANML.g:1005:9: ')' { match(')'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "RightP" // $ANTLR start "LeftC" public final void mLeftC() throws RecognitionException { try { int _type = LeftC; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1006:6: ( '{' ) // ANML.g:1006:8: '{' { match('{'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "LeftC" // $ANTLR start "RightC" public final void mRightC() throws RecognitionException { try { int _type = RightC; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1007:7: ( '}' ) // ANML.g:1007:9: '}' { match('}'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "RightC" // $ANTLR start "LeftB" public final void mLeftB() throws RecognitionException { try { int _type = LeftB; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1008:6: ( '[' ) // ANML.g:1008:8: '[' { match('['); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "LeftB" // $ANTLR start "RightB" public final void mRightB() throws RecognitionException { try { int _type = RightB; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1009:7: ( ']' ) // ANML.g:1009:9: ']' { match(']'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "RightB" // $ANTLR start "Undefine" public final void mUndefine() throws RecognitionException { try { int _type = Undefine; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1010:9: ( ':_' ) // ANML.g:1010:11: ':_' { match(":_"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Undefine" // $ANTLR start "Skip" public final void mSkip() throws RecognitionException { try { int _type = Skip; int _channel = DEFAULT_TOKEN_CHANNEL; // ANML.g:1011:5: ( '_' ) // ANML.g:1011:7: '_' { match('_'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "Skip" public void mTokens() throws RecognitionException { // ANML.g:1:8: ( NotLog | AndLog | OrLog | XorLog | EqualLog | Implies | NotBit | AndBit | OrBit | XorBit | Times | Divide | Plus | Minus | Equal | NotEqual | LessThan | LessThanE | GreaterThan | GreaterThanE | SetAssign | Assign | Consume | Produce | Use | Lend | Change | When | Else | Exists | ForAll | With | Within | Contains | Constant | Fluent | Function | Predicate | Variable | Type | Action | Fact | Goal | Decomposition | Ordered | Unordered | Boolean | Integer | Float | Symbol | String | Object | Vector | Delta | Undefined | All | Start | End | Duration | Infinity | True | False | INT | FLOAT | STRING | ID | WS | SLC | MLC | Dot | Dots | Comma | Semi | Colon | LeftP | RightP | LeftC | RightC | LeftB | RightB | Undefine | Skip ) int alt29=82; alt29 = dfa29.predict(input); switch (alt29) { case 1 : // ANML.g:1:10: NotLog { mNotLog(); } break; case 2 : // ANML.g:1:17: AndLog { mAndLog(); } break; case 3 : // ANML.g:1:24: OrLog { mOrLog(); } break; case 4 : // ANML.g:1:30: XorLog { mXorLog(); } break; case 5 : // ANML.g:1:37: EqualLog { mEqualLog(); } break; case 6 : // ANML.g:1:46: Implies { mImplies(); } break; case 7 : // ANML.g:1:54: NotBit { mNotBit(); } break; case 8 : // ANML.g:1:61: AndBit { mAndBit(); } break; case 9 : // ANML.g:1:68: OrBit { mOrBit(); } break; case 10 : // ANML.g:1:74: XorBit { mXorBit(); } break; case 11 : // ANML.g:1:81: Times { mTimes(); } break; case 12 : // ANML.g:1:87: Divide { mDivide(); } break; case 13 : // ANML.g:1:94: Plus { mPlus(); } break; case 14 : // ANML.g:1:99: Minus { mMinus(); } break; case 15 : // ANML.g:1:105: Equal { mEqual(); } break; case 16 : // ANML.g:1:111: NotEqual { mNotEqual(); } break; case 17 : // ANML.g:1:120: LessThan { mLessThan(); } break; case 18 : // ANML.g:1:129: LessThanE { mLessThanE(); } break; case 19 : // ANML.g:1:139: GreaterThan { mGreaterThan(); } break; case 20 : // ANML.g:1:151: GreaterThanE { mGreaterThanE(); } break; case 21 : // ANML.g:1:164: SetAssign { mSetAssign(); } break; case 22 : // ANML.g:1:174: Assign { mAssign(); } break; case 23 : // ANML.g:1:181: Consume { mConsume(); } break; case 24 : // ANML.g:1:189: Produce { mProduce(); } break; case 25 : // ANML.g:1:197: Use { mUse(); } break; case 26 : // ANML.g:1:201: Lend { mLend(); } break; case 27 : // ANML.g:1:206: Change { mChange(); } break; case 28 : // ANML.g:1:213: When { mWhen(); } break; case 29 : // ANML.g:1:218: Else { mElse(); } break; case 30 : // ANML.g:1:223: Exists { mExists(); } break; case 31 : // ANML.g:1:230: ForAll { mForAll(); } break; case 32 : // ANML.g:1:237: With { mWith(); } break; case 33 : // ANML.g:1:242: Within { mWithin(); } break; case 34 : // ANML.g:1:249: Contains { mContains(); } break; case 35 : // ANML.g:1:258: Constant { mConstant(); } break; case 36 : // ANML.g:1:267: Fluent { mFluent(); } break; case 37 : // ANML.g:1:274: Function { mFunction(); } break; case 38 : // ANML.g:1:283: Predicate { mPredicate(); } break; case 39 : // ANML.g:1:293: Variable { mVariable(); } break; case 40 : // ANML.g:1:302: Type { mType(); } break; case 41 : // ANML.g:1:307: Action { mAction(); } break; case 42 : // ANML.g:1:314: Fact { mFact(); } break; case 43 : // ANML.g:1:319: Goal { mGoal(); } break; case 44 : // ANML.g:1:324: Decomposition { mDecomposition(); } break; case 45 : // ANML.g:1:338: Ordered { mOrdered(); } break; case 46 : // ANML.g:1:346: Unordered { mUnordered(); } break; case 47 : // ANML.g:1:356: Boolean { mBoolean(); } break; case 48 : // ANML.g:1:364: Integer { mInteger(); } break; case 49 : // ANML.g:1:372: Float { mFloat(); } break; case 50 : // ANML.g:1:378: Symbol { mSymbol(); } break; case 51 : // ANML.g:1:385: String { mString(); } break; case 52 : // ANML.g:1:392: Object { mObject(); } break; case 53 : // ANML.g:1:399: Vector { mVector(); } break; case 54 : // ANML.g:1:406: Delta { mDelta(); } break; case 55 : // ANML.g:1:412: Undefined { mUndefined(); } break; case 56 : // ANML.g:1:422: All { mAll(); } break; case 57 : // ANML.g:1:426: Start { mStart(); } break; case 58 : // ANML.g:1:432: End { mEnd(); } break; case 59 : // ANML.g:1:436: Duration { mDuration(); } break; case 60 : // ANML.g:1:445: Infinity { mInfinity(); } break; case 61 : // ANML.g:1:454: True { mTrue(); } break; case 62 : // ANML.g:1:459: False { mFalse(); } break; case 63 : // ANML.g:1:465: INT { mINT(); } break; case 64 : // ANML.g:1:469: FLOAT { mFLOAT(); } break; case 65 : // ANML.g:1:475: STRING { mSTRING(); } break; case 66 : // ANML.g:1:482: ID { mID(); } break; case 67 : // ANML.g:1:485: WS { mWS(); } break; case 68 : // ANML.g:1:488: SLC { mSLC(); } break; case 69 : // ANML.g:1:492: MLC { mMLC(); } break; case 70 : // ANML.g:1:496: Dot { mDot(); } break; case 71 : // ANML.g:1:500: Dots { mDots(); } break; case 72 : // ANML.g:1:505: Comma { mComma(); } break; case 73 : // ANML.g:1:511: Semi { mSemi(); } break; case 74 : // ANML.g:1:516: Colon { mColon(); } break; case 75 : // ANML.g:1:522: LeftP { mLeftP(); } break; case 76 : // ANML.g:1:528: RightP { mRightP(); } break; case 77 : // ANML.g:1:535: LeftC { mLeftC(); } break; case 78 : // ANML.g:1:541: RightC { mRightC(); } break; case 79 : // ANML.g:1:548: LeftB { mLeftB(); } break; case 80 : // ANML.g:1:554: RightB { mRightB(); } break; case 81 : // ANML.g:1:561: Undefine { mUndefine(); } break; case 82 : // ANML.g:1:570: Skip { mSkip(); } break; } } protected DFA13 dfa13 = new DFA13(this); protected DFA20 dfa20 = new DFA20(this); protected DFA27 dfa27 = new DFA27(this); protected DFA29 dfa29 = new DFA29(this); static final String DFA13_eotS = "\16\uffff"; static final String DFA13_eofS = "\16\uffff"; static final String DFA13_minS = "\1\111\1\156\1\116\1\146\1\uffff\1\106\1\146\1\106\6\uffff"; static final String DFA13_maxS = "\1\151\2\156\1\146\1\uffff\1\106\1\164\1\124\6\uffff"; static final String DFA13_acceptS = "\4\uffff\1\2\3\uffff\1\1\1\4\1\6\1\3\1\5\1\7"; static final String DFA13_specialS = "\16\uffff}>"; static final String[] DFA13_transitionS = { "\1\2\37\uffff\1\1", "\1\3", "\1\5\37\uffff\1\4", "\1\6", "", "\1\7", "\1\12\2\uffff\1\10\12\uffff\1\11", "\1\15\2\uffff\1\13\12\uffff\1\14", "", "", "", "", "", "" }; static final short[] DFA13_eot = DFA.unpackEncodedString(DFA13_eotS); static final short[] DFA13_eof = DFA.unpackEncodedString(DFA13_eofS); static final char[] DFA13_min = DFA.unpackEncodedStringToUnsignedChars(DFA13_minS); static final char[] DFA13_max = DFA.unpackEncodedStringToUnsignedChars(DFA13_maxS); static final short[] DFA13_accept = DFA.unpackEncodedString(DFA13_acceptS); static final short[] DFA13_special = DFA.unpackEncodedString(DFA13_specialS); static final short[][] DFA13_transition; static { int numStates = DFA13_transitionS.length; DFA13_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA13_transition[i] = DFA.unpackEncodedString(DFA13_transitionS[i]); } } class DFA13 extends DFA { public DFA13(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 13; this.eot = DFA13_eot; this.eof = DFA13_eof; this.min = DFA13_min; this.max = DFA13_max; this.accept = DFA13_accept; this.special = DFA13_special; this.transition = DFA13_transition; } public String getDescription() { return "975:1: Infinity : ( 'infinity' | 'Infinity' | 'INFINITY' | 'infty' | 'INFTY' | 'inff' | 'INFF' );"; } } static final String DFA20_eotS = "\4\uffff"; static final String DFA20_eofS = "\4\uffff"; static final String DFA20_minS = "\1\60\1\56\2\uffff"; static final String DFA20_maxS = "\1\71\1\146\2\uffff"; static final String DFA20_acceptS = "\2\uffff\1\1\1\2"; static final String DFA20_specialS = "\4\uffff}>"; static final String[] DFA20_transitionS = { "\12\1", "\1\2\1\uffff\12\1\54\uffff\1\3", "", "" }; static final short[] DFA20_eot = DFA.unpackEncodedString(DFA20_eotS); static final short[] DFA20_eof = DFA.unpackEncodedString(DFA20_eofS); static final char[] DFA20_min = DFA.unpackEncodedStringToUnsignedChars(DFA20_minS); static final char[] DFA20_max = DFA.unpackEncodedStringToUnsignedChars(DFA20_maxS); static final short[] DFA20_accept = DFA.unpackEncodedString(DFA20_acceptS); static final short[] DFA20_special = DFA.unpackEncodedString(DFA20_specialS); static final short[][] DFA20_transition; static { int numStates = DFA20_transitionS.length; DFA20_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA20_transition[i] = DFA.unpackEncodedString(DFA20_transitionS[i]); } } class DFA20 extends DFA { public DFA20(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 20; this.eot = DFA20_eot; this.eof = DFA20_eof; this.min = DFA20_min; this.max = DFA20_max; this.accept = DFA20_accept; this.special = DFA20_special; this.transition = DFA20_transition; } public String getDescription() { return "982:1: FLOAT : ( ( DIGIT )+ Dot ( DIGIT )+ | ( DIGIT )+ 'f' );"; } } static final String DFA27_eotS = "\5\uffff"; static final String DFA27_eofS = "\5\uffff"; static final String DFA27_minS = "\2\0\3\uffff"; static final String DFA27_maxS = "\2\uffff\3\uffff"; static final String DFA27_acceptS = "\2\uffff\1\1\1\2\1\3"; static final String DFA27_specialS = "\1\1\1\0\3\uffff}>"; static final String[] DFA27_transitionS = { "\52\2\1\1\uffd5\2", "\52\3\1\1\4\3\1\4\uffd0\3", "", "", "" }; static final short[] DFA27_eot = DFA.unpackEncodedString(DFA27_eotS); static final short[] DFA27_eof = DFA.unpackEncodedString(DFA27_eofS); static final char[] DFA27_min = DFA.unpackEncodedStringToUnsignedChars(DFA27_minS); static final char[] DFA27_max = DFA.unpackEncodedStringToUnsignedChars(DFA27_maxS); static final short[] DFA27_accept = DFA.unpackEncodedString(DFA27_acceptS); static final short[] DFA27_special = DFA.unpackEncodedString(DFA27_specialS); static final short[][] DFA27_transition; static { int numStates = DFA27_transitionS.length; DFA27_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA27_transition[i] = DFA.unpackEncodedString(DFA27_transitionS[i]); } } class DFA27 extends DFA { public DFA27(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 27; this.eot = DFA27_eot; this.eof = DFA27_eof; this.min = DFA27_min; this.max = DFA27_max; this.accept = DFA27_accept; this.special = DFA27_special; this.transition = DFA27_transition; } public String getDescription() { return "()* loopback of 997:12: (~ '*' | ( '*' )+ (~ ( '*' | '/' ) ) )*"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { IntStream input = _input; int _s = s; switch ( s ) { case 0 : int LA27_1 = input.LA(1); s = -1; if ( ((LA27_1>='\u0000' && LA27_1<=')')||(LA27_1>='+' && LA27_1<='.')||(LA27_1>='0' && LA27_1<='\uFFFF')) ) {s = 3;} else if ( (LA27_1=='*') ) {s = 1;} else if ( (LA27_1=='/') ) {s = 4;} if ( s>=0 ) return s; break; case 1 : int LA27_0 = input.LA(1); s = -1; if ( (LA27_0=='*') ) {s = 1;} else if ( ((LA27_0>='\u0000' && LA27_0<=')')||(LA27_0>='+' && LA27_0<='\uFFFF')) ) {s = 2;} if ( s>=0 ) return s; break; } NoViableAltException nvae = new NoViableAltException(getDescription(), 27, _s, input); error(nvae); throw nvae; } } static final String DFA29_eotS = "\1\uffff\14\52\1\124\2\uffff\1\124\1\uffff\1\127\3\uffff\1\131\1"+ "\133\1\145\12\52\1\uffff\1\171\1\52\1\175\1\u0080\1\u0081\3\uffff"+ "\1\u0084\11\uffff\10\52\1\u008e\1\52\2\u008e\11\52\1\u009b\6\52"+ "\24\uffff\23\52\1\uffff\3\52\1\uffff\2\52\5\uffff\3\u00be\1\u00bf"+ "\1\52\1\u00c1\2\u00bf\1\52\1\uffff\1\52\3\u00c4\3\52\1\u00c8\1\u00c9"+ "\1\52\1\u00cc\1\52\1\uffff\20\52\1\u00e4\21\52\2\uffff\1\52\1\uffff"+ "\2\52\1\uffff\1\52\1\u00fa\1\52\2\uffff\2\52\1\uffff\2\52\1\u0100"+ "\7\52\1\u0100\1\u0108\1\u0109\4\52\1\u010e\5\52\1\uffff\1\52\1\u0115"+ "\1\175\1\u0116\2\52\1\u011a\6\52\2\175\6\52\1\uffff\4\52\1\u0100"+ "\1\uffff\6\52\1\u0100\2\uffff\2\52\1\u0133\1\52\1\uffff\1\u0080"+ "\1\52\1\u0137\3\52\2\uffff\3\52\1\uffff\2\52\1\u0140\3\52\2\u0080"+ "\1\u0144\1\52\1\u0146\1\u00c9\1\u0147\3\52\2\u00c9\4\52\1\u014f"+ "\1\u0150\1\uffff\3\52\1\uffff\2\52\1\u0156\3\52\1\u015a\1\u015b"+ "\1\uffff\3\52\1\uffff\1\u015f\2\uffff\1\u0160\1\u00cc\1\52\2\u0160"+ "\2\52\2\uffff\5\52\1\uffff\2\52\1\u011a\2\uffff\3\52\2\uffff\3\u0100"+ "\1\u016e\1\u016f\1\u0137\1\52\1\u00e4\4\52\1\u0175\2\uffff\1\u0176"+ "\1\u0177\3\171\3\uffff"; static final String DFA29_eofS = "\u0178\uffff"; static final String DFA29_minS = "\1\11\1\157\1\117\1\143\1\116\1\142\1\122\1\157\1\117\1\154\1\146"+ "\1\121\1\115\1\46\2\uffff\1\75\1\uffff\1\52\3\uffff\2\75\1\55\1"+ "\150\1\141\1\157\1\162\1\141\1\162\1\157\1\156\1\157\1\164\1\uffff"+ "\1\60\1\165\2\60\1\56\3\uffff\1\56\11\uffff\2\164\1\124\1\144\1"+ "\164\1\154\1\144\1\104\1\60\1\152\2\60\2\162\1\122\1\165\1\163\1"+ "\151\1\144\1\146\1\160\1\60\1\165\1\125\1\160\1\120\1\146\1\106"+ "\24\uffff\1\145\1\164\1\162\1\157\1\156\1\143\1\156\1\145\1\162"+ "\1\143\1\160\1\165\1\141\1\144\1\157\1\155\1\141\1\104\1\144\1\uffff"+ "\1\162\1\125\1\165\1\uffff\1\114\1\154\5\uffff\4\60\1\151\3\60\1"+ "\145\1\uffff\1\145\3\60\1\141\1\145\1\163\2\60\1\154\1\60\1\146"+ "\1\uffff\1\141\1\101\1\154\1\114\1\151\1\106\1\156\1\150\1\141\1"+ "\145\1\141\1\143\1\164\2\163\1\144\1\60\1\164\2\145\1\154\1\162"+ "\1\145\1\154\1\142\1\151\1\162\1\105\1\145\1\141\1\105\1\145\1\123"+ "\1\163\2\uffff\1\157\1\uffff\1\162\1\143\1\uffff\1\154\1\60\1\164"+ "\2\uffff\1\151\1\147\1\uffff\1\156\1\171\1\60\1\154\1\114\1\151"+ "\1\111\1\156\1\116\1\131\3\60\1\154\1\156\2\164\1\60\1\145\1\141"+ "\1\164\1\151\1\141\1\uffff\1\157\3\60\1\144\1\146\1\60\1\157\1\156"+ "\1\164\1\106\1\146\1\164\2\60\1\105\1\145\1\156\1\145\1\164\1\163"+ "\1\uffff\1\163\2\145\1\151\1\60\1\uffff\1\163\1\123\1\145\1\105"+ "\1\151\1\111\1\60\2\uffff\1\154\1\164\1\60\1\151\1\uffff\1\60\1"+ "\151\1\60\1\143\1\142\1\162\2\uffff\1\145\1\151\1\141\1\uffff\1"+ "\154\1\147\1\60\1\111\2\151\3\60\1\144\3\60\1\163\1\162\1\164\2"+ "\60\1\163\1\123\1\164\1\124\2\60\1\uffff\1\157\2\156\1\uffff\1\141"+ "\1\154\1\60\1\162\2\156\2\60\1\uffff\1\116\1\156\1\157\1\uffff\1"+ "\60\2\uffff\2\60\1\171\2\60\1\171\1\131\2\uffff\1\156\1\163\2\164"+ "\1\145\1\uffff\2\145\1\60\2\uffff\1\105\1\145\1\156\2\uffff\6\60"+ "\1\145\1\60\2\144\1\104\1\144\1\60\2\uffff\5\60\3\uffff"; static final String DFA29_maxS = "\1\176\2\157\2\156\2\162\2\157\1\170\1\156\1\161\1\156\1\75\2\uffff"+ "\1\75\1\uffff\1\57\3\uffff\2\75\1\165\1\151\1\165\1\157\1\162\1"+ "\145\1\171\1\157\1\156\1\157\1\171\1\uffff\1\172\1\165\2\172\1\146"+ "\3\uffff\1\56\11\uffff\2\164\1\124\1\144\1\164\1\154\1\144\1\104"+ "\1\172\1\152\2\172\2\162\1\122\1\165\1\163\1\151\1\144\1\146\1\160"+ "\1\172\1\165\1\125\1\160\1\120\1\146\1\106\24\uffff\1\145\1\164"+ "\1\162\1\165\1\156\1\154\1\156\1\145\1\162\1\143\1\160\1\165\1\141"+ "\2\157\1\155\1\162\1\104\1\144\1\uffff\1\162\1\125\1\165\1\uffff"+ "\1\114\1\154\5\uffff\4\172\1\151\3\172\1\145\1\uffff\1\145\3\172"+ "\1\141\1\145\1\163\2\172\1\154\1\172\1\164\1\uffff\1\141\1\101\1"+ "\154\1\114\1\151\1\124\1\156\1\150\1\141\1\145\1\141\1\143\1\164"+ "\1\163\1\164\1\144\1\172\1\164\2\145\1\154\1\162\1\145\1\154\1\142"+ "\1\151\1\162\1\105\1\145\1\141\1\105\1\145\1\123\1\163\2\uffff\1"+ "\157\1\uffff\1\162\1\143\1\uffff\1\154\1\172\1\164\2\uffff\1\151"+ "\1\147\1\uffff\1\156\1\171\1\172\1\154\1\114\1\151\1\111\1\156\1"+ "\116\1\131\3\172\1\154\1\156\2\164\1\172\1\145\1\141\1\164\1\151"+ "\1\141\1\uffff\1\157\3\172\1\144\1\146\1\172\1\157\1\156\1\164\1"+ "\106\1\146\1\164\2\172\1\105\1\145\1\156\1\145\1\164\1\163\1\uffff"+ "\1\163\2\145\1\151\1\172\1\uffff\1\163\1\123\1\145\1\105\1\151\1"+ "\111\1\172\2\uffff\1\154\1\164\1\172\1\151\1\uffff\1\172\1\151\1"+ "\172\1\143\1\142\1\162\2\uffff\1\145\1\151\1\141\1\uffff\1\154\1"+ "\147\1\172\1\111\2\151\3\172\1\144\3\172\1\163\1\162\1\164\2\172"+ "\1\163\1\123\1\164\1\124\2\172\1\uffff\1\157\2\156\1\uffff\1\141"+ "\1\154\1\172\1\162\2\156\2\172\1\uffff\1\116\1\156\1\157\1\uffff"+ "\1\172\2\uffff\2\172\1\171\2\172\1\171\1\131\2\uffff\1\156\1\163"+ "\2\164\1\145\1\uffff\2\145\1\172\2\uffff\1\105\1\145\1\156\2\uffff"+ "\6\172\1\145\1\172\2\144\1\104\1\144\1\172\2\uffff\5\172\3\uffff"; static final String DFA29_acceptS = "\16\uffff\1\10\1\11\1\uffff\1\13\1\uffff\1\15\1\16\1\17\15\uffff"+ "\1\66\5\uffff\1\101\1\102\1\103\1\uffff\1\110\1\111\1\113\1\114"+ "\1\115\1\116\1\117\1\120\1\122\34\uffff\1\12\1\20\1\7\1\104\1\105"+ "\1\14\1\22\1\21\1\24\1\23\1\25\1\26\1\27\1\30\1\31\1\32\1\33\1\54"+ "\1\121\1\112\23\uffff\1\67\3\uffff\1\75\2\uffff\1\76\1\77\1\100"+ "\1\107\1\106\11\uffff\1\3\14\uffff\1\41\42\uffff\1\1\1\2\1\uffff"+ "\1\70\2\uffff\1\4\3\uffff\1\72\1\5\2\uffff\1\60\27\uffff\1\47\25"+ "\uffff\1\35\5\uffff\1\74\7\uffff\1\34\1\40\4\uffff\1\52\6\uffff"+ "\1\50\1\53\3\uffff\1\57\30\uffff\1\61\3\uffff\1\43\10\uffff\1\71"+ "\3\uffff\1\51\1\uffff\1\64\1\36\7\uffff\1\37\1\44\5\uffff\1\65\3"+ "\uffff\1\62\1\63\3\uffff\1\55\1\6\15\uffff\1\45\1\42\5\uffff\1\73"+ "\1\46\1\56"; static final String DFA29_specialS = "\u0178\uffff}>"; static final String[] DFA29_transitionS = { "\2\53\1\uffff\2\53\22\uffff\1\53\1\20\1\51\3\uffff\1\16\1\uffff"+ "\1\57\1\60\1\21\1\23\1\55\1\24\1\54\1\22\12\50\1\30\1\56\1\26"+ "\1\25\1\27\2\uffff\1\4\3\52\1\13\1\47\2\52\1\14\4\52\1\2\1\6"+ "\4\52\1\46\1\44\2\52\1\10\2\52\1\63\1\uffff\1\64\1\43\1\65\1"+ "\uffff\1\3\1\41\1\33\1\45\1\11\1\32\1\37\1\52\1\12\4\52\1\1"+ "\1\5\1\34\2\52\1\42\1\36\1\40\1\35\1\31\1\7\2\52\1\61\1\17\1"+ "\62\1\15", "\1\66", "\1\70\37\uffff\1\67", "\1\72\10\uffff\1\73\1\uffff\1\71", "\1\75\37\uffff\1\74", "\1\77\17\uffff\1\76", "\1\101\37\uffff\1\100", "\1\102", "\1\104\37\uffff\1\103", "\1\106\1\uffff\1\110\2\uffff\1\105\6\uffff\1\107", "\1\111\6\uffff\1\112\1\113", "\1\115\37\uffff\1\114", "\1\117\1\121\36\uffff\1\116\1\120", "\1\122\26\uffff\1\123", "", "", "\1\123", "", "\1\126\4\uffff\1\125", "", "", "", "\1\130", "\1\132", "\1\142\17\uffff\1\135\41\uffff\1\144\3\uffff\1\136\1\143\4"+ "\uffff\1\134\2\uffff\1\141\3\uffff\1\137\4\uffff\1\140", "\1\146\1\147", "\1\153\12\uffff\1\151\2\uffff\1\150\5\uffff\1\152", "\1\154", "\1\155", "\1\156\3\uffff\1\157", "\1\161\6\uffff\1\160", "\1\162", "\1\163", "\1\164", "\1\166\4\uffff\1\165", "", "\12\52\7\uffff\15\52\1\167\14\52\4\uffff\1\52\1\uffff\15\52"+ "\1\170\14\52", "\1\172", "\12\52\7\uffff\21\52\1\173\10\52\4\uffff\1\52\1\uffff\21\52"+ "\1\174\10\52", "\12\52\7\uffff\1\176\31\52\4\uffff\1\52\1\uffff\1\177\31\52", "\1\u0082\1\uffff\12\50\54\uffff\1\u0082", "", "", "", "\1\u0083", "", "", "", "", "", "", "", "", "", "\1\u0085", "\1\u0086", "\1\u0087", "\1\u0088", "\1\u0089", "\1\u008a", "\1\u008b", "\1\u008c", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\3\52\1\u008d\26\52", "\1\u008f", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0090", "\1\u0091", "\1\u0092", "\1\u0093", "\1\u0094", "\1\u0095", "\1\u0096", "\1\u0097", "\1\u0098", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\5\52\1\u009a\15\52"+ "\1\u0099\6\52", "\1\u009c", "\1\u009d", "\1\u009e", "\1\u009f", "\1\u00a0", "\1\u00a1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\1\u00a2", "\1\u00a3", "\1\u00a4", "\1\u00a6\5\uffff\1\u00a5", "\1\u00a7", "\1\u00a8\10\uffff\1\u00a9", "\1\u00aa", "\1\u00ab", "\1\u00ac", "\1\u00ad", "\1\u00ae", "\1\u00af", "\1\u00b0", "\1\u00b2\12\uffff\1\u00b1", "\1\u00b3", "\1\u00b4", "\1\u00b6\20\uffff\1\u00b5", "\1\u00b7", "\1\u00b8", "", "\1\u00b9", "\1\u00ba", "\1\u00bb", "", "\1\u00bc", "\1\u00bd", "", "", "", "", "", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u00c0", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u00c2", "", "\1\u00c3", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u00c5", "\1\u00c6", "\1\u00c7", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u00ca", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\4\52\1\u00cb\25\52", "\1\u00cf\2\uffff\1\u00cd\12\uffff\1\u00ce", "", "\1\u00d0", "\1\u00d1", "\1\u00d2", "\1\u00d3", "\1\u00d4", "\1\u00d7\2\uffff\1\u00d5\12\uffff\1\u00d6", "\1\u00d8", "\1\u00d9", "\1\u00da", "\1\u00db", "\1\u00dc", "\1\u00dd", "\1\u00de", "\1\u00df", "\1\u00e1\1\u00e0", "\1\u00e2", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\10\52\1\u00e3\21"+ "\52", "\1\u00e5", "\1\u00e6", "\1\u00e7", "\1\u00e8", "\1\u00e9", "\1\u00ea", "\1\u00eb", "\1\u00ec", "\1\u00ed", "\1\u00ee", "\1\u00ef", "\1\u00f0", "\1\u00f1", "\1\u00f2", "\1\u00f3", "\1\u00f4", "\1\u00f5", "", "", "\1\u00f6", "", "\1\u00f7", "\1\u00f8", "", "\1\u00f9", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u00fb", "", "", "\1\u00fc", "\1\u00fd", "", "\1\u00fe", "\1\u00ff", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0101", "\1\u0102", "\1\u0103", "\1\u0104", "\1\u0105", "\1\u0106", "\1\u0107", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u010a", "\1\u010b", "\1\u010c", "\1\u010d", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u010f", "\1\u0110", "\1\u0111", "\1\u0112", "\1\u0113", "", "\1\u0114", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0117", "\1\u0118", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\4\52\1\u0119\25\52", "\1\u011b", "\1\u011c", "\1\u011d", "\1\u011e", "\1\u011f", "\1\u0120", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0121", "\1\u0122", "\1\u0123", "\1\u0124", "\1\u0125", "\1\u0126", "", "\1\u0127", "\1\u0128", "\1\u0129", "\1\u012a", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "", "\1\u012b", "\1\u012c", "\1\u012d", "\1\u012e", "\1\u012f", "\1\u0130", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "", "", "\1\u0131", "\1\u0132", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0134", "", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0135", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\1\u0136\31\52", "\1\u0138", "\1\u0139", "\1\u013a", "", "", "\1\u013b", "\1\u013c", "\1\u013d", "", "\1\u013e", "\1\u013f", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0141", "\1\u0142", "\1\u0143", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0145", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0148", "\1\u0149", "\1\u014a", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u014b", "\1\u014c", "\1\u014d", "\1\u014e", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "", "\1\u0151", "\1\u0152", "\1\u0153", "", "\1\u0154", "\1\u0155", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0157", "\1\u0158", "\1\u0159", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "", "\1\u015c", "\1\u015d", "\1\u015e", "", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "", "", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0161", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0162", "\1\u0163", "", "", "\1\u0164", "\1\u0165", "\1\u0166", "\1\u0167", "\1\u0168", "", "\1\u0169", "\1\u016a", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "", "", "\1\u016b", "\1\u016c", "\1\u016d", "", "", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0170", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\1\u0171", "\1\u0172", "\1\u0173", "\1\u0174", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "", "", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "\12\52\7\uffff\32\52\4\uffff\1\52\1\uffff\32\52", "", "", "" }; static final short[] DFA29_eot = DFA.unpackEncodedString(DFA29_eotS); static final short[] DFA29_eof = DFA.unpackEncodedString(DFA29_eofS); static final char[] DFA29_min = DFA.unpackEncodedStringToUnsignedChars(DFA29_minS); static final char[] DFA29_max = DFA.unpackEncodedStringToUnsignedChars(DFA29_maxS); static final short[] DFA29_accept = DFA.unpackEncodedString(DFA29_acceptS); static final short[] DFA29_special = DFA.unpackEncodedString(DFA29_specialS); static final short[][] DFA29_transition; static { int numStates = DFA29_transitionS.length; DFA29_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA29_transition[i] = DFA.unpackEncodedString(DFA29_transitionS[i]); } } class DFA29 extends DFA { public DFA29(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 29; this.eot = DFA29_eot; this.eof = DFA29_eof; this.min = DFA29_min; this.max = DFA29_max; this.accept = DFA29_accept; this.special = DFA29_special; this.transition = DFA29_transition; } public String getDescription() { return "1:1: Tokens : ( NotLog | AndLog | OrLog | XorLog | EqualLog | Implies | NotBit | AndBit | OrBit | XorBit | Times | Divide | Plus | Minus | Equal | NotEqual | LessThan | LessThanE | GreaterThan | GreaterThanE | SetAssign | Assign | Consume | Produce | Use | Lend | Change | When | Else | Exists | ForAll | With | Within | Contains | Constant | Fluent | Function | Predicate | Variable | Type | Action | Fact | Goal | Decomposition | Ordered | Unordered | Boolean | Integer | Float | Symbol | String | Object | Vector | Delta | Undefined | All | Start | End | Duration | Infinity | True | False | INT | FLOAT | STRING | ID | WS | SLC | MLC | Dot | Dots | Comma | Semi | Colon | LeftP | RightP | LeftC | RightC | LeftB | RightB | Undefine | Skip );"; } } }
Java
/* [The "BSD licence"] Copyright (c) 2005-2007 Terence Parr All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package gov.nasa.anml.parsing; import org.antlr.runtime.*; import org.antlr.runtime.tree.*; /** A node representing erroneous token range in token stream */ public class ANMLErrorNode extends ANMLToken { public IntStream input; public Token start; public Token stop; public RecognitionException trappedException; public ANMLErrorNode(TokenStream input, Token start, Token stop, RecognitionException e) { //System.out.println("start: "+start+", stop: "+stop); if ( stop==null || (stop.getTokenIndex() < start.getTokenIndex() && stop.getType()!=Token.EOF) ) { // sometimes resync does not consume a token (when LT(1) is // in follow set. So, stop will be 1 to left to start. adjust. // Also handle case where start is the first token and no token // is consumed during recovery; LT(-1) will return null. stop = start; } this.input = input; this.start = start; this.stop = stop; this.trappedException = e; } public boolean isNil() { return false; } public int getType() { return Token.INVALID_TOKEN_TYPE; } public String getText() { String badText = null; if ( start instanceof Token ) { int i = ((Token)start).getTokenIndex(); int j = ((Token)stop).getTokenIndex(); if ( ((Token)stop).getType() == Token.EOF ) { j = ((TokenStream)input).size(); } badText = ((TokenStream)input).toString(i, j); } else if ( start instanceof Tree ) { badText = ((TreeNodeStream)input).toString(start, stop); } else { // people should subclass if they alter the tree type so this // next one is for sure correct. badText = "<unknown>"; } return badText; } public String toString() { if ( trappedException instanceof MissingTokenException ) { return "<missing type: "+ ((MissingTokenException)trappedException).getMissingType()+ ">"; } else if ( trappedException instanceof UnwantedTokenException ) { return "<extraneous: "+ ((UnwantedTokenException)trappedException).getUnexpectedToken()+ ", resync="+getText()+">"; } else if ( trappedException instanceof MismatchedTokenException ) { return "<mismatched token: "+trappedException.token+", resync="+getText()+">"; } else if ( trappedException instanceof NoViableAltException ) { return "<unexpected: "+trappedException.token+ ", resync="+getText()+">"; } return "<error: "+getText()+">"; } }
Java
// $ANTLR 3.1.1 ANML.g 2010-06-01 19:37:47 package gov.nasa.anml.parsing; import gov.nasa.anml.lifted.*; import gov.nasa.anml.utility.*; import org.antlr.runtime.*; import java.util.Stack; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import org.antlr.runtime.tree.*; public class ANMLParser extends Parser { public static final String[] tokenNames = new String[] { "<invalid>", "<EOR>", "<DOWN>", "<UP>", "Types", "Constants", "Fluents", "Actions", "Parameters", "Arguments", "Stmts", "Block", "Decompositions", "TypeRef", "LabelRef", "Ref", "Bind", "Access", "TypeRefine", "Type", "Fluent", "FluentFunction", "Constant", "ConstantFunction", "Parameter", "Action", "Label", "DefiniteInterval", "DefinitePoint", "IndefiniteInterval", "IndefinitePoint", "Bra", "Ket", "Before", "At", "After", "TBra", "TKet", "TStart", "TEnd", "TDuration", "Chain", "TimedStmt", "TimedExpr", "ContainsSomeStmt", "ContainsAllStmt", "ContainsSomeExpr", "ContainsAllExpr", "ForAllExpr", "ForAllStmt", "ExistsExpr", "ExistsStmt", "When", "WhenElse", "Enum", "Range", "ID", "This", "Boolean", "Integer", "Float", "Symbol", "String", "Object", "Vector", "Predicate", "LessThan", "Assign", "With", "Semi", "Comma", "Undefined", "Undefine", "LeftP", "RightP", "Variable", "Function", "Fact", "LeftC", "RightC", "NotLog", "NotBit", "EqualLog", "Equal", "Goal", "LeftB", "Duration", "RightB", "Decomposition", "Contains", "Else", "ForAll", "Exists", "Change", "Produce", "Consume", "Lend", "Use", "Within", "SetAssign", "Skip", "Delta", "All", "Dots", "Colon", "Implies", "XorLog", "OrLog", "AndLog", "XorBit", "Plus", "Minus", "OrBit", "Times", "Divide", "AndBit", "Unordered", "Ordered", "Dot", "Start", "End", "INT", "FLOAT", "STRING", "True", "False", "Infinity", "NotEqual", "GreaterThan", "LessThanE", "GreaterThanE", "DIGIT", "ESC", "LETTER", "WS", "SLC", "MLC" }; public static final int IndefinitePoint=30; public static final int Implies=105; public static final int Ket=32; public static final int LessThan=66; public static final int OrBit=112; public static final int AndLog=108; public static final int TDuration=40; public static final int Stmts=10; public static final int LETTER=133; public static final int Before=33; public static final int Fluents=6; public static final int Constants=5; public static final int Bind=16; public static final int After=35; public static final int DefinitePoint=28; public static final int XorLog=106; public static final int Lend=96; public static final int LabelRef=14; public static final int Actions=7; public static final int EOF=-1; public static final int LessThanE=129; public static final int AndBit=115; public static final int Variable=75; public static final int NotLog=80; public static final int ForAll=91; public static final int When=52; public static final int TEnd=39; public static final int NotBit=81; public static final int Access=17; public static final int Undefined=71; public static final int Use=97; public static final int ContainsAllExpr=47; public static final int ExistsExpr=50; public static final int Decompositions=12; public static final int ForAllStmt=49; public static final int TimedStmt=42; public static final int ContainsSomeExpr=46; public static final int This=57; public static final int DefiniteInterval=27; public static final int INT=121; public static final int Colon=104; public static final int Action=25; public static final int NotEqual=127; public static final int TimedExpr=43; public static final int Equal=83; public static final int Fluent=20; public static final int With=68; public static final int Block=11; public static final int Object=63; public static final int Float=60; public static final int LeftC=78; public static final int Range=55; public static final int Minus=111; public static final int WS=134; public static final int Semi=69; public static final int LeftB=85; public static final int Function=76; public static final int Times=113; public static final int OrLog=107; public static final int MLC=136; public static final int TypeRefine=18; public static final int ExistsStmt=51; public static final int TBra=36; public static final int IndefiniteInterval=29; public static final int Else=90; public static final int Label=26; public static final int ForAllExpr=48; public static final int Types=4; public static final int End=120; public static final int Parameters=8; public static final int Fact=77; public static final int Unordered=116; public static final int Undefine=72; public static final int Within=98; public static final int LeftP=73; public static final int ESC=132; public static final int All=102; public static final int TStart=38; public static final int SLC=135; public static final int Decomposition=88; public static final int False=125; public static final int GreaterThanE=130; public static final int Constant=22; public static final int FLOAT=122; public static final int Enum=54; public static final int ID=56; public static final int GreaterThan=128; public static final int Consume=95; public static final int Arguments=9; public static final int Assign=67; public static final int Change=93; public static final int Chain=41; public static final int TypeRef=13; public static final int Produce=94; public static final int WhenElse=53; public static final int Ordered=117; public static final int ConstantFunction=23; public static final int Bra=31; public static final int Exists=92; public static final int DIGIT=131; public static final int Symbol=61; public static final int String=62; public static final int True=124; public static final int ContainsSomeStmt=44; public static final int Predicate=65; public static final int Vector=64; public static final int RightP=74; public static final int Start=119; public static final int At=34; public static final int Type=19; public static final int Delta=101; public static final int XorBit=109; public static final int Contains=89; public static final int TKet=37; public static final int ContainsAllStmt=45; public static final int RightC=79; public static final int SetAssign=99; public static final int RightB=87; public static final int Duration=86; public static final int Divide=114; public static final int Parameter=24; public static final int Goal=84; public static final int Skip=100; public static final int Ref=15; public static final int Plus=110; public static final int Boolean=58; public static final int Dot=118; public static final int Dots=103; public static final int EqualLog=82; public static final int Infinity=126; public static final int Comma=70; public static final int Integer=59; public static final int STRING=123; public static final int FluentFunction=21; // delegates // delegators protected static class T_scope { ANMLToken typeRef; } protected Stack T_stack = new Stack(); protected static class S_scope { Scope d; } protected Stack S_stack = new Stack(); public ANMLParser(TokenStream input) { this(input, new RecognizerSharedState()); } public ANMLParser(TokenStream input, RecognizerSharedState state) { super(input, state); } protected TreeAdaptor adaptor = new CommonTreeAdaptor(); public void setTreeAdaptor(TreeAdaptor adaptor) { this.adaptor = adaptor; } public TreeAdaptor getTreeAdaptor() { return adaptor; } public String[] getTokenNames() { return ANMLParser.tokenNames; } public String getGrammarFileName() { return "ANML.g"; } public int LA(int i) { return input.LA(i); } public boolean LA(int i,int t) { return input.LA(i)==t; } protected ANMLToken getMissingSymbol(IntStream input, RecognitionException e, int expectedTokenType, BitSet follow) { String tokenName = getTokenName(expectedTokenType); String tokenText = "<missing " + tokenName + ">"; ANMLToken t = (ANMLToken)adaptor.create(expectedTokenType,tokenText); Token current = ((TokenStream)input).LT(1); if ( current.getType() == Token.EOF ) { current = ((TokenStream)input).LT(-1); } t.line = current.getLine(); t.charPositionInLine = current.getCharPositionInLine(); t.channel = DEFAULT_TOKEN_CHANNEL; return t; } public final String getTokenName(int tokenType) { String tokenText = null; if ( tokenType==Token.EOF ) tokenText = "EOF"; else tokenText = getTokenNames()[tokenType]; return tokenText; } public static class model_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "model" // ANML.g:177:1: model[Domain d] : (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* -> ^( Block ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) ; public final ANMLParser.model_return model(Domain d) throws RecognitionException { S_stack.push(new S_scope()); ANMLParser.model_return retval = new ANMLParser.model_return(); retval.start = input.LT(1); ANMLToken root_0 = null; List list_t=null; List list_c=null; List list_f=null; List list_a=null; List list_s=null; RuleReturnScope t = null; RuleReturnScope c = null; RuleReturnScope f = null; RuleReturnScope a = null; RuleReturnScope s = null; RewriteRuleSubtreeStream stream_fact_decl=new RewriteRuleSubtreeStream(adaptor,"rule fact_decl"); RewriteRuleSubtreeStream stream_goal_decl=new RewriteRuleSubtreeStream(adaptor,"rule goal_decl"); RewriteRuleSubtreeStream stream_type_decl=new RewriteRuleSubtreeStream(adaptor,"rule type_decl"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); RewriteRuleSubtreeStream stream_fluent_decl=new RewriteRuleSubtreeStream(adaptor,"rule fluent_decl"); RewriteRuleSubtreeStream stream_const_decl=new RewriteRuleSubtreeStream(adaptor,"rule const_decl"); RewriteRuleSubtreeStream stream_action_decl=new RewriteRuleSubtreeStream(adaptor,"rule action_decl"); ((S_scope)S_stack.peek()).d = d; try { // ANML.g:180:1: ( (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* -> ^( Block ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) ) // ANML.g:181:2: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* { // ANML.g:181:2: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* loop1: do { int alt1=8; alt1 = dfa1.predict(input); switch (alt1) { case 1 : // ANML.g:181:4: t+= type_decl { pushFollow(FOLLOW_type_decl_in_model398); t=type_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_decl.add(t.getTree()); if (list_t==null) list_t=new ArrayList(); list_t.add(t.getTree()); } break; case 2 : // ANML.g:182:4: c+= const_decl { pushFollow(FOLLOW_const_decl_in_model406); c=const_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_const_decl.add(c.getTree()); if (list_c==null) list_c=new ArrayList(); list_c.add(c.getTree()); } break; case 3 : // ANML.g:183:4: f+= fluent_decl { pushFollow(FOLLOW_fluent_decl_in_model414); f=fluent_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fluent_decl.add(f.getTree()); if (list_f==null) list_f=new ArrayList(); list_f.add(f.getTree()); } break; case 4 : // ANML.g:184:4: a+= action_decl { pushFollow(FOLLOW_action_decl_in_model422); a=action_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_action_decl.add(a.getTree()); if (list_a==null) list_a=new ArrayList(); list_a.add(a.getTree()); } break; case 5 : // ANML.g:185:4: s+= fact_decl { pushFollow(FOLLOW_fact_decl_in_model429); s=fact_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fact_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 6 : // ANML.g:186:4: s+= goal_decl { pushFollow(FOLLOW_goal_decl_in_model437); s=goal_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_goal_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 7 : // ANML.g:187:4: s+= stmt { pushFollow(FOLLOW_stmt_in_model445); s=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; default : break loop1; } } while (true); // AST REWRITE // elements: s, f, a, t, c // token labels: // rule labels: retval // token list labels: // rule list labels: f, t, s, c, a if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_f=new RewriteRuleSubtreeStream(adaptor,"token f",list_f); RewriteRuleSubtreeStream stream_t=new RewriteRuleSubtreeStream(adaptor,"token t",list_t); RewriteRuleSubtreeStream stream_s=new RewriteRuleSubtreeStream(adaptor,"token s",list_s); RewriteRuleSubtreeStream stream_c=new RewriteRuleSubtreeStream(adaptor,"token c",list_c); RewriteRuleSubtreeStream stream_a=new RewriteRuleSubtreeStream(adaptor,"token a",list_a); root_0 = (ANMLToken)adaptor.nil(); // 189:2: -> ^( Block ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) { // ANML.g:190:2: ^( Block ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Block, "Block"), root_1); // ANML.g:191:3: ^( Types ( $t)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Types, "Types"), root_2); // ANML.g:191:11: ( $t)* while ( stream_t.hasNext() ) { adaptor.addChild(root_2, stream_t.nextTree()); } stream_t.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:192:3: ^( Constants ( $c)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Constants, "Constants"), root_2); // ANML.g:192:15: ( $c)* while ( stream_c.hasNext() ) { adaptor.addChild(root_2, stream_c.nextTree()); } stream_c.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:193:3: ^( Fluents ( $f)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Fluents, "Fluents"), root_2); // ANML.g:193:13: ( $f)* while ( stream_f.hasNext() ) { adaptor.addChild(root_2, stream_f.nextTree()); } stream_f.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:194:3: ^( Actions ( $a)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Actions, "Actions"), root_2); // ANML.g:194:13: ( $a)* while ( stream_a.hasNext() ) { adaptor.addChild(root_2, stream_a.nextTree()); } stream_a.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:195:3: ^( Stmts ( $s)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Stmts, "Stmts"), root_2); // ANML.g:195:11: ( $s)* while ( stream_s.hasNext() ) { adaptor.addChild(root_2, stream_s.nextTree()); } stream_s.reset(); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { S_stack.pop(); } return retval; } // $ANTLR end "model" public static class builtinType_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "builtinType" // ANML.g:201:1: builtinType : ( Boolean | Integer | Float | Symbol | String | Object ); public final ANMLParser.builtinType_return builtinType() throws RecognitionException { ANMLParser.builtinType_return retval = new ANMLParser.builtinType_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken set1=null; ANMLToken set1_tree=null; try { // ANML.g:202:2: ( Boolean | Integer | Float | Symbol | String | Object ) // ANML.g: { root_0 = (ANMLToken)adaptor.nil(); set1=(ANMLToken)input.LT(1); if ( (input.LA(1)>=Boolean && input.LA(1)<=Object) ) { input.consume(); if ( state.backtracking==0 ) adaptor.addChild(root_0, (ANMLToken)adaptor.create(set1)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "builtinType" public static class type_spec_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "type_spec" // ANML.g:212:1: type_spec : ( builtinType ( set )? -> ^( TypeRef builtinType ( set )? ) | ID ( set )? -> ^( TypeRef ID ( set )? ) | Vector param_list -> ^( Vector param_list ) | type_enumeration ); public final ANMLParser.type_spec_return type_spec() throws RecognitionException { ANMLParser.type_spec_return retval = new ANMLParser.type_spec_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID4=null; ANMLToken Vector6=null; ANMLParser.builtinType_return builtinType2 = null; ANMLParser.set_return set3 = null; ANMLParser.set_return set5 = null; ANMLParser.param_list_return param_list7 = null; ANMLParser.type_enumeration_return type_enumeration8 = null; ANMLToken ID4_tree=null; ANMLToken Vector6_tree=null; RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleTokenStream stream_Vector=new RewriteRuleTokenStream(adaptor,"token Vector"); RewriteRuleSubtreeStream stream_set=new RewriteRuleSubtreeStream(adaptor,"rule set"); RewriteRuleSubtreeStream stream_builtinType=new RewriteRuleSubtreeStream(adaptor,"rule builtinType"); RewriteRuleSubtreeStream stream_param_list=new RewriteRuleSubtreeStream(adaptor,"rule param_list"); try { // ANML.g:214:2: ( builtinType ( set )? -> ^( TypeRef builtinType ( set )? ) | ID ( set )? -> ^( TypeRef ID ( set )? ) | Vector param_list -> ^( Vector param_list ) | type_enumeration ) int alt4=4; switch ( input.LA(1) ) { case Boolean: case Integer: case Float: case Symbol: case String: case Object: { alt4=1; } break; case ID: { alt4=2; } break; case Vector: { alt4=3; } break; case LeftC: { alt4=4; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 4, 0, input); throw nvae; } switch (alt4) { case 1 : // ANML.g:214:4: builtinType ( set )? { pushFollow(FOLLOW_builtinType_in_type_spec567); builtinType2=builtinType(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_builtinType.add(builtinType2.getTree()); // ANML.g:214:16: ( set )? int alt2=2; int LA2_0 = input.LA(1); if ( (LA2_0==LeftC||LA2_0==LeftB) ) { alt2=1; } switch (alt2) { case 1 : // ANML.g:214:16: set { pushFollow(FOLLOW_set_in_type_spec569); set3=set(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_set.add(set3.getTree()); } break; } // AST REWRITE // elements: set, builtinType // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 215:4: -> ^( TypeRef builtinType ( set )? ) { // ANML.g:215:7: ^( TypeRef builtinType ( set )? ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRef, "TypeRef"), root_1); adaptor.addChild(root_1, stream_builtinType.nextTree()); // ANML.g:215:29: ( set )? if ( stream_set.hasNext() ) { adaptor.addChild(root_1, stream_set.nextTree()); } stream_set.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:216:4: ID ( set )? { ID4=(ANMLToken)match(input,ID,FOLLOW_ID_in_type_spec589); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID4); // ANML.g:216:7: ( set )? int alt3=2; int LA3_0 = input.LA(1); if ( (LA3_0==LeftC||LA3_0==LeftB) ) { alt3=1; } switch (alt3) { case 1 : // ANML.g:216:7: set { pushFollow(FOLLOW_set_in_type_spec591); set5=set(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_set.add(set5.getTree()); } break; } // AST REWRITE // elements: ID, set // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 217:4: -> ^( TypeRef ID ( set )? ) { // ANML.g:217:7: ^( TypeRef ID ( set )? ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRef, "TypeRef"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); // ANML.g:217:20: ( set )? if ( stream_set.hasNext() ) { adaptor.addChild(root_1, stream_set.nextTree()); } stream_set.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:218:4: Vector param_list { Vector6=(ANMLToken)match(input,Vector,FOLLOW_Vector_in_type_spec611); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Vector.add(Vector6); pushFollow(FOLLOW_param_list_in_type_spec613); param_list7=param_list(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_list.add(param_list7.getTree()); // AST REWRITE // elements: param_list, Vector // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 219:4: -> ^( Vector param_list ) { // ANML.g:219:7: ^( Vector param_list ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot(stream_Vector.nextNode(), root_1); adaptor.addChild(root_1, stream_param_list.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 4 : // ANML.g:220:4: type_enumeration { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_type_enumeration_in_type_spec629); type_enumeration8=type_enumeration(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, type_enumeration8.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } if ( state.backtracking==0 ) { ((T_scope)T_stack.peek()).typeRef =((ANMLToken)retval.tree); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "type_spec" public static class type_ref_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "type_ref" // ANML.g:222:1: type_ref : ( builtinType ( set )? -> ^( TypeRef builtinType ( set )? ) | ID ( set )? -> ^( TypeRef ID ( set )? ) ); public final ANMLParser.type_ref_return type_ref() throws RecognitionException { ANMLParser.type_ref_return retval = new ANMLParser.type_ref_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID11=null; ANMLParser.builtinType_return builtinType9 = null; ANMLParser.set_return set10 = null; ANMLParser.set_return set12 = null; ANMLToken ID11_tree=null; RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleSubtreeStream stream_set=new RewriteRuleSubtreeStream(adaptor,"rule set"); RewriteRuleSubtreeStream stream_builtinType=new RewriteRuleSubtreeStream(adaptor,"rule builtinType"); try { // ANML.g:224:2: ( builtinType ( set )? -> ^( TypeRef builtinType ( set )? ) | ID ( set )? -> ^( TypeRef ID ( set )? ) ) int alt7=2; int LA7_0 = input.LA(1); if ( ((LA7_0>=Boolean && LA7_0<=Object)) ) { alt7=1; } else if ( (LA7_0==ID) ) { alt7=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 7, 0, input); throw nvae; } switch (alt7) { case 1 : // ANML.g:224:4: builtinType ( set )? { pushFollow(FOLLOW_builtinType_in_type_ref644); builtinType9=builtinType(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_builtinType.add(builtinType9.getTree()); // ANML.g:224:16: ( set )? int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0==LeftC||LA5_0==LeftB) ) { alt5=1; } switch (alt5) { case 1 : // ANML.g:224:16: set { pushFollow(FOLLOW_set_in_type_ref646); set10=set(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_set.add(set10.getTree()); } break; } // AST REWRITE // elements: set, builtinType // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 225:4: -> ^( TypeRef builtinType ( set )? ) { // ANML.g:225:7: ^( TypeRef builtinType ( set )? ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRef, "TypeRef"), root_1); adaptor.addChild(root_1, stream_builtinType.nextTree()); // ANML.g:225:29: ( set )? if ( stream_set.hasNext() ) { adaptor.addChild(root_1, stream_set.nextTree()); } stream_set.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:226:4: ID ( set )? { ID11=(ANMLToken)match(input,ID,FOLLOW_ID_in_type_ref666); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID11); // ANML.g:226:7: ( set )? int alt6=2; int LA6_0 = input.LA(1); if ( (LA6_0==LeftC||LA6_0==LeftB) ) { alt6=1; } switch (alt6) { case 1 : // ANML.g:226:7: set { pushFollow(FOLLOW_set_in_type_ref668); set12=set(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_set.add(set12.getTree()); } break; } // AST REWRITE // elements: set, ID // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 227:4: -> ^( TypeRef ID ( set )? ) { // ANML.g:227:7: ^( TypeRef ID ( set )? ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRef, "TypeRef"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); // ANML.g:227:20: ( set )? if ( stream_set.hasNext() ) { adaptor.addChild(root_1, stream_set.nextTree()); } stream_set.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } if ( state.backtracking==0 ) { ((T_scope)T_stack.peek()).typeRef =((ANMLToken)retval.tree); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "type_ref" public static class user_type_ref_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "user_type_ref" // ANML.g:229:1: user_type_ref : ID -> ^( TypeRef ID ) ; public final ANMLParser.user_type_ref_return user_type_ref() throws RecognitionException { ANMLParser.user_type_ref_return retval = new ANMLParser.user_type_ref_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID13=null; ANMLToken ID13_tree=null; RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); try { // ANML.g:231:2: ( ID -> ^( TypeRef ID ) ) // ANML.g:231:4: ID { ID13=(ANMLToken)match(input,ID,FOLLOW_ID_in_user_type_ref698); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID13); // AST REWRITE // elements: ID // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 231:7: -> ^( TypeRef ID ) { // ANML.g:231:10: ^( TypeRef ID ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRef, "TypeRef"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } if ( state.backtracking==0 ) { ((T_scope)T_stack.peek()).typeRef =((ANMLToken)retval.tree); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "user_type_ref" public static class enumerated_type_ref_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "enumerated_type_ref" // ANML.g:233:1: enumerated_type_ref : ( Symbol -> ^( TypeRef Symbol ) | Object -> ^( TypeRef Object ) | ID -> ^( TypeRef ID ) ); public final ANMLParser.enumerated_type_ref_return enumerated_type_ref() throws RecognitionException { ANMLParser.enumerated_type_ref_return retval = new ANMLParser.enumerated_type_ref_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Symbol14=null; ANMLToken Object15=null; ANMLToken ID16=null; ANMLToken Symbol14_tree=null; ANMLToken Object15_tree=null; ANMLToken ID16_tree=null; RewriteRuleTokenStream stream_Symbol=new RewriteRuleTokenStream(adaptor,"token Symbol"); RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleTokenStream stream_Object=new RewriteRuleTokenStream(adaptor,"token Object"); try { // ANML.g:235:2: ( Symbol -> ^( TypeRef Symbol ) | Object -> ^( TypeRef Object ) | ID -> ^( TypeRef ID ) ) int alt8=3; switch ( input.LA(1) ) { case Symbol: { alt8=1; } break; case Object: { alt8=2; } break; case ID: { alt8=3; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 8, 0, input); throw nvae; } switch (alt8) { case 1 : // ANML.g:235:4: Symbol { Symbol14=(ANMLToken)match(input,Symbol,FOLLOW_Symbol_in_enumerated_type_ref720); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Symbol.add(Symbol14); // AST REWRITE // elements: Symbol // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 235:11: -> ^( TypeRef Symbol ) { // ANML.g:235:14: ^( TypeRef Symbol ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRef, "TypeRef"), root_1); adaptor.addChild(root_1, stream_Symbol.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:236:4: Object { Object15=(ANMLToken)match(input,Object,FOLLOW_Object_in_enumerated_type_ref733); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Object.add(Object15); // AST REWRITE // elements: Object // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 236:11: -> ^( TypeRef Object ) { // ANML.g:236:14: ^( TypeRef Object ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRef, "TypeRef"), root_1); adaptor.addChild(root_1, stream_Object.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:237:4: ID { ID16=(ANMLToken)match(input,ID,FOLLOW_ID_in_enumerated_type_ref746); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID16); // AST REWRITE // elements: ID // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 237:7: -> ^( TypeRef ID ) { // ANML.g:237:10: ^( TypeRef ID ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRef, "TypeRef"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } if ( state.backtracking==0 ) { ((T_scope)T_stack.peek()).typeRef =((ANMLToken)retval.tree); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "enumerated_type_ref" public static class predicate_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "predicate_helper" // ANML.g:239:1: predicate_helper : Predicate -> ^( TypeRef[$Predicate] Boolean[$Predicate] ) ; public final ANMLParser.predicate_helper_return predicate_helper() throws RecognitionException { ANMLParser.predicate_helper_return retval = new ANMLParser.predicate_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Predicate17=null; ANMLToken Predicate17_tree=null; RewriteRuleTokenStream stream_Predicate=new RewriteRuleTokenStream(adaptor,"token Predicate"); try { // ANML.g:241:2: ( Predicate -> ^( TypeRef[$Predicate] Boolean[$Predicate] ) ) // ANML.g:241:4: Predicate { Predicate17=(ANMLToken)match(input,Predicate,FOLLOW_Predicate_in_predicate_helper768); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Predicate.add(Predicate17); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 242:4: -> ^( TypeRef[$Predicate] Boolean[$Predicate] ) { // ANML.g:242:7: ^( TypeRef[$Predicate] Boolean[$Predicate] ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRef, Predicate17), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(Boolean, Predicate17)); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } if ( state.backtracking==0 ) { ((T_scope)T_stack.peek()).typeRef =((ANMLToken)retval.tree); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "predicate_helper" public static class param_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "param_helper" // ANML.g:247:1: param_helper : ID -> ^( Parameter ID ) ; public final ANMLParser.param_helper_return param_helper() throws RecognitionException { ANMLParser.param_helper_return retval = new ANMLParser.param_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID18=null; ANMLToken ID18_tree=null; RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); try { // ANML.g:247:14: ( ID -> ^( Parameter ID ) ) // ANML.g:247:16: ID { ID18=(ANMLToken)match(input,ID,FOLLOW_ID_in_param_helper792); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID18); // AST REWRITE // elements: ID // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 248:2: -> ^( Parameter ID ) { // ANML.g:248:5: ^( Parameter ID ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Parameter, "Parameter"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, ((T_scope)T_stack.peek()).typeRef); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "param_helper" public static class var_decl_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "var_decl_helper" // ANML.g:250:1: var_decl_helper : ID ( init )? -> ^( Fluent ID ( init )? ) ; public final ANMLParser.var_decl_helper_return var_decl_helper() throws RecognitionException { ANMLParser.var_decl_helper_return retval = new ANMLParser.var_decl_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID19=null; ANMLParser.init_return init20 = null; ANMLToken ID19_tree=null; RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleSubtreeStream stream_init=new RewriteRuleSubtreeStream(adaptor,"rule init"); try { // ANML.g:250:17: ( ID ( init )? -> ^( Fluent ID ( init )? ) ) // ANML.g:250:19: ID ( init )? { ID19=(ANMLToken)match(input,ID,FOLLOW_ID_in_var_decl_helper813); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID19); // ANML.g:250:22: ( init )? int alt9=2; int LA9_0 = input.LA(1); if ( (LA9_0==Assign||LA9_0==Undefine) ) { alt9=1; } switch (alt9) { case 1 : // ANML.g:250:22: init { pushFollow(FOLLOW_init_in_var_decl_helper815); init20=init(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_init.add(init20.getTree()); } break; } // AST REWRITE // elements: ID, init // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 251:2: -> ^( Fluent ID ( init )? ) { // ANML.g:251:5: ^( Fluent ID ( init )? ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Fluent, "Fluent"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, ((T_scope)T_stack.peek()).typeRef); // ANML.g:251:31: ( init )? if ( stream_init.hasNext() ) { adaptor.addChild(root_1, stream_init.nextTree()); } stream_init.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "var_decl_helper" public static class fun_decl_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "fun_decl_helper" // ANML.g:253:1: fun_decl_helper : ID param_list -> ^( FluentFunction ID param_list ) ; public final ANMLParser.fun_decl_helper_return fun_decl_helper() throws RecognitionException { ANMLParser.fun_decl_helper_return retval = new ANMLParser.fun_decl_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID21=null; ANMLParser.param_list_return param_list22 = null; ANMLToken ID21_tree=null; RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleSubtreeStream stream_param_list=new RewriteRuleSubtreeStream(adaptor,"rule param_list"); try { // ANML.g:253:17: ( ID param_list -> ^( FluentFunction ID param_list ) ) // ANML.g:253:19: ID param_list { ID21=(ANMLToken)match(input,ID,FOLLOW_ID_in_fun_decl_helper839); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID21); pushFollow(FOLLOW_param_list_in_fun_decl_helper841); param_list22=param_list(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_list.add(param_list22.getTree()); // AST REWRITE // elements: ID, param_list // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 254:2: -> ^( FluentFunction ID param_list ) { // ANML.g:254:5: ^( FluentFunction ID param_list ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(FluentFunction, "FluentFunction"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, ((T_scope)T_stack.peek()).typeRef); adaptor.addChild(root_1, stream_param_list.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "fun_decl_helper" public static class const_var_decl_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "const_var_decl_helper" // ANML.g:256:1: const_var_decl_helper : ID ( init )? -> ^( Constant ID ( init )? ) ; public final ANMLParser.const_var_decl_helper_return const_var_decl_helper() throws RecognitionException { ANMLParser.const_var_decl_helper_return retval = new ANMLParser.const_var_decl_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID23=null; ANMLParser.init_return init24 = null; ANMLToken ID23_tree=null; RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleSubtreeStream stream_init=new RewriteRuleSubtreeStream(adaptor,"rule init"); try { // ANML.g:256:23: ( ID ( init )? -> ^( Constant ID ( init )? ) ) // ANML.g:256:25: ID ( init )? { ID23=(ANMLToken)match(input,ID,FOLLOW_ID_in_const_var_decl_helper863); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID23); // ANML.g:256:28: ( init )? int alt10=2; int LA10_0 = input.LA(1); if ( (LA10_0==Assign||LA10_0==Undefine) ) { alt10=1; } switch (alt10) { case 1 : // ANML.g:256:28: init { pushFollow(FOLLOW_init_in_const_var_decl_helper865); init24=init(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_init.add(init24.getTree()); } break; } // AST REWRITE // elements: ID, init // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 257:2: -> ^( Constant ID ( init )? ) { // ANML.g:257:5: ^( Constant ID ( init )? ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Constant, "Constant"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, ((T_scope)T_stack.peek()).typeRef); // ANML.g:257:33: ( init )? if ( stream_init.hasNext() ) { adaptor.addChild(root_1, stream_init.nextTree()); } stream_init.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "const_var_decl_helper" public static class const_fun_decl_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "const_fun_decl_helper" // ANML.g:259:1: const_fun_decl_helper : ID param_list -> ^( ConstantFunction ID param_list ) ; public final ANMLParser.const_fun_decl_helper_return const_fun_decl_helper() throws RecognitionException { ANMLParser.const_fun_decl_helper_return retval = new ANMLParser.const_fun_decl_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID25=null; ANMLParser.param_list_return param_list26 = null; ANMLToken ID25_tree=null; RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleSubtreeStream stream_param_list=new RewriteRuleSubtreeStream(adaptor,"rule param_list"); try { // ANML.g:259:23: ( ID param_list -> ^( ConstantFunction ID param_list ) ) // ANML.g:259:25: ID param_list { ID25=(ANMLToken)match(input,ID,FOLLOW_ID_in_const_fun_decl_helper889); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID25); pushFollow(FOLLOW_param_list_in_const_fun_decl_helper891); param_list26=param_list(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_list.add(param_list26.getTree()); // AST REWRITE // elements: ID, param_list // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 260:2: -> ^( ConstantFunction ID param_list ) { // ANML.g:260:5: ^( ConstantFunction ID param_list ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(ConstantFunction, "ConstantFunction"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, ((T_scope)T_stack.peek()).typeRef); adaptor.addChild(root_1, stream_param_list.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "const_fun_decl_helper" public static class type_decl_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "type_decl_helper" // ANML.g:262:1: type_decl_helper : ID ( LessThan s+= type_ref | Assign d+= type_spec | With p+= object_block )* -> ^( Type ID ^( Assign[\"Assign\"] ( $d)* ) ^( LessThan[\"LessThan\"] ( $s)* ) ^( With[\"With\"] ( $p)* ) ) ; public final ANMLParser.type_decl_helper_return type_decl_helper() throws RecognitionException { ANMLParser.type_decl_helper_return retval = new ANMLParser.type_decl_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID27=null; ANMLToken LessThan28=null; ANMLToken Assign29=null; ANMLToken With30=null; List list_s=null; List list_d=null; List list_p=null; RuleReturnScope s = null; RuleReturnScope d = null; RuleReturnScope p = null; ANMLToken ID27_tree=null; ANMLToken LessThan28_tree=null; ANMLToken Assign29_tree=null; ANMLToken With30_tree=null; RewriteRuleTokenStream stream_Assign=new RewriteRuleTokenStream(adaptor,"token Assign"); RewriteRuleTokenStream stream_LessThan=new RewriteRuleTokenStream(adaptor,"token LessThan"); RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleTokenStream stream_With=new RewriteRuleTokenStream(adaptor,"token With"); RewriteRuleSubtreeStream stream_type_spec=new RewriteRuleSubtreeStream(adaptor,"rule type_spec"); RewriteRuleSubtreeStream stream_object_block=new RewriteRuleSubtreeStream(adaptor,"rule object_block"); RewriteRuleSubtreeStream stream_type_ref=new RewriteRuleSubtreeStream(adaptor,"rule type_ref"); try { // ANML.g:263:2: ( ID ( LessThan s+= type_ref | Assign d+= type_spec | With p+= object_block )* -> ^( Type ID ^( Assign[\"Assign\"] ( $d)* ) ^( LessThan[\"LessThan\"] ( $s)* ) ^( With[\"With\"] ( $p)* ) ) ) // ANML.g:263:4: ID ( LessThan s+= type_ref | Assign d+= type_spec | With p+= object_block )* { ID27=(ANMLToken)match(input,ID,FOLLOW_ID_in_type_decl_helper914); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID27); // ANML.g:264:4: ( LessThan s+= type_ref | Assign d+= type_spec | With p+= object_block )* loop11: do { int alt11=4; switch ( input.LA(1) ) { case LessThan: { alt11=1; } break; case Assign: { alt11=2; } break; case With: { alt11=3; } break; } switch (alt11) { case 1 : // ANML.g:264:6: LessThan s+= type_ref { LessThan28=(ANMLToken)match(input,LessThan,FOLLOW_LessThan_in_type_decl_helper921); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LessThan.add(LessThan28); pushFollow(FOLLOW_type_ref_in_type_decl_helper925); s=type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_ref.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 2 : // ANML.g:265:6: Assign d+= type_spec { Assign29=(ANMLToken)match(input,Assign,FOLLOW_Assign_in_type_decl_helper932); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Assign.add(Assign29); pushFollow(FOLLOW_type_spec_in_type_decl_helper936); d=type_spec(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_spec.add(d.getTree()); if (list_d==null) list_d=new ArrayList(); list_d.add(d.getTree()); } break; case 3 : // ANML.g:266:6: With p+= object_block { With30=(ANMLToken)match(input,With,FOLLOW_With_in_type_decl_helper943); if (state.failed) return retval; if ( state.backtracking==0 ) stream_With.add(With30); pushFollow(FOLLOW_object_block_in_type_decl_helper947); p=object_block(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_object_block.add(p.getTree()); if (list_p==null) list_p=new ArrayList(); list_p.add(p.getTree()); } break; default : break loop11; } } while (true); // AST REWRITE // elements: With, Assign, ID, p, LessThan, d, s // token labels: // rule labels: retval // token list labels: // rule list labels: d, s, p if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_d=new RewriteRuleSubtreeStream(adaptor,"token d",list_d); RewriteRuleSubtreeStream stream_s=new RewriteRuleSubtreeStream(adaptor,"token s",list_s); RewriteRuleSubtreeStream stream_p=new RewriteRuleSubtreeStream(adaptor,"token p",list_p); root_0 = (ANMLToken)adaptor.nil(); // 268:2: -> ^( Type ID ^( Assign[\"Assign\"] ( $d)* ) ^( LessThan[\"LessThan\"] ( $s)* ) ^( With[\"With\"] ( $p)* ) ) { // ANML.g:268:5: ^( Type ID ^( Assign[\"Assign\"] ( $d)* ) ^( LessThan[\"LessThan\"] ( $s)* ) ^( With[\"With\"] ( $p)* ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Type, "Type"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); // ANML.g:268:15: ^( Assign[\"Assign\"] ( $d)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Assign, "Assign"), root_2); // ANML.g:268:34: ( $d)* while ( stream_d.hasNext() ) { adaptor.addChild(root_2, stream_d.nextTree()); } stream_d.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:268:39: ^( LessThan[\"LessThan\"] ( $s)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LessThan, "LessThan"), root_2); // ANML.g:268:62: ( $s)* while ( stream_s.hasNext() ) { adaptor.addChild(root_2, stream_s.nextTree()); } stream_s.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:268:67: ^( With[\"With\"] ( $p)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(With, "With"), root_2); // ANML.g:268:82: ( $p)* while ( stream_p.hasNext() ) { adaptor.addChild(root_2, stream_p.nextTree()); } stream_p.reset(); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "type_decl_helper" public static class type_refine_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "type_refine_helper" // ANML.g:270:1: type_refine_helper : ( user_type_ref LessThan type_ref Semi -> ^( TypeRefine[$LessThan] user_type_ref ^( LessThan type_ref ) ) | user_type_ref Assign type_spec Semi -> ^( TypeRefine[$Assign] user_type_ref ^( Assign type_spec ) ) | enumerated_type_ref i= ID ( Comma ID )* Semi -> ^( TypeRefine[$i] enumerated_type_ref ( ID )+ ) ); public final ANMLParser.type_refine_helper_return type_refine_helper() throws RecognitionException { ANMLParser.type_refine_helper_return retval = new ANMLParser.type_refine_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken i=null; ANMLToken LessThan32=null; ANMLToken Semi34=null; ANMLToken Assign36=null; ANMLToken Semi38=null; ANMLToken Comma40=null; ANMLToken ID41=null; ANMLToken Semi42=null; ANMLParser.user_type_ref_return user_type_ref31 = null; ANMLParser.type_ref_return type_ref33 = null; ANMLParser.user_type_ref_return user_type_ref35 = null; ANMLParser.type_spec_return type_spec37 = null; ANMLParser.enumerated_type_ref_return enumerated_type_ref39 = null; ANMLToken i_tree=null; ANMLToken LessThan32_tree=null; ANMLToken Semi34_tree=null; ANMLToken Assign36_tree=null; ANMLToken Semi38_tree=null; ANMLToken Comma40_tree=null; ANMLToken ID41_tree=null; ANMLToken Semi42_tree=null; RewriteRuleTokenStream stream_Assign=new RewriteRuleTokenStream(adaptor,"token Assign"); RewriteRuleTokenStream stream_Semi=new RewriteRuleTokenStream(adaptor,"token Semi"); RewriteRuleTokenStream stream_LessThan=new RewriteRuleTokenStream(adaptor,"token LessThan"); RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleSubtreeStream stream_type_spec=new RewriteRuleSubtreeStream(adaptor,"rule type_spec"); RewriteRuleSubtreeStream stream_user_type_ref=new RewriteRuleSubtreeStream(adaptor,"rule user_type_ref"); RewriteRuleSubtreeStream stream_type_ref=new RewriteRuleSubtreeStream(adaptor,"rule type_ref"); RewriteRuleSubtreeStream stream_enumerated_type_ref=new RewriteRuleSubtreeStream(adaptor,"rule enumerated_type_ref"); try { // ANML.g:271:2: ( user_type_ref LessThan type_ref Semi -> ^( TypeRefine[$LessThan] user_type_ref ^( LessThan type_ref ) ) | user_type_ref Assign type_spec Semi -> ^( TypeRefine[$Assign] user_type_ref ^( Assign type_spec ) ) | enumerated_type_ref i= ID ( Comma ID )* Semi -> ^( TypeRefine[$i] enumerated_type_ref ( ID )+ ) ) int alt13=3; int LA13_0 = input.LA(1); if ( (LA13_0==ID) ) { switch ( input.LA(2) ) { case LessThan: { alt13=1; } break; case ID: { alt13=3; } break; case Assign: { alt13=2; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 13, 1, input); throw nvae; } } else if ( (LA13_0==Symbol||LA13_0==Object) ) { alt13=3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 13, 0, input); throw nvae; } switch (alt13) { case 1 : // ANML.g:271:4: user_type_ref LessThan type_ref Semi { pushFollow(FOLLOW_user_type_ref_in_type_refine_helper998); user_type_ref31=user_type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_user_type_ref.add(user_type_ref31.getTree()); LessThan32=(ANMLToken)match(input,LessThan,FOLLOW_LessThan_in_type_refine_helper1000); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LessThan.add(LessThan32); pushFollow(FOLLOW_type_ref_in_type_refine_helper1002); type_ref33=type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_ref.add(type_ref33.getTree()); Semi34=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_type_refine_helper1004); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi34); // AST REWRITE // elements: user_type_ref, type_ref, LessThan // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 272:3: -> ^( TypeRefine[$LessThan] user_type_ref ^( LessThan type_ref ) ) { // ANML.g:272:6: ^( TypeRefine[$LessThan] user_type_ref ^( LessThan type_ref ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRefine, LessThan32), root_1); adaptor.addChild(root_1, stream_user_type_ref.nextTree()); // ANML.g:272:44: ^( LessThan type_ref ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot(stream_LessThan.nextNode(), root_2); adaptor.addChild(root_2, stream_type_ref.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:273:4: user_type_ref Assign type_spec Semi { pushFollow(FOLLOW_user_type_ref_in_type_refine_helper1026); user_type_ref35=user_type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_user_type_ref.add(user_type_ref35.getTree()); Assign36=(ANMLToken)match(input,Assign,FOLLOW_Assign_in_type_refine_helper1028); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Assign.add(Assign36); pushFollow(FOLLOW_type_spec_in_type_refine_helper1030); type_spec37=type_spec(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_spec.add(type_spec37.getTree()); Semi38=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_type_refine_helper1032); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi38); // AST REWRITE // elements: type_spec, Assign, user_type_ref // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 274:3: -> ^( TypeRefine[$Assign] user_type_ref ^( Assign type_spec ) ) { // ANML.g:274:6: ^( TypeRefine[$Assign] user_type_ref ^( Assign type_spec ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRefine, Assign36), root_1); adaptor.addChild(root_1, stream_user_type_ref.nextTree()); // ANML.g:274:42: ^( Assign type_spec ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot(stream_Assign.nextNode(), root_2); adaptor.addChild(root_2, stream_type_spec.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:275:4: enumerated_type_ref i= ID ( Comma ID )* Semi { pushFollow(FOLLOW_enumerated_type_ref_in_type_refine_helper1054); enumerated_type_ref39=enumerated_type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_enumerated_type_ref.add(enumerated_type_ref39.getTree()); i=(ANMLToken)match(input,ID,FOLLOW_ID_in_type_refine_helper1058); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(i); // ANML.g:275:29: ( Comma ID )* loop12: do { int alt12=2; int LA12_0 = input.LA(1); if ( (LA12_0==Comma) ) { alt12=1; } switch (alt12) { case 1 : // ANML.g:275:30: Comma ID { Comma40=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_type_refine_helper1061); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma40); ID41=(ANMLToken)match(input,ID,FOLLOW_ID_in_type_refine_helper1063); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID41); } break; default : break loop12; } } while (true); Semi42=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_type_refine_helper1067); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi42); // AST REWRITE // elements: ID, enumerated_type_ref // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 276:3: -> ^( TypeRefine[$i] enumerated_type_ref ( ID )+ ) { // ANML.g:276:6: ^( TypeRefine[$i] enumerated_type_ref ( ID )+ ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TypeRefine, i), root_1); adaptor.addChild(root_1, stream_enumerated_type_ref.nextTree()); if ( !(stream_ID.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_ID.hasNext() ) { adaptor.addChild(root_1, stream_ID.nextNode()); } stream_ID.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "type_refine_helper" public static class init_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "init" // ANML.g:280:1: init : ( Assign expr | Assign Undefined | Undefine ); public final ANMLParser.init_return init() throws RecognitionException { ANMLParser.init_return retval = new ANMLParser.init_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Assign43=null; ANMLToken Assign45=null; ANMLToken Undefined46=null; ANMLToken Undefine47=null; ANMLParser.expr_return expr44 = null; ANMLToken Assign43_tree=null; ANMLToken Assign45_tree=null; ANMLToken Undefined46_tree=null; ANMLToken Undefine47_tree=null; try { // ANML.g:281:2: ( Assign expr | Assign Undefined | Undefine ) int alt14=3; int LA14_0 = input.LA(1); if ( (LA14_0==Assign) ) { int LA14_1 = input.LA(2); if ( (LA14_1==Undefined) ) { alt14=2; } else if ( ((LA14_1>=Bra && LA14_1<=Ket)||LA14_1==ID||LA14_1==LeftP||(LA14_1>=NotLog && LA14_1<=NotBit)||(LA14_1>=LeftB && LA14_1<=Duration)||LA14_1==Contains||(LA14_1>=ForAll && LA14_1<=Exists)||LA14_1==Dots||LA14_1==Minus||(LA14_1>=Unordered && LA14_1<=Ordered)||(LA14_1>=Start && LA14_1<=Infinity)) ) { alt14=1; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 14, 1, input); throw nvae; } } else if ( (LA14_0==Undefine) ) { alt14=3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 14, 0, input); throw nvae; } switch (alt14) { case 1 : // ANML.g:281:4: Assign expr { root_0 = (ANMLToken)adaptor.nil(); Assign43=(ANMLToken)match(input,Assign,FOLLOW_Assign_in_init1094); if (state.failed) return retval; pushFollow(FOLLOW_expr_in_init1097); expr44=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, expr44.getTree()); } break; case 2 : // ANML.g:282:4: Assign Undefined { root_0 = (ANMLToken)adaptor.nil(); Assign45=(ANMLToken)match(input,Assign,FOLLOW_Assign_in_init1102); if (state.failed) return retval; Undefined46=(ANMLToken)match(input,Undefined,FOLLOW_Undefined_in_init1105); if (state.failed) return retval; } break; case 3 : // ANML.g:283:4: Undefine { root_0 = (ANMLToken)adaptor.nil(); Undefine47=(ANMLToken)match(input,Undefine,FOLLOW_Undefine_in_init1111); if (state.failed) return retval; } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "init" public static class param_list_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "param_list" // ANML.g:285:1: param_list : ( LeftP p+= param ( Comma p+= param )* RightP -> ^( Parameters ( $p)+ ) | LeftP RightP -> ^( Parameters ) ) ; public final ANMLParser.param_list_return param_list() throws RecognitionException { ANMLParser.param_list_return retval = new ANMLParser.param_list_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftP48=null; ANMLToken Comma49=null; ANMLToken RightP50=null; ANMLToken LeftP51=null; ANMLToken RightP52=null; List list_p=null; RuleReturnScope p = null; ANMLToken LeftP48_tree=null; ANMLToken Comma49_tree=null; ANMLToken RightP50_tree=null; ANMLToken LeftP51_tree=null; ANMLToken RightP52_tree=null; RewriteRuleTokenStream stream_RightP=new RewriteRuleTokenStream(adaptor,"token RightP"); RewriteRuleTokenStream stream_LeftP=new RewriteRuleTokenStream(adaptor,"token LeftP"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleSubtreeStream stream_param=new RewriteRuleSubtreeStream(adaptor,"rule param"); try { // ANML.g:285:12: ( ( LeftP p+= param ( Comma p+= param )* RightP -> ^( Parameters ( $p)+ ) | LeftP RightP -> ^( Parameters ) ) ) // ANML.g:286:2: ( LeftP p+= param ( Comma p+= param )* RightP -> ^( Parameters ( $p)+ ) | LeftP RightP -> ^( Parameters ) ) { // ANML.g:286:2: ( LeftP p+= param ( Comma p+= param )* RightP -> ^( Parameters ( $p)+ ) | LeftP RightP -> ^( Parameters ) ) int alt16=2; int LA16_0 = input.LA(1); if ( (LA16_0==LeftP) ) { int LA16_1 = input.LA(2); if ( (LA16_1==RightP) ) { alt16=2; } else if ( (LA16_1==ID||(LA16_1>=Boolean && LA16_1<=Object)) ) { alt16=1; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 16, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 16, 0, input); throw nvae; } switch (alt16) { case 1 : // ANML.g:286:4: LeftP p+= param ( Comma p+= param )* RightP { LeftP48=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_param_list1124); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftP.add(LeftP48); pushFollow(FOLLOW_param_in_param_list1128); p=param(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param.add(p.getTree()); if (list_p==null) list_p=new ArrayList(); list_p.add(p.getTree()); // ANML.g:286:19: ( Comma p+= param )* loop15: do { int alt15=2; int LA15_0 = input.LA(1); if ( (LA15_0==Comma) ) { alt15=1; } switch (alt15) { case 1 : // ANML.g:286:20: Comma p+= param { Comma49=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_param_list1131); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma49); pushFollow(FOLLOW_param_in_param_list1135); p=param(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param.add(p.getTree()); if (list_p==null) list_p=new ArrayList(); list_p.add(p.getTree()); } break; default : break loop15; } } while (true); RightP50=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_param_list1139); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightP.add(RightP50); // AST REWRITE // elements: p // token labels: // rule labels: retval // token list labels: // rule list labels: p if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_p=new RewriteRuleSubtreeStream(adaptor,"token p",list_p); root_0 = (ANMLToken)adaptor.nil(); // 287:3: -> ^( Parameters ( $p)+ ) { // ANML.g:287:6: ^( Parameters ( $p)+ ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Parameters, "Parameters"), root_1); if ( !(stream_p.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_p.hasNext() ) { adaptor.addChild(root_1, stream_p.nextTree()); } stream_p.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:288:4: LeftP RightP { LeftP51=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_param_list1157); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftP.add(LeftP51); RightP52=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_param_list1159); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightP.add(RightP52); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 289:3: -> ^( Parameters ) { // ANML.g:289:6: ^( Parameters ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Parameters, "Parameters"), root_1); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "param_list" public static class param_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "param" // ANML.g:294:1: param : type_ref param_helper ( Comma param_helper )* -> ( param_helper )+ ; public final ANMLParser.param_return param() throws RecognitionException { T_stack.push(new T_scope()); ANMLParser.param_return retval = new ANMLParser.param_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Comma55=null; ANMLParser.type_ref_return type_ref53 = null; ANMLParser.param_helper_return param_helper54 = null; ANMLParser.param_helper_return param_helper56 = null; ANMLToken Comma55_tree=null; RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleSubtreeStream stream_param_helper=new RewriteRuleSubtreeStream(adaptor,"rule param_helper"); RewriteRuleSubtreeStream stream_type_ref=new RewriteRuleSubtreeStream(adaptor,"rule type_ref"); try { // ANML.g:296:2: ( type_ref param_helper ( Comma param_helper )* -> ( param_helper )+ ) // ANML.g:296:4: type_ref param_helper ( Comma param_helper )* { pushFollow(FOLLOW_type_ref_in_param1189); type_ref53=type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_ref.add(type_ref53.getTree()); pushFollow(FOLLOW_param_helper_in_param1191); param_helper54=param_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_helper.add(param_helper54.getTree()); // ANML.g:296:26: ( Comma param_helper )* loop17: do { int alt17=2; int LA17_0 = input.LA(1); if ( (LA17_0==Comma) ) { int LA17_1 = input.LA(2); if ( (LA17_1==ID) ) { int LA17_3 = input.LA(3); if ( (LA17_3==Comma||LA17_3==RightP) ) { alt17=1; } } } switch (alt17) { case 1 : // ANML.g:296:27: Comma param_helper { Comma55=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_param1194); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma55); pushFollow(FOLLOW_param_helper_in_param1196); param_helper56=param_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_helper.add(param_helper56.getTree()); } break; default : break loop17; } } while (true); // AST REWRITE // elements: param_helper // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 297:4: -> ( param_helper )+ { if ( !(stream_param_helper.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_param_helper.hasNext() ) { adaptor.addChild(root_0, stream_param_helper.nextTree()); } stream_param_helper.reset(); } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { T_stack.pop(); } return retval; } // $ANTLR end "param" public static class type_decl_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "type_decl" // ANML.g:299:1: type_decl : ( Type l+= type_decl_helper ( Comma l+= type_decl_helper )* Semi -> ( $l)+ | type_refine ); public final ANMLParser.type_decl_return type_decl() throws RecognitionException { T_stack.push(new T_scope()); ANMLParser.type_decl_return retval = new ANMLParser.type_decl_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Type57=null; ANMLToken Comma58=null; ANMLToken Semi59=null; List list_l=null; ANMLParser.type_refine_return type_refine60 = null; RuleReturnScope l = null; ANMLToken Type57_tree=null; ANMLToken Comma58_tree=null; ANMLToken Semi59_tree=null; RewriteRuleTokenStream stream_Semi=new RewriteRuleTokenStream(adaptor,"token Semi"); RewriteRuleTokenStream stream_Type=new RewriteRuleTokenStream(adaptor,"token Type"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleSubtreeStream stream_type_decl_helper=new RewriteRuleSubtreeStream(adaptor,"rule type_decl_helper"); try { // ANML.g:301:2: ( Type l+= type_decl_helper ( Comma l+= type_decl_helper )* Semi -> ( $l)+ | type_refine ) int alt19=2; int LA19_0 = input.LA(1); if ( (LA19_0==Type) ) { alt19=1; } else if ( (LA19_0==Fact) ) { alt19=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 19, 0, input); throw nvae; } switch (alt19) { case 1 : // ANML.g:301:4: Type l+= type_decl_helper ( Comma l+= type_decl_helper )* Semi { Type57=(ANMLToken)match(input,Type,FOLLOW_Type_in_type_decl1223); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Type.add(Type57); pushFollow(FOLLOW_type_decl_helper_in_type_decl1227); l=type_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); // ANML.g:301:29: ( Comma l+= type_decl_helper )* loop18: do { int alt18=2; int LA18_0 = input.LA(1); if ( (LA18_0==Comma) ) { alt18=1; } switch (alt18) { case 1 : // ANML.g:301:30: Comma l+= type_decl_helper { Comma58=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_type_decl1230); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma58); pushFollow(FOLLOW_type_decl_helper_in_type_decl1234); l=type_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); } break; default : break loop18; } } while (true); Semi59=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_type_decl1238); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi59); // AST REWRITE // elements: l // token labels: // rule labels: retval // token list labels: // rule list labels: l if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_l=new RewriteRuleSubtreeStream(adaptor,"token l",list_l); root_0 = (ANMLToken)adaptor.nil(); // 302:4: -> ( $l)+ { if ( !(stream_l.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_l.hasNext() ) { adaptor.addChild(root_0, stream_l.nextTree()); } stream_l.reset(); } retval.tree = root_0;} } break; case 2 : // ANML.g:303:4: type_refine { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_type_refine_in_type_decl1252); type_refine60=type_refine(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, type_refine60.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { T_stack.pop(); } return retval; } // $ANTLR end "type_decl" public static class const_decl_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "const_decl" // ANML.g:305:1: const_decl : Constant type_ref (l+= const_var_decl_helper ( Comma l+= const_var_decl_helper )* Semi | l+= const_fun_decl_helper ( Comma l+= const_fun_decl_helper )* Semi ) -> ( $l)+ ; public final ANMLParser.const_decl_return const_decl() throws RecognitionException { T_stack.push(new T_scope()); ANMLParser.const_decl_return retval = new ANMLParser.const_decl_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Constant61=null; ANMLToken Comma63=null; ANMLToken Semi64=null; ANMLToken Comma65=null; ANMLToken Semi66=null; List list_l=null; ANMLParser.type_ref_return type_ref62 = null; RuleReturnScope l = null; ANMLToken Constant61_tree=null; ANMLToken Comma63_tree=null; ANMLToken Semi64_tree=null; ANMLToken Comma65_tree=null; ANMLToken Semi66_tree=null; RewriteRuleTokenStream stream_Semi=new RewriteRuleTokenStream(adaptor,"token Semi"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleTokenStream stream_Constant=new RewriteRuleTokenStream(adaptor,"token Constant"); RewriteRuleSubtreeStream stream_const_var_decl_helper=new RewriteRuleSubtreeStream(adaptor,"rule const_var_decl_helper"); RewriteRuleSubtreeStream stream_type_ref=new RewriteRuleSubtreeStream(adaptor,"rule type_ref"); RewriteRuleSubtreeStream stream_const_fun_decl_helper=new RewriteRuleSubtreeStream(adaptor,"rule const_fun_decl_helper"); try { // ANML.g:307:1: ( Constant type_ref (l+= const_var_decl_helper ( Comma l+= const_var_decl_helper )* Semi | l+= const_fun_decl_helper ( Comma l+= const_fun_decl_helper )* Semi ) -> ( $l)+ ) // ANML.g:308:2: Constant type_ref (l+= const_var_decl_helper ( Comma l+= const_var_decl_helper )* Semi | l+= const_fun_decl_helper ( Comma l+= const_fun_decl_helper )* Semi ) { Constant61=(ANMLToken)match(input,Constant,FOLLOW_Constant_in_const_decl1269); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Constant.add(Constant61); pushFollow(FOLLOW_type_ref_in_const_decl1271); type_ref62=type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_ref.add(type_ref62.getTree()); // ANML.g:309:2: (l+= const_var_decl_helper ( Comma l+= const_var_decl_helper )* Semi | l+= const_fun_decl_helper ( Comma l+= const_fun_decl_helper )* Semi ) int alt22=2; int LA22_0 = input.LA(1); if ( (LA22_0==ID) ) { int LA22_1 = input.LA(2); if ( (LA22_1==LeftP) ) { alt22=2; } else if ( (LA22_1==Assign||(LA22_1>=Semi && LA22_1<=Comma)||LA22_1==Undefine) ) { alt22=1; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 22, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 22, 0, input); throw nvae; } switch (alt22) { case 1 : // ANML.g:309:4: l+= const_var_decl_helper ( Comma l+= const_var_decl_helper )* Semi { pushFollow(FOLLOW_const_var_decl_helper_in_const_decl1278); l=const_var_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_const_var_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); // ANML.g:309:29: ( Comma l+= const_var_decl_helper )* loop20: do { int alt20=2; int LA20_0 = input.LA(1); if ( (LA20_0==Comma) ) { alt20=1; } switch (alt20) { case 1 : // ANML.g:309:30: Comma l+= const_var_decl_helper { Comma63=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_const_decl1281); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma63); pushFollow(FOLLOW_const_var_decl_helper_in_const_decl1285); l=const_var_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_const_var_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); } break; default : break loop20; } } while (true); Semi64=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_const_decl1289); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi64); } break; case 2 : // ANML.g:310:4: l+= const_fun_decl_helper ( Comma l+= const_fun_decl_helper )* Semi { pushFollow(FOLLOW_const_fun_decl_helper_in_const_decl1296); l=const_fun_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_const_fun_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); // ANML.g:310:29: ( Comma l+= const_fun_decl_helper )* loop21: do { int alt21=2; int LA21_0 = input.LA(1); if ( (LA21_0==Comma) ) { alt21=1; } switch (alt21) { case 1 : // ANML.g:310:30: Comma l+= const_fun_decl_helper { Comma65=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_const_decl1299); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma65); pushFollow(FOLLOW_const_fun_decl_helper_in_const_decl1303); l=const_fun_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_const_fun_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); } break; default : break loop21; } } while (true); Semi66=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_const_decl1307); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi66); } break; } // AST REWRITE // elements: l // token labels: // rule labels: retval // token list labels: // rule list labels: l if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_l=new RewriteRuleSubtreeStream(adaptor,"token l",list_l); root_0 = (ANMLToken)adaptor.nil(); // 312:4: -> ( $l)+ { if ( !(stream_l.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_l.hasNext() ) { adaptor.addChild(root_0, stream_l.nextTree()); } stream_l.reset(); } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { T_stack.pop(); } return retval; } // $ANTLR end "const_decl" public static class fluent_decl_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "fluent_decl" // ANML.g:315:1: fluent_decl : ( Fluent type_ref (l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) | Variable type_ref l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | Function type_ref l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi | predicate_helper l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) -> ( $l)+ ; public final ANMLParser.fluent_decl_return fluent_decl() throws RecognitionException { T_stack.push(new T_scope()); ANMLParser.fluent_decl_return retval = new ANMLParser.fluent_decl_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Fluent67=null; ANMLToken Comma69=null; ANMLToken Semi70=null; ANMLToken Comma71=null; ANMLToken Semi72=null; ANMLToken Variable73=null; ANMLToken Comma75=null; ANMLToken Semi76=null; ANMLToken Function77=null; ANMLToken Comma79=null; ANMLToken Semi80=null; ANMLToken Comma82=null; ANMLToken Semi83=null; List list_l=null; ANMLParser.type_ref_return type_ref68 = null; ANMLParser.type_ref_return type_ref74 = null; ANMLParser.type_ref_return type_ref78 = null; ANMLParser.predicate_helper_return predicate_helper81 = null; RuleReturnScope l = null; ANMLToken Fluent67_tree=null; ANMLToken Comma69_tree=null; ANMLToken Semi70_tree=null; ANMLToken Comma71_tree=null; ANMLToken Semi72_tree=null; ANMLToken Variable73_tree=null; ANMLToken Comma75_tree=null; ANMLToken Semi76_tree=null; ANMLToken Function77_tree=null; ANMLToken Comma79_tree=null; ANMLToken Semi80_tree=null; ANMLToken Comma82_tree=null; ANMLToken Semi83_tree=null; RewriteRuleTokenStream stream_Semi=new RewriteRuleTokenStream(adaptor,"token Semi"); RewriteRuleTokenStream stream_Variable=new RewriteRuleTokenStream(adaptor,"token Variable"); RewriteRuleTokenStream stream_Function=new RewriteRuleTokenStream(adaptor,"token Function"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleTokenStream stream_Fluent=new RewriteRuleTokenStream(adaptor,"token Fluent"); RewriteRuleSubtreeStream stream_predicate_helper=new RewriteRuleSubtreeStream(adaptor,"rule predicate_helper"); RewriteRuleSubtreeStream stream_fun_decl_helper=new RewriteRuleSubtreeStream(adaptor,"rule fun_decl_helper"); RewriteRuleSubtreeStream stream_type_ref=new RewriteRuleSubtreeStream(adaptor,"rule type_ref"); RewriteRuleSubtreeStream stream_var_decl_helper=new RewriteRuleSubtreeStream(adaptor,"rule var_decl_helper"); try { // ANML.g:317:1: ( ( Fluent type_ref (l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) | Variable type_ref l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | Function type_ref l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi | predicate_helper l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) -> ( $l)+ ) // ANML.g:318:2: ( Fluent type_ref (l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) | Variable type_ref l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | Function type_ref l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi | predicate_helper l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) { // ANML.g:318:2: ( Fluent type_ref (l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) | Variable type_ref l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | Function type_ref l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi | predicate_helper l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) int alt29=4; switch ( input.LA(1) ) { case Fluent: { alt29=1; } break; case Variable: { alt29=2; } break; case Function: { alt29=3; } break; case Predicate: { alt29=4; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 29, 0, input); throw nvae; } switch (alt29) { case 1 : // ANML.g:318:4: Fluent type_ref (l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) { Fluent67=(ANMLToken)match(input,Fluent,FOLLOW_Fluent_in_fluent_decl1339); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Fluent.add(Fluent67); pushFollow(FOLLOW_type_ref_in_fluent_decl1341); type_ref68=type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_ref.add(type_ref68.getTree()); // ANML.g:319:5: (l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi | l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi ) int alt25=2; int LA25_0 = input.LA(1); if ( (LA25_0==ID) ) { int LA25_1 = input.LA(2); if ( (LA25_1==LeftP) ) { alt25=2; } else if ( (LA25_1==Assign||(LA25_1>=Semi && LA25_1<=Comma)||LA25_1==Undefine) ) { alt25=1; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 25, 1, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 25, 0, input); throw nvae; } switch (alt25) { case 1 : // ANML.g:319:7: l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi { pushFollow(FOLLOW_var_decl_helper_in_fluent_decl1351); l=var_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_var_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); // ANML.g:319:26: ( Comma l+= var_decl_helper )* loop23: do { int alt23=2; int LA23_0 = input.LA(1); if ( (LA23_0==Comma) ) { alt23=1; } switch (alt23) { case 1 : // ANML.g:319:27: Comma l+= var_decl_helper { Comma69=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_fluent_decl1354); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma69); pushFollow(FOLLOW_var_decl_helper_in_fluent_decl1358); l=var_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_var_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); } break; default : break loop23; } } while (true); Semi70=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_fluent_decl1362); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi70); } break; case 2 : // ANML.g:320:7: l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi { pushFollow(FOLLOW_fun_decl_helper_in_fluent_decl1372); l=fun_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fun_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); // ANML.g:320:26: ( Comma l+= fun_decl_helper )* loop24: do { int alt24=2; int LA24_0 = input.LA(1); if ( (LA24_0==Comma) ) { alt24=1; } switch (alt24) { case 1 : // ANML.g:320:27: Comma l+= fun_decl_helper { Comma71=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_fluent_decl1375); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma71); pushFollow(FOLLOW_fun_decl_helper_in_fluent_decl1379); l=fun_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fun_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); } break; default : break loop24; } } while (true); Semi72=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_fluent_decl1383); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi72); } break; } } break; case 2 : // ANML.g:322:4: Variable type_ref l+= var_decl_helper ( Comma l+= var_decl_helper )* Semi { Variable73=(ANMLToken)match(input,Variable,FOLLOW_Variable_in_fluent_decl1394); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Variable.add(Variable73); pushFollow(FOLLOW_type_ref_in_fluent_decl1396); type_ref74=type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_ref.add(type_ref74.getTree()); pushFollow(FOLLOW_var_decl_helper_in_fluent_decl1400); l=var_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_var_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); // ANML.g:322:41: ( Comma l+= var_decl_helper )* loop26: do { int alt26=2; int LA26_0 = input.LA(1); if ( (LA26_0==Comma) ) { alt26=1; } switch (alt26) { case 1 : // ANML.g:322:42: Comma l+= var_decl_helper { Comma75=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_fluent_decl1403); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma75); pushFollow(FOLLOW_var_decl_helper_in_fluent_decl1407); l=var_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_var_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); } break; default : break loop26; } } while (true); Semi76=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_fluent_decl1411); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi76); } break; case 3 : // ANML.g:323:4: Function type_ref l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi { Function77=(ANMLToken)match(input,Function,FOLLOW_Function_in_fluent_decl1417); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Function.add(Function77); pushFollow(FOLLOW_type_ref_in_fluent_decl1419); type_ref78=type_ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_ref.add(type_ref78.getTree()); pushFollow(FOLLOW_fun_decl_helper_in_fluent_decl1423); l=fun_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fun_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); // ANML.g:323:41: ( Comma l+= fun_decl_helper )* loop27: do { int alt27=2; int LA27_0 = input.LA(1); if ( (LA27_0==Comma) ) { alt27=1; } switch (alt27) { case 1 : // ANML.g:323:42: Comma l+= fun_decl_helper { Comma79=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_fluent_decl1426); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma79); pushFollow(FOLLOW_fun_decl_helper_in_fluent_decl1430); l=fun_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fun_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); } break; default : break loop27; } } while (true); Semi80=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_fluent_decl1434); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi80); } break; case 4 : // ANML.g:324:4: predicate_helper l+= fun_decl_helper ( Comma l+= fun_decl_helper )* Semi { pushFollow(FOLLOW_predicate_helper_in_fluent_decl1440); predicate_helper81=predicate_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_predicate_helper.add(predicate_helper81.getTree()); pushFollow(FOLLOW_fun_decl_helper_in_fluent_decl1444); l=fun_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fun_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); // ANML.g:324:40: ( Comma l+= fun_decl_helper )* loop28: do { int alt28=2; int LA28_0 = input.LA(1); if ( (LA28_0==Comma) ) { alt28=1; } switch (alt28) { case 1 : // ANML.g:324:41: Comma l+= fun_decl_helper { Comma82=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_fluent_decl1447); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma82); pushFollow(FOLLOW_fun_decl_helper_in_fluent_decl1451); l=fun_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fun_decl_helper.add(l.getTree()); if (list_l==null) list_l=new ArrayList(); list_l.add(l.getTree()); } break; default : break loop28; } } while (true); Semi83=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_fluent_decl1455); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi83); } break; } // AST REWRITE // elements: l // token labels: // rule labels: retval // token list labels: // rule list labels: l if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_l=new RewriteRuleSubtreeStream(adaptor,"token l",list_l); root_0 = (ANMLToken)adaptor.nil(); // 326:4: -> ( $l)+ { if ( !(stream_l.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_l.hasNext() ) { adaptor.addChild(root_0, stream_l.nextTree()); } stream_l.reset(); } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { T_stack.pop(); } return retval; } // $ANTLR end "fluent_decl" public static class type_refine_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "type_refine" // ANML.g:329:1: type_refine : Fact ( LeftC ( type_refine_helper )+ RightC -> ( type_refine_helper )+ | type_refine_helper -> type_refine_helper ) ; public final ANMLParser.type_refine_return type_refine() throws RecognitionException { ANMLParser.type_refine_return retval = new ANMLParser.type_refine_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Fact84=null; ANMLToken LeftC85=null; ANMLToken RightC87=null; ANMLParser.type_refine_helper_return type_refine_helper86 = null; ANMLParser.type_refine_helper_return type_refine_helper88 = null; ANMLToken Fact84_tree=null; ANMLToken LeftC85_tree=null; ANMLToken RightC87_tree=null; RewriteRuleTokenStream stream_LeftC=new RewriteRuleTokenStream(adaptor,"token LeftC"); RewriteRuleTokenStream stream_Fact=new RewriteRuleTokenStream(adaptor,"token Fact"); RewriteRuleTokenStream stream_RightC=new RewriteRuleTokenStream(adaptor,"token RightC"); RewriteRuleSubtreeStream stream_type_refine_helper=new RewriteRuleSubtreeStream(adaptor,"rule type_refine_helper"); try { // ANML.g:330:2: ( Fact ( LeftC ( type_refine_helper )+ RightC -> ( type_refine_helper )+ | type_refine_helper -> type_refine_helper ) ) // ANML.g:330:4: Fact ( LeftC ( type_refine_helper )+ RightC -> ( type_refine_helper )+ | type_refine_helper -> type_refine_helper ) { Fact84=(ANMLToken)match(input,Fact,FOLLOW_Fact_in_type_refine1478); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Fact.add(Fact84); // ANML.g:331:3: ( LeftC ( type_refine_helper )+ RightC -> ( type_refine_helper )+ | type_refine_helper -> type_refine_helper ) int alt31=2; int LA31_0 = input.LA(1); if ( (LA31_0==LeftC) ) { alt31=1; } else if ( (LA31_0==ID||LA31_0==Symbol||LA31_0==Object) ) { alt31=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 31, 0, input); throw nvae; } switch (alt31) { case 1 : // ANML.g:331:5: LeftC ( type_refine_helper )+ RightC { LeftC85=(ANMLToken)match(input,LeftC,FOLLOW_LeftC_in_type_refine1484); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftC.add(LeftC85); // ANML.g:331:11: ( type_refine_helper )+ int cnt30=0; loop30: do { int alt30=2; int LA30_0 = input.LA(1); if ( (LA30_0==ID||LA30_0==Symbol||LA30_0==Object) ) { alt30=1; } switch (alt30) { case 1 : // ANML.g:331:11: type_refine_helper { pushFollow(FOLLOW_type_refine_helper_in_type_refine1486); type_refine_helper86=type_refine_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_refine_helper.add(type_refine_helper86.getTree()); } break; default : if ( cnt30 >= 1 ) break loop30; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee = new EarlyExitException(30, input); throw eee; } cnt30++; } while (true); RightC87=(ANMLToken)match(input,RightC,FOLLOW_RightC_in_type_refine1489); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightC.add(RightC87); // AST REWRITE // elements: type_refine_helper // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 332:4: -> ( type_refine_helper )+ { if ( !(stream_type_refine_helper.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_type_refine_helper.hasNext() ) { adaptor.addChild(root_0, stream_type_refine_helper.nextTree()); } stream_type_refine_helper.reset(); } retval.tree = root_0;} } break; case 2 : // ANML.g:333:5: type_refine_helper { pushFollow(FOLLOW_type_refine_helper_in_type_refine1503); type_refine_helper88=type_refine_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_refine_helper.add(type_refine_helper88.getTree()); // AST REWRITE // elements: type_refine_helper // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 334:4: -> type_refine_helper { adaptor.addChild(root_0, stream_type_refine_helper.nextTree()); } retval.tree = root_0;} } break; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "type_refine" public static class fact_decl_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "fact_decl_helper" // ANML.g:338:1: fact_decl_helper : ( ( ref Semi )=> ref Semi -> ^( TimedStmt[$ref.tree] ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) ^( Assign[$Semi] ref True ) ) | ( ( NotLog | NotBit ) ref Semi )=> (n= NotLog | n= NotBit ) ref Semi -> ^( TimedStmt[$n] ^( DefinitePoint[$n] ^( TStart Start ) ) ^( Assign[$Semi] ref False ) ) | ref (o= EqualLog | o= Equal ) expr Semi -> ^( TimedStmt[$ref.tree] ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) ^( Assign[$o] ref expr ) ) | Semi ); public final ANMLParser.fact_decl_helper_return fact_decl_helper() throws RecognitionException { ANMLParser.fact_decl_helper_return retval = new ANMLParser.fact_decl_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken n=null; ANMLToken o=null; ANMLToken Semi90=null; ANMLToken Semi92=null; ANMLToken Semi95=null; ANMLToken Semi96=null; ANMLParser.ref_return ref89 = null; ANMLParser.ref_return ref91 = null; ANMLParser.ref_return ref93 = null; ANMLParser.expr_return expr94 = null; ANMLToken n_tree=null; ANMLToken o_tree=null; ANMLToken Semi90_tree=null; ANMLToken Semi92_tree=null; ANMLToken Semi95_tree=null; ANMLToken Semi96_tree=null; RewriteRuleTokenStream stream_EqualLog=new RewriteRuleTokenStream(adaptor,"token EqualLog"); RewriteRuleTokenStream stream_Semi=new RewriteRuleTokenStream(adaptor,"token Semi"); RewriteRuleTokenStream stream_NotBit=new RewriteRuleTokenStream(adaptor,"token NotBit"); RewriteRuleTokenStream stream_Equal=new RewriteRuleTokenStream(adaptor,"token Equal"); RewriteRuleTokenStream stream_NotLog=new RewriteRuleTokenStream(adaptor,"token NotLog"); RewriteRuleSubtreeStream stream_ref=new RewriteRuleSubtreeStream(adaptor,"rule ref"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { // ANML.g:339:2: ( ( ref Semi )=> ref Semi -> ^( TimedStmt[$ref.tree] ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) ^( Assign[$Semi] ref True ) ) | ( ( NotLog | NotBit ) ref Semi )=> (n= NotLog | n= NotBit ) ref Semi -> ^( TimedStmt[$n] ^( DefinitePoint[$n] ^( TStart Start ) ) ^( Assign[$Semi] ref False ) ) | ref (o= EqualLog | o= Equal ) expr Semi -> ^( TimedStmt[$ref.tree] ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) ^( Assign[$o] ref expr ) ) | Semi ) int alt34=4; int LA34_0 = input.LA(1); if ( (LA34_0==ID) ) { int LA34_1 = input.LA(2); if ( (synpred1_ANML()) ) { alt34=1; } else if ( (true) ) { alt34=3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 34, 1, input); throw nvae; } } else if ( (LA34_0==NotLog) && (synpred2_ANML())) { alt34=2; } else if ( (LA34_0==NotBit) && (synpred2_ANML())) { alt34=2; } else if ( (LA34_0==Semi) ) { alt34=4; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 34, 0, input); throw nvae; } switch (alt34) { case 1 : // ANML.g:339:4: ( ref Semi )=> ref Semi { pushFollow(FOLLOW_ref_in_fact_decl_helper1534); ref89=ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ref.add(ref89.getTree()); Semi90=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_fact_decl_helper1536); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi90); // AST REWRITE // elements: ref // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 340:4: -> ^( TimedStmt[$ref.tree] ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) ^( Assign[$Semi] ref True ) ) { // ANML.g:340:7: ^( TimedStmt[$ref.tree] ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) ^( Assign[$Semi] ref True ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TimedStmt, (ref89!=null?((ANMLToken)ref89.tree):null)), root_1); // ANML.g:340:30: ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefinitePoint, (ref89!=null?((ANMLToken)ref89.tree):null)), root_2); // ANML.g:340:57: ^( TStart Start ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Start, "Start")); adaptor.addChild(root_2, root_3); } adaptor.addChild(root_1, root_2); } // ANML.g:340:74: ^( Assign[$Semi] ref True ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Assign, Semi90), root_2); adaptor.addChild(root_2, stream_ref.nextTree()); adaptor.addChild(root_2, (ANMLToken)adaptor.create(True, "True")); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:341:4: ( ( NotLog | NotBit ) ref Semi )=> (n= NotLog | n= NotBit ) ref Semi { // ANML.g:341:33: (n= NotLog | n= NotBit ) int alt32=2; int LA32_0 = input.LA(1); if ( (LA32_0==NotLog) ) { alt32=1; } else if ( (LA32_0==NotBit) ) { alt32=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 32, 0, input); throw nvae; } switch (alt32) { case 1 : // ANML.g:341:34: n= NotLog { n=(ANMLToken)match(input,NotLog,FOLLOW_NotLog_in_fact_decl_helper1587); if (state.failed) return retval; if ( state.backtracking==0 ) stream_NotLog.add(n); } break; case 2 : // ANML.g:341:43: n= NotBit { n=(ANMLToken)match(input,NotBit,FOLLOW_NotBit_in_fact_decl_helper1591); if (state.failed) return retval; if ( state.backtracking==0 ) stream_NotBit.add(n); } break; } pushFollow(FOLLOW_ref_in_fact_decl_helper1594); ref91=ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ref.add(ref91.getTree()); Semi92=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_fact_decl_helper1596); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi92); // AST REWRITE // elements: ref // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 342:4: -> ^( TimedStmt[$n] ^( DefinitePoint[$n] ^( TStart Start ) ) ^( Assign[$Semi] ref False ) ) { // ANML.g:342:7: ^( TimedStmt[$n] ^( DefinitePoint[$n] ^( TStart Start ) ) ^( Assign[$Semi] ref False ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TimedStmt, n), root_1); // ANML.g:342:23: ^( DefinitePoint[$n] ^( TStart Start ) ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefinitePoint, n), root_2); // ANML.g:342:43: ^( TStart Start ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Start, "Start")); adaptor.addChild(root_2, root_3); } adaptor.addChild(root_1, root_2); } // ANML.g:342:60: ^( Assign[$Semi] ref False ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Assign, Semi92), root_2); adaptor.addChild(root_2, stream_ref.nextTree()); adaptor.addChild(root_2, (ANMLToken)adaptor.create(False, "False")); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:343:4: ref (o= EqualLog | o= Equal ) expr Semi { pushFollow(FOLLOW_ref_in_fact_decl_helper1631); ref93=ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ref.add(ref93.getTree()); // ANML.g:343:8: (o= EqualLog | o= Equal ) int alt33=2; int LA33_0 = input.LA(1); if ( (LA33_0==EqualLog) ) { alt33=1; } else if ( (LA33_0==Equal) ) { alt33=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 33, 0, input); throw nvae; } switch (alt33) { case 1 : // ANML.g:343:9: o= EqualLog { o=(ANMLToken)match(input,EqualLog,FOLLOW_EqualLog_in_fact_decl_helper1636); if (state.failed) return retval; if ( state.backtracking==0 ) stream_EqualLog.add(o); } break; case 2 : // ANML.g:343:20: o= Equal { o=(ANMLToken)match(input,Equal,FOLLOW_Equal_in_fact_decl_helper1640); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Equal.add(o); } break; } pushFollow(FOLLOW_expr_in_fact_decl_helper1643); expr94=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(expr94.getTree()); Semi95=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_fact_decl_helper1645); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi95); // AST REWRITE // elements: ref, expr // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 344:4: -> ^( TimedStmt[$ref.tree] ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) ^( Assign[$o] ref expr ) ) { // ANML.g:344:7: ^( TimedStmt[$ref.tree] ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) ^( Assign[$o] ref expr ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TimedStmt, (ref93!=null?((ANMLToken)ref93.tree):null)), root_1); // ANML.g:344:30: ^( DefinitePoint[$ref.tree] ^( TStart Start ) ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefinitePoint, (ref93!=null?((ANMLToken)ref93.tree):null)), root_2); // ANML.g:344:57: ^( TStart Start ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Start, "Start")); adaptor.addChild(root_2, root_3); } adaptor.addChild(root_1, root_2); } // ANML.g:344:74: ^( Assign[$o] ref expr ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Assign, o), root_2); adaptor.addChild(root_2, stream_ref.nextTree()); adaptor.addChild(root_2, stream_expr.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 4 : // ANML.g:345:4: Semi { root_0 = (ANMLToken)adaptor.nil(); Semi96=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_fact_decl_helper1680); if (state.failed) return retval; } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "fact_decl_helper" public static class goal_decl_helper_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "goal_decl_helper" // ANML.g:348:1: goal_decl_helper : ( expr Semi -> ^( TimedStmt[$expr.tree] ^( DefinitePoint[$expr.tree] ^( TStart End ) ) expr ) | Semi ); public final ANMLParser.goal_decl_helper_return goal_decl_helper() throws RecognitionException { ANMLParser.goal_decl_helper_return retval = new ANMLParser.goal_decl_helper_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Semi98=null; ANMLToken Semi99=null; ANMLParser.expr_return expr97 = null; ANMLToken Semi98_tree=null; ANMLToken Semi99_tree=null; RewriteRuleTokenStream stream_Semi=new RewriteRuleTokenStream(adaptor,"token Semi"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { // ANML.g:349:2: ( expr Semi -> ^( TimedStmt[$expr.tree] ^( DefinitePoint[$expr.tree] ^( TStart End ) ) expr ) | Semi ) int alt35=2; int LA35_0 = input.LA(1); if ( ((LA35_0>=Bra && LA35_0<=Ket)||LA35_0==ID||LA35_0==LeftP||(LA35_0>=NotLog && LA35_0<=NotBit)||(LA35_0>=LeftB && LA35_0<=Duration)||LA35_0==Contains||(LA35_0>=ForAll && LA35_0<=Exists)||LA35_0==Dots||LA35_0==Minus||(LA35_0>=Unordered && LA35_0<=Ordered)||(LA35_0>=Start && LA35_0<=Infinity)) ) { alt35=1; } else if ( (LA35_0==Semi) ) { alt35=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 35, 0, input); throw nvae; } switch (alt35) { case 1 : // ANML.g:349:4: expr Semi { pushFollow(FOLLOW_expr_in_goal_decl_helper1691); expr97=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(expr97.getTree()); Semi98=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_goal_decl_helper1693); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi98); // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 350:4: -> ^( TimedStmt[$expr.tree] ^( DefinitePoint[$expr.tree] ^( TStart End ) ) expr ) { // ANML.g:350:7: ^( TimedStmt[$expr.tree] ^( DefinitePoint[$expr.tree] ^( TStart End ) ) expr ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TimedStmt, (expr97!=null?((ANMLToken)expr97.tree):null)), root_1); // ANML.g:350:31: ^( DefinitePoint[$expr.tree] ^( TStart End ) ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefinitePoint, (expr97!=null?((ANMLToken)expr97.tree):null)), root_2); // ANML.g:350:59: ^( TStart End ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(End, "End")); adaptor.addChild(root_2, root_3); } adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_expr.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:351:4: Semi { root_0 = (ANMLToken)adaptor.nil(); Semi99=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_goal_decl_helper1721); if (state.failed) return retval; } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "goal_decl_helper" public static class fact_decl_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "fact_decl" // ANML.g:354:1: fact_decl : Fact ( LeftC ( fact_decl_helper )* RightC -> ( fact_decl_helper )* | fact_decl_helper -> fact_decl_helper ) ; public final ANMLParser.fact_decl_return fact_decl() throws RecognitionException { ANMLParser.fact_decl_return retval = new ANMLParser.fact_decl_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Fact100=null; ANMLToken LeftC101=null; ANMLToken RightC103=null; ANMLParser.fact_decl_helper_return fact_decl_helper102 = null; ANMLParser.fact_decl_helper_return fact_decl_helper104 = null; ANMLToken Fact100_tree=null; ANMLToken LeftC101_tree=null; ANMLToken RightC103_tree=null; RewriteRuleTokenStream stream_LeftC=new RewriteRuleTokenStream(adaptor,"token LeftC"); RewriteRuleTokenStream stream_Fact=new RewriteRuleTokenStream(adaptor,"token Fact"); RewriteRuleTokenStream stream_RightC=new RewriteRuleTokenStream(adaptor,"token RightC"); RewriteRuleSubtreeStream stream_fact_decl_helper=new RewriteRuleSubtreeStream(adaptor,"rule fact_decl_helper"); try { // ANML.g:354:11: ( Fact ( LeftC ( fact_decl_helper )* RightC -> ( fact_decl_helper )* | fact_decl_helper -> fact_decl_helper ) ) // ANML.g:354:13: Fact ( LeftC ( fact_decl_helper )* RightC -> ( fact_decl_helper )* | fact_decl_helper -> fact_decl_helper ) { Fact100=(ANMLToken)match(input,Fact,FOLLOW_Fact_in_fact_decl1732); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Fact.add(Fact100); // ANML.g:355:5: ( LeftC ( fact_decl_helper )* RightC -> ( fact_decl_helper )* | fact_decl_helper -> fact_decl_helper ) int alt37=2; int LA37_0 = input.LA(1); if ( (LA37_0==LeftC) ) { alt37=1; } else if ( (LA37_0==ID||LA37_0==Semi||(LA37_0>=NotLog && LA37_0<=NotBit)) ) { alt37=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 37, 0, input); throw nvae; } switch (alt37) { case 1 : // ANML.g:355:7: LeftC ( fact_decl_helper )* RightC { LeftC101=(ANMLToken)match(input,LeftC,FOLLOW_LeftC_in_fact_decl1740); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftC.add(LeftC101); // ANML.g:355:13: ( fact_decl_helper )* loop36: do { int alt36=2; int LA36_0 = input.LA(1); if ( (LA36_0==ID||LA36_0==Semi||(LA36_0>=NotLog && LA36_0<=NotBit)) ) { alt36=1; } switch (alt36) { case 1 : // ANML.g:355:13: fact_decl_helper { pushFollow(FOLLOW_fact_decl_helper_in_fact_decl1742); fact_decl_helper102=fact_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fact_decl_helper.add(fact_decl_helper102.getTree()); } break; default : break loop36; } } while (true); RightC103=(ANMLToken)match(input,RightC,FOLLOW_RightC_in_fact_decl1745); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightC.add(RightC103); // AST REWRITE // elements: fact_decl_helper // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 356:7: -> ( fact_decl_helper )* { // ANML.g:356:10: ( fact_decl_helper )* while ( stream_fact_decl_helper.hasNext() ) { adaptor.addChild(root_0, stream_fact_decl_helper.nextTree()); } stream_fact_decl_helper.reset(); } retval.tree = root_0;} } break; case 2 : // ANML.g:357:7: fact_decl_helper { pushFollow(FOLLOW_fact_decl_helper_in_fact_decl1764); fact_decl_helper104=fact_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fact_decl_helper.add(fact_decl_helper104.getTree()); // AST REWRITE // elements: fact_decl_helper // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 358:7: -> fact_decl_helper { adaptor.addChild(root_0, stream_fact_decl_helper.nextTree()); } retval.tree = root_0;} } break; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "fact_decl" public static class goal_decl_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "goal_decl" // ANML.g:363:1: goal_decl : Goal ( LeftC ( goal_decl_helper )* RightC -> ( goal_decl_helper )* | goal_decl_helper -> goal_decl_helper ) ; public final ANMLParser.goal_decl_return goal_decl() throws RecognitionException { ANMLParser.goal_decl_return retval = new ANMLParser.goal_decl_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Goal105=null; ANMLToken LeftC106=null; ANMLToken RightC108=null; ANMLParser.goal_decl_helper_return goal_decl_helper107 = null; ANMLParser.goal_decl_helper_return goal_decl_helper109 = null; ANMLToken Goal105_tree=null; ANMLToken LeftC106_tree=null; ANMLToken RightC108_tree=null; RewriteRuleTokenStream stream_LeftC=new RewriteRuleTokenStream(adaptor,"token LeftC"); RewriteRuleTokenStream stream_RightC=new RewriteRuleTokenStream(adaptor,"token RightC"); RewriteRuleTokenStream stream_Goal=new RewriteRuleTokenStream(adaptor,"token Goal"); RewriteRuleSubtreeStream stream_goal_decl_helper=new RewriteRuleSubtreeStream(adaptor,"rule goal_decl_helper"); try { // ANML.g:363:11: ( Goal ( LeftC ( goal_decl_helper )* RightC -> ( goal_decl_helper )* | goal_decl_helper -> goal_decl_helper ) ) // ANML.g:363:13: Goal ( LeftC ( goal_decl_helper )* RightC -> ( goal_decl_helper )* | goal_decl_helper -> goal_decl_helper ) { Goal105=(ANMLToken)match(input,Goal,FOLLOW_Goal_in_goal_decl1791); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Goal.add(Goal105); // ANML.g:364:2: ( LeftC ( goal_decl_helper )* RightC -> ( goal_decl_helper )* | goal_decl_helper -> goal_decl_helper ) int alt39=2; int LA39_0 = input.LA(1); if ( (LA39_0==LeftC) ) { alt39=1; } else if ( ((LA39_0>=Bra && LA39_0<=Ket)||LA39_0==ID||LA39_0==Semi||LA39_0==LeftP||(LA39_0>=NotLog && LA39_0<=NotBit)||(LA39_0>=LeftB && LA39_0<=Duration)||LA39_0==Contains||(LA39_0>=ForAll && LA39_0<=Exists)||LA39_0==Dots||LA39_0==Minus||(LA39_0>=Unordered && LA39_0<=Ordered)||(LA39_0>=Start && LA39_0<=Infinity)) ) { alt39=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 39, 0, input); throw nvae; } switch (alt39) { case 1 : // ANML.g:364:4: LeftC ( goal_decl_helper )* RightC { LeftC106=(ANMLToken)match(input,LeftC,FOLLOW_LeftC_in_goal_decl1797); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftC.add(LeftC106); // ANML.g:364:10: ( goal_decl_helper )* loop38: do { int alt38=2; int LA38_0 = input.LA(1); if ( ((LA38_0>=Bra && LA38_0<=Ket)||LA38_0==ID||LA38_0==Semi||LA38_0==LeftP||(LA38_0>=NotLog && LA38_0<=NotBit)||(LA38_0>=LeftB && LA38_0<=Duration)||LA38_0==Contains||(LA38_0>=ForAll && LA38_0<=Exists)||LA38_0==Dots||LA38_0==Minus||(LA38_0>=Unordered && LA38_0<=Ordered)||(LA38_0>=Start && LA38_0<=Infinity)) ) { alt38=1; } switch (alt38) { case 1 : // ANML.g:364:10: goal_decl_helper { pushFollow(FOLLOW_goal_decl_helper_in_goal_decl1799); goal_decl_helper107=goal_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_goal_decl_helper.add(goal_decl_helper107.getTree()); } break; default : break loop38; } } while (true); RightC108=(ANMLToken)match(input,RightC,FOLLOW_RightC_in_goal_decl1802); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightC.add(RightC108); // AST REWRITE // elements: goal_decl_helper // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 365:4: -> ( goal_decl_helper )* { // ANML.g:365:7: ( goal_decl_helper )* while ( stream_goal_decl_helper.hasNext() ) { adaptor.addChild(root_0, stream_goal_decl_helper.nextTree()); } stream_goal_decl_helper.reset(); } retval.tree = root_0;} } break; case 2 : // ANML.g:366:4: goal_decl_helper { pushFollow(FOLLOW_goal_decl_helper_in_goal_decl1815); goal_decl_helper109=goal_decl_helper(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_goal_decl_helper.add(goal_decl_helper109.getTree()); // AST REWRITE // elements: goal_decl_helper // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 367:4: -> goal_decl_helper { adaptor.addChild(root_0, stream_goal_decl_helper.nextTree()); } retval.tree = root_0;} } break; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "goal_decl" public static class object_block_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "object_block" // ANML.g:379:1: object_block : LeftC (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )+ RightC -> ^( Block[$LeftC,\"ObjectBlock\"] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) ; public final ANMLParser.object_block_return object_block() throws RecognitionException { ANMLParser.object_block_return retval = new ANMLParser.object_block_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftC110=null; ANMLToken RightC111=null; List list_t=null; List list_c=null; List list_f=null; List list_a=null; List list_s=null; RuleReturnScope t = null; RuleReturnScope c = null; RuleReturnScope f = null; RuleReturnScope a = null; RuleReturnScope s = null; ANMLToken LeftC110_tree=null; ANMLToken RightC111_tree=null; RewriteRuleTokenStream stream_LeftC=new RewriteRuleTokenStream(adaptor,"token LeftC"); RewriteRuleTokenStream stream_RightC=new RewriteRuleTokenStream(adaptor,"token RightC"); RewriteRuleSubtreeStream stream_fact_decl=new RewriteRuleSubtreeStream(adaptor,"rule fact_decl"); RewriteRuleSubtreeStream stream_goal_decl=new RewriteRuleSubtreeStream(adaptor,"rule goal_decl"); RewriteRuleSubtreeStream stream_type_decl=new RewriteRuleSubtreeStream(adaptor,"rule type_decl"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); RewriteRuleSubtreeStream stream_fluent_decl=new RewriteRuleSubtreeStream(adaptor,"rule fluent_decl"); RewriteRuleSubtreeStream stream_const_decl=new RewriteRuleSubtreeStream(adaptor,"rule const_decl"); RewriteRuleSubtreeStream stream_action_decl=new RewriteRuleSubtreeStream(adaptor,"rule action_decl"); try { // ANML.g:379:14: ( LeftC (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )+ RightC -> ^( Block[$LeftC,\"ObjectBlock\"] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) ) // ANML.g:380:2: LeftC (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )+ RightC { LeftC110=(ANMLToken)match(input,LeftC,FOLLOW_LeftC_in_object_block1846); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftC.add(LeftC110); // ANML.g:381:3: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )+ int cnt40=0; loop40: do { int alt40=8; alt40 = dfa40.predict(input); switch (alt40) { case 1 : // ANML.g:381:5: t+= type_decl { pushFollow(FOLLOW_type_decl_in_object_block1854); t=type_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_decl.add(t.getTree()); if (list_t==null) list_t=new ArrayList(); list_t.add(t.getTree()); } break; case 2 : // ANML.g:382:5: c+= const_decl { pushFollow(FOLLOW_const_decl_in_object_block1863); c=const_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_const_decl.add(c.getTree()); if (list_c==null) list_c=new ArrayList(); list_c.add(c.getTree()); } break; case 3 : // ANML.g:383:5: f+= fluent_decl { pushFollow(FOLLOW_fluent_decl_in_object_block1872); f=fluent_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fluent_decl.add(f.getTree()); if (list_f==null) list_f=new ArrayList(); list_f.add(f.getTree()); } break; case 4 : // ANML.g:384:5: a+= action_decl { pushFollow(FOLLOW_action_decl_in_object_block1881); a=action_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_action_decl.add(a.getTree()); if (list_a==null) list_a=new ArrayList(); list_a.add(a.getTree()); } break; case 5 : // ANML.g:385:5: s+= fact_decl { pushFollow(FOLLOW_fact_decl_in_object_block1889); s=fact_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fact_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 6 : // ANML.g:386:5: s+= goal_decl { pushFollow(FOLLOW_goal_decl_in_object_block1898); s=goal_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_goal_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 7 : // ANML.g:387:5: s+= stmt { pushFollow(FOLLOW_stmt_in_object_block1907); s=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; default : if ( cnt40 >= 1 ) break loop40; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee = new EarlyExitException(40, input); throw eee; } cnt40++; } while (true); RightC111=(ANMLToken)match(input,RightC,FOLLOW_RightC_in_object_block1917); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightC.add(RightC111); // AST REWRITE // elements: f, t, a, s, c // token labels: // rule labels: retval // token list labels: // rule list labels: f, t, s, c, a if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_f=new RewriteRuleSubtreeStream(adaptor,"token f",list_f); RewriteRuleSubtreeStream stream_t=new RewriteRuleSubtreeStream(adaptor,"token t",list_t); RewriteRuleSubtreeStream stream_s=new RewriteRuleSubtreeStream(adaptor,"token s",list_s); RewriteRuleSubtreeStream stream_c=new RewriteRuleSubtreeStream(adaptor,"token c",list_c); RewriteRuleSubtreeStream stream_a=new RewriteRuleSubtreeStream(adaptor,"token a",list_a); root_0 = (ANMLToken)adaptor.nil(); // 390:3: -> ^( Block[$LeftC,\"ObjectBlock\"] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) { // ANML.g:391:3: ^( Block[$LeftC,\"ObjectBlock\"] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Block, LeftC110, "ObjectBlock"), root_1); // ANML.g:392:4: ^( Types ( $t)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Types, "Types"), root_2); // ANML.g:392:12: ( $t)* while ( stream_t.hasNext() ) { adaptor.addChild(root_2, stream_t.nextTree()); } stream_t.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:393:4: ^( Constants ( $c)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Constants, "Constants"), root_2); // ANML.g:393:16: ( $c)* while ( stream_c.hasNext() ) { adaptor.addChild(root_2, stream_c.nextTree()); } stream_c.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:394:4: ^( Fluents ( $f)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Fluents, "Fluents"), root_2); // ANML.g:394:14: ( $f)* while ( stream_f.hasNext() ) { adaptor.addChild(root_2, stream_f.nextTree()); } stream_f.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:395:4: ^( Actions ( $a)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Actions, "Actions"), root_2); // ANML.g:395:14: ( $a)* while ( stream_a.hasNext() ) { adaptor.addChild(root_2, stream_a.nextTree()); } stream_a.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:396:4: ^( Stmts ( $s)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Stmts, "Stmts"), root_2); // ANML.g:396:12: ( $s)* while ( stream_s.hasNext() ) { adaptor.addChild(root_2, stream_s.nextTree()); } stream_s.reset(); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "object_block" public static class action_decl_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "action_decl" // ANML.g:414:1: action_decl : Action ID param_list ( LeftB Duration RightB )? action_block[a] -> ^( Action ID param_list ( Duration )? action_block ) ; public final ANMLParser.action_decl_return action_decl() throws RecognitionException { ANMLParser.action_decl_return retval = new ANMLParser.action_decl_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Action112=null; ANMLToken ID113=null; ANMLToken LeftB115=null; ANMLToken Duration116=null; ANMLToken RightB117=null; ANMLParser.param_list_return param_list114 = null; ANMLParser.action_block_return action_block118 = null; ANMLToken Action112_tree=null; ANMLToken ID113_tree=null; ANMLToken LeftB115_tree=null; ANMLToken Duration116_tree=null; ANMLToken RightB117_tree=null; RewriteRuleTokenStream stream_RightB=new RewriteRuleTokenStream(adaptor,"token RightB"); RewriteRuleTokenStream stream_Action=new RewriteRuleTokenStream(adaptor,"token Action"); RewriteRuleTokenStream stream_LeftB=new RewriteRuleTokenStream(adaptor,"token LeftB"); RewriteRuleTokenStream stream_Duration=new RewriteRuleTokenStream(adaptor,"token Duration"); RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleSubtreeStream stream_action_block=new RewriteRuleSubtreeStream(adaptor,"rule action_block"); RewriteRuleSubtreeStream stream_param_list=new RewriteRuleSubtreeStream(adaptor,"rule param_list"); Action a=null; try { // ANML.g:416:1: ( Action ID param_list ( LeftB Duration RightB )? action_block[a] -> ^( Action ID param_list ( Duration )? action_block ) ) // ANML.g:417:2: Action ID param_list ( LeftB Duration RightB )? action_block[a] { Action112=(ANMLToken)match(input,Action,FOLLOW_Action_in_action_decl2022); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Action.add(Action112); ID113=(ANMLToken)match(input,ID,FOLLOW_ID_in_action_decl2024); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID113); if ( state.backtracking==0 ) { a = new Action(((S_scope)S_stack.peek()).d,ID113.getSimpleText()); ((S_scope)S_stack.peek()).d.addAction(a); } pushFollow(FOLLOW_param_list_in_action_decl2030); param_list114=param_list(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_list.add(param_list114.getTree()); // ANML.g:422:2: ( LeftB Duration RightB )? int alt41=2; int LA41_0 = input.LA(1); if ( (LA41_0==LeftB) ) { alt41=1; } switch (alt41) { case 1 : // ANML.g:422:3: LeftB Duration RightB { LeftB115=(ANMLToken)match(input,LeftB,FOLLOW_LeftB_in_action_decl2034); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftB.add(LeftB115); Duration116=(ANMLToken)match(input,Duration,FOLLOW_Duration_in_action_decl2036); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Duration.add(Duration116); RightB117=(ANMLToken)match(input,RightB,FOLLOW_RightB_in_action_decl2038); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightB.add(RightB117); } break; } pushFollow(FOLLOW_action_block_in_action_decl2044); action_block118=action_block(a); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_action_block.add(action_block118.getTree()); // AST REWRITE // elements: ID, action_block, Action, param_list, Duration // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 424:2: -> ^( Action ID param_list ( Duration )? action_block ) { // ANML.g:424:5: ^( Action ID param_list ( Duration )? action_block ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot(stream_Action.nextNode(), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, stream_param_list.nextTree()); // ANML.g:424:28: ( Duration )? if ( stream_Duration.hasNext() ) { adaptor.addChild(root_1, stream_Duration.nextNode()); } stream_Duration.reset(); adaptor.addChild(root_1, stream_action_block.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "action_decl" public static class durative_action_block_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "durative_action_block" // ANML.g:440:1: durative_action_block[Action a] : LeftB Duration RightB action_block_h ; public final ANMLParser.durative_action_block_return durative_action_block(Action a) throws RecognitionException { S_stack.push(new S_scope()); ANMLParser.durative_action_block_return retval = new ANMLParser.durative_action_block_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftB119=null; ANMLToken Duration120=null; ANMLToken RightB121=null; ANMLParser.action_block_h_return action_block_h122 = null; ANMLToken LeftB119_tree=null; ANMLToken Duration120_tree=null; ANMLToken RightB121_tree=null; ((S_scope)S_stack.peek()).d =a; try { // ANML.g:443:1: ( LeftB Duration RightB action_block_h ) // ANML.g:444:3: LeftB Duration RightB action_block_h { root_0 = (ANMLToken)adaptor.nil(); LeftB119=(ANMLToken)match(input,LeftB,FOLLOW_LeftB_in_durative_action_block2099); if (state.failed) return retval; Duration120=(ANMLToken)match(input,Duration,FOLLOW_Duration_in_durative_action_block2102); if (state.failed) return retval; if ( state.backtracking==0 ) { Duration120_tree = (ANMLToken)adaptor.create(Duration120); adaptor.addChild(root_0, Duration120_tree); } RightB121=(ANMLToken)match(input,RightB,FOLLOW_RightB_in_durative_action_block2104); if (state.failed) return retval; pushFollow(FOLLOW_action_block_h_in_durative_action_block2107); action_block_h122=action_block_h(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, action_block_h122.getTree()); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { S_stack.pop(); } return retval; } // $ANTLR end "durative_action_block" public static class action_block_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "action_block" // ANML.g:447:1: action_block[Action a] : action_block_h ; public final ANMLParser.action_block_return action_block(Action a) throws RecognitionException { S_stack.push(new S_scope()); ANMLParser.action_block_return retval = new ANMLParser.action_block_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLParser.action_block_h_return action_block_h123 = null; ((S_scope)S_stack.peek()).d =a; try { // ANML.g:450:1: ( action_block_h ) // ANML.g:451:3: action_block_h { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_action_block_h_in_action_block2130); action_block_h123=action_block_h(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, action_block_h123.getTree()); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { S_stack.pop(); } return retval; } // $ANTLR end "action_block" public static class action_block_h_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "action_block_h" // ANML.g:454:1: action_block_h : LeftC (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* (d+= decomp_block )* RightC -> ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ^( Decompositions ( $d)* ) ; public final ANMLParser.action_block_h_return action_block_h() throws RecognitionException { ANMLParser.action_block_h_return retval = new ANMLParser.action_block_h_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftC124=null; ANMLToken RightC125=null; List list_t=null; List list_c=null; List list_f=null; List list_a=null; List list_s=null; List list_d=null; RuleReturnScope t = null; RuleReturnScope c = null; RuleReturnScope f = null; RuleReturnScope a = null; RuleReturnScope s = null; RuleReturnScope d = null; ANMLToken LeftC124_tree=null; ANMLToken RightC125_tree=null; RewriteRuleTokenStream stream_LeftC=new RewriteRuleTokenStream(adaptor,"token LeftC"); RewriteRuleTokenStream stream_RightC=new RewriteRuleTokenStream(adaptor,"token RightC"); RewriteRuleSubtreeStream stream_fact_decl=new RewriteRuleSubtreeStream(adaptor,"rule fact_decl"); RewriteRuleSubtreeStream stream_decomp_block=new RewriteRuleSubtreeStream(adaptor,"rule decomp_block"); RewriteRuleSubtreeStream stream_goal_decl=new RewriteRuleSubtreeStream(adaptor,"rule goal_decl"); RewriteRuleSubtreeStream stream_type_decl=new RewriteRuleSubtreeStream(adaptor,"rule type_decl"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); RewriteRuleSubtreeStream stream_fluent_decl=new RewriteRuleSubtreeStream(adaptor,"rule fluent_decl"); RewriteRuleSubtreeStream stream_const_decl=new RewriteRuleSubtreeStream(adaptor,"rule const_decl"); RewriteRuleSubtreeStream stream_action_decl=new RewriteRuleSubtreeStream(adaptor,"rule action_decl"); try { // ANML.g:455:3: ( LeftC (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* (d+= decomp_block )* RightC -> ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ^( Decompositions ( $d)* ) ) // ANML.g:455:5: LeftC (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* (d+= decomp_block )* RightC { LeftC124=(ANMLToken)match(input,LeftC,FOLLOW_LeftC_in_action_block_h2141); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftC.add(LeftC124); // ANML.g:456:3: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* loop42: do { int alt42=8; alt42 = dfa42.predict(input); switch (alt42) { case 1 : // ANML.g:456:5: t+= type_decl { pushFollow(FOLLOW_type_decl_in_action_block_h2149); t=type_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_decl.add(t.getTree()); if (list_t==null) list_t=new ArrayList(); list_t.add(t.getTree()); } break; case 2 : // ANML.g:457:5: c+= const_decl { pushFollow(FOLLOW_const_decl_in_action_block_h2158); c=const_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_const_decl.add(c.getTree()); if (list_c==null) list_c=new ArrayList(); list_c.add(c.getTree()); } break; case 3 : // ANML.g:458:5: f+= fluent_decl { pushFollow(FOLLOW_fluent_decl_in_action_block_h2167); f=fluent_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fluent_decl.add(f.getTree()); if (list_f==null) list_f=new ArrayList(); list_f.add(f.getTree()); } break; case 4 : // ANML.g:459:5: a+= action_decl { pushFollow(FOLLOW_action_decl_in_action_block_h2176); a=action_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_action_decl.add(a.getTree()); if (list_a==null) list_a=new ArrayList(); list_a.add(a.getTree()); } break; case 5 : // ANML.g:460:5: s+= fact_decl { pushFollow(FOLLOW_fact_decl_in_action_block_h2184); s=fact_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fact_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 6 : // ANML.g:461:5: s+= goal_decl { pushFollow(FOLLOW_goal_decl_in_action_block_h2193); s=goal_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_goal_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 7 : // ANML.g:462:5: s+= stmt { pushFollow(FOLLOW_stmt_in_action_block_h2202); s=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; default : break loop42; } } while (true); // ANML.g:464:3: (d+= decomp_block )* loop43: do { int alt43=2; int LA43_0 = input.LA(1); if ( (LA43_0==Decomposition) ) { alt43=1; } switch (alt43) { case 1 : // ANML.g:464:4: d+= decomp_block { pushFollow(FOLLOW_decomp_block_in_action_block_h2214); d=decomp_block(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_decomp_block.add(d.getTree()); if (list_d==null) list_d=new ArrayList(); list_d.add(d.getTree()); } break; default : break loop43; } } while (true); RightC125=(ANMLToken)match(input,RightC,FOLLOW_RightC_in_action_block_h2220); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightC.add(RightC125); // AST REWRITE // elements: d, a, t, f, s, c // token labels: // rule labels: retval // token list labels: // rule list labels: f, d, t, s, c, a if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_f=new RewriteRuleSubtreeStream(adaptor,"token f",list_f); RewriteRuleSubtreeStream stream_d=new RewriteRuleSubtreeStream(adaptor,"token d",list_d); RewriteRuleSubtreeStream stream_t=new RewriteRuleSubtreeStream(adaptor,"token t",list_t); RewriteRuleSubtreeStream stream_s=new RewriteRuleSubtreeStream(adaptor,"token s",list_s); RewriteRuleSubtreeStream stream_c=new RewriteRuleSubtreeStream(adaptor,"token c",list_c); RewriteRuleSubtreeStream stream_a=new RewriteRuleSubtreeStream(adaptor,"token a",list_a); root_0 = (ANMLToken)adaptor.nil(); // 466:3: -> ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ^( Decompositions ( $d)* ) { // ANML.g:467:4: ^( Types ( $t)* ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Types, "Types"), root_1); // ANML.g:467:12: ( $t)* while ( stream_t.hasNext() ) { adaptor.addChild(root_1, stream_t.nextTree()); } stream_t.reset(); adaptor.addChild(root_0, root_1); } // ANML.g:468:4: ^( Constants ( $c)* ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Constants, "Constants"), root_1); // ANML.g:468:16: ( $c)* while ( stream_c.hasNext() ) { adaptor.addChild(root_1, stream_c.nextTree()); } stream_c.reset(); adaptor.addChild(root_0, root_1); } // ANML.g:469:4: ^( Fluents ( $f)* ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Fluents, "Fluents"), root_1); // ANML.g:469:14: ( $f)* while ( stream_f.hasNext() ) { adaptor.addChild(root_1, stream_f.nextTree()); } stream_f.reset(); adaptor.addChild(root_0, root_1); } // ANML.g:470:4: ^( Actions ( $a)* ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Actions, "Actions"), root_1); // ANML.g:470:14: ( $a)* while ( stream_a.hasNext() ) { adaptor.addChild(root_1, stream_a.nextTree()); } stream_a.reset(); adaptor.addChild(root_0, root_1); } // ANML.g:471:4: ^( Stmts ( $s)* ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Stmts, "Stmts"), root_1); // ANML.g:471:12: ( $s)* while ( stream_s.hasNext() ) { adaptor.addChild(root_1, stream_s.nextTree()); } stream_s.reset(); adaptor.addChild(root_0, root_1); } // ANML.g:472:4: ^( Decompositions ( $d)* ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Decompositions, "Decompositions"), root_1); // ANML.g:472:21: ( $d)* while ( stream_d.hasNext() ) { adaptor.addChild(root_1, stream_d.nextTree()); } stream_d.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "action_block_h" public static class decomp_block_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "decomp_block" // ANML.g:475:1: decomp_block : Decomposition (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* -> ^( Block[$Decomposition,\"DecompositionBlock\"] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) ; public final ANMLParser.decomp_block_return decomp_block() throws RecognitionException { ANMLParser.decomp_block_return retval = new ANMLParser.decomp_block_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Decomposition126=null; List list_t=null; List list_c=null; List list_f=null; List list_a=null; List list_s=null; RuleReturnScope t = null; RuleReturnScope c = null; RuleReturnScope f = null; RuleReturnScope a = null; RuleReturnScope s = null; ANMLToken Decomposition126_tree=null; RewriteRuleTokenStream stream_Decomposition=new RewriteRuleTokenStream(adaptor,"token Decomposition"); RewriteRuleSubtreeStream stream_fact_decl=new RewriteRuleSubtreeStream(adaptor,"rule fact_decl"); RewriteRuleSubtreeStream stream_goal_decl=new RewriteRuleSubtreeStream(adaptor,"rule goal_decl"); RewriteRuleSubtreeStream stream_type_decl=new RewriteRuleSubtreeStream(adaptor,"rule type_decl"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); RewriteRuleSubtreeStream stream_fluent_decl=new RewriteRuleSubtreeStream(adaptor,"rule fluent_decl"); RewriteRuleSubtreeStream stream_const_decl=new RewriteRuleSubtreeStream(adaptor,"rule const_decl"); RewriteRuleSubtreeStream stream_action_decl=new RewriteRuleSubtreeStream(adaptor,"rule action_decl"); try { // ANML.g:476:2: ( Decomposition (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* -> ^( Block[$Decomposition,\"DecompositionBlock\"] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) ) // ANML.g:476:4: Decomposition (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* { Decomposition126=(ANMLToken)match(input,Decomposition,FOLLOW_Decomposition_in_decomp_block2310); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Decomposition.add(Decomposition126); // ANML.g:478:3: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* loop44: do { int alt44=8; alt44 = dfa44.predict(input); switch (alt44) { case 1 : // ANML.g:478:5: t+= type_decl { pushFollow(FOLLOW_type_decl_in_decomp_block2320); t=type_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_decl.add(t.getTree()); if (list_t==null) list_t=new ArrayList(); list_t.add(t.getTree()); } break; case 2 : // ANML.g:479:5: c+= const_decl { pushFollow(FOLLOW_const_decl_in_decomp_block2329); c=const_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_const_decl.add(c.getTree()); if (list_c==null) list_c=new ArrayList(); list_c.add(c.getTree()); } break; case 3 : // ANML.g:480:5: f+= fluent_decl { pushFollow(FOLLOW_fluent_decl_in_decomp_block2338); f=fluent_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fluent_decl.add(f.getTree()); if (list_f==null) list_f=new ArrayList(); list_f.add(f.getTree()); } break; case 4 : // ANML.g:481:5: a+= action_decl { pushFollow(FOLLOW_action_decl_in_decomp_block2347); a=action_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_action_decl.add(a.getTree()); if (list_a==null) list_a=new ArrayList(); list_a.add(a.getTree()); } break; case 5 : // ANML.g:482:5: s+= fact_decl { pushFollow(FOLLOW_fact_decl_in_decomp_block2355); s=fact_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fact_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 6 : // ANML.g:483:5: s+= goal_decl { pushFollow(FOLLOW_goal_decl_in_decomp_block2364); s=goal_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_goal_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 7 : // ANML.g:484:5: s+= stmt { pushFollow(FOLLOW_stmt_in_decomp_block2373); s=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; default : break loop44; } } while (true); // AST REWRITE // elements: c, s, a, t, f // token labels: // rule labels: retval // token list labels: // rule list labels: f, t, s, c, a if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_f=new RewriteRuleSubtreeStream(adaptor,"token f",list_f); RewriteRuleSubtreeStream stream_t=new RewriteRuleSubtreeStream(adaptor,"token t",list_t); RewriteRuleSubtreeStream stream_s=new RewriteRuleSubtreeStream(adaptor,"token s",list_s); RewriteRuleSubtreeStream stream_c=new RewriteRuleSubtreeStream(adaptor,"token c",list_c); RewriteRuleSubtreeStream stream_a=new RewriteRuleSubtreeStream(adaptor,"token a",list_a); root_0 = (ANMLToken)adaptor.nil(); // 486:4: -> ^( Block[$Decomposition,\"DecompositionBlock\"] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) { // ANML.g:487:3: ^( Block[$Decomposition,\"DecompositionBlock\"] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Block, Decomposition126, "DecompositionBlock"), root_1); // ANML.g:489:4: ^( Types ( $t)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Types, "Types"), root_2); // ANML.g:489:12: ( $t)* while ( stream_t.hasNext() ) { adaptor.addChild(root_2, stream_t.nextTree()); } stream_t.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:490:4: ^( Constants ( $c)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Constants, "Constants"), root_2); // ANML.g:490:16: ( $c)* while ( stream_c.hasNext() ) { adaptor.addChild(root_2, stream_c.nextTree()); } stream_c.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:491:4: ^( Fluents ( $f)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Fluents, "Fluents"), root_2); // ANML.g:491:14: ( $f)* while ( stream_f.hasNext() ) { adaptor.addChild(root_2, stream_f.nextTree()); } stream_f.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:492:4: ^( Actions ( $a)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Actions, "Actions"), root_2); // ANML.g:492:14: ( $a)* while ( stream_a.hasNext() ) { adaptor.addChild(root_2, stream_a.nextTree()); } stream_a.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:493:4: ^( Stmts ( $s)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Stmts, "Stmts"), root_2); // ANML.g:493:12: ( $s)* while ( stream_s.hasNext() ) { adaptor.addChild(root_2, stream_s.nextTree()); } stream_s.reset(); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "decomp_block" public static class stmt_block_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_block" // ANML.g:497:1: stmt_block : LeftC (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* RightC -> ^( Block[$LeftC] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) ; public final ANMLParser.stmt_block_return stmt_block() throws RecognitionException { ANMLParser.stmt_block_return retval = new ANMLParser.stmt_block_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftC127=null; ANMLToken RightC128=null; List list_t=null; List list_c=null; List list_f=null; List list_a=null; List list_s=null; RuleReturnScope t = null; RuleReturnScope c = null; RuleReturnScope f = null; RuleReturnScope a = null; RuleReturnScope s = null; ANMLToken LeftC127_tree=null; ANMLToken RightC128_tree=null; RewriteRuleTokenStream stream_LeftC=new RewriteRuleTokenStream(adaptor,"token LeftC"); RewriteRuleTokenStream stream_RightC=new RewriteRuleTokenStream(adaptor,"token RightC"); RewriteRuleSubtreeStream stream_fact_decl=new RewriteRuleSubtreeStream(adaptor,"rule fact_decl"); RewriteRuleSubtreeStream stream_goal_decl=new RewriteRuleSubtreeStream(adaptor,"rule goal_decl"); RewriteRuleSubtreeStream stream_type_decl=new RewriteRuleSubtreeStream(adaptor,"rule type_decl"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); RewriteRuleSubtreeStream stream_fluent_decl=new RewriteRuleSubtreeStream(adaptor,"rule fluent_decl"); RewriteRuleSubtreeStream stream_const_decl=new RewriteRuleSubtreeStream(adaptor,"rule const_decl"); RewriteRuleSubtreeStream stream_action_decl=new RewriteRuleSubtreeStream(adaptor,"rule action_decl"); try { // ANML.g:498:2: ( LeftC (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* RightC -> ^( Block[$LeftC] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) ) // ANML.g:498:4: LeftC (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* RightC { LeftC127=(ANMLToken)match(input,LeftC,FOLLOW_LeftC_in_stmt_block2464); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftC.add(LeftC127); // ANML.g:499:3: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )* loop45: do { int alt45=8; alt45 = dfa45.predict(input); switch (alt45) { case 1 : // ANML.g:499:5: t+= type_decl { pushFollow(FOLLOW_type_decl_in_stmt_block2472); t=type_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_decl.add(t.getTree()); if (list_t==null) list_t=new ArrayList(); list_t.add(t.getTree()); } break; case 2 : // ANML.g:500:5: c+= const_decl { pushFollow(FOLLOW_const_decl_in_stmt_block2481); c=const_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_const_decl.add(c.getTree()); if (list_c==null) list_c=new ArrayList(); list_c.add(c.getTree()); } break; case 3 : // ANML.g:501:5: f+= fluent_decl { pushFollow(FOLLOW_fluent_decl_in_stmt_block2490); f=fluent_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fluent_decl.add(f.getTree()); if (list_f==null) list_f=new ArrayList(); list_f.add(f.getTree()); } break; case 4 : // ANML.g:502:5: a+= action_decl { pushFollow(FOLLOW_action_decl_in_stmt_block2499); a=action_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_action_decl.add(a.getTree()); if (list_a==null) list_a=new ArrayList(); list_a.add(a.getTree()); } break; case 5 : // ANML.g:503:5: s+= fact_decl { pushFollow(FOLLOW_fact_decl_in_stmt_block2507); s=fact_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_fact_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 6 : // ANML.g:504:5: s+= goal_decl { pushFollow(FOLLOW_goal_decl_in_stmt_block2516); s=goal_decl(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_goal_decl.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; case 7 : // ANML.g:505:5: s+= stmt { pushFollow(FOLLOW_stmt_in_stmt_block2525); s=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); } break; default : break loop45; } } while (true); RightC128=(ANMLToken)match(input,RightC,FOLLOW_RightC_in_stmt_block2537); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightC.add(RightC128); // AST REWRITE // elements: s, a, t, f, c // token labels: // rule labels: retval // token list labels: // rule list labels: f, t, s, c, a if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_f=new RewriteRuleSubtreeStream(adaptor,"token f",list_f); RewriteRuleSubtreeStream stream_t=new RewriteRuleSubtreeStream(adaptor,"token t",list_t); RewriteRuleSubtreeStream stream_s=new RewriteRuleSubtreeStream(adaptor,"token s",list_s); RewriteRuleSubtreeStream stream_c=new RewriteRuleSubtreeStream(adaptor,"token c",list_c); RewriteRuleSubtreeStream stream_a=new RewriteRuleSubtreeStream(adaptor,"token a",list_a); root_0 = (ANMLToken)adaptor.nil(); // 508:4: -> ^( Block[$LeftC] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) { // ANML.g:509:3: ^( Block[$LeftC] ^( Types ( $t)* ) ^( Constants ( $c)* ) ^( Fluents ( $f)* ) ^( Actions ( $a)* ) ^( Stmts ( $s)* ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Block, LeftC127), root_1); // ANML.g:510:4: ^( Types ( $t)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Types, "Types"), root_2); // ANML.g:510:12: ( $t)* while ( stream_t.hasNext() ) { adaptor.addChild(root_2, stream_t.nextTree()); } stream_t.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:511:4: ^( Constants ( $c)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Constants, "Constants"), root_2); // ANML.g:511:16: ( $c)* while ( stream_c.hasNext() ) { adaptor.addChild(root_2, stream_c.nextTree()); } stream_c.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:512:4: ^( Fluents ( $f)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Fluents, "Fluents"), root_2); // ANML.g:512:14: ( $f)* while ( stream_f.hasNext() ) { adaptor.addChild(root_2, stream_f.nextTree()); } stream_f.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:513:4: ^( Actions ( $a)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Actions, "Actions"), root_2); // ANML.g:513:14: ( $a)* while ( stream_a.hasNext() ) { adaptor.addChild(root_2, stream_a.nextTree()); } stream_a.reset(); adaptor.addChild(root_1, root_2); } // ANML.g:514:4: ^( Stmts ( $s)* ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Stmts, "Stmts"), root_2); // ANML.g:514:12: ( $s)* while ( stream_s.hasNext() ) { adaptor.addChild(root_2, stream_s.nextTree()); } stream_s.reset(); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_block" public static class stmt_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt" // ANML.g:518:1: stmt : ( ( stmt_primitive )=> stmt_primitive | ( stmt_block )=> stmt_block | ( stmt_timed )=> stmt_timed | stmt_contains | stmt_when | stmt_forall | stmt_exists ); public final ANMLParser.stmt_return stmt() throws RecognitionException { ANMLParser.stmt_return retval = new ANMLParser.stmt_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLParser.stmt_primitive_return stmt_primitive129 = null; ANMLParser.stmt_block_return stmt_block130 = null; ANMLParser.stmt_timed_return stmt_timed131 = null; ANMLParser.stmt_contains_return stmt_contains132 = null; ANMLParser.stmt_when_return stmt_when133 = null; ANMLParser.stmt_forall_return stmt_forall134 = null; ANMLParser.stmt_exists_return stmt_exists135 = null; try { // ANML.g:519:2: ( ( stmt_primitive )=> stmt_primitive | ( stmt_block )=> stmt_block | ( stmt_timed )=> stmt_timed | stmt_contains | stmt_when | stmt_forall | stmt_exists ) int alt46=7; alt46 = dfa46.predict(input); switch (alt46) { case 1 : // ANML.g:519:4: ( stmt_primitive )=> stmt_primitive { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_primitive_in_stmt2628); stmt_primitive129=stmt_primitive(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_primitive129.getTree()); } break; case 2 : // ANML.g:520:4: ( stmt_block )=> stmt_block { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_block_in_stmt2638); stmt_block130=stmt_block(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_block130.getTree()); } break; case 3 : // ANML.g:521:4: ( stmt_timed )=> stmt_timed { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_timed_in_stmt2648); stmt_timed131=stmt_timed(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_timed131.getTree()); } break; case 4 : // ANML.g:522:4: stmt_contains { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_contains_in_stmt2653); stmt_contains132=stmt_contains(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_contains132.getTree()); } break; case 5 : // ANML.g:523:4: stmt_when { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_when_in_stmt2658); stmt_when133=stmt_when(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_when133.getTree()); } break; case 6 : // ANML.g:524:4: stmt_forall { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_forall_in_stmt2663); stmt_forall134=stmt_forall(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_forall134.getTree()); } break; case 7 : // ANML.g:525:4: stmt_exists { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_exists_in_stmt2668); stmt_exists135=stmt_exists(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_exists135.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt" public static class stmt_contains_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_contains" // ANML.g:528:1: stmt_contains : Contains ( ( exist_time stmt )=> exist_time stmt -> ^( ContainsSomeStmt[$Contains] exist_time stmt ) | stmt -> ^( ContainsAllStmt[$Contains] stmt ) ) ; public final ANMLParser.stmt_contains_return stmt_contains() throws RecognitionException { ANMLParser.stmt_contains_return retval = new ANMLParser.stmt_contains_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Contains136=null; ANMLParser.exist_time_return exist_time137 = null; ANMLParser.stmt_return stmt138 = null; ANMLParser.stmt_return stmt139 = null; ANMLToken Contains136_tree=null; RewriteRuleTokenStream stream_Contains=new RewriteRuleTokenStream(adaptor,"token Contains"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); RewriteRuleSubtreeStream stream_exist_time=new RewriteRuleSubtreeStream(adaptor,"rule exist_time"); try { // ANML.g:529:2: ( Contains ( ( exist_time stmt )=> exist_time stmt -> ^( ContainsSomeStmt[$Contains] exist_time stmt ) | stmt -> ^( ContainsAllStmt[$Contains] stmt ) ) ) // ANML.g:529:4: Contains ( ( exist_time stmt )=> exist_time stmt -> ^( ContainsSomeStmt[$Contains] exist_time stmt ) | stmt -> ^( ContainsAllStmt[$Contains] stmt ) ) { Contains136=(ANMLToken)match(input,Contains,FOLLOW_Contains_in_stmt_contains2678); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Contains.add(Contains136); // ANML.g:530:3: ( ( exist_time stmt )=> exist_time stmt -> ^( ContainsSomeStmt[$Contains] exist_time stmt ) | stmt -> ^( ContainsAllStmt[$Contains] stmt ) ) int alt47=2; alt47 = dfa47.predict(input); switch (alt47) { case 1 : // ANML.g:530:4: ( exist_time stmt )=> exist_time stmt { pushFollow(FOLLOW_exist_time_in_stmt_contains2691); exist_time137=exist_time(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_exist_time.add(exist_time137.getTree()); pushFollow(FOLLOW_stmt_in_stmt_contains2693); stmt138=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(stmt138.getTree()); // AST REWRITE // elements: exist_time, stmt // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 531:4: -> ^( ContainsSomeStmt[$Contains] exist_time stmt ) { // ANML.g:531:7: ^( ContainsSomeStmt[$Contains] exist_time stmt ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(ContainsSomeStmt, Contains136), root_1); adaptor.addChild(root_1, stream_exist_time.nextTree()); adaptor.addChild(root_1, stream_stmt.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:532:5: stmt { pushFollow(FOLLOW_stmt_in_stmt_contains2713); stmt139=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(stmt139.getTree()); // AST REWRITE // elements: stmt // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 533:4: -> ^( ContainsAllStmt[$Contains] stmt ) { // ANML.g:533:7: ^( ContainsAllStmt[$Contains] stmt ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(ContainsAllStmt, Contains136), root_1); adaptor.addChild(root_1, stream_stmt.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_contains" public static class stmt_when_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_when" // ANML.g:537:1: stmt_when : When guard stmt ( ( Else )=> Else stmt -> ^( WhenElse[$When] guard stmt stmt ) | -> ^( When guard stmt ) ) ; public final ANMLParser.stmt_when_return stmt_when() throws RecognitionException { ANMLParser.stmt_when_return retval = new ANMLParser.stmt_when_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken When140=null; ANMLToken Else143=null; ANMLParser.guard_return guard141 = null; ANMLParser.stmt_return stmt142 = null; ANMLParser.stmt_return stmt144 = null; ANMLToken When140_tree=null; ANMLToken Else143_tree=null; RewriteRuleTokenStream stream_Else=new RewriteRuleTokenStream(adaptor,"token Else"); RewriteRuleTokenStream stream_When=new RewriteRuleTokenStream(adaptor,"token When"); RewriteRuleSubtreeStream stream_guard=new RewriteRuleSubtreeStream(adaptor,"rule guard"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); try { // ANML.g:538:2: ( When guard stmt ( ( Else )=> Else stmt -> ^( WhenElse[$When] guard stmt stmt ) | -> ^( When guard stmt ) ) ) // ANML.g:538:4: When guard stmt ( ( Else )=> Else stmt -> ^( WhenElse[$When] guard stmt stmt ) | -> ^( When guard stmt ) ) { When140=(ANMLToken)match(input,When,FOLLOW_When_in_stmt_when2740); if (state.failed) return retval; if ( state.backtracking==0 ) stream_When.add(When140); pushFollow(FOLLOW_guard_in_stmt_when2742); guard141=guard(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_guard.add(guard141.getTree()); pushFollow(FOLLOW_stmt_in_stmt_when2744); stmt142=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(stmt142.getTree()); // ANML.g:539:3: ( ( Else )=> Else stmt -> ^( WhenElse[$When] guard stmt stmt ) | -> ^( When guard stmt ) ) int alt48=2; int LA48_0 = input.LA(1); if ( (LA48_0==Else) ) { int LA48_1 = input.LA(2); if ( (synpred7_ANML()) ) { alt48=1; } else if ( (true) ) { alt48=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 48, 1, input); throw nvae; } } else if ( (LA48_0==EOF||(LA48_0>=Type && LA48_0<=Fluent)||LA48_0==Constant||LA48_0==Action||(LA48_0>=Bra && LA48_0<=Ket)||LA48_0==When||LA48_0==ID||LA48_0==Predicate||LA48_0==Semi||LA48_0==LeftP||(LA48_0>=Variable && LA48_0<=NotBit)||(LA48_0>=Goal && LA48_0<=Duration)||(LA48_0>=Decomposition && LA48_0<=Contains)||(LA48_0>=ForAll && LA48_0<=Exists)||LA48_0==Delta||LA48_0==Dots||LA48_0==Minus||(LA48_0>=Unordered && LA48_0<=Ordered)||(LA48_0>=Start && LA48_0<=Infinity)) ) { alt48=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 48, 0, input); throw nvae; } switch (alt48) { case 1 : // ANML.g:539:5: ( Else )=> Else stmt { Else143=(ANMLToken)match(input,Else,FOLLOW_Else_in_stmt_when2757); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Else.add(Else143); pushFollow(FOLLOW_stmt_in_stmt_when2759); stmt144=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(stmt144.getTree()); // AST REWRITE // elements: guard, stmt, stmt // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 540:4: -> ^( WhenElse[$When] guard stmt stmt ) { // ANML.g:540:7: ^( WhenElse[$When] guard stmt stmt ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(WhenElse, When140), root_1); adaptor.addChild(root_1, stream_guard.nextTree()); adaptor.addChild(root_1, stream_stmt.nextTree()); adaptor.addChild(root_1, stream_stmt.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:542:4: { // AST REWRITE // elements: guard, stmt, When // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 542:4: -> ^( When guard stmt ) { // ANML.g:542:7: ^( When guard stmt ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot(stream_When.nextNode(), root_1); adaptor.addChild(root_1, stream_guard.nextTree()); adaptor.addChild(root_1, stream_stmt.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_when" public static class stmt_forall_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_forall" // ANML.g:546:1: stmt_forall : ForAll param_list stmt -> ^( ForAllStmt[$ForAll] param_list stmt ) ; public final ANMLParser.stmt_forall_return stmt_forall() throws RecognitionException { ANMLParser.stmt_forall_return retval = new ANMLParser.stmt_forall_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ForAll145=null; ANMLParser.param_list_return param_list146 = null; ANMLParser.stmt_return stmt147 = null; ANMLToken ForAll145_tree=null; RewriteRuleTokenStream stream_ForAll=new RewriteRuleTokenStream(adaptor,"token ForAll"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); RewriteRuleSubtreeStream stream_param_list=new RewriteRuleSubtreeStream(adaptor,"rule param_list"); try { // ANML.g:547:2: ( ForAll param_list stmt -> ^( ForAllStmt[$ForAll] param_list stmt ) ) // ANML.g:547:4: ForAll param_list stmt { ForAll145=(ANMLToken)match(input,ForAll,FOLLOW_ForAll_in_stmt_forall2807); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ForAll.add(ForAll145); pushFollow(FOLLOW_param_list_in_stmt_forall2809); param_list146=param_list(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_list.add(param_list146.getTree()); pushFollow(FOLLOW_stmt_in_stmt_forall2811); stmt147=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(stmt147.getTree()); // AST REWRITE // elements: stmt, param_list // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 548:3: -> ^( ForAllStmt[$ForAll] param_list stmt ) { // ANML.g:548:6: ^( ForAllStmt[$ForAll] param_list stmt ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(ForAllStmt, ForAll145), root_1); adaptor.addChild(root_1, stream_param_list.nextTree()); adaptor.addChild(root_1, stream_stmt.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_forall" public static class stmt_exists_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_exists" // ANML.g:551:1: stmt_exists : Exists param_list stmt -> ^( ExistsStmt[$Exists] param_list stmt ) ; public final ANMLParser.stmt_exists_return stmt_exists() throws RecognitionException { ANMLParser.stmt_exists_return retval = new ANMLParser.stmt_exists_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Exists148=null; ANMLParser.param_list_return param_list149 = null; ANMLParser.stmt_return stmt150 = null; ANMLToken Exists148_tree=null; RewriteRuleTokenStream stream_Exists=new RewriteRuleTokenStream(adaptor,"token Exists"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); RewriteRuleSubtreeStream stream_param_list=new RewriteRuleSubtreeStream(adaptor,"rule param_list"); try { // ANML.g:552:2: ( Exists param_list stmt -> ^( ExistsStmt[$Exists] param_list stmt ) ) // ANML.g:552:4: Exists param_list stmt { Exists148=(ANMLToken)match(input,Exists,FOLLOW_Exists_in_stmt_exists2834); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Exists.add(Exists148); pushFollow(FOLLOW_param_list_in_stmt_exists2836); param_list149=param_list(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_list.add(param_list149.getTree()); pushFollow(FOLLOW_stmt_in_stmt_exists2838); stmt150=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(stmt150.getTree()); // AST REWRITE // elements: param_list, stmt // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 553:3: -> ^( ExistsStmt[$Exists] param_list stmt ) { // ANML.g:553:6: ^( ExistsStmt[$Exists] param_list stmt ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(ExistsStmt, Exists148), root_1); adaptor.addChild(root_1, stream_param_list.nextTree()); adaptor.addChild(root_1, stream_stmt.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_exists" public static class stmt_timed_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_timed" // ANML.g:556:1: stmt_timed : interval stmt -> ^( TimedStmt interval stmt ) ; public final ANMLParser.stmt_timed_return stmt_timed() throws RecognitionException { ANMLParser.stmt_timed_return retval = new ANMLParser.stmt_timed_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLParser.interval_return interval151 = null; ANMLParser.stmt_return stmt152 = null; RewriteRuleSubtreeStream stream_interval=new RewriteRuleSubtreeStream(adaptor,"rule interval"); RewriteRuleSubtreeStream stream_stmt=new RewriteRuleSubtreeStream(adaptor,"rule stmt"); try { // ANML.g:557:2: ( interval stmt -> ^( TimedStmt interval stmt ) ) // ANML.g:557:4: interval stmt { pushFollow(FOLLOW_interval_in_stmt_timed2861); interval151=interval(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_interval.add(interval151.getTree()); pushFollow(FOLLOW_stmt_in_stmt_timed2863); stmt152=stmt(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt.add(stmt152.getTree()); // AST REWRITE // elements: stmt, interval // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 558:3: -> ^( TimedStmt interval stmt ) { // ANML.g:558:6: ^( TimedStmt interval stmt ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TimedStmt, "TimedStmt"), root_1); adaptor.addChild(root_1, stream_interval.nextTree()); adaptor.addChild(root_1, stream_stmt.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_timed" public static class stmt_primitive_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_primitive" // ANML.g:561:1: stmt_primitive : ( ( expr Semi )=> expr Semi | ( stmt_chain Semi )=> stmt_chain Semi | ( stmt_delta_chain Semi )=> stmt_delta_chain Semi | ( stmt_timeless Semi )=> stmt_timeless Semi | Semi -> Skip ); public final ANMLParser.stmt_primitive_return stmt_primitive() throws RecognitionException { T_stack.push(new T_scope()); ANMLParser.stmt_primitive_return retval = new ANMLParser.stmt_primitive_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Semi154=null; ANMLToken Semi156=null; ANMLToken Semi158=null; ANMLToken Semi160=null; ANMLToken Semi161=null; ANMLParser.expr_return expr153 = null; ANMLParser.stmt_chain_return stmt_chain155 = null; ANMLParser.stmt_delta_chain_return stmt_delta_chain157 = null; ANMLParser.stmt_timeless_return stmt_timeless159 = null; ANMLToken Semi154_tree=null; ANMLToken Semi156_tree=null; ANMLToken Semi158_tree=null; ANMLToken Semi160_tree=null; ANMLToken Semi161_tree=null; RewriteRuleTokenStream stream_Semi=new RewriteRuleTokenStream(adaptor,"token Semi"); try { // ANML.g:562:2: ( ( expr Semi )=> expr Semi | ( stmt_chain Semi )=> stmt_chain Semi | ( stmt_delta_chain Semi )=> stmt_delta_chain Semi | ( stmt_timeless Semi )=> stmt_timeless Semi | Semi -> Skip ) int alt49=5; alt49 = dfa49.predict(input); switch (alt49) { case 1 : // ANML.g:562:4: ( expr Semi )=> expr Semi { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_expr_in_stmt_primitive2899); expr153=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, expr153.getTree()); Semi154=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_stmt_primitive2901); if (state.failed) return retval; } break; case 2 : // ANML.g:563:6: ( stmt_chain Semi )=> stmt_chain Semi { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_chain_in_stmt_primitive2916); stmt_chain155=stmt_chain(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_chain155.getTree()); Semi156=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_stmt_primitive2918); if (state.failed) return retval; } break; case 3 : // ANML.g:564:4: ( stmt_delta_chain Semi )=> stmt_delta_chain Semi { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_delta_chain_in_stmt_primitive2931); stmt_delta_chain157=stmt_delta_chain(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_delta_chain157.getTree()); Semi158=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_stmt_primitive2933); if (state.failed) return retval; } break; case 4 : // ANML.g:565:6: ( stmt_timeless Semi )=> stmt_timeless Semi { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_stmt_timeless_in_stmt_primitive2948); stmt_timeless159=stmt_timeless(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, stmt_timeless159.getTree()); Semi160=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_stmt_primitive2950); if (state.failed) return retval; } break; case 5 : // ANML.g:566:6: Semi { Semi161=(ANMLToken)match(input,Semi,FOLLOW_Semi_in_stmt_primitive2958); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Semi.add(Semi161); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 566:11: -> Skip { adaptor.addChild(root_0, (ANMLToken)adaptor.create(Skip, "Skip")); } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { T_stack.pop(); } return retval; } // $ANTLR end "stmt_primitive" public static class stmt_chain_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_chain" // ANML.g:569:1: stmt_chain : ( ref (e+= stmt_chain_1 )+ -> ^( Chain ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) ref ( $e)+ ) | ( interval ref ( stmt_chain_1 )+ )=> interval ref (e+= stmt_chain_1 )+ -> ^( Chain interval ref ( $e)+ ) ); public final ANMLParser.stmt_chain_return stmt_chain() throws RecognitionException { ANMLParser.stmt_chain_return retval = new ANMLParser.stmt_chain_return(); retval.start = input.LT(1); ANMLToken root_0 = null; List list_e=null; ANMLParser.ref_return ref162 = null; ANMLParser.interval_return interval163 = null; ANMLParser.ref_return ref164 = null; RuleReturnScope e = null; RewriteRuleSubtreeStream stream_ref=new RewriteRuleSubtreeStream(adaptor,"rule ref"); RewriteRuleSubtreeStream stream_interval=new RewriteRuleSubtreeStream(adaptor,"rule interval"); RewriteRuleSubtreeStream stream_stmt_chain_1=new RewriteRuleSubtreeStream(adaptor,"rule stmt_chain_1"); try { // ANML.g:570:2: ( ref (e+= stmt_chain_1 )+ -> ^( Chain ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) ref ( $e)+ ) | ( interval ref ( stmt_chain_1 )+ )=> interval ref (e+= stmt_chain_1 )+ -> ^( Chain interval ref ( $e)+ ) ) int alt52=2; int LA52_0 = input.LA(1); if ( (LA52_0==ID) ) { alt52=1; } else if ( (LA52_0==LeftB) && (synpred12_ANML())) { alt52=2; } else if ( (LA52_0==LeftP) && (synpred12_ANML())) { alt52=2; } else if ( (LA52_0==Dots) && (synpred12_ANML())) { alt52=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 52, 0, input); throw nvae; } switch (alt52) { case 1 : // ANML.g:570:4: ref (e+= stmt_chain_1 )+ { pushFollow(FOLLOW_ref_in_stmt_chain2972); ref162=ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ref.add(ref162.getTree()); // ANML.g:570:9: (e+= stmt_chain_1 )+ int cnt50=0; loop50: do { int alt50=2; int LA50_0 = input.LA(1); if ( ((LA50_0>=LessThan && LA50_0<=Assign)||LA50_0==Comma||LA50_0==Undefine||LA50_0==Equal||(LA50_0>=Change && LA50_0<=Skip)||(LA50_0>=NotEqual && LA50_0<=GreaterThanE)) ) { alt50=1; } switch (alt50) { case 1 : // ANML.g:570:9: e+= stmt_chain_1 { pushFollow(FOLLOW_stmt_chain_1_in_stmt_chain2976); e=stmt_chain_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt_chain_1.add(e.getTree()); if (list_e==null) list_e=new ArrayList(); list_e.add(e.getTree()); } break; default : if ( cnt50 >= 1 ) break loop50; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee = new EarlyExitException(50, input); throw eee; } cnt50++; } while (true); // AST REWRITE // elements: e, ref // token labels: // rule labels: retval // token list labels: // rule list labels: e if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",list_e); root_0 = (ANMLToken)adaptor.nil(); // 571:5: -> ^( Chain ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) ref ( $e)+ ) { // ANML.g:571:8: ^( Chain ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) ref ( $e)+ ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Chain, "Chain"), root_1); // ANML.g:571:16: ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefiniteInterval, "DefiniteInterval"), root_2); // ANML.g:571:35: ^( TBra Bra ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TBra, "TBra"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Bra, "Bra")); adaptor.addChild(root_2, root_3); } // ANML.g:571:47: ^( TStart Start ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Start, "Start")); adaptor.addChild(root_2, root_3); } // ANML.g:571:63: ^( TDuration Duration ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TDuration, "TDuration"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Duration, "Duration")); adaptor.addChild(root_2, root_3); } // ANML.g:571:85: ^( TEnd End ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TEnd, "TEnd"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(End, "End")); adaptor.addChild(root_2, root_3); } // ANML.g:571:97: ^( TKet Ket ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TKet, "TKet"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Ket, "Ket")); adaptor.addChild(root_2, root_3); } adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ref.nextTree()); if ( !(stream_e.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_e.hasNext() ) { adaptor.addChild(root_1, stream_e.nextTree()); } stream_e.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:572:4: ( interval ref ( stmt_chain_1 )+ )=> interval ref (e+= stmt_chain_1 )+ { pushFollow(FOLLOW_interval_in_stmt_chain3043); interval163=interval(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_interval.add(interval163.getTree()); pushFollow(FOLLOW_ref_in_stmt_chain3045); ref164=ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ref.add(ref164.getTree()); // ANML.g:572:49: (e+= stmt_chain_1 )+ int cnt51=0; loop51: do { int alt51=2; int LA51_0 = input.LA(1); if ( ((LA51_0>=LessThan && LA51_0<=Assign)||LA51_0==Comma||LA51_0==Undefine||LA51_0==Equal||(LA51_0>=Change && LA51_0<=Skip)||(LA51_0>=NotEqual && LA51_0<=GreaterThanE)) ) { alt51=1; } switch (alt51) { case 1 : // ANML.g:572:49: e+= stmt_chain_1 { pushFollow(FOLLOW_stmt_chain_1_in_stmt_chain3049); e=stmt_chain_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt_chain_1.add(e.getTree()); if (list_e==null) list_e=new ArrayList(); list_e.add(e.getTree()); } break; default : if ( cnt51 >= 1 ) break loop51; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee = new EarlyExitException(51, input); throw eee; } cnt51++; } while (true); // AST REWRITE // elements: interval, ref, e // token labels: // rule labels: retval // token list labels: // rule list labels: e if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",list_e); root_0 = (ANMLToken)adaptor.nil(); // 573:3: -> ^( Chain interval ref ( $e)+ ) { // ANML.g:573:6: ^( Chain interval ref ( $e)+ ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Chain, "Chain"), root_1); adaptor.addChild(root_1, stream_interval.nextTree()); adaptor.addChild(root_1, stream_ref.nextTree()); if ( !(stream_e.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_e.hasNext() ) { adaptor.addChild(root_1, stream_e.nextTree()); } stream_e.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_chain" public static class stmt_chain_1_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_chain_1" // ANML.g:575:1: stmt_chain_1 : ( ( Comma )? Assign e_num | ( Comma )? o= Change b= e_num -> Undefine ^( Assign $b) | ( Comma )? o= Produce b= e_num | ( Comma )? o= Consume b= e_num | ( Comma )? o= Lend b= e_num -> ^( Produce $b) Skip ^( Consume $b) | ( Comma )? o= Use b= e_num -> ^( Consume $b) Skip ^( Produce $b) | ( Comma )? (o= Within | o= SetAssign ) s= set | ( Comma )? i= num_relop b= e_num | ( Comma )? (o= Equal Skip | o= Skip ) -> Skip | ( Comma )? (o= Assign Undefined | o= Undefine ) -> Undefine ); public final ANMLParser.stmt_chain_1_return stmt_chain_1() throws RecognitionException { ANMLParser.stmt_chain_1_return retval = new ANMLParser.stmt_chain_1_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken o=null; ANMLToken Comma165=null; ANMLToken Assign166=null; ANMLToken Comma168=null; ANMLToken Comma169=null; ANMLToken Comma170=null; ANMLToken Comma171=null; ANMLToken Comma172=null; ANMLToken Comma173=null; ANMLToken Comma174=null; ANMLToken Comma175=null; ANMLToken Skip176=null; ANMLToken Comma177=null; ANMLToken Undefined178=null; ANMLParser.e_num_return b = null; ANMLParser.set_return s = null; ANMLParser.num_relop_return i = null; ANMLParser.e_num_return e_num167 = null; ANMLToken o_tree=null; ANMLToken Comma165_tree=null; ANMLToken Assign166_tree=null; ANMLToken Comma168_tree=null; ANMLToken Comma169_tree=null; ANMLToken Comma170_tree=null; ANMLToken Comma171_tree=null; ANMLToken Comma172_tree=null; ANMLToken Comma173_tree=null; ANMLToken Comma174_tree=null; ANMLToken Comma175_tree=null; ANMLToken Skip176_tree=null; ANMLToken Comma177_tree=null; ANMLToken Undefined178_tree=null; RewriteRuleTokenStream stream_Skip=new RewriteRuleTokenStream(adaptor,"token Skip"); RewriteRuleTokenStream stream_Assign=new RewriteRuleTokenStream(adaptor,"token Assign"); RewriteRuleTokenStream stream_Undefine=new RewriteRuleTokenStream(adaptor,"token Undefine"); RewriteRuleTokenStream stream_Change=new RewriteRuleTokenStream(adaptor,"token Change"); RewriteRuleTokenStream stream_Lend=new RewriteRuleTokenStream(adaptor,"token Lend"); RewriteRuleTokenStream stream_Equal=new RewriteRuleTokenStream(adaptor,"token Equal"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleTokenStream stream_Undefined=new RewriteRuleTokenStream(adaptor,"token Undefined"); RewriteRuleTokenStream stream_Use=new RewriteRuleTokenStream(adaptor,"token Use"); RewriteRuleSubtreeStream stream_e_num=new RewriteRuleSubtreeStream(adaptor,"rule e_num"); try { // ANML.g:576:5: ( ( Comma )? Assign e_num | ( Comma )? o= Change b= e_num -> Undefine ^( Assign $b) | ( Comma )? o= Produce b= e_num | ( Comma )? o= Consume b= e_num | ( Comma )? o= Lend b= e_num -> ^( Produce $b) Skip ^( Consume $b) | ( Comma )? o= Use b= e_num -> ^( Consume $b) Skip ^( Produce $b) | ( Comma )? (o= Within | o= SetAssign ) s= set | ( Comma )? i= num_relop b= e_num | ( Comma )? (o= Equal Skip | o= Skip ) -> Skip | ( Comma )? (o= Assign Undefined | o= Undefine ) -> Undefine ) int alt66=10; alt66 = dfa66.predict(input); switch (alt66) { case 1 : // ANML.g:576:7: ( Comma )? Assign e_num { root_0 = (ANMLToken)adaptor.nil(); // ANML.g:576:12: ( Comma )? int alt53=2; int LA53_0 = input.LA(1); if ( (LA53_0==Comma) ) { alt53=1; } switch (alt53) { case 1 : // ANML.g:576:12: Comma { Comma165=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13078); if (state.failed) return retval; } break; } Assign166=(ANMLToken)match(input,Assign,FOLLOW_Assign_in_stmt_chain_13082); if (state.failed) return retval; if ( state.backtracking==0 ) { Assign166_tree = (ANMLToken)adaptor.create(Assign166); root_0 = (ANMLToken)adaptor.becomeRoot(Assign166_tree, root_0); } pushFollow(FOLLOW_e_num_in_stmt_chain_13085); e_num167=e_num(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num167.getTree()); } break; case 2 : // ANML.g:577:7: ( Comma )? o= Change b= e_num { // ANML.g:577:7: ( Comma )? int alt54=2; int LA54_0 = input.LA(1); if ( (LA54_0==Comma) ) { alt54=1; } switch (alt54) { case 1 : // ANML.g:577:7: Comma { Comma168=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13093); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma168); } break; } o=(ANMLToken)match(input,Change,FOLLOW_Change_in_stmt_chain_13098); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Change.add(o); pushFollow(FOLLOW_e_num_in_stmt_chain_13102); b=e_num(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_e_num.add(b.getTree()); // AST REWRITE // elements: b // token labels: // rule labels: retval, b // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_b=new RewriteRuleSubtreeStream(adaptor,"token b",b!=null?b.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 578:6: -> Undefine ^( Assign $b) { adaptor.addChild(root_0, (ANMLToken)adaptor.create(Undefine, "Undefine")); // ANML.g:579:7: ^( Assign $b) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Assign, "Assign"), root_1); adaptor.addChild(root_1, stream_b.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:580:7: ( Comma )? o= Produce b= e_num { root_0 = (ANMLToken)adaptor.nil(); // ANML.g:580:12: ( Comma )? int alt55=2; int LA55_0 = input.LA(1); if ( (LA55_0==Comma) ) { alt55=1; } switch (alt55) { case 1 : // ANML.g:580:12: Comma { Comma169=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13133); if (state.failed) return retval; } break; } o=(ANMLToken)match(input,Produce,FOLLOW_Produce_in_stmt_chain_13139); if (state.failed) return retval; if ( state.backtracking==0 ) { o_tree = (ANMLToken)adaptor.create(o); root_0 = (ANMLToken)adaptor.becomeRoot(o_tree, root_0); } pushFollow(FOLLOW_e_num_in_stmt_chain_13144); b=e_num(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, b.getTree()); } break; case 4 : // ANML.g:581:7: ( Comma )? o= Consume b= e_num { root_0 = (ANMLToken)adaptor.nil(); // ANML.g:581:12: ( Comma )? int alt56=2; int LA56_0 = input.LA(1); if ( (LA56_0==Comma) ) { alt56=1; } switch (alt56) { case 1 : // ANML.g:581:12: Comma { Comma170=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13152); if (state.failed) return retval; } break; } o=(ANMLToken)match(input,Consume,FOLLOW_Consume_in_stmt_chain_13158); if (state.failed) return retval; if ( state.backtracking==0 ) { o_tree = (ANMLToken)adaptor.create(o); root_0 = (ANMLToken)adaptor.becomeRoot(o_tree, root_0); } pushFollow(FOLLOW_e_num_in_stmt_chain_13163); b=e_num(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, b.getTree()); } break; case 5 : // ANML.g:582:7: ( Comma )? o= Lend b= e_num { // ANML.g:582:7: ( Comma )? int alt57=2; int LA57_0 = input.LA(1); if ( (LA57_0==Comma) ) { alt57=1; } switch (alt57) { case 1 : // ANML.g:582:7: Comma { Comma171=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13171); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma171); } break; } o=(ANMLToken)match(input,Lend,FOLLOW_Lend_in_stmt_chain_13176); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Lend.add(o); pushFollow(FOLLOW_e_num_in_stmt_chain_13180); b=e_num(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_e_num.add(b.getTree()); // AST REWRITE // elements: b, b // token labels: // rule labels: retval, b // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_b=new RewriteRuleSubtreeStream(adaptor,"token b",b!=null?b.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 583:6: -> ^( Produce $b) Skip ^( Consume $b) { // ANML.g:583:9: ^( Produce $b) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Produce, "Produce"), root_1); adaptor.addChild(root_1, stream_b.nextTree()); adaptor.addChild(root_0, root_1); } adaptor.addChild(root_0, (ANMLToken)adaptor.create(Skip, "Skip")); // ANML.g:585:7: ^( Consume $b) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Consume, "Consume"), root_1); adaptor.addChild(root_1, stream_b.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 6 : // ANML.g:586:7: ( Comma )? o= Use b= e_num { // ANML.g:586:7: ( Comma )? int alt58=2; int LA58_0 = input.LA(1); if ( (LA58_0==Comma) ) { alt58=1; } switch (alt58) { case 1 : // ANML.g:586:7: Comma { Comma172=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13223); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma172); } break; } o=(ANMLToken)match(input,Use,FOLLOW_Use_in_stmt_chain_13228); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Use.add(o); pushFollow(FOLLOW_e_num_in_stmt_chain_13232); b=e_num(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_e_num.add(b.getTree()); // AST REWRITE // elements: b, b // token labels: // rule labels: retval, b // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_b=new RewriteRuleSubtreeStream(adaptor,"token b",b!=null?b.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 587:6: -> ^( Consume $b) Skip ^( Produce $b) { // ANML.g:587:9: ^( Consume $b) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Consume, "Consume"), root_1); adaptor.addChild(root_1, stream_b.nextTree()); adaptor.addChild(root_0, root_1); } adaptor.addChild(root_0, (ANMLToken)adaptor.create(Skip, "Skip")); // ANML.g:589:7: ^( Produce $b) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Produce, "Produce"), root_1); adaptor.addChild(root_1, stream_b.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 7 : // ANML.g:590:7: ( Comma )? (o= Within | o= SetAssign ) s= set { root_0 = (ANMLToken)adaptor.nil(); // ANML.g:590:12: ( Comma )? int alt59=2; int LA59_0 = input.LA(1); if ( (LA59_0==Comma) ) { alt59=1; } switch (alt59) { case 1 : // ANML.g:590:12: Comma { Comma173=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13276); if (state.failed) return retval; } break; } // ANML.g:590:15: (o= Within | o= SetAssign ) int alt60=2; int LA60_0 = input.LA(1); if ( (LA60_0==Within) ) { alt60=1; } else if ( (LA60_0==SetAssign) ) { alt60=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 60, 0, input); throw nvae; } switch (alt60) { case 1 : // ANML.g:590:16: o= Within { o=(ANMLToken)match(input,Within,FOLLOW_Within_in_stmt_chain_13283); if (state.failed) return retval; if ( state.backtracking==0 ) { o_tree = (ANMLToken)adaptor.create(o); adaptor.addChild(root_0, o_tree); } } break; case 2 : // ANML.g:590:25: o= SetAssign { o=(ANMLToken)match(input,SetAssign,FOLLOW_SetAssign_in_stmt_chain_13287); if (state.failed) return retval; if ( state.backtracking==0 ) { o_tree = (ANMLToken)adaptor.create(o); adaptor.addChild(root_0, o_tree); } } break; } pushFollow(FOLLOW_set_in_stmt_chain_13293); s=set(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, s.getTree()); } break; case 8 : // ANML.g:591:7: ( Comma )? i= num_relop b= e_num { root_0 = (ANMLToken)adaptor.nil(); // ANML.g:591:12: ( Comma )? int alt61=2; int LA61_0 = input.LA(1); if ( (LA61_0==Comma) ) { alt61=1; } switch (alt61) { case 1 : // ANML.g:591:12: Comma { Comma174=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13301); if (state.failed) return retval; } break; } pushFollow(FOLLOW_num_relop_in_stmt_chain_13307); i=num_relop(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) root_0 = (ANMLToken)adaptor.becomeRoot(i.getTree(), root_0); pushFollow(FOLLOW_e_num_in_stmt_chain_13312); b=e_num(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, b.getTree()); } break; case 9 : // ANML.g:592:4: ( Comma )? (o= Equal Skip | o= Skip ) { // ANML.g:592:4: ( Comma )? int alt62=2; int LA62_0 = input.LA(1); if ( (LA62_0==Comma) ) { alt62=1; } switch (alt62) { case 1 : // ANML.g:592:4: Comma { Comma175=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13318); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma175); } break; } // ANML.g:592:11: (o= Equal Skip | o= Skip ) int alt63=2; int LA63_0 = input.LA(1); if ( (LA63_0==Equal) ) { alt63=1; } else if ( (LA63_0==Skip) ) { alt63=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 63, 0, input); throw nvae; } switch (alt63) { case 1 : // ANML.g:592:12: o= Equal Skip { o=(ANMLToken)match(input,Equal,FOLLOW_Equal_in_stmt_chain_13324); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Equal.add(o); Skip176=(ANMLToken)match(input,Skip,FOLLOW_Skip_in_stmt_chain_13326); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Skip.add(Skip176); } break; case 2 : // ANML.g:592:27: o= Skip { o=(ANMLToken)match(input,Skip,FOLLOW_Skip_in_stmt_chain_13332); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Skip.add(o); } break; } // AST REWRITE // elements: Skip // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 593:3: -> Skip { adaptor.addChild(root_0, stream_Skip.nextNode()); } retval.tree = root_0;} } break; case 10 : // ANML.g:594:7: ( Comma )? (o= Assign Undefined | o= Undefine ) { // ANML.g:594:7: ( Comma )? int alt64=2; int LA64_0 = input.LA(1); if ( (LA64_0==Comma) ) { alt64=1; } switch (alt64) { case 1 : // ANML.g:594:7: Comma { Comma177=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_chain_13347); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma177); } break; } // ANML.g:594:14: (o= Assign Undefined | o= Undefine ) int alt65=2; int LA65_0 = input.LA(1); if ( (LA65_0==Assign) ) { alt65=1; } else if ( (LA65_0==Undefine) ) { alt65=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 65, 0, input); throw nvae; } switch (alt65) { case 1 : // ANML.g:594:15: o= Assign Undefined { o=(ANMLToken)match(input,Assign,FOLLOW_Assign_in_stmt_chain_13353); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Assign.add(o); Undefined178=(ANMLToken)match(input,Undefined,FOLLOW_Undefined_in_stmt_chain_13355); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Undefined.add(Undefined178); } break; case 2 : // ANML.g:594:36: o= Undefine { o=(ANMLToken)match(input,Undefine,FOLLOW_Undefine_in_stmt_chain_13361); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Undefine.add(o); } break; } // AST REWRITE // elements: Undefine // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 595:6: -> Undefine { adaptor.addChild(root_0, stream_Undefine.nextNode()); } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_chain_1" public static class stmt_delta_chain_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_delta_chain" // ANML.g:598:1: stmt_delta_chain : ( Delta ref (e+= stmt_delta_chain_1 )+ -> ^( Chain ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) ^( Delta ref ) ( $e)+ ) | ( interval ref ( stmt_delta_chain_1 )+ )=> interval ref (e+= stmt_delta_chain_1 )+ -> ^( Chain interval ^( Delta ref ) ( $e)+ ) ); public final ANMLParser.stmt_delta_chain_return stmt_delta_chain() throws RecognitionException { ANMLParser.stmt_delta_chain_return retval = new ANMLParser.stmt_delta_chain_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Delta179=null; List list_e=null; ANMLParser.ref_return ref180 = null; ANMLParser.interval_return interval181 = null; ANMLParser.ref_return ref182 = null; RuleReturnScope e = null; ANMLToken Delta179_tree=null; RewriteRuleTokenStream stream_Delta=new RewriteRuleTokenStream(adaptor,"token Delta"); RewriteRuleSubtreeStream stream_ref=new RewriteRuleSubtreeStream(adaptor,"rule ref"); RewriteRuleSubtreeStream stream_interval=new RewriteRuleSubtreeStream(adaptor,"rule interval"); RewriteRuleSubtreeStream stream_stmt_delta_chain_1=new RewriteRuleSubtreeStream(adaptor,"rule stmt_delta_chain_1"); try { // ANML.g:599:2: ( Delta ref (e+= stmt_delta_chain_1 )+ -> ^( Chain ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) ^( Delta ref ) ( $e)+ ) | ( interval ref ( stmt_delta_chain_1 )+ )=> interval ref (e+= stmt_delta_chain_1 )+ -> ^( Chain interval ^( Delta ref ) ( $e)+ ) ) int alt69=2; int LA69_0 = input.LA(1); if ( (LA69_0==Delta) ) { alt69=1; } else if ( (LA69_0==LeftB) && (synpred13_ANML())) { alt69=2; } else if ( (LA69_0==LeftP) && (synpred13_ANML())) { alt69=2; } else if ( (LA69_0==Dots) && (synpred13_ANML())) { alt69=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 69, 0, input); throw nvae; } switch (alt69) { case 1 : // ANML.g:599:4: Delta ref (e+= stmt_delta_chain_1 )+ { Delta179=(ANMLToken)match(input,Delta,FOLLOW_Delta_in_stmt_delta_chain3383); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Delta.add(Delta179); pushFollow(FOLLOW_ref_in_stmt_delta_chain3385); ref180=ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ref.add(ref180.getTree()); // ANML.g:599:15: (e+= stmt_delta_chain_1 )+ int cnt67=0; loop67: do { int alt67=2; int LA67_0 = input.LA(1); if ( (LA67_0==Assign||LA67_0==Comma||LA67_0==Undefine||LA67_0==Equal||LA67_0==Change||(LA67_0>=SetAssign && LA67_0<=Skip)) ) { alt67=1; } switch (alt67) { case 1 : // ANML.g:599:15: e+= stmt_delta_chain_1 { pushFollow(FOLLOW_stmt_delta_chain_1_in_stmt_delta_chain3389); e=stmt_delta_chain_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt_delta_chain_1.add(e.getTree()); if (list_e==null) list_e=new ArrayList(); list_e.add(e.getTree()); } break; default : if ( cnt67 >= 1 ) break loop67; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee = new EarlyExitException(67, input); throw eee; } cnt67++; } while (true); // AST REWRITE // elements: e, Delta, ref // token labels: // rule labels: retval // token list labels: // rule list labels: e if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",list_e); root_0 = (ANMLToken)adaptor.nil(); // 600:5: -> ^( Chain ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) ^( Delta ref ) ( $e)+ ) { // ANML.g:600:8: ^( Chain ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) ^( Delta ref ) ( $e)+ ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Chain, "Chain"), root_1); // ANML.g:600:16: ^( DefiniteInterval ^( TBra Bra ) ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ^( TKet Ket ) ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefiniteInterval, "DefiniteInterval"), root_2); // ANML.g:600:35: ^( TBra Bra ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TBra, "TBra"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Bra, "Bra")); adaptor.addChild(root_2, root_3); } // ANML.g:600:47: ^( TStart Start ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Start, "Start")); adaptor.addChild(root_2, root_3); } // ANML.g:600:63: ^( TDuration Duration ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TDuration, "TDuration"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Duration, "Duration")); adaptor.addChild(root_2, root_3); } // ANML.g:600:85: ^( TEnd End ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TEnd, "TEnd"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(End, "End")); adaptor.addChild(root_2, root_3); } // ANML.g:600:97: ^( TKet Ket ) { ANMLToken root_3 = (ANMLToken)adaptor.nil(); root_3 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TKet, "TKet"), root_3); adaptor.addChild(root_3, (ANMLToken)adaptor.create(Ket, "Ket")); adaptor.addChild(root_2, root_3); } adaptor.addChild(root_1, root_2); } // ANML.g:600:110: ^( Delta ref ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot(stream_Delta.nextNode(), root_2); adaptor.addChild(root_2, stream_ref.nextTree()); adaptor.addChild(root_1, root_2); } if ( !(stream_e.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_e.hasNext() ) { adaptor.addChild(root_1, stream_e.nextTree()); } stream_e.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:601:4: ( interval ref ( stmt_delta_chain_1 )+ )=> interval ref (e+= stmt_delta_chain_1 )+ { pushFollow(FOLLOW_interval_in_stmt_delta_chain3461); interval181=interval(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_interval.add(interval181.getTree()); pushFollow(FOLLOW_ref_in_stmt_delta_chain3463); ref182=ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ref.add(ref182.getTree()); // ANML.g:601:55: (e+= stmt_delta_chain_1 )+ int cnt68=0; loop68: do { int alt68=2; int LA68_0 = input.LA(1); if ( (LA68_0==Assign||LA68_0==Comma||LA68_0==Undefine||LA68_0==Equal||LA68_0==Change||(LA68_0>=SetAssign && LA68_0<=Skip)) ) { alt68=1; } switch (alt68) { case 1 : // ANML.g:601:55: e+= stmt_delta_chain_1 { pushFollow(FOLLOW_stmt_delta_chain_1_in_stmt_delta_chain3467); e=stmt_delta_chain_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_stmt_delta_chain_1.add(e.getTree()); if (list_e==null) list_e=new ArrayList(); list_e.add(e.getTree()); } break; default : if ( cnt68 >= 1 ) break loop68; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee = new EarlyExitException(68, input); throw eee; } cnt68++; } while (true); // AST REWRITE // elements: interval, e, ref // token labels: // rule labels: retval // token list labels: // rule list labels: e if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",list_e); root_0 = (ANMLToken)adaptor.nil(); // 602:3: -> ^( Chain interval ^( Delta ref ) ( $e)+ ) { // ANML.g:602:6: ^( Chain interval ^( Delta ref ) ( $e)+ ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Chain, "Chain"), root_1); adaptor.addChild(root_1, stream_interval.nextTree()); // ANML.g:602:23: ^( Delta ref ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Delta, "Delta"), root_2); adaptor.addChild(root_2, stream_ref.nextTree()); adaptor.addChild(root_1, root_2); } if ( !(stream_e.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_e.hasNext() ) { adaptor.addChild(root_1, stream_e.nextTree()); } stream_e.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_delta_chain" public static class stmt_delta_chain_1_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_delta_chain_1" // ANML.g:606:1: stmt_delta_chain_1 : ( ( Comma )? Assign b= e_num | ( Comma )? o= Change b= e_num -> Undefine ^( Assign $b) | ( Comma )? SetAssign s= set | ( Comma )? (o= Equal Skip | o= Skip ) -> Skip | ( Comma )? (o= Assign Undefined | o= Undefine ) -> Undefine ); public final ANMLParser.stmt_delta_chain_1_return stmt_delta_chain_1() throws RecognitionException { ANMLParser.stmt_delta_chain_1_return retval = new ANMLParser.stmt_delta_chain_1_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken o=null; ANMLToken Comma183=null; ANMLToken Assign184=null; ANMLToken Comma185=null; ANMLToken Comma186=null; ANMLToken SetAssign187=null; ANMLToken Comma188=null; ANMLToken Skip189=null; ANMLToken Comma190=null; ANMLToken Undefined191=null; ANMLParser.e_num_return b = null; ANMLParser.set_return s = null; ANMLToken o_tree=null; ANMLToken Comma183_tree=null; ANMLToken Assign184_tree=null; ANMLToken Comma185_tree=null; ANMLToken Comma186_tree=null; ANMLToken SetAssign187_tree=null; ANMLToken Comma188_tree=null; ANMLToken Skip189_tree=null; ANMLToken Comma190_tree=null; ANMLToken Undefined191_tree=null; RewriteRuleTokenStream stream_Skip=new RewriteRuleTokenStream(adaptor,"token Skip"); RewriteRuleTokenStream stream_Assign=new RewriteRuleTokenStream(adaptor,"token Assign"); RewriteRuleTokenStream stream_Undefine=new RewriteRuleTokenStream(adaptor,"token Undefine"); RewriteRuleTokenStream stream_Change=new RewriteRuleTokenStream(adaptor,"token Change"); RewriteRuleTokenStream stream_Equal=new RewriteRuleTokenStream(adaptor,"token Equal"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleTokenStream stream_Undefined=new RewriteRuleTokenStream(adaptor,"token Undefined"); RewriteRuleSubtreeStream stream_e_num=new RewriteRuleSubtreeStream(adaptor,"rule e_num"); try { // ANML.g:607:5: ( ( Comma )? Assign b= e_num | ( Comma )? o= Change b= e_num -> Undefine ^( Assign $b) | ( Comma )? SetAssign s= set | ( Comma )? (o= Equal Skip | o= Skip ) -> Skip | ( Comma )? (o= Assign Undefined | o= Undefine ) -> Undefine ) int alt77=5; switch ( input.LA(1) ) { case Comma: { switch ( input.LA(2) ) { case SetAssign: { alt77=3; } break; case Assign: { int LA77_2 = input.LA(3); if ( (LA77_2==Undefined) ) { alt77=5; } else if ( ((LA77_2>=Bra && LA77_2<=Ket)||LA77_2==ID||LA77_2==LeftP||LA77_2==NotBit||(LA77_2>=LeftB && LA77_2<=Duration)||LA77_2==Contains||(LA77_2>=ForAll && LA77_2<=Exists)||LA77_2==Dots||LA77_2==Minus||(LA77_2>=Unordered && LA77_2<=Ordered)||(LA77_2>=Start && LA77_2<=Infinity)) ) { alt77=1; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 77, 2, input); throw nvae; } } break; case Undefine: { alt77=5; } break; case Equal: case Skip: { alt77=4; } break; case Change: { alt77=2; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 77, 1, input); throw nvae; } } break; case Assign: { int LA77_2 = input.LA(2); if ( (LA77_2==Undefined) ) { alt77=5; } else if ( ((LA77_2>=Bra && LA77_2<=Ket)||LA77_2==ID||LA77_2==LeftP||LA77_2==NotBit||(LA77_2>=LeftB && LA77_2<=Duration)||LA77_2==Contains||(LA77_2>=ForAll && LA77_2<=Exists)||LA77_2==Dots||LA77_2==Minus||(LA77_2>=Unordered && LA77_2<=Ordered)||(LA77_2>=Start && LA77_2<=Infinity)) ) { alt77=1; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 77, 2, input); throw nvae; } } break; case Change: { alt77=2; } break; case SetAssign: { alt77=3; } break; case Equal: case Skip: { alt77=4; } break; case Undefine: { alt77=5; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 77, 0, input); throw nvae; } switch (alt77) { case 1 : // ANML.g:607:7: ( Comma )? Assign b= e_num { root_0 = (ANMLToken)adaptor.nil(); // ANML.g:607:7: ( Comma )? int alt70=2; int LA70_0 = input.LA(1); if ( (LA70_0==Comma) ) { alt70=1; } switch (alt70) { case 1 : // ANML.g:607:7: Comma { Comma183=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_delta_chain_13502); if (state.failed) return retval; if ( state.backtracking==0 ) { Comma183_tree = (ANMLToken)adaptor.create(Comma183); adaptor.addChild(root_0, Comma183_tree); } } break; } Assign184=(ANMLToken)match(input,Assign,FOLLOW_Assign_in_stmt_delta_chain_13505); if (state.failed) return retval; if ( state.backtracking==0 ) { Assign184_tree = (ANMLToken)adaptor.create(Assign184); root_0 = (ANMLToken)adaptor.becomeRoot(Assign184_tree, root_0); } pushFollow(FOLLOW_e_num_in_stmt_delta_chain_13510); b=e_num(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, b.getTree()); } break; case 2 : // ANML.g:608:7: ( Comma )? o= Change b= e_num { // ANML.g:608:7: ( Comma )? int alt71=2; int LA71_0 = input.LA(1); if ( (LA71_0==Comma) ) { alt71=1; } switch (alt71) { case 1 : // ANML.g:608:7: Comma { Comma185=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_delta_chain_13518); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma185); } break; } o=(ANMLToken)match(input,Change,FOLLOW_Change_in_stmt_delta_chain_13523); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Change.add(o); pushFollow(FOLLOW_e_num_in_stmt_delta_chain_13527); b=e_num(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_e_num.add(b.getTree()); // AST REWRITE // elements: b // token labels: // rule labels: retval, b // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_b=new RewriteRuleSubtreeStream(adaptor,"token b",b!=null?b.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 609:6: -> Undefine ^( Assign $b) { adaptor.addChild(root_0, (ANMLToken)adaptor.create(Undefine, "Undefine")); // ANML.g:610:7: ^( Assign $b) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Assign, "Assign"), root_1); adaptor.addChild(root_1, stream_b.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:611:7: ( Comma )? SetAssign s= set { root_0 = (ANMLToken)adaptor.nil(); // ANML.g:611:7: ( Comma )? int alt72=2; int LA72_0 = input.LA(1); if ( (LA72_0==Comma) ) { alt72=1; } switch (alt72) { case 1 : // ANML.g:611:7: Comma { Comma186=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_delta_chain_13557); if (state.failed) return retval; if ( state.backtracking==0 ) { Comma186_tree = (ANMLToken)adaptor.create(Comma186); adaptor.addChild(root_0, Comma186_tree); } } break; } SetAssign187=(ANMLToken)match(input,SetAssign,FOLLOW_SetAssign_in_stmt_delta_chain_13560); if (state.failed) return retval; if ( state.backtracking==0 ) { SetAssign187_tree = (ANMLToken)adaptor.create(SetAssign187); root_0 = (ANMLToken)adaptor.becomeRoot(SetAssign187_tree, root_0); } pushFollow(FOLLOW_set_in_stmt_delta_chain_13565); s=set(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, s.getTree()); } break; case 4 : // ANML.g:612:4: ( Comma )? (o= Equal Skip | o= Skip ) { // ANML.g:612:4: ( Comma )? int alt73=2; int LA73_0 = input.LA(1); if ( (LA73_0==Comma) ) { alt73=1; } switch (alt73) { case 1 : // ANML.g:612:4: Comma { Comma188=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_delta_chain_13570); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma188); } break; } // ANML.g:612:11: (o= Equal Skip | o= Skip ) int alt74=2; int LA74_0 = input.LA(1); if ( (LA74_0==Equal) ) { alt74=1; } else if ( (LA74_0==Skip) ) { alt74=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 74, 0, input); throw nvae; } switch (alt74) { case 1 : // ANML.g:612:12: o= Equal Skip { o=(ANMLToken)match(input,Equal,FOLLOW_Equal_in_stmt_delta_chain_13576); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Equal.add(o); Skip189=(ANMLToken)match(input,Skip,FOLLOW_Skip_in_stmt_delta_chain_13578); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Skip.add(Skip189); } break; case 2 : // ANML.g:612:27: o= Skip { o=(ANMLToken)match(input,Skip,FOLLOW_Skip_in_stmt_delta_chain_13584); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Skip.add(o); } break; } // AST REWRITE // elements: Skip // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 613:3: -> Skip { adaptor.addChild(root_0, stream_Skip.nextNode()); } retval.tree = root_0;} } break; case 5 : // ANML.g:614:7: ( Comma )? (o= Assign Undefined | o= Undefine ) { // ANML.g:614:7: ( Comma )? int alt75=2; int LA75_0 = input.LA(1); if ( (LA75_0==Comma) ) { alt75=1; } switch (alt75) { case 1 : // ANML.g:614:7: Comma { Comma190=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_stmt_delta_chain_13599); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma190); } break; } // ANML.g:614:14: (o= Assign Undefined | o= Undefine ) int alt76=2; int LA76_0 = input.LA(1); if ( (LA76_0==Assign) ) { alt76=1; } else if ( (LA76_0==Undefine) ) { alt76=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 76, 0, input); throw nvae; } switch (alt76) { case 1 : // ANML.g:614:15: o= Assign Undefined { o=(ANMLToken)match(input,Assign,FOLLOW_Assign_in_stmt_delta_chain_13605); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Assign.add(o); Undefined191=(ANMLToken)match(input,Undefined,FOLLOW_Undefined_in_stmt_delta_chain_13607); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Undefined.add(Undefined191); } break; case 2 : // ANML.g:614:36: o= Undefine { o=(ANMLToken)match(input,Undefine,FOLLOW_Undefine_in_stmt_delta_chain_13613); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Undefine.add(o); } break; } // AST REWRITE // elements: Undefine // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 615:6: -> Undefine { adaptor.addChild(root_0, stream_Undefine.nextNode()); } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_delta_chain_1" public static class stmt_timeless_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "stmt_timeless" // ANML.g:618:1: stmt_timeless : time_primitive Assign expr ; public final ANMLParser.stmt_timeless_return stmt_timeless() throws RecognitionException { ANMLParser.stmt_timeless_return retval = new ANMLParser.stmt_timeless_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Assign193=null; ANMLParser.time_primitive_return time_primitive192 = null; ANMLParser.expr_return expr194 = null; ANMLToken Assign193_tree=null; try { // ANML.g:619:2: ( time_primitive Assign expr ) // ANML.g:619:4: time_primitive Assign expr { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_time_primitive_in_stmt_timeless3634); time_primitive192=time_primitive(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, time_primitive192.getTree()); Assign193=(ANMLToken)match(input,Assign,FOLLOW_Assign_in_stmt_timeless3636); if (state.failed) return retval; if ( state.backtracking==0 ) { Assign193_tree = (ANMLToken)adaptor.create(Assign193); root_0 = (ANMLToken)adaptor.becomeRoot(Assign193_tree, root_0); } pushFollow(FOLLOW_expr_in_stmt_timeless3639); expr194=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, expr194.getTree()); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "stmt_timeless" public static class guard_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "guard" // ANML.g:622:1: guard : expr ; public final ANMLParser.guard_return guard() throws RecognitionException { ANMLParser.guard_return retval = new ANMLParser.guard_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLParser.expr_return expr195 = null; try { // ANML.g:624:2: ( expr ) // ANML.g:624:4: expr { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_expr_in_guard3652); expr195=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, expr195.getTree()); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "guard" public static class interval_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "interval" // ANML.g:628:1: interval : ( ( univ_time )=> univ_time | ( exist_time )=> exist_time ); public final ANMLParser.interval_return interval() throws RecognitionException { ANMLParser.interval_return retval = new ANMLParser.interval_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLParser.univ_time_return univ_time196 = null; ANMLParser.exist_time_return exist_time197 = null; try { // ANML.g:629:2: ( ( univ_time )=> univ_time | ( exist_time )=> exist_time ) int alt78=2; int LA78_0 = input.LA(1); if ( (LA78_0==LeftB) ) { int LA78_1 = input.LA(2); if ( (synpred14_ANML()) ) { alt78=1; } else if ( (synpred15_ANML()) ) { alt78=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 78, 1, input); throw nvae; } } else if ( (LA78_0==LeftP) ) { int LA78_2 = input.LA(2); if ( (synpred14_ANML()) ) { alt78=1; } else if ( (synpred15_ANML()) ) { alt78=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 78, 2, input); throw nvae; } } else if ( (LA78_0==Dots) && (synpred15_ANML())) { alt78=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 78, 0, input); throw nvae; } switch (alt78) { case 1 : // ANML.g:629:4: ( univ_time )=> univ_time { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_univ_time_in_interval3667); univ_time196=univ_time(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, univ_time196.getTree()); } break; case 2 : // ANML.g:630:4: ( exist_time )=> exist_time { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_exist_time_in_interval3676); exist_time197=exist_time(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, exist_time197.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "interval" public static class univ_time_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "univ_time" // ANML.g:637:1: univ_time : ( ( bra All ket )=> bra All ket -> ^( DefiniteInterval bra ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ket ) | ( LeftB expr RightB )=> LeftB e= expr RightB -> ^( DefinitePoint ^( TStart $e) ) | bra (d= delta_time Comma e= expr ket -> ^( DefiniteInterval bra ^( TDuration $d) ^( TEnd $e) ket ) | e= expr Comma (d= delta_time ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TDuration $d) ket ) | f= expr ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TEnd $f) ket ) ) ) ); public final ANMLParser.univ_time_return univ_time() throws RecognitionException { ANMLParser.univ_time_return retval = new ANMLParser.univ_time_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken All199=null; ANMLToken LeftB201=null; ANMLToken RightB202=null; ANMLToken Comma204=null; ANMLToken Comma206=null; ANMLParser.expr_return e = null; ANMLParser.delta_time_return d = null; ANMLParser.expr_return f = null; ANMLParser.bra_return bra198 = null; ANMLParser.ket_return ket200 = null; ANMLParser.bra_return bra203 = null; ANMLParser.ket_return ket205 = null; ANMLParser.ket_return ket207 = null; ANMLParser.ket_return ket208 = null; ANMLToken All199_tree=null; ANMLToken LeftB201_tree=null; ANMLToken RightB202_tree=null; ANMLToken Comma204_tree=null; ANMLToken Comma206_tree=null; RewriteRuleTokenStream stream_RightB=new RewriteRuleTokenStream(adaptor,"token RightB"); RewriteRuleTokenStream stream_LeftB=new RewriteRuleTokenStream(adaptor,"token LeftB"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleTokenStream stream_All=new RewriteRuleTokenStream(adaptor,"token All"); RewriteRuleSubtreeStream stream_delta_time=new RewriteRuleSubtreeStream(adaptor,"rule delta_time"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); RewriteRuleSubtreeStream stream_bra=new RewriteRuleSubtreeStream(adaptor,"rule bra"); RewriteRuleSubtreeStream stream_ket=new RewriteRuleSubtreeStream(adaptor,"rule ket"); try { // ANML.g:639:2: ( ( bra All ket )=> bra All ket -> ^( DefiniteInterval bra ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ket ) | ( LeftB expr RightB )=> LeftB e= expr RightB -> ^( DefinitePoint ^( TStart $e) ) | bra (d= delta_time Comma e= expr ket -> ^( DefiniteInterval bra ^( TDuration $d) ^( TEnd $e) ket ) | e= expr Comma (d= delta_time ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TDuration $d) ket ) | f= expr ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TEnd $f) ket ) ) ) ) int alt81=3; int LA81_0 = input.LA(1); if ( (LA81_0==LeftB) ) { int LA81_1 = input.LA(2); if ( (synpred16_ANML()) ) { alt81=1; } else if ( (synpred17_ANML()) ) { alt81=2; } else if ( (true) ) { alt81=3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 81, 1, input); throw nvae; } } else if ( (LA81_0==LeftP) ) { int LA81_2 = input.LA(2); if ( (synpred16_ANML()) ) { alt81=1; } else if ( (true) ) { alt81=3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 81, 2, input); throw nvae; } } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 81, 0, input); throw nvae; } switch (alt81) { case 1 : // ANML.g:639:4: ( bra All ket )=> bra All ket { pushFollow(FOLLOW_bra_in_univ_time3702); bra198=bra(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_bra.add(bra198.getTree()); All199=(ANMLToken)match(input,All,FOLLOW_All_in_univ_time3704); if (state.failed) return retval; if ( state.backtracking==0 ) stream_All.add(All199); pushFollow(FOLLOW_ket_in_univ_time3706); ket200=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket200.getTree()); // AST REWRITE // elements: bra, ket // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 640:6: -> ^( DefiniteInterval bra ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ket ) { // ANML.g:640:9: ^( DefiniteInterval bra ^( TStart Start ) ^( TDuration Duration ) ^( TEnd End ) ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefiniteInterval, "DefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); // ANML.g:640:32: ^( TStart Start ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_2); adaptor.addChild(root_2, (ANMLToken)adaptor.create(Start, "Start")); adaptor.addChild(root_1, root_2); } // ANML.g:640:48: ^( TDuration Duration ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TDuration, "TDuration"), root_2); adaptor.addChild(root_2, (ANMLToken)adaptor.create(Duration, "Duration")); adaptor.addChild(root_1, root_2); } // ANML.g:640:70: ^( TEnd End ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TEnd, "TEnd"), root_2); adaptor.addChild(root_2, (ANMLToken)adaptor.create(End, "End")); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:641:4: ( LeftB expr RightB )=> LeftB e= expr RightB { LeftB201=(ANMLToken)match(input,LeftB,FOLLOW_LeftB_in_univ_time3754); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftB.add(LeftB201); pushFollow(FOLLOW_expr_in_univ_time3758); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); RightB202=(ANMLToken)match(input,RightB,FOLLOW_RightB_in_univ_time3760); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightB.add(RightB202); // AST REWRITE // elements: e // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 642:4: -> ^( DefinitePoint ^( TStart $e) ) { // ANML.g:642:7: ^( DefinitePoint ^( TStart $e) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefinitePoint, "DefinitePoint"), root_1); // ANML.g:642:23: ^( TStart $e) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_2); adaptor.addChild(root_2, stream_e.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:643:4: bra (d= delta_time Comma e= expr ket -> ^( DefiniteInterval bra ^( TDuration $d) ^( TEnd $e) ket ) | e= expr Comma (d= delta_time ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TDuration $d) ket ) | f= expr ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TEnd $f) ket ) ) ) { pushFollow(FOLLOW_bra_in_univ_time3782); bra203=bra(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_bra.add(bra203.getTree()); // ANML.g:644:4: (d= delta_time Comma e= expr ket -> ^( DefiniteInterval bra ^( TDuration $d) ^( TEnd $e) ket ) | e= expr Comma (d= delta_time ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TDuration $d) ket ) | f= expr ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TEnd $f) ket ) ) ) int alt80=2; int LA80_0 = input.LA(1); if ( (LA80_0==Delta) ) { alt80=1; } else if ( ((LA80_0>=Bra && LA80_0<=Ket)||LA80_0==ID||LA80_0==LeftP||(LA80_0>=NotLog && LA80_0<=NotBit)||(LA80_0>=LeftB && LA80_0<=Duration)||LA80_0==Contains||(LA80_0>=ForAll && LA80_0<=Exists)||LA80_0==Dots||LA80_0==Minus||(LA80_0>=Unordered && LA80_0<=Ordered)||(LA80_0>=Start && LA80_0<=Infinity)) ) { alt80=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 80, 0, input); throw nvae; } switch (alt80) { case 1 : // ANML.g:644:6: d= delta_time Comma e= expr ket { pushFollow(FOLLOW_delta_time_in_univ_time3792); d=delta_time(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_delta_time.add(d.getTree()); Comma204=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_univ_time3794); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma204); pushFollow(FOLLOW_expr_in_univ_time3798); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); pushFollow(FOLLOW_ket_in_univ_time3800); ket205=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket205.getTree()); // AST REWRITE // elements: d, ket, bra, e // token labels: // rule labels: retval, d, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_d=new RewriteRuleSubtreeStream(adaptor,"token d",d!=null?d.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 645:3: -> ^( DefiniteInterval bra ^( TDuration $d) ^( TEnd $e) ket ) { // ANML.g:645:6: ^( DefiniteInterval bra ^( TDuration $d) ^( TEnd $e) ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefiniteInterval, "DefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); // ANML.g:645:29: ^( TDuration $d) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TDuration, "TDuration"), root_2); adaptor.addChild(root_2, stream_d.nextTree()); adaptor.addChild(root_1, root_2); } // ANML.g:645:45: ^( TEnd $e) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TEnd, "TEnd"), root_2); adaptor.addChild(root_2, stream_e.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:646:6: e= expr Comma (d= delta_time ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TDuration $d) ket ) | f= expr ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TEnd $f) ket ) ) { pushFollow(FOLLOW_expr_in_univ_time3835); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); Comma206=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_univ_time3837); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma206); // ANML.g:647:3: (d= delta_time ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TDuration $d) ket ) | f= expr ket -> ^( DefiniteInterval bra ^( TStart $e) ^( TEnd $f) ket ) ) int alt79=2; int LA79_0 = input.LA(1); if ( (LA79_0==Delta) ) { alt79=1; } else if ( ((LA79_0>=Bra && LA79_0<=Ket)||LA79_0==ID||LA79_0==LeftP||(LA79_0>=NotLog && LA79_0<=NotBit)||(LA79_0>=LeftB && LA79_0<=Duration)||LA79_0==Contains||(LA79_0>=ForAll && LA79_0<=Exists)||LA79_0==Dots||LA79_0==Minus||(LA79_0>=Unordered && LA79_0<=Ordered)||(LA79_0>=Start && LA79_0<=Infinity)) ) { alt79=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 79, 0, input); throw nvae; } switch (alt79) { case 1 : // ANML.g:647:5: d= delta_time ket { pushFollow(FOLLOW_delta_time_in_univ_time3846); d=delta_time(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_delta_time.add(d.getTree()); pushFollow(FOLLOW_ket_in_univ_time3848); ket207=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket207.getTree()); // AST REWRITE // elements: ket, d, e, bra // token labels: // rule labels: retval, d, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_d=new RewriteRuleSubtreeStream(adaptor,"token d",d!=null?d.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 648:5: -> ^( DefiniteInterval bra ^( TStart $e) ^( TDuration $d) ket ) { // ANML.g:648:8: ^( DefiniteInterval bra ^( TStart $e) ^( TDuration $d) ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefiniteInterval, "DefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); // ANML.g:648:31: ^( TStart $e) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_2); adaptor.addChild(root_2, stream_e.nextTree()); adaptor.addChild(root_1, root_2); } // ANML.g:648:44: ^( TDuration $d) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TDuration, "TDuration"), root_2); adaptor.addChild(root_2, stream_d.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:649:5: f= expr ket { pushFollow(FOLLOW_expr_in_univ_time3884); f=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(f.getTree()); pushFollow(FOLLOW_ket_in_univ_time3886); ket208=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket208.getTree()); // AST REWRITE // elements: f, e, ket, bra // token labels: // rule labels: f, retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_f=new RewriteRuleSubtreeStream(adaptor,"token f",f!=null?f.tree:null); RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 650:5: -> ^( DefiniteInterval bra ^( TStart $e) ^( TEnd $f) ket ) { // ANML.g:650:8: ^( DefiniteInterval bra ^( TStart $e) ^( TEnd $f) ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(DefiniteInterval, "DefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); // ANML.g:650:31: ^( TStart $e) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_2); adaptor.addChild(root_2, stream_e.nextTree()); adaptor.addChild(root_1, root_2); } // ANML.g:650:44: ^( TEnd $f) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TEnd, "TEnd"), root_2); adaptor.addChild(root_2, stream_f.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } } break; } } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "univ_time" public static class exist_time_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "exist_time" // ANML.g:655:1: exist_time : ( ( LeftB Skip RightB )=> LeftB Skip RightB -> ^( IndefinitePoint ) | ( bra expr rLimit )=> bra e= expr rLimit -> ^( IndefiniteInterval bra ^( TStart $e) rLimit ) | ( lLimit expr ket )=> lLimit e= expr ket -> ^( IndefiniteInterval lLimit ^( TEnd $e) ket ) | bra ( ( Delta )=>d= delta_time Comma ( Skip )? ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip Comma ( ( Delta )=>d= delta_time ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip ket -> ^( IndefiniteInterval bra ket ) | e= expr ket -> ^( IndefiniteInterval bra ^( TEnd $e) ket ) ) | e= expr Comma Skip ket -> ^( IndefiniteInterval bra ^( TStart $e) ket ) ) ); public final ANMLParser.exist_time_return exist_time() throws RecognitionException { ANMLParser.exist_time_return retval = new ANMLParser.exist_time_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftB209=null; ANMLToken Skip210=null; ANMLToken RightB211=null; ANMLToken Comma217=null; ANMLToken Skip218=null; ANMLToken Skip220=null; ANMLToken Comma221=null; ANMLToken Skip223=null; ANMLToken Comma226=null; ANMLToken Skip227=null; ANMLParser.expr_return e = null; ANMLParser.delta_time_return d = null; ANMLParser.bra_return bra212 = null; ANMLParser.rLimit_return rLimit213 = null; ANMLParser.lLimit_return lLimit214 = null; ANMLParser.ket_return ket215 = null; ANMLParser.bra_return bra216 = null; ANMLParser.ket_return ket219 = null; ANMLParser.ket_return ket222 = null; ANMLParser.ket_return ket224 = null; ANMLParser.ket_return ket225 = null; ANMLParser.ket_return ket228 = null; ANMLToken LeftB209_tree=null; ANMLToken Skip210_tree=null; ANMLToken RightB211_tree=null; ANMLToken Comma217_tree=null; ANMLToken Skip218_tree=null; ANMLToken Skip220_tree=null; ANMLToken Comma221_tree=null; ANMLToken Skip223_tree=null; ANMLToken Comma226_tree=null; ANMLToken Skip227_tree=null; RewriteRuleTokenStream stream_Skip=new RewriteRuleTokenStream(adaptor,"token Skip"); RewriteRuleTokenStream stream_RightB=new RewriteRuleTokenStream(adaptor,"token RightB"); RewriteRuleTokenStream stream_LeftB=new RewriteRuleTokenStream(adaptor,"token LeftB"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleSubtreeStream stream_rLimit=new RewriteRuleSubtreeStream(adaptor,"rule rLimit"); RewriteRuleSubtreeStream stream_delta_time=new RewriteRuleSubtreeStream(adaptor,"rule delta_time"); RewriteRuleSubtreeStream stream_bra=new RewriteRuleSubtreeStream(adaptor,"rule bra"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); RewriteRuleSubtreeStream stream_ket=new RewriteRuleSubtreeStream(adaptor,"rule ket"); RewriteRuleSubtreeStream stream_lLimit=new RewriteRuleSubtreeStream(adaptor,"rule lLimit"); try { // ANML.g:657:2: ( ( LeftB Skip RightB )=> LeftB Skip RightB -> ^( IndefinitePoint ) | ( bra expr rLimit )=> bra e= expr rLimit -> ^( IndefiniteInterval bra ^( TStart $e) rLimit ) | ( lLimit expr ket )=> lLimit e= expr ket -> ^( IndefiniteInterval lLimit ^( TEnd $e) ket ) | bra ( ( Delta )=>d= delta_time Comma ( Skip )? ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip Comma ( ( Delta )=>d= delta_time ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip ket -> ^( IndefiniteInterval bra ket ) | e= expr ket -> ^( IndefiniteInterval bra ^( TEnd $e) ket ) ) | e= expr Comma Skip ket -> ^( IndefiniteInterval bra ^( TStart $e) ket ) ) ) int alt85=4; int LA85_0 = input.LA(1); if ( (LA85_0==LeftB) ) { int LA85_1 = input.LA(2); if ( (synpred18_ANML()) ) { alt85=1; } else if ( (synpred19_ANML()) ) { alt85=2; } else if ( (true) ) { alt85=4; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 85, 1, input); throw nvae; } } else if ( (LA85_0==LeftP) ) { int LA85_2 = input.LA(2); if ( (synpred19_ANML()) ) { alt85=2; } else if ( (true) ) { alt85=4; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 85, 2, input); throw nvae; } } else if ( (LA85_0==Dots) && (synpred20_ANML())) { alt85=3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 85, 0, input); throw nvae; } switch (alt85) { case 1 : // ANML.g:657:4: ( LeftB Skip RightB )=> LeftB Skip RightB { LeftB209=(ANMLToken)match(input,LeftB,FOLLOW_LeftB_in_exist_time3945); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftB.add(LeftB209); Skip210=(ANMLToken)match(input,Skip,FOLLOW_Skip_in_exist_time3947); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Skip.add(Skip210); RightB211=(ANMLToken)match(input,RightB,FOLLOW_RightB_in_exist_time3949); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightB.add(RightB211); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 657:44: -> ^( IndefinitePoint ) { // ANML.g:657:47: ^( IndefinitePoint ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(IndefinitePoint, "IndefinitePoint"), root_1); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:658:4: ( bra expr rLimit )=> bra e= expr rLimit { pushFollow(FOLLOW_bra_in_exist_time3969); bra212=bra(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_bra.add(bra212.getTree()); pushFollow(FOLLOW_expr_in_exist_time3973); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); pushFollow(FOLLOW_rLimit_in_exist_time3975); rLimit213=rLimit(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_rLimit.add(rLimit213.getTree()); // AST REWRITE // elements: bra, rLimit, e // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 658:42: -> ^( IndefiniteInterval bra ^( TStart $e) rLimit ) { // ANML.g:658:45: ^( IndefiniteInterval bra ^( TStart $e) rLimit ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(IndefiniteInterval, "IndefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); // ANML.g:658:70: ^( TStart $e) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_2); adaptor.addChild(root_2, stream_e.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_rLimit.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:659:4: ( lLimit expr ket )=> lLimit e= expr ket { pushFollow(FOLLOW_lLimit_in_exist_time4006); lLimit214=lLimit(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_lLimit.add(lLimit214.getTree()); pushFollow(FOLLOW_expr_in_exist_time4010); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); pushFollow(FOLLOW_ket_in_exist_time4012); ket215=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket215.getTree()); // AST REWRITE // elements: lLimit, e, ket // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 659:42: -> ^( IndefiniteInterval lLimit ^( TEnd $e) ket ) { // ANML.g:659:45: ^( IndefiniteInterval lLimit ^( TEnd $e) ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(IndefiniteInterval, "IndefiniteInterval"), root_1); adaptor.addChild(root_1, stream_lLimit.nextTree()); // ANML.g:659:73: ^( TEnd $e) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TEnd, "TEnd"), root_2); adaptor.addChild(root_2, stream_e.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 4 : // ANML.g:660:4: bra ( ( Delta )=>d= delta_time Comma ( Skip )? ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip Comma ( ( Delta )=>d= delta_time ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip ket -> ^( IndefiniteInterval bra ket ) | e= expr ket -> ^( IndefiniteInterval bra ^( TEnd $e) ket ) ) | e= expr Comma Skip ket -> ^( IndefiniteInterval bra ^( TStart $e) ket ) ) { pushFollow(FOLLOW_bra_in_exist_time4034); bra216=bra(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_bra.add(bra216.getTree()); // ANML.g:661:4: ( ( Delta )=>d= delta_time Comma ( Skip )? ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip Comma ( ( Delta )=>d= delta_time ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip ket -> ^( IndefiniteInterval bra ket ) | e= expr ket -> ^( IndefiniteInterval bra ^( TEnd $e) ket ) ) | e= expr Comma Skip ket -> ^( IndefiniteInterval bra ^( TStart $e) ket ) ) int alt84=3; int LA84_0 = input.LA(1); if ( (LA84_0==Delta) && (synpred21_ANML())) { alt84=1; } else if ( (LA84_0==Skip) && (synpred22_ANML())) { alt84=2; } else if ( ((LA84_0>=Bra && LA84_0<=Ket)||LA84_0==ID||LA84_0==LeftP||(LA84_0>=NotLog && LA84_0<=NotBit)||(LA84_0>=LeftB && LA84_0<=Duration)||LA84_0==Contains||(LA84_0>=ForAll && LA84_0<=Exists)||LA84_0==Dots||LA84_0==Minus||(LA84_0>=Unordered && LA84_0<=Ordered)||(LA84_0>=Start && LA84_0<=Infinity)) ) { alt84=3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 84, 0, input); throw nvae; } switch (alt84) { case 1 : // ANML.g:661:6: ( Delta )=>d= delta_time Comma ( Skip )? ket { pushFollow(FOLLOW_delta_time_in_exist_time4049); d=delta_time(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_delta_time.add(d.getTree()); Comma217=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_exist_time4051); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma217); // ANML.g:661:35: ( Skip )? int alt82=2; int LA82_0 = input.LA(1); if ( (LA82_0==Skip) ) { alt82=1; } switch (alt82) { case 1 : // ANML.g:661:35: Skip { Skip218=(ANMLToken)match(input,Skip,FOLLOW_Skip_in_exist_time4053); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Skip.add(Skip218); } break; } pushFollow(FOLLOW_ket_in_exist_time4056); ket219=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket219.getTree()); // AST REWRITE // elements: ket, d, bra // token labels: // rule labels: retval, d // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_d=new RewriteRuleSubtreeStream(adaptor,"token d",d!=null?d.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 661:45: -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) { // ANML.g:661:48: ^( IndefiniteInterval bra ^( TDuration $d) ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(IndefiniteInterval, "IndefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); // ANML.g:661:73: ^( TDuration $d) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TDuration, "TDuration"), root_2); adaptor.addChild(root_2, stream_d.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:662:6: ( Skip )=> Skip Comma ( ( Delta )=>d= delta_time ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip ket -> ^( IndefiniteInterval bra ket ) | e= expr ket -> ^( IndefiniteInterval bra ^( TEnd $e) ket ) ) { Skip220=(ANMLToken)match(input,Skip,FOLLOW_Skip_in_exist_time4085); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Skip.add(Skip220); Comma221=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_exist_time4087); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma221); // ANML.g:663:5: ( ( Delta )=>d= delta_time ket -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) | ( Skip )=> Skip ket -> ^( IndefiniteInterval bra ket ) | e= expr ket -> ^( IndefiniteInterval bra ^( TEnd $e) ket ) ) int alt83=3; int LA83_0 = input.LA(1); if ( (LA83_0==Delta) && (synpred23_ANML())) { alt83=1; } else if ( (LA83_0==Skip) && (synpred24_ANML())) { alt83=2; } else if ( ((LA83_0>=Bra && LA83_0<=Ket)||LA83_0==ID||LA83_0==LeftP||(LA83_0>=NotLog && LA83_0<=NotBit)||(LA83_0>=LeftB && LA83_0<=Duration)||LA83_0==Contains||(LA83_0>=ForAll && LA83_0<=Exists)||LA83_0==Dots||LA83_0==Minus||(LA83_0>=Unordered && LA83_0<=Ordered)||(LA83_0>=Start && LA83_0<=Infinity)) ) { alt83=3; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 83, 0, input); throw nvae; } switch (alt83) { case 1 : // ANML.g:663:7: ( Delta )=>d= delta_time ket { pushFollow(FOLLOW_delta_time_in_exist_time4103); d=delta_time(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_delta_time.add(d.getTree()); pushFollow(FOLLOW_ket_in_exist_time4105); ket222=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket222.getTree()); // AST REWRITE // elements: d, ket, bra // token labels: // rule labels: retval, d // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_d=new RewriteRuleSubtreeStream(adaptor,"token d",d!=null?d.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 663:34: -> ^( IndefiniteInterval bra ^( TDuration $d) ket ) { // ANML.g:663:37: ^( IndefiniteInterval bra ^( TDuration $d) ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(IndefiniteInterval, "IndefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); // ANML.g:663:62: ^( TDuration $d) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TDuration, "TDuration"), root_2); adaptor.addChild(root_2, stream_d.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:664:5: ( Skip )=> Skip ket { Skip223=(ANMLToken)match(input,Skip,FOLLOW_Skip_in_exist_time4133); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Skip.add(Skip223); pushFollow(FOLLOW_ket_in_exist_time4135); ket224=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket224.getTree()); // AST REWRITE // elements: bra, ket // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 664:23: -> ^( IndefiniteInterval bra ket ) { // ANML.g:664:26: ^( IndefiniteInterval bra ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(IndefiniteInterval, "IndefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:665:5: e= expr ket { pushFollow(FOLLOW_expr_in_exist_time4154); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); pushFollow(FOLLOW_ket_in_exist_time4156); ket225=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket225.getTree()); // AST REWRITE // elements: e, bra, ket // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 665:16: -> ^( IndefiniteInterval bra ^( TEnd $e) ket ) { // ANML.g:665:19: ^( IndefiniteInterval bra ^( TEnd $e) ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(IndefiniteInterval, "IndefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); // ANML.g:665:44: ^( TEnd $e) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TEnd, "TEnd"), root_2); adaptor.addChild(root_2, stream_e.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } } break; case 3 : // ANML.g:667:6: e= expr Comma Skip ket { pushFollow(FOLLOW_expr_in_exist_time4186); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); Comma226=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_exist_time4188); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma226); Skip227=(ANMLToken)match(input,Skip,FOLLOW_Skip_in_exist_time4190); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Skip.add(Skip227); pushFollow(FOLLOW_ket_in_exist_time4192); ket228=ket(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_ket.add(ket228.getTree()); // AST REWRITE // elements: bra, e, ket // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 667:28: -> ^( IndefiniteInterval bra ^( TStart $e) ket ) { // ANML.g:667:31: ^( IndefiniteInterval bra ^( TStart $e) ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(IndefiniteInterval, "IndefiniteInterval"), root_1); adaptor.addChild(root_1, stream_bra.nextTree()); // ANML.g:667:56: ^( TStart $e) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TStart, "TStart"), root_2); adaptor.addChild(root_2, stream_e.nextTree()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_1, stream_ket.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "exist_time" public static class delta_time_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "delta_time" // ANML.g:671:1: delta_time : Delta e_num_1 ; public final ANMLParser.delta_time_return delta_time() throws RecognitionException { ANMLParser.delta_time_return retval = new ANMLParser.delta_time_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Delta229=null; ANMLParser.e_num_1_return e_num_1230 = null; ANMLToken Delta229_tree=null; try { // ANML.g:671:12: ( Delta e_num_1 ) // ANML.g:671:14: Delta e_num_1 { root_0 = (ANMLToken)adaptor.nil(); Delta229=(ANMLToken)match(input,Delta,FOLLOW_Delta_in_delta_time4223); if (state.failed) return retval; pushFollow(FOLLOW_e_num_1_in_delta_time4226); e_num_1230=e_num_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_1230.getTree()); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "delta_time" public static class bra_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "bra" // ANML.g:674:1: bra : ( LeftB -> ^( TBra At[$LeftB,\"At\"] ) | LeftP -> ^( TBra After[$LeftP,\"After\"] ) ); public final ANMLParser.bra_return bra() throws RecognitionException { ANMLParser.bra_return retval = new ANMLParser.bra_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftB231=null; ANMLToken LeftP232=null; ANMLToken LeftB231_tree=null; ANMLToken LeftP232_tree=null; RewriteRuleTokenStream stream_LeftB=new RewriteRuleTokenStream(adaptor,"token LeftB"); RewriteRuleTokenStream stream_LeftP=new RewriteRuleTokenStream(adaptor,"token LeftP"); try { // ANML.g:675:2: ( LeftB -> ^( TBra At[$LeftB,\"At\"] ) | LeftP -> ^( TBra After[$LeftP,\"After\"] ) ) int alt86=2; int LA86_0 = input.LA(1); if ( (LA86_0==LeftB) ) { alt86=1; } else if ( (LA86_0==LeftP) ) { alt86=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 86, 0, input); throw nvae; } switch (alt86) { case 1 : // ANML.g:675:4: LeftB { LeftB231=(ANMLToken)match(input,LeftB,FOLLOW_LeftB_in_bra4238); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftB.add(LeftB231); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 675:10: -> ^( TBra At[$LeftB,\"At\"] ) { // ANML.g:675:13: ^( TBra At[$LeftB,\"At\"] ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TBra, "TBra"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(At, LeftB231, "At")); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:676:4: LeftP { LeftP232=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_bra4253); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftP.add(LeftP232); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 676:10: -> ^( TBra After[$LeftP,\"After\"] ) { // ANML.g:676:13: ^( TBra After[$LeftP,\"After\"] ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TBra, "TBra"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(After, LeftP232, "After")); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "bra" public static class ket_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "ket" // ANML.g:679:1: ket : ( RightB -> ^( TKet At[$RightB,\"At\"] ) | RightP -> ^( TKet Before[$RightP,\"Before\"] ) ); public final ANMLParser.ket_return ket() throws RecognitionException { ANMLParser.ket_return retval = new ANMLParser.ket_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken RightB233=null; ANMLToken RightP234=null; ANMLToken RightB233_tree=null; ANMLToken RightP234_tree=null; RewriteRuleTokenStream stream_RightP=new RewriteRuleTokenStream(adaptor,"token RightP"); RewriteRuleTokenStream stream_RightB=new RewriteRuleTokenStream(adaptor,"token RightB"); try { // ANML.g:680:2: ( RightB -> ^( TKet At[$RightB,\"At\"] ) | RightP -> ^( TKet Before[$RightP,\"Before\"] ) ) int alt87=2; int LA87_0 = input.LA(1); if ( (LA87_0==RightB) ) { alt87=1; } else if ( (LA87_0==RightP) ) { alt87=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 87, 0, input); throw nvae; } switch (alt87) { case 1 : // ANML.g:680:4: RightB { RightB233=(ANMLToken)match(input,RightB,FOLLOW_RightB_in_ket4273); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightB.add(RightB233); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 680:11: -> ^( TKet At[$RightB,\"At\"] ) { // ANML.g:680:14: ^( TKet At[$RightB,\"At\"] ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TKet, "TKet"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(At, RightB233, "At")); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:681:4: RightP { RightP234=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_ket4288); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightP.add(RightP234); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 681:11: -> ^( TKet Before[$RightP,\"Before\"] ) { // ANML.g:681:14: ^( TKet Before[$RightP,\"Before\"] ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TKet, "TKet"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(Before, RightP234, "Before")); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "ket" public static class lLimit_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "lLimit" // ANML.g:684:1: lLimit : Dots -> ^( TBra Before[$Dots,\"Before\"] ) ; public final ANMLParser.lLimit_return lLimit() throws RecognitionException { ANMLParser.lLimit_return retval = new ANMLParser.lLimit_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Dots235=null; ANMLToken Dots235_tree=null; RewriteRuleTokenStream stream_Dots=new RewriteRuleTokenStream(adaptor,"token Dots"); try { // ANML.g:684:8: ( Dots -> ^( TBra Before[$Dots,\"Before\"] ) ) // ANML.g:684:10: Dots { Dots235=(ANMLToken)match(input,Dots,FOLLOW_Dots_in_lLimit4306); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Dots.add(Dots235); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 684:15: -> ^( TBra Before[$Dots,\"Before\"] ) { // ANML.g:684:18: ^( TBra Before[$Dots,\"Before\"] ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TBra, "TBra"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(Before, Dots235, "Before")); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "lLimit" public static class rLimit_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "rLimit" // ANML.g:685:1: rLimit : Dots -> ^( TKet After[$Dots,\"After\"] ) ; public final ANMLParser.rLimit_return rLimit() throws RecognitionException { ANMLParser.rLimit_return retval = new ANMLParser.rLimit_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Dots236=null; ANMLToken Dots236_tree=null; RewriteRuleTokenStream stream_Dots=new RewriteRuleTokenStream(adaptor,"token Dots"); try { // ANML.g:685:8: ( Dots -> ^( TKet After[$Dots,\"After\"] ) ) // ANML.g:685:10: Dots { Dots236=(ANMLToken)match(input,Dots,FOLLOW_Dots_in_rLimit4322); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Dots.add(Dots236); // AST REWRITE // elements: // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 685:15: -> ^( TKet After[$Dots,\"After\"] ) { // ANML.g:685:18: ^( TKet After[$Dots,\"After\"] ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TKet, "TKet"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(After, Dots236, "After")); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "rLimit" public static class expr_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "expr" // ANML.g:689:1: expr : ( ( e_prefix )=> e_prefix | e_log_1 ); public final ANMLParser.expr_return expr() throws RecognitionException { ANMLParser.expr_return retval = new ANMLParser.expr_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLParser.e_prefix_return e_prefix237 = null; ANMLParser.e_log_1_return e_log_1238 = null; try { // ANML.g:690:2: ( ( e_prefix )=> e_prefix | e_log_1 ) int alt88=2; alt88 = dfa88.predict(input); switch (alt88) { case 1 : // ANML.g:690:4: ( e_prefix )=> e_prefix { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_prefix_in_expr4346); e_prefix237=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix237.getTree()); } break; case 2 : // ANML.g:691:4: e_log_1 { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_log_1_in_expr4351); e_log_1238=e_log_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_1238.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "expr" public static class e_prefix_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_prefix" // ANML.g:694:1: e_prefix : ( ID Colon e= expr -> ^( Label[$Colon] ID $e) | ( interval expr )=> interval e= expr -> ^( TimedExpr interval $e) | ( Contains )=> Contains ( ( exist_time expr )=> exist_time e= expr -> ^( ContainsSomeExpr[$Contains] exist_time $e) | e= expr -> ^( ContainsAllExpr[$Contains] $e) ) | ForAll param_list e= expr -> ^( ForAllExpr[$ForAll] param_list $e) | Exists param_list e= expr -> ^( ExistsExpr[$Exists] param_list $e) ); public final ANMLParser.e_prefix_return e_prefix() throws RecognitionException { T_stack.push(new T_scope()); ANMLParser.e_prefix_return retval = new ANMLParser.e_prefix_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID239=null; ANMLToken Colon240=null; ANMLToken Contains242=null; ANMLToken ForAll244=null; ANMLToken Exists246=null; ANMLParser.expr_return e = null; ANMLParser.interval_return interval241 = null; ANMLParser.exist_time_return exist_time243 = null; ANMLParser.param_list_return param_list245 = null; ANMLParser.param_list_return param_list247 = null; ANMLToken ID239_tree=null; ANMLToken Colon240_tree=null; ANMLToken Contains242_tree=null; ANMLToken ForAll244_tree=null; ANMLToken Exists246_tree=null; RewriteRuleTokenStream stream_Colon=new RewriteRuleTokenStream(adaptor,"token Colon"); RewriteRuleTokenStream stream_Exists=new RewriteRuleTokenStream(adaptor,"token Exists"); RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleTokenStream stream_Contains=new RewriteRuleTokenStream(adaptor,"token Contains"); RewriteRuleTokenStream stream_ForAll=new RewriteRuleTokenStream(adaptor,"token ForAll"); RewriteRuleSubtreeStream stream_interval=new RewriteRuleSubtreeStream(adaptor,"rule interval"); RewriteRuleSubtreeStream stream_exist_time=new RewriteRuleSubtreeStream(adaptor,"rule exist_time"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); RewriteRuleSubtreeStream stream_param_list=new RewriteRuleSubtreeStream(adaptor,"rule param_list"); try { // ANML.g:697:2: ( ID Colon e= expr -> ^( Label[$Colon] ID $e) | ( interval expr )=> interval e= expr -> ^( TimedExpr interval $e) | ( Contains )=> Contains ( ( exist_time expr )=> exist_time e= expr -> ^( ContainsSomeExpr[$Contains] exist_time $e) | e= expr -> ^( ContainsAllExpr[$Contains] $e) ) | ForAll param_list e= expr -> ^( ForAllExpr[$ForAll] param_list $e) | Exists param_list e= expr -> ^( ExistsExpr[$Exists] param_list $e) ) int alt90=5; int LA90_0 = input.LA(1); if ( (LA90_0==ID) ) { alt90=1; } else if ( (LA90_0==LeftB) && (synpred26_ANML())) { alt90=2; } else if ( (LA90_0==LeftP) && (synpred26_ANML())) { alt90=2; } else if ( (LA90_0==Dots) && (synpred26_ANML())) { alt90=2; } else if ( (LA90_0==Contains) && (synpred27_ANML())) { alt90=3; } else if ( (LA90_0==ForAll) ) { alt90=4; } else if ( (LA90_0==Exists) ) { alt90=5; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 90, 0, input); throw nvae; } switch (alt90) { case 1 : // ANML.g:697:4: ID Colon e= expr { ID239=(ANMLToken)match(input,ID,FOLLOW_ID_in_e_prefix4368); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID239); Colon240=(ANMLToken)match(input,Colon,FOLLOW_Colon_in_e_prefix4370); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Colon.add(Colon240); pushFollow(FOLLOW_expr_in_e_prefix4374); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); // AST REWRITE // elements: ID, e // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 698:3: -> ^( Label[$Colon] ID $e) { // ANML.g:698:6: ^( Label[$Colon] ID $e) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Label, Colon240), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, stream_e.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:699:4: ( interval expr )=> interval e= expr { pushFollow(FOLLOW_interval_in_e_prefix4400); interval241=interval(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_interval.add(interval241.getTree()); pushFollow(FOLLOW_expr_in_e_prefix4404); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); // AST REWRITE // elements: e, interval // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 700:3: -> ^( TimedExpr interval $e) { // ANML.g:700:6: ^( TimedExpr interval $e) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(TimedExpr, "TimedExpr"), root_1); adaptor.addChild(root_1, stream_interval.nextTree()); adaptor.addChild(root_1, stream_e.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:703:4: ( Contains )=> Contains ( ( exist_time expr )=> exist_time e= expr -> ^( ContainsSomeExpr[$Contains] exist_time $e) | e= expr -> ^( ContainsAllExpr[$Contains] $e) ) { Contains242=(ANMLToken)match(input,Contains,FOLLOW_Contains_in_e_prefix4429); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Contains.add(Contains242); // ANML.g:704:3: ( ( exist_time expr )=> exist_time e= expr -> ^( ContainsSomeExpr[$Contains] exist_time $e) | e= expr -> ^( ContainsAllExpr[$Contains] $e) ) int alt89=2; alt89 = dfa89.predict(input); switch (alt89) { case 1 : // ANML.g:704:4: ( exist_time expr )=> exist_time e= expr { pushFollow(FOLLOW_exist_time_in_e_prefix4442); exist_time243=exist_time(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_exist_time.add(exist_time243.getTree()); pushFollow(FOLLOW_expr_in_e_prefix4446); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); // AST REWRITE // elements: exist_time, e // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 705:4: -> ^( ContainsSomeExpr[$Contains] exist_time $e) { // ANML.g:705:7: ^( ContainsSomeExpr[$Contains] exist_time $e) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(ContainsSomeExpr, Contains242), root_1); adaptor.addChild(root_1, stream_exist_time.nextTree()); adaptor.addChild(root_1, stream_e.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:706:5: e= expr { pushFollow(FOLLOW_expr_in_e_prefix4470); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); // AST REWRITE // elements: e // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 707:4: -> ^( ContainsAllExpr[$Contains] $e) { // ANML.g:707:7: ^( ContainsAllExpr[$Contains] $e) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(ContainsAllExpr, Contains242), root_1); adaptor.addChild(root_1, stream_e.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } } break; case 4 : // ANML.g:709:4: ForAll param_list e= expr { ForAll244=(ANMLToken)match(input,ForAll,FOLLOW_ForAll_in_e_prefix4494); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ForAll.add(ForAll244); pushFollow(FOLLOW_param_list_in_e_prefix4496); param_list245=param_list(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_list.add(param_list245.getTree()); pushFollow(FOLLOW_expr_in_e_prefix4500); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); // AST REWRITE // elements: param_list, e // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 710:3: -> ^( ForAllExpr[$ForAll] param_list $e) { // ANML.g:710:6: ^( ForAllExpr[$ForAll] param_list $e) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(ForAllExpr, ForAll244), root_1); adaptor.addChild(root_1, stream_param_list.nextTree()); adaptor.addChild(root_1, stream_e.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 5 : // ANML.g:711:4: Exists param_list e= expr { Exists246=(ANMLToken)match(input,Exists,FOLLOW_Exists_in_e_prefix4519); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Exists.add(Exists246); pushFollow(FOLLOW_param_list_in_e_prefix4521); param_list247=param_list(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_param_list.add(param_list247.getTree()); pushFollow(FOLLOW_expr_in_e_prefix4525); e=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(e.getTree()); // AST REWRITE // elements: e, param_list // token labels: // rule labels: retval, e // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_e=new RewriteRuleSubtreeStream(adaptor,"token e",e!=null?e.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 712:3: -> ^( ExistsExpr[$Exists] param_list $e) { // ANML.g:712:6: ^( ExistsExpr[$Exists] param_list $e) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(ExistsExpr, Exists246), root_1); adaptor.addChild(root_1, stream_param_list.nextTree()); adaptor.addChild(root_1, stream_e.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { T_stack.pop(); } return retval; } // $ANTLR end "e_prefix" public static class e_log_1_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_log_1" // ANML.g:721:1: e_log_1 : e_log_2 ( ( Implies )=> Implies ( ( e_prefix )=> e_prefix | e_log_1 ) )? ; public final ANMLParser.e_log_1_return e_log_1() throws RecognitionException { ANMLParser.e_log_1_return retval = new ANMLParser.e_log_1_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Implies249=null; ANMLParser.e_log_2_return e_log_2248 = null; ANMLParser.e_prefix_return e_prefix250 = null; ANMLParser.e_log_1_return e_log_1251 = null; ANMLToken Implies249_tree=null; try { // ANML.g:722:2: ( e_log_2 ( ( Implies )=> Implies ( ( e_prefix )=> e_prefix | e_log_1 ) )? ) // ANML.g:722:4: e_log_2 ( ( Implies )=> Implies ( ( e_prefix )=> e_prefix | e_log_1 ) )? { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_log_2_in_e_log_14560); e_log_2248=e_log_2(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_2248.getTree()); // ANML.g:722:12: ( ( Implies )=> Implies ( ( e_prefix )=> e_prefix | e_log_1 ) )? int alt92=2; int LA92_0 = input.LA(1); if ( (LA92_0==Implies) ) { int LA92_1 = input.LA(2); if ( (synpred29_ANML()) ) { alt92=1; } } switch (alt92) { case 1 : // ANML.g:722:13: ( Implies )=> Implies ( ( e_prefix )=> e_prefix | e_log_1 ) { Implies249=(ANMLToken)match(input,Implies,FOLLOW_Implies_in_e_log_14567); if (state.failed) return retval; if ( state.backtracking==0 ) { Implies249_tree = (ANMLToken)adaptor.create(Implies249); root_0 = (ANMLToken)adaptor.becomeRoot(Implies249_tree, root_0); } // ANML.g:722:33: ( ( e_prefix )=> e_prefix | e_log_1 ) int alt91=2; alt91 = dfa91.predict(input); switch (alt91) { case 1 : // ANML.g:722:34: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_log_14575); e_prefix250=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix250.getTree()); } break; case 2 : // ANML.g:722:57: e_log_1 { pushFollow(FOLLOW_e_log_1_in_e_log_14579); e_log_1251=e_log_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_1251.getTree()); } break; } } break; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_log_1" public static class e_log_2_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_log_2" // ANML.g:725:1: e_log_2 : e_log_3 ( ( EqualLog )=> EqualLog ( ( e_prefix )=> e_prefix | e_log_3 ) )* ; public final ANMLParser.e_log_2_return e_log_2() throws RecognitionException { ANMLParser.e_log_2_return retval = new ANMLParser.e_log_2_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken EqualLog253=null; ANMLParser.e_log_3_return e_log_3252 = null; ANMLParser.e_prefix_return e_prefix254 = null; ANMLParser.e_log_3_return e_log_3255 = null; ANMLToken EqualLog253_tree=null; try { // ANML.g:726:2: ( e_log_3 ( ( EqualLog )=> EqualLog ( ( e_prefix )=> e_prefix | e_log_3 ) )* ) // ANML.g:726:4: e_log_3 ( ( EqualLog )=> EqualLog ( ( e_prefix )=> e_prefix | e_log_3 ) )* { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_log_3_in_e_log_24592); e_log_3252=e_log_3(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_3252.getTree()); // ANML.g:726:12: ( ( EqualLog )=> EqualLog ( ( e_prefix )=> e_prefix | e_log_3 ) )* loop94: do { int alt94=2; int LA94_0 = input.LA(1); if ( (LA94_0==EqualLog) ) { int LA94_2 = input.LA(2); if ( (synpred31_ANML()) ) { alt94=1; } } switch (alt94) { case 1 : // ANML.g:726:13: ( EqualLog )=> EqualLog ( ( e_prefix )=> e_prefix | e_log_3 ) { EqualLog253=(ANMLToken)match(input,EqualLog,FOLLOW_EqualLog_in_e_log_24599); if (state.failed) return retval; if ( state.backtracking==0 ) { EqualLog253_tree = (ANMLToken)adaptor.create(EqualLog253); root_0 = (ANMLToken)adaptor.becomeRoot(EqualLog253_tree, root_0); } // ANML.g:726:35: ( ( e_prefix )=> e_prefix | e_log_3 ) int alt93=2; alt93 = dfa93.predict(input); switch (alt93) { case 1 : // ANML.g:726:36: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_log_24607); e_prefix254=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix254.getTree()); } break; case 2 : // ANML.g:726:59: e_log_3 { pushFollow(FOLLOW_e_log_3_in_e_log_24611); e_log_3255=e_log_3(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_3255.getTree()); } break; } } break; default : break loop94; } } while (true); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_log_2" public static class e_log_3_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_log_3" // ANML.g:729:1: e_log_3 : e_log_4 ( ( XorLog )=> XorLog ( ( e_prefix )=> e_prefix | e_log_4 ) )* ; public final ANMLParser.e_log_3_return e_log_3() throws RecognitionException { ANMLParser.e_log_3_return retval = new ANMLParser.e_log_3_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken XorLog257=null; ANMLParser.e_log_4_return e_log_4256 = null; ANMLParser.e_prefix_return e_prefix258 = null; ANMLParser.e_log_4_return e_log_4259 = null; ANMLToken XorLog257_tree=null; try { // ANML.g:730:2: ( e_log_4 ( ( XorLog )=> XorLog ( ( e_prefix )=> e_prefix | e_log_4 ) )* ) // ANML.g:730:4: e_log_4 ( ( XorLog )=> XorLog ( ( e_prefix )=> e_prefix | e_log_4 ) )* { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_log_4_in_e_log_34624); e_log_4256=e_log_4(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_4256.getTree()); // ANML.g:730:12: ( ( XorLog )=> XorLog ( ( e_prefix )=> e_prefix | e_log_4 ) )* loop96: do { int alt96=2; int LA96_0 = input.LA(1); if ( (LA96_0==XorLog) ) { int LA96_2 = input.LA(2); if ( (synpred33_ANML()) ) { alt96=1; } } switch (alt96) { case 1 : // ANML.g:730:13: ( XorLog )=> XorLog ( ( e_prefix )=> e_prefix | e_log_4 ) { XorLog257=(ANMLToken)match(input,XorLog,FOLLOW_XorLog_in_e_log_34631); if (state.failed) return retval; if ( state.backtracking==0 ) { XorLog257_tree = (ANMLToken)adaptor.create(XorLog257); root_0 = (ANMLToken)adaptor.becomeRoot(XorLog257_tree, root_0); } // ANML.g:730:31: ( ( e_prefix )=> e_prefix | e_log_4 ) int alt95=2; alt95 = dfa95.predict(input); switch (alt95) { case 1 : // ANML.g:730:32: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_log_34639); e_prefix258=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix258.getTree()); } break; case 2 : // ANML.g:730:55: e_log_4 { pushFollow(FOLLOW_e_log_4_in_e_log_34643); e_log_4259=e_log_4(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_4259.getTree()); } break; } } break; default : break loop96; } } while (true); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_log_3" public static class e_log_4_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_log_4" // ANML.g:745:1: e_log_4 : e_log_5 ( ( OrLog )=> OrLog ( ( e_prefix )=> e_prefix | e_log_5 ) )* ; public final ANMLParser.e_log_4_return e_log_4() throws RecognitionException { ANMLParser.e_log_4_return retval = new ANMLParser.e_log_4_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken OrLog261=null; ANMLParser.e_log_5_return e_log_5260 = null; ANMLParser.e_prefix_return e_prefix262 = null; ANMLParser.e_log_5_return e_log_5263 = null; ANMLToken OrLog261_tree=null; try { // ANML.g:746:2: ( e_log_5 ( ( OrLog )=> OrLog ( ( e_prefix )=> e_prefix | e_log_5 ) )* ) // ANML.g:746:4: e_log_5 ( ( OrLog )=> OrLog ( ( e_prefix )=> e_prefix | e_log_5 ) )* { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_log_5_in_e_log_44669); e_log_5260=e_log_5(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_5260.getTree()); // ANML.g:746:12: ( ( OrLog )=> OrLog ( ( e_prefix )=> e_prefix | e_log_5 ) )* loop98: do { int alt98=2; int LA98_0 = input.LA(1); if ( (LA98_0==OrLog) ) { int LA98_2 = input.LA(2); if ( (synpred35_ANML()) ) { alt98=1; } } switch (alt98) { case 1 : // ANML.g:746:13: ( OrLog )=> OrLog ( ( e_prefix )=> e_prefix | e_log_5 ) { OrLog261=(ANMLToken)match(input,OrLog,FOLLOW_OrLog_in_e_log_44676); if (state.failed) return retval; if ( state.backtracking==0 ) { OrLog261_tree = (ANMLToken)adaptor.create(OrLog261); root_0 = (ANMLToken)adaptor.becomeRoot(OrLog261_tree, root_0); } // ANML.g:746:29: ( ( e_prefix )=> e_prefix | e_log_5 ) int alt97=2; alt97 = dfa97.predict(input); switch (alt97) { case 1 : // ANML.g:746:30: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_log_44684); e_prefix262=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix262.getTree()); } break; case 2 : // ANML.g:746:53: e_log_5 { pushFollow(FOLLOW_e_log_5_in_e_log_44688); e_log_5263=e_log_5(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_5263.getTree()); } break; } } break; default : break loop98; } } while (true); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_log_4" public static class e_log_5_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_log_5" // ANML.g:749:1: e_log_5 : e_log_6 ( ( AndLog )=> AndLog ( ( e_prefix )=> e_prefix | e_log_6 ) )* ; public final ANMLParser.e_log_5_return e_log_5() throws RecognitionException { ANMLParser.e_log_5_return retval = new ANMLParser.e_log_5_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken AndLog265=null; ANMLParser.e_log_6_return e_log_6264 = null; ANMLParser.e_prefix_return e_prefix266 = null; ANMLParser.e_log_6_return e_log_6267 = null; ANMLToken AndLog265_tree=null; try { // ANML.g:750:2: ( e_log_6 ( ( AndLog )=> AndLog ( ( e_prefix )=> e_prefix | e_log_6 ) )* ) // ANML.g:750:4: e_log_6 ( ( AndLog )=> AndLog ( ( e_prefix )=> e_prefix | e_log_6 ) )* { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_log_6_in_e_log_54702); e_log_6264=e_log_6(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_6264.getTree()); // ANML.g:750:12: ( ( AndLog )=> AndLog ( ( e_prefix )=> e_prefix | e_log_6 ) )* loop100: do { int alt100=2; int LA100_0 = input.LA(1); if ( (LA100_0==AndLog) ) { int LA100_2 = input.LA(2); if ( (synpred37_ANML()) ) { alt100=1; } } switch (alt100) { case 1 : // ANML.g:750:13: ( AndLog )=> AndLog ( ( e_prefix )=> e_prefix | e_log_6 ) { AndLog265=(ANMLToken)match(input,AndLog,FOLLOW_AndLog_in_e_log_54709); if (state.failed) return retval; if ( state.backtracking==0 ) { AndLog265_tree = (ANMLToken)adaptor.create(AndLog265); root_0 = (ANMLToken)adaptor.becomeRoot(AndLog265_tree, root_0); } // ANML.g:750:31: ( ( e_prefix )=> e_prefix | e_log_6 ) int alt99=2; alt99 = dfa99.predict(input); switch (alt99) { case 1 : // ANML.g:750:32: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_log_54717); e_prefix266=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix266.getTree()); } break; case 2 : // ANML.g:750:55: e_log_6 { pushFollow(FOLLOW_e_log_6_in_e_log_54721); e_log_6267=e_log_6(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_6267.getTree()); } break; } } break; default : break loop100; } } while (true); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_log_5" public static class e_log_6_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_log_6" // ANML.g:753:1: e_log_6 : ( ( NotLog )=> NotLog ( ( e_prefix )=> e_prefix | e_log_6 ) | e_log_7 ); public final ANMLParser.e_log_6_return e_log_6() throws RecognitionException { ANMLParser.e_log_6_return retval = new ANMLParser.e_log_6_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken NotLog268=null; ANMLParser.e_prefix_return e_prefix269 = null; ANMLParser.e_log_6_return e_log_6270 = null; ANMLParser.e_log_7_return e_log_7271 = null; ANMLToken NotLog268_tree=null; try { // ANML.g:754:2: ( ( NotLog )=> NotLog ( ( e_prefix )=> e_prefix | e_log_6 ) | e_log_7 ) int alt102=2; int LA102_0 = input.LA(1); if ( (LA102_0==NotLog) && (synpred39_ANML())) { alt102=1; } else if ( ((LA102_0>=Bra && LA102_0<=Ket)||LA102_0==ID||LA102_0==LeftP||LA102_0==NotBit||LA102_0==Duration||LA102_0==Minus||(LA102_0>=Unordered && LA102_0<=Ordered)||(LA102_0>=Start && LA102_0<=Infinity)) ) { alt102=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 102, 0, input); throw nvae; } switch (alt102) { case 1 : // ANML.g:754:4: ( NotLog )=> NotLog ( ( e_prefix )=> e_prefix | e_log_6 ) { root_0 = (ANMLToken)adaptor.nil(); NotLog268=(ANMLToken)match(input,NotLog,FOLLOW_NotLog_in_e_log_64738); if (state.failed) return retval; if ( state.backtracking==0 ) { NotLog268_tree = (ANMLToken)adaptor.create(NotLog268); root_0 = (ANMLToken)adaptor.becomeRoot(NotLog268_tree, root_0); } // ANML.g:754:22: ( ( e_prefix )=> e_prefix | e_log_6 ) int alt101=2; alt101 = dfa101.predict(input); switch (alt101) { case 1 : // ANML.g:754:23: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_log_64746); e_prefix269=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix269.getTree()); } break; case 2 : // ANML.g:754:46: e_log_6 { pushFollow(FOLLOW_e_log_6_in_e_log_64750); e_log_6270=e_log_6(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_6270.getTree()); } break; } } break; case 2 : // ANML.g:755:4: e_log_7 { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_log_7_in_e_log_64756); e_log_7271=e_log_7(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_log_7271.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_log_6" public static class e_log_7_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_log_7" // ANML.g:758:1: e_log_7 : e_num_1 ( ( num_relop )=> num_relop ( ( e_prefix )=> e_prefix | e_num_1 ) )? ; public final ANMLParser.e_log_7_return e_log_7() throws RecognitionException { ANMLParser.e_log_7_return retval = new ANMLParser.e_log_7_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLParser.e_num_1_return e_num_1272 = null; ANMLParser.num_relop_return num_relop273 = null; ANMLParser.e_prefix_return e_prefix274 = null; ANMLParser.e_num_1_return e_num_1275 = null; try { // ANML.g:759:2: ( e_num_1 ( ( num_relop )=> num_relop ( ( e_prefix )=> e_prefix | e_num_1 ) )? ) // ANML.g:759:4: e_num_1 ( ( num_relop )=> num_relop ( ( e_prefix )=> e_prefix | e_num_1 ) )? { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_num_1_in_e_log_74766); e_num_1272=e_num_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_1272.getTree()); // ANML.g:759:12: ( ( num_relop )=> num_relop ( ( e_prefix )=> e_prefix | e_num_1 ) )? int alt104=2; int LA104_0 = input.LA(1); if ( (LA104_0==Equal) ) { int LA104_1 = input.LA(2); if ( (synpred41_ANML()) ) { alt104=1; } } else if ( (LA104_0==LessThan||(LA104_0>=NotEqual && LA104_0<=GreaterThanE)) ) { int LA104_3 = input.LA(2); if ( (synpred41_ANML()) ) { alt104=1; } } switch (alt104) { case 1 : // ANML.g:759:13: ( num_relop )=> num_relop ( ( e_prefix )=> e_prefix | e_num_1 ) { pushFollow(FOLLOW_num_relop_in_e_log_74773); num_relop273=num_relop(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) root_0 = (ANMLToken)adaptor.becomeRoot(num_relop273.getTree(), root_0); // ANML.g:759:37: ( ( e_prefix )=> e_prefix | e_num_1 ) int alt103=2; alt103 = dfa103.predict(input); switch (alt103) { case 1 : // ANML.g:759:38: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_log_74781); e_prefix274=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix274.getTree()); } break; case 2 : // ANML.g:759:61: e_num_1 { pushFollow(FOLLOW_e_num_1_in_e_log_74785); e_num_1275=e_num_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_1275.getTree()); } break; } } break; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_log_7" public static class e_num_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_num" // ANML.g:762:1: e_num : ( ( e_prefix )=> e_prefix | e_num_1 ); public final ANMLParser.e_num_return e_num() throws RecognitionException { ANMLParser.e_num_return retval = new ANMLParser.e_num_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLParser.e_prefix_return e_prefix276 = null; ANMLParser.e_num_1_return e_num_1277 = null; try { // ANML.g:763:2: ( ( e_prefix )=> e_prefix | e_num_1 ) int alt105=2; alt105 = dfa105.predict(input); switch (alt105) { case 1 : // ANML.g:763:4: ( e_prefix )=> e_prefix { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_prefix_in_e_num4802); e_prefix276=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix276.getTree()); } break; case 2 : // ANML.g:764:4: e_num_1 { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_num_1_in_e_num4807); e_num_1277=e_num_1(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_1277.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_num" public static class e_num_1_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_num_1" // ANML.g:767:1: e_num_1 : e_num_2 ( ( XorBit )=> XorBit ( ( e_prefix )=> e_prefix | e_num_2 ) )* ; public final ANMLParser.e_num_1_return e_num_1() throws RecognitionException { ANMLParser.e_num_1_return retval = new ANMLParser.e_num_1_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken XorBit279=null; ANMLParser.e_num_2_return e_num_2278 = null; ANMLParser.e_prefix_return e_prefix280 = null; ANMLParser.e_num_2_return e_num_2281 = null; ANMLToken XorBit279_tree=null; try { // ANML.g:768:2: ( e_num_2 ( ( XorBit )=> XorBit ( ( e_prefix )=> e_prefix | e_num_2 ) )* ) // ANML.g:768:4: e_num_2 ( ( XorBit )=> XorBit ( ( e_prefix )=> e_prefix | e_num_2 ) )* { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_num_2_in_e_num_14817); e_num_2278=e_num_2(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_2278.getTree()); // ANML.g:768:12: ( ( XorBit )=> XorBit ( ( e_prefix )=> e_prefix | e_num_2 ) )* loop107: do { int alt107=2; int LA107_0 = input.LA(1); if ( (LA107_0==XorBit) ) { int LA107_2 = input.LA(2); if ( (synpred44_ANML()) ) { alt107=1; } } switch (alt107) { case 1 : // ANML.g:768:13: ( XorBit )=> XorBit ( ( e_prefix )=> e_prefix | e_num_2 ) { XorBit279=(ANMLToken)match(input,XorBit,FOLLOW_XorBit_in_e_num_14824); if (state.failed) return retval; if ( state.backtracking==0 ) { XorBit279_tree = (ANMLToken)adaptor.create(XorBit279); root_0 = (ANMLToken)adaptor.becomeRoot(XorBit279_tree, root_0); } // ANML.g:768:31: ( ( e_prefix )=> e_prefix | e_num_2 ) int alt106=2; alt106 = dfa106.predict(input); switch (alt106) { case 1 : // ANML.g:768:32: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_num_14832); e_prefix280=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix280.getTree()); } break; case 2 : // ANML.g:768:55: e_num_2 { pushFollow(FOLLOW_e_num_2_in_e_num_14836); e_num_2281=e_num_2(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_2281.getTree()); } break; } } break; default : break loop107; } } while (true); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_num_1" public static class e_num_2_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_num_2" // ANML.g:771:1: e_num_2 : e_num_3 ( ( Plus | Minus | OrBit )=> ( Plus | Minus | OrBit ) ( ( e_prefix )=> e_prefix | e_num_3 ) )* ; public final ANMLParser.e_num_2_return e_num_2() throws RecognitionException { ANMLParser.e_num_2_return retval = new ANMLParser.e_num_2_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Plus283=null; ANMLToken Minus284=null; ANMLToken OrBit285=null; ANMLParser.e_num_3_return e_num_3282 = null; ANMLParser.e_prefix_return e_prefix286 = null; ANMLParser.e_num_3_return e_num_3287 = null; ANMLToken Plus283_tree=null; ANMLToken Minus284_tree=null; ANMLToken OrBit285_tree=null; try { // ANML.g:772:2: ( e_num_3 ( ( Plus | Minus | OrBit )=> ( Plus | Minus | OrBit ) ( ( e_prefix )=> e_prefix | e_num_3 ) )* ) // ANML.g:772:4: e_num_3 ( ( Plus | Minus | OrBit )=> ( Plus | Minus | OrBit ) ( ( e_prefix )=> e_prefix | e_num_3 ) )* { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_num_3_in_e_num_24849); e_num_3282=e_num_3(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_3282.getTree()); // ANML.g:772:12: ( ( Plus | Minus | OrBit )=> ( Plus | Minus | OrBit ) ( ( e_prefix )=> e_prefix | e_num_3 ) )* loop110: do { int alt110=2; switch ( input.LA(1) ) { case Minus: { int LA110_2 = input.LA(2); if ( (synpred46_ANML()) ) { alt110=1; } } break; case Plus: { int LA110_3 = input.LA(2); if ( (synpred46_ANML()) ) { alt110=1; } } break; case OrBit: { int LA110_4 = input.LA(2); if ( (synpred46_ANML()) ) { alt110=1; } } break; } switch (alt110) { case 1 : // ANML.g:772:13: ( Plus | Minus | OrBit )=> ( Plus | Minus | OrBit ) ( ( e_prefix )=> e_prefix | e_num_3 ) { // ANML.g:772:33: ( Plus | Minus | OrBit ) int alt108=3; switch ( input.LA(1) ) { case Plus: { alt108=1; } break; case Minus: { alt108=2; } break; case OrBit: { alt108=3; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 108, 0, input); throw nvae; } switch (alt108) { case 1 : // ANML.g:772:34: Plus { Plus283=(ANMLToken)match(input,Plus,FOLLOW_Plus_in_e_num_24861); if (state.failed) return retval; if ( state.backtracking==0 ) { Plus283_tree = (ANMLToken)adaptor.create(Plus283); root_0 = (ANMLToken)adaptor.becomeRoot(Plus283_tree, root_0); } } break; case 2 : // ANML.g:772:40: Minus { Minus284=(ANMLToken)match(input,Minus,FOLLOW_Minus_in_e_num_24864); if (state.failed) return retval; if ( state.backtracking==0 ) { Minus284_tree = (ANMLToken)adaptor.create(Minus284); root_0 = (ANMLToken)adaptor.becomeRoot(Minus284_tree, root_0); } } break; case 3 : // ANML.g:772:47: OrBit { OrBit285=(ANMLToken)match(input,OrBit,FOLLOW_OrBit_in_e_num_24867); if (state.failed) return retval; if ( state.backtracking==0 ) { OrBit285_tree = (ANMLToken)adaptor.create(OrBit285); root_0 = (ANMLToken)adaptor.becomeRoot(OrBit285_tree, root_0); } } break; } // ANML.g:772:55: ( ( e_prefix )=> e_prefix | e_num_3 ) int alt109=2; alt109 = dfa109.predict(input); switch (alt109) { case 1 : // ANML.g:772:56: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_num_24876); e_prefix286=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix286.getTree()); } break; case 2 : // ANML.g:772:79: e_num_3 { pushFollow(FOLLOW_e_num_3_in_e_num_24880); e_num_3287=e_num_3(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_3287.getTree()); } break; } } break; default : break loop110; } } while (true); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_num_2" public static class e_num_3_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_num_3" // ANML.g:775:1: e_num_3 : e_num_4 ( ( Times | Divide | AndBit )=> ( Times | Divide | AndBit ) ( ( e_prefix )=> e_prefix | e_num_4 ) )* ; public final ANMLParser.e_num_3_return e_num_3() throws RecognitionException { ANMLParser.e_num_3_return retval = new ANMLParser.e_num_3_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Times289=null; ANMLToken Divide290=null; ANMLToken AndBit291=null; ANMLParser.e_num_4_return e_num_4288 = null; ANMLParser.e_prefix_return e_prefix292 = null; ANMLParser.e_num_4_return e_num_4293 = null; ANMLToken Times289_tree=null; ANMLToken Divide290_tree=null; ANMLToken AndBit291_tree=null; try { // ANML.g:776:2: ( e_num_4 ( ( Times | Divide | AndBit )=> ( Times | Divide | AndBit ) ( ( e_prefix )=> e_prefix | e_num_4 ) )* ) // ANML.g:776:4: e_num_4 ( ( Times | Divide | AndBit )=> ( Times | Divide | AndBit ) ( ( e_prefix )=> e_prefix | e_num_4 ) )* { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_num_4_in_e_num_34893); e_num_4288=e_num_4(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_4288.getTree()); // ANML.g:777:3: ( ( Times | Divide | AndBit )=> ( Times | Divide | AndBit ) ( ( e_prefix )=> e_prefix | e_num_4 ) )* loop113: do { int alt113=2; switch ( input.LA(1) ) { case Times: { int LA113_2 = input.LA(2); if ( (synpred48_ANML()) ) { alt113=1; } } break; case Divide: { int LA113_3 = input.LA(2); if ( (synpred48_ANML()) ) { alt113=1; } } break; case AndBit: { int LA113_4 = input.LA(2); if ( (synpred48_ANML()) ) { alt113=1; } } break; } switch (alt113) { case 1 : // ANML.g:777:4: ( Times | Divide | AndBit )=> ( Times | Divide | AndBit ) ( ( e_prefix )=> e_prefix | e_num_4 ) { // ANML.g:777:27: ( Times | Divide | AndBit ) int alt111=3; switch ( input.LA(1) ) { case Times: { alt111=1; } break; case Divide: { alt111=2; } break; case AndBit: { alt111=3; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 111, 0, input); throw nvae; } switch (alt111) { case 1 : // ANML.g:777:28: Times { Times289=(ANMLToken)match(input,Times,FOLLOW_Times_in_e_num_34908); if (state.failed) return retval; if ( state.backtracking==0 ) { Times289_tree = (ANMLToken)adaptor.create(Times289); root_0 = (ANMLToken)adaptor.becomeRoot(Times289_tree, root_0); } } break; case 2 : // ANML.g:777:35: Divide { Divide290=(ANMLToken)match(input,Divide,FOLLOW_Divide_in_e_num_34911); if (state.failed) return retval; if ( state.backtracking==0 ) { Divide290_tree = (ANMLToken)adaptor.create(Divide290); root_0 = (ANMLToken)adaptor.becomeRoot(Divide290_tree, root_0); } } break; case 3 : // ANML.g:777:43: AndBit { AndBit291=(ANMLToken)match(input,AndBit,FOLLOW_AndBit_in_e_num_34914); if (state.failed) return retval; if ( state.backtracking==0 ) { AndBit291_tree = (ANMLToken)adaptor.create(AndBit291); root_0 = (ANMLToken)adaptor.becomeRoot(AndBit291_tree, root_0); } } break; } // ANML.g:778:4: ( ( e_prefix )=> e_prefix | e_num_4 ) int alt112=2; alt112 = dfa112.predict(input); switch (alt112) { case 1 : // ANML.g:778:5: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_num_34927); e_prefix292=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix292.getTree()); } break; case 2 : // ANML.g:779:6: e_num_4 { pushFollow(FOLLOW_e_num_4_in_e_num_34935); e_num_4293=e_num_4(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_4293.getTree()); } break; } } break; default : break loop113; } } while (true); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_num_3" public static class e_num_4_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_num_4" // ANML.g:784:1: e_num_4 : ( ( Minus | NotBit )=> ( Minus | NotBit ) ( ( e_prefix )=> e_prefix | e_num_4 ) | e_atomic ); public final ANMLParser.e_num_4_return e_num_4() throws RecognitionException { ANMLParser.e_num_4_return retval = new ANMLParser.e_num_4_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Minus294=null; ANMLToken NotBit295=null; ANMLParser.e_prefix_return e_prefix296 = null; ANMLParser.e_num_4_return e_num_4297 = null; ANMLParser.e_atomic_return e_atomic298 = null; ANMLToken Minus294_tree=null; ANMLToken NotBit295_tree=null; try { // ANML.g:785:2: ( ( Minus | NotBit )=> ( Minus | NotBit ) ( ( e_prefix )=> e_prefix | e_num_4 ) | e_atomic ) int alt116=2; int LA116_0 = input.LA(1); if ( (LA116_0==Minus) && (synpred50_ANML())) { alt116=1; } else if ( (LA116_0==NotBit) && (synpred50_ANML())) { alt116=1; } else if ( ((LA116_0>=Bra && LA116_0<=Ket)||LA116_0==ID||LA116_0==LeftP||LA116_0==Duration||(LA116_0>=Unordered && LA116_0<=Ordered)||(LA116_0>=Start && LA116_0<=Infinity)) ) { alt116=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 116, 0, input); throw nvae; } switch (alt116) { case 1 : // ANML.g:785:4: ( Minus | NotBit )=> ( Minus | NotBit ) ( ( e_prefix )=> e_prefix | e_num_4 ) { root_0 = (ANMLToken)adaptor.nil(); // ANML.g:785:20: ( Minus | NotBit ) int alt114=2; int LA114_0 = input.LA(1); if ( (LA114_0==Minus) ) { alt114=1; } else if ( (LA114_0==NotBit) ) { alt114=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 114, 0, input); throw nvae; } switch (alt114) { case 1 : // ANML.g:785:21: Minus { Minus294=(ANMLToken)match(input,Minus,FOLLOW_Minus_in_e_num_44962); if (state.failed) return retval; if ( state.backtracking==0 ) { Minus294_tree = (ANMLToken)adaptor.create(Minus294); root_0 = (ANMLToken)adaptor.becomeRoot(Minus294_tree, root_0); } } break; case 2 : // ANML.g:785:28: NotBit { NotBit295=(ANMLToken)match(input,NotBit,FOLLOW_NotBit_in_e_num_44965); if (state.failed) return retval; if ( state.backtracking==0 ) { NotBit295_tree = (ANMLToken)adaptor.create(NotBit295); root_0 = (ANMLToken)adaptor.becomeRoot(NotBit295_tree, root_0); } } break; } // ANML.g:786:3: ( ( e_prefix )=> e_prefix | e_num_4 ) int alt115=2; alt115 = dfa115.predict(input); switch (alt115) { case 1 : // ANML.g:786:4: ( e_prefix )=> e_prefix { pushFollow(FOLLOW_e_prefix_in_e_num_44977); e_prefix296=e_prefix(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_prefix296.getTree()); } break; case 2 : // ANML.g:787:5: e_num_4 { pushFollow(FOLLOW_e_num_4_in_e_num_44984); e_num_4297=e_num_4(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_num_4297.getTree()); } break; } } break; case 2 : // ANML.g:789:4: e_atomic { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_e_atomic_in_e_num_44993); e_atomic298=e_atomic(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, e_atomic298.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_num_4" public static class e_atomic_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "e_atomic" // ANML.g:792:1: e_atomic : ( '(' expr ')' | time_primitive | time_complex | literal | ref ); public final ANMLParser.e_atomic_return e_atomic() throws RecognitionException { ANMLParser.e_atomic_return retval = new ANMLParser.e_atomic_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken char_literal299=null; ANMLToken char_literal301=null; ANMLParser.expr_return expr300 = null; ANMLParser.time_primitive_return time_primitive302 = null; ANMLParser.time_complex_return time_complex303 = null; ANMLParser.literal_return literal304 = null; ANMLParser.ref_return ref305 = null; ANMLToken char_literal299_tree=null; ANMLToken char_literal301_tree=null; try { // ANML.g:793:2: ( '(' expr ')' | time_primitive | time_complex | literal | ref ) int alt117=5; switch ( input.LA(1) ) { case LeftP: { alt117=1; } break; case Bra: case Ket: case Duration: case Start: case End: { alt117=2; } break; case Unordered: case Ordered: { alt117=3; } break; case INT: case FLOAT: case STRING: case True: case False: case Infinity: { alt117=4; } break; case ID: { alt117=5; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 117, 0, input); throw nvae; } switch (alt117) { case 1 : // ANML.g:793:4: '(' expr ')' { root_0 = (ANMLToken)adaptor.nil(); char_literal299=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_e_atomic5003); if (state.failed) return retval; pushFollow(FOLLOW_expr_in_e_atomic5006); expr300=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, expr300.getTree()); char_literal301=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_e_atomic5008); if (state.failed) return retval; } break; case 2 : // ANML.g:794:4: time_primitive { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_time_primitive_in_e_atomic5014); time_primitive302=time_primitive(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, time_primitive302.getTree()); } break; case 3 : // ANML.g:795:4: time_complex { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_time_complex_in_e_atomic5019); time_complex303=time_complex(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, time_complex303.getTree()); } break; case 4 : // ANML.g:796:4: literal { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_literal_in_e_atomic5024); literal304=literal(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, literal304.getTree()); } break; case 5 : // ANML.g:797:4: ref { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_ref_in_e_atomic5029); ref305=ref(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, ref305.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "e_atomic" public static class time_complex_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "time_complex" // ANML.g:800:1: time_complex : ( Unordered | Ordered ) '(' expr ( Comma expr )* ')' ; public final ANMLParser.time_complex_return time_complex() throws RecognitionException { ANMLParser.time_complex_return retval = new ANMLParser.time_complex_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Unordered306=null; ANMLToken Ordered307=null; ANMLToken char_literal308=null; ANMLToken Comma310=null; ANMLToken char_literal312=null; ANMLParser.expr_return expr309 = null; ANMLParser.expr_return expr311 = null; ANMLToken Unordered306_tree=null; ANMLToken Ordered307_tree=null; ANMLToken char_literal308_tree=null; ANMLToken Comma310_tree=null; ANMLToken char_literal312_tree=null; try { // ANML.g:800:14: ( ( Unordered | Ordered ) '(' expr ( Comma expr )* ')' ) // ANML.g:801:2: ( Unordered | Ordered ) '(' expr ( Comma expr )* ')' { root_0 = (ANMLToken)adaptor.nil(); // ANML.g:801:2: ( Unordered | Ordered ) int alt118=2; int LA118_0 = input.LA(1); if ( (LA118_0==Unordered) ) { alt118=1; } else if ( (LA118_0==Ordered) ) { alt118=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 118, 0, input); throw nvae; } switch (alt118) { case 1 : // ANML.g:801:3: Unordered { Unordered306=(ANMLToken)match(input,Unordered,FOLLOW_Unordered_in_time_complex5042); if (state.failed) return retval; if ( state.backtracking==0 ) { Unordered306_tree = (ANMLToken)adaptor.create(Unordered306); root_0 = (ANMLToken)adaptor.becomeRoot(Unordered306_tree, root_0); } } break; case 2 : // ANML.g:801:14: Ordered { Ordered307=(ANMLToken)match(input,Ordered,FOLLOW_Ordered_in_time_complex5045); if (state.failed) return retval; if ( state.backtracking==0 ) { Ordered307_tree = (ANMLToken)adaptor.create(Ordered307); root_0 = (ANMLToken)adaptor.becomeRoot(Ordered307_tree, root_0); } } break; } char_literal308=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_time_complex5049); if (state.failed) return retval; pushFollow(FOLLOW_expr_in_time_complex5052); expr309=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, expr309.getTree()); // ANML.g:801:34: ( Comma expr )* loop119: do { int alt119=2; int LA119_0 = input.LA(1); if ( (LA119_0==Comma) ) { alt119=1; } switch (alt119) { case 1 : // ANML.g:801:35: Comma expr { Comma310=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_time_complex5055); if (state.failed) return retval; pushFollow(FOLLOW_expr_in_time_complex5058); expr311=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, expr311.getTree()); } break; default : break loop119; } } while (true); char_literal312=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_time_complex5062); if (state.failed) return retval; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "time_complex" public static class ref_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "ref" // ANML.g:804:1: ref : (i= ID -> ^( Ref[$i,\"ReferenceID\"] $i) ) ( Dot ID -> ^( Access[$Dot,\"AccessField\"] $ref ^( Ref ID ) ) | ( arg_list )=> arg_list -> ^( Bind[$arg_list.tree,\"BindParameters\"] $ref arg_list ) )* ; public final ANMLParser.ref_return ref() throws RecognitionException { ANMLParser.ref_return retval = new ANMLParser.ref_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken i=null; ANMLToken Dot313=null; ANMLToken ID314=null; ANMLParser.arg_list_return arg_list315 = null; ANMLToken i_tree=null; ANMLToken Dot313_tree=null; ANMLToken ID314_tree=null; RewriteRuleTokenStream stream_Dot=new RewriteRuleTokenStream(adaptor,"token Dot"); RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); RewriteRuleSubtreeStream stream_arg_list=new RewriteRuleSubtreeStream(adaptor,"rule arg_list"); try { // ANML.g:805:2: ( (i= ID -> ^( Ref[$i,\"ReferenceID\"] $i) ) ( Dot ID -> ^( Access[$Dot,\"AccessField\"] $ref ^( Ref ID ) ) | ( arg_list )=> arg_list -> ^( Bind[$arg_list.tree,\"BindParameters\"] $ref arg_list ) )* ) // ANML.g:805:4: (i= ID -> ^( Ref[$i,\"ReferenceID\"] $i) ) ( Dot ID -> ^( Access[$Dot,\"AccessField\"] $ref ^( Ref ID ) ) | ( arg_list )=> arg_list -> ^( Bind[$arg_list.tree,\"BindParameters\"] $ref arg_list ) )* { // ANML.g:805:4: (i= ID -> ^( Ref[$i,\"ReferenceID\"] $i) ) // ANML.g:805:5: i= ID { i=(ANMLToken)match(input,ID,FOLLOW_ID_in_ref5076); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(i); // AST REWRITE // elements: i // token labels: i // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleTokenStream stream_i=new RewriteRuleTokenStream(adaptor,"token i",i); RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 805:10: -> ^( Ref[$i,\"ReferenceID\"] $i) { // ANML.g:805:13: ^( Ref[$i,\"ReferenceID\"] $i) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Ref, i, "ReferenceID"), root_1); adaptor.addChild(root_1, stream_i.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } // ANML.g:806:3: ( Dot ID -> ^( Access[$Dot,\"AccessField\"] $ref ^( Ref ID ) ) | ( arg_list )=> arg_list -> ^( Bind[$arg_list.tree,\"BindParameters\"] $ref arg_list ) )* loop120: do { int alt120=3; alt120 = dfa120.predict(input); switch (alt120) { case 1 : // ANML.g:806:5: Dot ID { Dot313=(ANMLToken)match(input,Dot,FOLLOW_Dot_in_ref5093); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Dot.add(Dot313); ID314=(ANMLToken)match(input,ID,FOLLOW_ID_in_ref5095); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID314); // AST REWRITE // elements: ref, ID // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 807:4: -> ^( Access[$Dot,\"AccessField\"] $ref ^( Ref ID ) ) { // ANML.g:807:7: ^( Access[$Dot,\"AccessField\"] $ref ^( Ref ID ) ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Access, Dot313, "AccessField"), root_1); adaptor.addChild(root_1, stream_retval.nextTree()); // ANML.g:807:41: ^( Ref ID ) { ANMLToken root_2 = (ANMLToken)adaptor.nil(); root_2 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Ref, "Ref"), root_2); adaptor.addChild(root_2, stream_ID.nextNode()); adaptor.addChild(root_1, root_2); } adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:808:5: ( arg_list )=> arg_list { pushFollow(FOLLOW_arg_list_in_ref5125); arg_list315=arg_list(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_arg_list.add(arg_list315.getTree()); // AST REWRITE // elements: arg_list, ref // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 809:4: -> ^( Bind[$arg_list.tree,\"BindParameters\"] $ref arg_list ) { // ANML.g:809:7: ^( Bind[$arg_list.tree,\"BindParameters\"] $ref arg_list ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Bind, (arg_list315!=null?((ANMLToken)arg_list315.tree):null), "BindParameters"), root_1); adaptor.addChild(root_1, stream_retval.nextTree()); adaptor.addChild(root_1, stream_arg_list.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; default : break loop120; } } while (true); } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "ref" public static class time_primitive_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "time_primitive" // ANML.g:813:1: time_primitive : ( ( Bra LeftP ID RightP )=> Bra LeftP ID RightP -> ^( LabelRef ID Bra ) | ( Start LeftP ID RightP )=> Start LeftP ID RightP -> ^( LabelRef ID Start ) | ( End LeftP ID RightP )=> End LeftP ID RightP -> ^( LabelRef ID End ) | ( Duration LeftP ID RightP )=> Duration LeftP ID RightP -> ^( LabelRef ID Duration ) | ( Ket LeftP ID RightP )=> Ket LeftP ID RightP -> ^( LabelRef ID Ket ) | Start -> ^( LabelRef This Start ) | End -> ^( LabelRef This End ) | Duration -> ^( LabelRef This Duration ) | Bra -> ^( LabelRef This Bra ) | Ket -> ^( LabelRef This Ket ) ); public final ANMLParser.time_primitive_return time_primitive() throws RecognitionException { ANMLParser.time_primitive_return retval = new ANMLParser.time_primitive_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken Bra316=null; ANMLToken LeftP317=null; ANMLToken ID318=null; ANMLToken RightP319=null; ANMLToken Start320=null; ANMLToken LeftP321=null; ANMLToken ID322=null; ANMLToken RightP323=null; ANMLToken End324=null; ANMLToken LeftP325=null; ANMLToken ID326=null; ANMLToken RightP327=null; ANMLToken Duration328=null; ANMLToken LeftP329=null; ANMLToken ID330=null; ANMLToken RightP331=null; ANMLToken Ket332=null; ANMLToken LeftP333=null; ANMLToken ID334=null; ANMLToken RightP335=null; ANMLToken Start336=null; ANMLToken End337=null; ANMLToken Duration338=null; ANMLToken Bra339=null; ANMLToken Ket340=null; ANMLToken Bra316_tree=null; ANMLToken LeftP317_tree=null; ANMLToken ID318_tree=null; ANMLToken RightP319_tree=null; ANMLToken Start320_tree=null; ANMLToken LeftP321_tree=null; ANMLToken ID322_tree=null; ANMLToken RightP323_tree=null; ANMLToken End324_tree=null; ANMLToken LeftP325_tree=null; ANMLToken ID326_tree=null; ANMLToken RightP327_tree=null; ANMLToken Duration328_tree=null; ANMLToken LeftP329_tree=null; ANMLToken ID330_tree=null; ANMLToken RightP331_tree=null; ANMLToken Ket332_tree=null; ANMLToken LeftP333_tree=null; ANMLToken ID334_tree=null; ANMLToken RightP335_tree=null; ANMLToken Start336_tree=null; ANMLToken End337_tree=null; ANMLToken Duration338_tree=null; ANMLToken Bra339_tree=null; ANMLToken Ket340_tree=null; RewriteRuleTokenStream stream_RightP=new RewriteRuleTokenStream(adaptor,"token RightP"); RewriteRuleTokenStream stream_End=new RewriteRuleTokenStream(adaptor,"token End"); RewriteRuleTokenStream stream_Start=new RewriteRuleTokenStream(adaptor,"token Start"); RewriteRuleTokenStream stream_Bra=new RewriteRuleTokenStream(adaptor,"token Bra"); RewriteRuleTokenStream stream_Ket=new RewriteRuleTokenStream(adaptor,"token Ket"); RewriteRuleTokenStream stream_Duration=new RewriteRuleTokenStream(adaptor,"token Duration"); RewriteRuleTokenStream stream_LeftP=new RewriteRuleTokenStream(adaptor,"token LeftP"); RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); try { // ANML.g:814:2: ( ( Bra LeftP ID RightP )=> Bra LeftP ID RightP -> ^( LabelRef ID Bra ) | ( Start LeftP ID RightP )=> Start LeftP ID RightP -> ^( LabelRef ID Start ) | ( End LeftP ID RightP )=> End LeftP ID RightP -> ^( LabelRef ID End ) | ( Duration LeftP ID RightP )=> Duration LeftP ID RightP -> ^( LabelRef ID Duration ) | ( Ket LeftP ID RightP )=> Ket LeftP ID RightP -> ^( LabelRef ID Ket ) | Start -> ^( LabelRef This Start ) | End -> ^( LabelRef This End ) | Duration -> ^( LabelRef This Duration ) | Bra -> ^( LabelRef This Bra ) | Ket -> ^( LabelRef This Ket ) ) int alt121=10; alt121 = dfa121.predict(input); switch (alt121) { case 1 : // ANML.g:814:4: ( Bra LeftP ID RightP )=> Bra LeftP ID RightP { Bra316=(ANMLToken)match(input,Bra,FOLLOW_Bra_in_time_primitive5166); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Bra.add(Bra316); LeftP317=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_time_primitive5168); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftP.add(LeftP317); ID318=(ANMLToken)match(input,ID,FOLLOW_ID_in_time_primitive5170); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID318); RightP319=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_time_primitive5172); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightP.add(RightP319); // AST REWRITE // elements: ID, Bra // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 815:6: -> ^( LabelRef ID Bra ) { // ANML.g:815:9: ^( LabelRef ID Bra ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, stream_Bra.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 2 : // ANML.g:816:4: ( Start LeftP ID RightP )=> Start LeftP ID RightP { Start320=(ANMLToken)match(input,Start,FOLLOW_Start_in_time_primitive5203); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Start.add(Start320); LeftP321=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_time_primitive5205); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftP.add(LeftP321); ID322=(ANMLToken)match(input,ID,FOLLOW_ID_in_time_primitive5207); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID322); RightP323=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_time_primitive5209); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightP.add(RightP323); // AST REWRITE // elements: Start, ID // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 817:6: -> ^( LabelRef ID Start ) { // ANML.g:817:9: ^( LabelRef ID Start ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, stream_Start.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 3 : // ANML.g:818:4: ( End LeftP ID RightP )=> End LeftP ID RightP { End324=(ANMLToken)match(input,End,FOLLOW_End_in_time_primitive5240); if (state.failed) return retval; if ( state.backtracking==0 ) stream_End.add(End324); LeftP325=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_time_primitive5242); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftP.add(LeftP325); ID326=(ANMLToken)match(input,ID,FOLLOW_ID_in_time_primitive5244); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID326); RightP327=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_time_primitive5246); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightP.add(RightP327); // AST REWRITE // elements: End, ID // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 819:3: -> ^( LabelRef ID End ) { // ANML.g:819:6: ^( LabelRef ID End ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, stream_End.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 4 : // ANML.g:820:4: ( Duration LeftP ID RightP )=> Duration LeftP ID RightP { Duration328=(ANMLToken)match(input,Duration,FOLLOW_Duration_in_time_primitive5274); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Duration.add(Duration328); LeftP329=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_time_primitive5276); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftP.add(LeftP329); ID330=(ANMLToken)match(input,ID,FOLLOW_ID_in_time_primitive5278); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID330); RightP331=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_time_primitive5280); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightP.add(RightP331); // AST REWRITE // elements: Duration, ID // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 821:3: -> ^( LabelRef ID Duration ) { // ANML.g:821:6: ^( LabelRef ID Duration ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, stream_Duration.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 5 : // ANML.g:822:4: ( Ket LeftP ID RightP )=> Ket LeftP ID RightP { Ket332=(ANMLToken)match(input,Ket,FOLLOW_Ket_in_time_primitive5308); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Ket.add(Ket332); LeftP333=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_time_primitive5310); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftP.add(LeftP333); ID334=(ANMLToken)match(input,ID,FOLLOW_ID_in_time_primitive5312); if (state.failed) return retval; if ( state.backtracking==0 ) stream_ID.add(ID334); RightP335=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_time_primitive5314); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightP.add(RightP335); // AST REWRITE // elements: Ket, ID // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 823:6: -> ^( LabelRef ID Ket ) { // ANML.g:823:9: ^( LabelRef ID Ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, stream_ID.nextNode()); adaptor.addChild(root_1, stream_Ket.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 6 : // ANML.g:824:4: Start { Start336=(ANMLToken)match(input,Start,FOLLOW_Start_in_time_primitive5334); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Start.add(Start336); // AST REWRITE // elements: Start // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 825:6: -> ^( LabelRef This Start ) { // ANML.g:825:9: ^( LabelRef This Start ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(This, "This")); adaptor.addChild(root_1, stream_Start.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 7 : // ANML.g:826:4: End { End337=(ANMLToken)match(input,End,FOLLOW_End_in_time_primitive5354); if (state.failed) return retval; if ( state.backtracking==0 ) stream_End.add(End337); // AST REWRITE // elements: End // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 827:6: -> ^( LabelRef This End ) { // ANML.g:827:9: ^( LabelRef This End ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(This, "This")); adaptor.addChild(root_1, stream_End.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 8 : // ANML.g:828:4: Duration { Duration338=(ANMLToken)match(input,Duration,FOLLOW_Duration_in_time_primitive5374); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Duration.add(Duration338); // AST REWRITE // elements: Duration // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 829:6: -> ^( LabelRef This Duration ) { // ANML.g:829:9: ^( LabelRef This Duration ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(This, "This")); adaptor.addChild(root_1, stream_Duration.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 9 : // ANML.g:830:4: Bra { Bra339=(ANMLToken)match(input,Bra,FOLLOW_Bra_in_time_primitive5394); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Bra.add(Bra339); // AST REWRITE // elements: Bra // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 831:6: -> ^( LabelRef This Bra ) { // ANML.g:831:9: ^( LabelRef This Bra ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(This, "This")); adaptor.addChild(root_1, stream_Bra.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; case 10 : // ANML.g:832:4: Ket { Ket340=(ANMLToken)match(input,Ket,FOLLOW_Ket_in_time_primitive5414); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Ket.add(Ket340); // AST REWRITE // elements: Ket // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 833:6: -> ^( LabelRef This Ket ) { // ANML.g:833:9: ^( LabelRef This Ket ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(LabelRef, "LabelRef"), root_1); adaptor.addChild(root_1, (ANMLToken)adaptor.create(This, "This")); adaptor.addChild(root_1, stream_Ket.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "time_primitive" public static class set_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "set" // ANML.g:836:1: set : ( enumeration | range ); public final ANMLParser.set_return set() throws RecognitionException { ANMLParser.set_return retval = new ANMLParser.set_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLParser.enumeration_return enumeration341 = null; ANMLParser.range_return range342 = null; try { // ANML.g:836:4: ( enumeration | range ) int alt122=2; int LA122_0 = input.LA(1); if ( (LA122_0==LeftC) ) { alt122=1; } else if ( (LA122_0==LeftB) ) { alt122=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 122, 0, input); throw nvae; } switch (alt122) { case 1 : // ANML.g:836:6: enumeration { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_enumeration_in_set5438); enumeration341=enumeration(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, enumeration341.getTree()); } break; case 2 : // ANML.g:836:20: range { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_range_in_set5442); range342=range(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, range342.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "set" public static class enumeration_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "enumeration" // ANML.g:838:1: enumeration : LeftC expr ( ( Comma )? expr )* RightC -> ^( Enum[$LeftC,\"Enumeration\"] ( expr )+ ) ; public final ANMLParser.enumeration_return enumeration() throws RecognitionException { ANMLParser.enumeration_return retval = new ANMLParser.enumeration_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftC343=null; ANMLToken Comma345=null; ANMLToken RightC347=null; ANMLParser.expr_return expr344 = null; ANMLParser.expr_return expr346 = null; ANMLToken LeftC343_tree=null; ANMLToken Comma345_tree=null; ANMLToken RightC347_tree=null; RewriteRuleTokenStream stream_LeftC=new RewriteRuleTokenStream(adaptor,"token LeftC"); RewriteRuleTokenStream stream_RightC=new RewriteRuleTokenStream(adaptor,"token RightC"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { // ANML.g:838:12: ( LeftC expr ( ( Comma )? expr )* RightC -> ^( Enum[$LeftC,\"Enumeration\"] ( expr )+ ) ) // ANML.g:839:2: LeftC expr ( ( Comma )? expr )* RightC { LeftC343=(ANMLToken)match(input,LeftC,FOLLOW_LeftC_in_enumeration5451); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftC.add(LeftC343); pushFollow(FOLLOW_expr_in_enumeration5453); expr344=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(expr344.getTree()); // ANML.g:839:13: ( ( Comma )? expr )* loop124: do { int alt124=2; int LA124_0 = input.LA(1); if ( ((LA124_0>=Bra && LA124_0<=Ket)||LA124_0==ID||LA124_0==Comma||LA124_0==LeftP||(LA124_0>=NotLog && LA124_0<=NotBit)||(LA124_0>=LeftB && LA124_0<=Duration)||LA124_0==Contains||(LA124_0>=ForAll && LA124_0<=Exists)||LA124_0==Dots||LA124_0==Minus||(LA124_0>=Unordered && LA124_0<=Ordered)||(LA124_0>=Start && LA124_0<=Infinity)) ) { alt124=1; } switch (alt124) { case 1 : // ANML.g:839:14: ( Comma )? expr { // ANML.g:839:14: ( Comma )? int alt123=2; int LA123_0 = input.LA(1); if ( (LA123_0==Comma) ) { alt123=1; } switch (alt123) { case 1 : // ANML.g:839:14: Comma { Comma345=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_enumeration5456); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma345); } break; } pushFollow(FOLLOW_expr_in_enumeration5459); expr346=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(expr346.getTree()); } break; default : break loop124; } } while (true); RightC347=(ANMLToken)match(input,RightC,FOLLOW_RightC_in_enumeration5463); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightC.add(RightC347); // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 839:35: -> ^( Enum[$LeftC,\"Enumeration\"] ( expr )+ ) { // ANML.g:839:38: ^( Enum[$LeftC,\"Enumeration\"] ( expr )+ ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Enum, LeftC343, "Enumeration"), root_1); if ( !(stream_expr.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_expr.hasNext() ) { adaptor.addChild(root_1, stream_expr.nextTree()); } stream_expr.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "enumeration" public static class range_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "range" // ANML.g:842:1: range : LeftB a= expr ( Comma )? b= expr RightB -> ^( Range[$LeftB,\"Range\"] $a $b) ; public final ANMLParser.range_return range() throws RecognitionException { ANMLParser.range_return retval = new ANMLParser.range_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftB348=null; ANMLToken Comma349=null; ANMLToken RightB350=null; ANMLParser.expr_return a = null; ANMLParser.expr_return b = null; ANMLToken LeftB348_tree=null; ANMLToken Comma349_tree=null; ANMLToken RightB350_tree=null; RewriteRuleTokenStream stream_RightB=new RewriteRuleTokenStream(adaptor,"token RightB"); RewriteRuleTokenStream stream_LeftB=new RewriteRuleTokenStream(adaptor,"token LeftB"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { // ANML.g:842:6: ( LeftB a= expr ( Comma )? b= expr RightB -> ^( Range[$LeftB,\"Range\"] $a $b) ) // ANML.g:843:4: LeftB a= expr ( Comma )? b= expr RightB { LeftB348=(ANMLToken)match(input,LeftB,FOLLOW_LeftB_in_range5485); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftB.add(LeftB348); pushFollow(FOLLOW_expr_in_range5489); a=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(a.getTree()); // ANML.g:843:17: ( Comma )? int alt125=2; int LA125_0 = input.LA(1); if ( (LA125_0==Comma) ) { alt125=1; } switch (alt125) { case 1 : // ANML.g:843:17: Comma { Comma349=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_range5491); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma349); } break; } pushFollow(FOLLOW_expr_in_range5496); b=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(b.getTree()); RightB350=(ANMLToken)match(input,RightB,FOLLOW_RightB_in_range5498); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightB.add(RightB350); // AST REWRITE // elements: a, b // token labels: // rule labels: retval, b, a // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); RewriteRuleSubtreeStream stream_b=new RewriteRuleSubtreeStream(adaptor,"token b",b!=null?b.tree:null); RewriteRuleSubtreeStream stream_a=new RewriteRuleSubtreeStream(adaptor,"token a",a!=null?a.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 843:38: -> ^( Range[$LeftB,\"Range\"] $a $b) { // ANML.g:843:41: ^( Range[$LeftB,\"Range\"] $a $b) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Range, LeftB348, "Range"), root_1); adaptor.addChild(root_1, stream_a.nextTree()); adaptor.addChild(root_1, stream_b.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "range" public static class type_enumeration_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "type_enumeration" // ANML.g:846:1: type_enumeration : LeftC type_enumeration_element ( ( Comma )? type_enumeration_element )* RightC -> ^( Enum[$LeftC,\"TypeElementEnumeration\"] ( type_enumeration_element )+ ) ; public final ANMLParser.type_enumeration_return type_enumeration() throws RecognitionException { ANMLParser.type_enumeration_return retval = new ANMLParser.type_enumeration_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftC351=null; ANMLToken Comma353=null; ANMLToken RightC355=null; ANMLParser.type_enumeration_element_return type_enumeration_element352 = null; ANMLParser.type_enumeration_element_return type_enumeration_element354 = null; ANMLToken LeftC351_tree=null; ANMLToken Comma353_tree=null; ANMLToken RightC355_tree=null; RewriteRuleTokenStream stream_LeftC=new RewriteRuleTokenStream(adaptor,"token LeftC"); RewriteRuleTokenStream stream_RightC=new RewriteRuleTokenStream(adaptor,"token RightC"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleSubtreeStream stream_type_enumeration_element=new RewriteRuleSubtreeStream(adaptor,"rule type_enumeration_element"); try { // ANML.g:846:17: ( LeftC type_enumeration_element ( ( Comma )? type_enumeration_element )* RightC -> ^( Enum[$LeftC,\"TypeElementEnumeration\"] ( type_enumeration_element )+ ) ) // ANML.g:847:2: LeftC type_enumeration_element ( ( Comma )? type_enumeration_element )* RightC { LeftC351=(ANMLToken)match(input,LeftC,FOLLOW_LeftC_in_type_enumeration5522); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftC.add(LeftC351); pushFollow(FOLLOW_type_enumeration_element_in_type_enumeration5524); type_enumeration_element352=type_enumeration_element(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_enumeration_element.add(type_enumeration_element352.getTree()); // ANML.g:847:33: ( ( Comma )? type_enumeration_element )* loop127: do { int alt127=2; int LA127_0 = input.LA(1); if ( (LA127_0==ID||LA127_0==Comma||(LA127_0>=INT && LA127_0<=Infinity)) ) { alt127=1; } switch (alt127) { case 1 : // ANML.g:847:34: ( Comma )? type_enumeration_element { // ANML.g:847:34: ( Comma )? int alt126=2; int LA126_0 = input.LA(1); if ( (LA126_0==Comma) ) { alt126=1; } switch (alt126) { case 1 : // ANML.g:847:34: Comma { Comma353=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_type_enumeration5527); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma353); } break; } pushFollow(FOLLOW_type_enumeration_element_in_type_enumeration5530); type_enumeration_element354=type_enumeration_element(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_type_enumeration_element.add(type_enumeration_element354.getTree()); } break; default : break loop127; } } while (true); RightC355=(ANMLToken)match(input,RightC,FOLLOW_RightC_in_type_enumeration5534); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightC.add(RightC355); // AST REWRITE // elements: type_enumeration_element // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 848:2: -> ^( Enum[$LeftC,\"TypeElementEnumeration\"] ( type_enumeration_element )+ ) { // ANML.g:848:5: ^( Enum[$LeftC,\"TypeElementEnumeration\"] ( type_enumeration_element )+ ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Enum, LeftC351, "TypeElementEnumeration"), root_1); if ( !(stream_type_enumeration_element.hasNext()) ) { throw new RewriteEarlyExitException(); } while ( stream_type_enumeration_element.hasNext() ) { adaptor.addChild(root_1, stream_type_enumeration_element.nextTree()); } stream_type_enumeration_element.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "type_enumeration" public static class type_enumeration_element_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "type_enumeration_element" // ANML.g:852:1: type_enumeration_element : ( ID | literal ); public final ANMLParser.type_enumeration_element_return type_enumeration_element() throws RecognitionException { ANMLParser.type_enumeration_element_return retval = new ANMLParser.type_enumeration_element_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken ID356=null; ANMLParser.literal_return literal357 = null; ANMLToken ID356_tree=null; try { // ANML.g:852:25: ( ID | literal ) int alt128=2; int LA128_0 = input.LA(1); if ( (LA128_0==ID) ) { alt128=1; } else if ( ((LA128_0>=INT && LA128_0<=Infinity)) ) { alt128=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 128, 0, input); throw nvae; } switch (alt128) { case 1 : // ANML.g:853:2: ID { root_0 = (ANMLToken)adaptor.nil(); ID356=(ANMLToken)match(input,ID,FOLLOW_ID_in_type_enumeration_element5559); if (state.failed) return retval; if ( state.backtracking==0 ) { ID356_tree = (ANMLToken)adaptor.create(ID356); adaptor.addChild(root_0, ID356_tree); } } break; case 2 : // ANML.g:853:7: literal { root_0 = (ANMLToken)adaptor.nil(); pushFollow(FOLLOW_literal_in_type_enumeration_element5563); literal357=literal(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, literal357.getTree()); } break; } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "type_enumeration_element" public static class arg_list_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "arg_list" // ANML.g:857:1: arg_list : LeftP ( expr ( ( Comma )? expr )* )? RightP -> ^( Arguments[$LeftP,\"Arguments\"] ( expr )* ) ; public final ANMLParser.arg_list_return arg_list() throws RecognitionException { ANMLParser.arg_list_return retval = new ANMLParser.arg_list_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken LeftP358=null; ANMLToken Comma360=null; ANMLToken RightP362=null; ANMLParser.expr_return expr359 = null; ANMLParser.expr_return expr361 = null; ANMLToken LeftP358_tree=null; ANMLToken Comma360_tree=null; ANMLToken RightP362_tree=null; RewriteRuleTokenStream stream_RightP=new RewriteRuleTokenStream(adaptor,"token RightP"); RewriteRuleTokenStream stream_LeftP=new RewriteRuleTokenStream(adaptor,"token LeftP"); RewriteRuleTokenStream stream_Comma=new RewriteRuleTokenStream(adaptor,"token Comma"); RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr"); try { // ANML.g:857:10: ( LeftP ( expr ( ( Comma )? expr )* )? RightP -> ^( Arguments[$LeftP,\"Arguments\"] ( expr )* ) ) // ANML.g:858:4: LeftP ( expr ( ( Comma )? expr )* )? RightP { LeftP358=(ANMLToken)match(input,LeftP,FOLLOW_LeftP_in_arg_list5576); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LeftP.add(LeftP358); // ANML.g:858:10: ( expr ( ( Comma )? expr )* )? int alt131=2; int LA131_0 = input.LA(1); if ( ((LA131_0>=Bra && LA131_0<=Ket)||LA131_0==ID||LA131_0==LeftP||(LA131_0>=NotLog && LA131_0<=NotBit)||(LA131_0>=LeftB && LA131_0<=Duration)||LA131_0==Contains||(LA131_0>=ForAll && LA131_0<=Exists)||LA131_0==Dots||LA131_0==Minus||(LA131_0>=Unordered && LA131_0<=Ordered)||(LA131_0>=Start && LA131_0<=Infinity)) ) { alt131=1; } switch (alt131) { case 1 : // ANML.g:858:11: expr ( ( Comma )? expr )* { pushFollow(FOLLOW_expr_in_arg_list5579); expr359=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(expr359.getTree()); // ANML.g:858:16: ( ( Comma )? expr )* loop130: do { int alt130=2; int LA130_0 = input.LA(1); if ( ((LA130_0>=Bra && LA130_0<=Ket)||LA130_0==ID||LA130_0==Comma||LA130_0==LeftP||(LA130_0>=NotLog && LA130_0<=NotBit)||(LA130_0>=LeftB && LA130_0<=Duration)||LA130_0==Contains||(LA130_0>=ForAll && LA130_0<=Exists)||LA130_0==Dots||LA130_0==Minus||(LA130_0>=Unordered && LA130_0<=Ordered)||(LA130_0>=Start && LA130_0<=Infinity)) ) { alt130=1; } switch (alt130) { case 1 : // ANML.g:858:17: ( Comma )? expr { // ANML.g:858:17: ( Comma )? int alt129=2; int LA129_0 = input.LA(1); if ( (LA129_0==Comma) ) { alt129=1; } switch (alt129) { case 1 : // ANML.g:858:17: Comma { Comma360=(ANMLToken)match(input,Comma,FOLLOW_Comma_in_arg_list5582); if (state.failed) return retval; if ( state.backtracking==0 ) stream_Comma.add(Comma360); } break; } pushFollow(FOLLOW_expr_in_arg_list5585); expr361=expr(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_expr.add(expr361.getTree()); } break; default : break loop130; } } while (true); } break; } RightP362=(ANMLToken)match(input,RightP,FOLLOW_RightP_in_arg_list5591); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RightP.add(RightP362); // AST REWRITE // elements: expr // token labels: // rule labels: retval // token list labels: // rule list labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null); root_0 = (ANMLToken)adaptor.nil(); // 858:40: -> ^( Arguments[$LeftP,\"Arguments\"] ( expr )* ) { // ANML.g:858:43: ^( Arguments[$LeftP,\"Arguments\"] ( expr )* ) { ANMLToken root_1 = (ANMLToken)adaptor.nil(); root_1 = (ANMLToken)adaptor.becomeRoot((ANMLToken)adaptor.create(Arguments, LeftP358, "Arguments"), root_1); // ANML.g:858:75: ( expr )* while ( stream_expr.hasNext() ) { adaptor.addChild(root_1, stream_expr.nextTree()); } stream_expr.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0;} } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "arg_list" public static class literal_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "literal" // ANML.g:863:1: literal : ( INT | FLOAT | STRING | True | False | Infinity ); public final ANMLParser.literal_return literal() throws RecognitionException { ANMLParser.literal_return retval = new ANMLParser.literal_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken set363=null; ANMLToken set363_tree=null; try { // ANML.g:864:2: ( INT | FLOAT | STRING | True | False | Infinity ) // ANML.g: { root_0 = (ANMLToken)adaptor.nil(); set363=(ANMLToken)input.LT(1); if ( (input.LA(1)>=INT && input.LA(1)<=Infinity) ) { input.consume(); if ( state.backtracking==0 ) adaptor.addChild(root_0, (ANMLToken)adaptor.create(set363)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "literal" public static class num_relop_return extends ParserRuleReturnScope { ANMLToken tree; public Object getTree() { return tree; } }; // $ANTLR start "num_relop" // ANML.g:877:1: num_relop : ( Equal | NotEqual | LessThan | GreaterThan | LessThanE | GreaterThanE ); public final ANMLParser.num_relop_return num_relop() throws RecognitionException { ANMLParser.num_relop_return retval = new ANMLParser.num_relop_return(); retval.start = input.LT(1); ANMLToken root_0 = null; ANMLToken set364=null; ANMLToken set364_tree=null; try { // ANML.g:877:11: ( Equal | NotEqual | LessThan | GreaterThan | LessThanE | GreaterThanE ) // ANML.g: { root_0 = (ANMLToken)adaptor.nil(); set364=(ANMLToken)input.LT(1); if ( input.LA(1)==LessThan||input.LA(1)==Equal||(input.LA(1)>=NotEqual && input.LA(1)<=GreaterThanE) ) { input.consume(); if ( state.backtracking==0 ) adaptor.addChild(root_0, (ANMLToken)adaptor.create(set364)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (ANMLToken)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (ANMLToken)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } // $ANTLR end "num_relop" // $ANTLR start synpred1_ANML public final void synpred1_ANML_fragment() throws RecognitionException { // ANML.g:339:4: ( ref Semi ) // ANML.g:339:5: ref Semi { pushFollow(FOLLOW_ref_in_synpred1_ANML1528); ref(); state._fsp--; if (state.failed) return ; match(input,Semi,FOLLOW_Semi_in_synpred1_ANML1530); if (state.failed) return ; } } // $ANTLR end synpred1_ANML // $ANTLR start synpred2_ANML public final void synpred2_ANML_fragment() throws RecognitionException { // ANML.g:341:4: ( ( NotLog | NotBit ) ref Semi ) // ANML.g:341:5: ( NotLog | NotBit ) ref Semi { if ( (input.LA(1)>=NotLog && input.LA(1)<=NotBit) ) { input.consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return ;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } pushFollow(FOLLOW_ref_in_synpred2_ANML1578); ref(); state._fsp--; if (state.failed) return ; match(input,Semi,FOLLOW_Semi_in_synpred2_ANML1580); if (state.failed) return ; } } // $ANTLR end synpred2_ANML // $ANTLR start synpred3_ANML public final void synpred3_ANML_fragment() throws RecognitionException { // ANML.g:519:4: ( stmt_primitive ) // ANML.g:519:5: stmt_primitive { pushFollow(FOLLOW_stmt_primitive_in_synpred3_ANML2624); stmt_primitive(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred3_ANML // $ANTLR start synpred4_ANML public final void synpred4_ANML_fragment() throws RecognitionException { // ANML.g:520:4: ( stmt_block ) // ANML.g:520:5: stmt_block { pushFollow(FOLLOW_stmt_block_in_synpred4_ANML2634); stmt_block(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred4_ANML // $ANTLR start synpred5_ANML public final void synpred5_ANML_fragment() throws RecognitionException { // ANML.g:521:4: ( stmt_timed ) // ANML.g:521:5: stmt_timed { pushFollow(FOLLOW_stmt_timed_in_synpred5_ANML2644); stmt_timed(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred5_ANML // $ANTLR start synpred6_ANML public final void synpred6_ANML_fragment() throws RecognitionException { // ANML.g:530:4: ( exist_time stmt ) // ANML.g:530:5: exist_time stmt { pushFollow(FOLLOW_exist_time_in_synpred6_ANML2685); exist_time(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_stmt_in_synpred6_ANML2687); stmt(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred6_ANML // $ANTLR start synpred7_ANML public final void synpred7_ANML_fragment() throws RecognitionException { // ANML.g:539:5: ( Else ) // ANML.g:539:6: Else { match(input,Else,FOLLOW_Else_in_synpred7_ANML2753); if (state.failed) return ; } } // $ANTLR end synpred7_ANML // $ANTLR start synpred8_ANML public final void synpred8_ANML_fragment() throws RecognitionException { // ANML.g:562:4: ( expr Semi ) // ANML.g:562:5: expr Semi { pushFollow(FOLLOW_expr_in_synpred8_ANML2893); expr(); state._fsp--; if (state.failed) return ; match(input,Semi,FOLLOW_Semi_in_synpred8_ANML2895); if (state.failed) return ; } } // $ANTLR end synpred8_ANML // $ANTLR start synpred9_ANML public final void synpred9_ANML_fragment() throws RecognitionException { // ANML.g:563:6: ( stmt_chain Semi ) // ANML.g:563:7: stmt_chain Semi { pushFollow(FOLLOW_stmt_chain_in_synpred9_ANML2910); stmt_chain(); state._fsp--; if (state.failed) return ; match(input,Semi,FOLLOW_Semi_in_synpred9_ANML2912); if (state.failed) return ; } } // $ANTLR end synpred9_ANML // $ANTLR start synpred10_ANML public final void synpred10_ANML_fragment() throws RecognitionException { // ANML.g:564:4: ( stmt_delta_chain Semi ) // ANML.g:564:5: stmt_delta_chain Semi { pushFollow(FOLLOW_stmt_delta_chain_in_synpred10_ANML2925); stmt_delta_chain(); state._fsp--; if (state.failed) return ; match(input,Semi,FOLLOW_Semi_in_synpred10_ANML2927); if (state.failed) return ; } } // $ANTLR end synpred10_ANML // $ANTLR start synpred11_ANML public final void synpred11_ANML_fragment() throws RecognitionException { // ANML.g:565:6: ( stmt_timeless Semi ) // ANML.g:565:7: stmt_timeless Semi { pushFollow(FOLLOW_stmt_timeless_in_synpred11_ANML2942); stmt_timeless(); state._fsp--; if (state.failed) return ; match(input,Semi,FOLLOW_Semi_in_synpred11_ANML2944); if (state.failed) return ; } } // $ANTLR end synpred11_ANML // $ANTLR start synpred12_ANML public final void synpred12_ANML_fragment() throws RecognitionException { // ANML.g:572:4: ( interval ref ( stmt_chain_1 )+ ) // ANML.g:572:5: interval ref ( stmt_chain_1 )+ { pushFollow(FOLLOW_interval_in_synpred12_ANML3034); interval(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_ref_in_synpred12_ANML3036); ref(); state._fsp--; if (state.failed) return ; // ANML.g:572:18: ( stmt_chain_1 )+ int cnt132=0; loop132: do { int alt132=2; int LA132_0 = input.LA(1); if ( ((LA132_0>=LessThan && LA132_0<=Assign)||LA132_0==Comma||LA132_0==Undefine||LA132_0==Equal||(LA132_0>=Change && LA132_0<=Skip)||(LA132_0>=NotEqual && LA132_0<=GreaterThanE)) ) { alt132=1; } switch (alt132) { case 1 : // ANML.g:572:18: stmt_chain_1 { pushFollow(FOLLOW_stmt_chain_1_in_synpred12_ANML3038); stmt_chain_1(); state._fsp--; if (state.failed) return ; } break; default : if ( cnt132 >= 1 ) break loop132; if (state.backtracking>0) {state.failed=true; return ;} EarlyExitException eee = new EarlyExitException(132, input); throw eee; } cnt132++; } while (true); } } // $ANTLR end synpred12_ANML // $ANTLR start synpred13_ANML public final void synpred13_ANML_fragment() throws RecognitionException { // ANML.g:601:4: ( interval ref ( stmt_delta_chain_1 )+ ) // ANML.g:601:5: interval ref ( stmt_delta_chain_1 )+ { pushFollow(FOLLOW_interval_in_synpred13_ANML3452); interval(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_ref_in_synpred13_ANML3454); ref(); state._fsp--; if (state.failed) return ; // ANML.g:601:18: ( stmt_delta_chain_1 )+ int cnt133=0; loop133: do { int alt133=2; int LA133_0 = input.LA(1); if ( (LA133_0==Assign||LA133_0==Comma||LA133_0==Undefine||LA133_0==Equal||LA133_0==Change||(LA133_0>=SetAssign && LA133_0<=Skip)) ) { alt133=1; } switch (alt133) { case 1 : // ANML.g:601:18: stmt_delta_chain_1 { pushFollow(FOLLOW_stmt_delta_chain_1_in_synpred13_ANML3456); stmt_delta_chain_1(); state._fsp--; if (state.failed) return ; } break; default : if ( cnt133 >= 1 ) break loop133; if (state.backtracking>0) {state.failed=true; return ;} EarlyExitException eee = new EarlyExitException(133, input); throw eee; } cnt133++; } while (true); } } // $ANTLR end synpred13_ANML // $ANTLR start synpred14_ANML public final void synpred14_ANML_fragment() throws RecognitionException { // ANML.g:629:4: ( univ_time ) // ANML.g:629:5: univ_time { pushFollow(FOLLOW_univ_time_in_synpred14_ANML3664); univ_time(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred14_ANML // $ANTLR start synpred15_ANML public final void synpred15_ANML_fragment() throws RecognitionException { // ANML.g:630:4: ( exist_time ) // ANML.g:630:5: exist_time { pushFollow(FOLLOW_exist_time_in_synpred15_ANML3673); exist_time(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred15_ANML // $ANTLR start synpred16_ANML public final void synpred16_ANML_fragment() throws RecognitionException { // ANML.g:639:4: ( bra All ket ) // ANML.g:639:5: bra All ket { pushFollow(FOLLOW_bra_in_synpred16_ANML3694); bra(); state._fsp--; if (state.failed) return ; match(input,All,FOLLOW_All_in_synpred16_ANML3696); if (state.failed) return ; pushFollow(FOLLOW_ket_in_synpred16_ANML3698); ket(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred16_ANML // $ANTLR start synpred17_ANML public final void synpred17_ANML_fragment() throws RecognitionException { // ANML.g:641:4: ( LeftB expr RightB ) // ANML.g:641:5: LeftB expr RightB { match(input,LeftB,FOLLOW_LeftB_in_synpred17_ANML3746); if (state.failed) return ; pushFollow(FOLLOW_expr_in_synpred17_ANML3748); expr(); state._fsp--; if (state.failed) return ; match(input,RightB,FOLLOW_RightB_in_synpred17_ANML3750); if (state.failed) return ; } } // $ANTLR end synpred17_ANML // $ANTLR start synpred18_ANML public final void synpred18_ANML_fragment() throws RecognitionException { // ANML.g:657:4: ( LeftB Skip RightB ) // ANML.g:657:5: LeftB Skip RightB { match(input,LeftB,FOLLOW_LeftB_in_synpred18_ANML3937); if (state.failed) return ; match(input,Skip,FOLLOW_Skip_in_synpred18_ANML3939); if (state.failed) return ; match(input,RightB,FOLLOW_RightB_in_synpred18_ANML3941); if (state.failed) return ; } } // $ANTLR end synpred18_ANML // $ANTLR start synpred19_ANML public final void synpred19_ANML_fragment() throws RecognitionException { // ANML.g:658:4: ( bra expr rLimit ) // ANML.g:658:5: bra expr rLimit { pushFollow(FOLLOW_bra_in_synpred19_ANML3961); bra(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_expr_in_synpred19_ANML3963); expr(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_rLimit_in_synpred19_ANML3965); rLimit(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred19_ANML // $ANTLR start synpred20_ANML public final void synpred20_ANML_fragment() throws RecognitionException { // ANML.g:659:4: ( lLimit expr ket ) // ANML.g:659:5: lLimit expr ket { pushFollow(FOLLOW_lLimit_in_synpred20_ANML3998); lLimit(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_expr_in_synpred20_ANML4000); expr(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_ket_in_synpred20_ANML4002); ket(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred20_ANML // $ANTLR start synpred21_ANML public final void synpred21_ANML_fragment() throws RecognitionException { // ANML.g:661:6: ( Delta ) // ANML.g:661:7: Delta { match(input,Delta,FOLLOW_Delta_in_synpred21_ANML4043); if (state.failed) return ; } } // $ANTLR end synpred21_ANML // $ANTLR start synpred22_ANML public final void synpred22_ANML_fragment() throws RecognitionException { // ANML.g:662:6: ( Skip ) // ANML.g:662:7: Skip { match(input,Skip,FOLLOW_Skip_in_synpred22_ANML4081); if (state.failed) return ; } } // $ANTLR end synpred22_ANML // $ANTLR start synpred23_ANML public final void synpred23_ANML_fragment() throws RecognitionException { // ANML.g:663:7: ( Delta ) // ANML.g:663:8: Delta { match(input,Delta,FOLLOW_Delta_in_synpred23_ANML4097); if (state.failed) return ; } } // $ANTLR end synpred23_ANML // $ANTLR start synpred24_ANML public final void synpred24_ANML_fragment() throws RecognitionException { // ANML.g:664:5: ( Skip ) // ANML.g:664:6: Skip { match(input,Skip,FOLLOW_Skip_in_synpred24_ANML4129); if (state.failed) return ; } } // $ANTLR end synpred24_ANML // $ANTLR start synpred25_ANML public final void synpred25_ANML_fragment() throws RecognitionException { // ANML.g:690:4: ( e_prefix ) // ANML.g:690:5: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred25_ANML4343); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred25_ANML // $ANTLR start synpred26_ANML public final void synpred26_ANML_fragment() throws RecognitionException { // ANML.g:699:4: ( interval expr ) // ANML.g:699:5: interval expr { pushFollow(FOLLOW_interval_in_synpred26_ANML4394); interval(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_expr_in_synpred26_ANML4396); expr(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred26_ANML // $ANTLR start synpred27_ANML public final void synpred27_ANML_fragment() throws RecognitionException { // ANML.g:703:4: ( Contains ) // ANML.g:703:5: Contains { match(input,Contains,FOLLOW_Contains_in_synpred27_ANML4425); if (state.failed) return ; } } // $ANTLR end synpred27_ANML // $ANTLR start synpred28_ANML public final void synpred28_ANML_fragment() throws RecognitionException { // ANML.g:704:4: ( exist_time expr ) // ANML.g:704:5: exist_time expr { pushFollow(FOLLOW_exist_time_in_synpred28_ANML4436); exist_time(); state._fsp--; if (state.failed) return ; pushFollow(FOLLOW_expr_in_synpred28_ANML4438); expr(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred28_ANML // $ANTLR start synpred29_ANML public final void synpred29_ANML_fragment() throws RecognitionException { // ANML.g:722:13: ( Implies ) // ANML.g:722:14: Implies { match(input,Implies,FOLLOW_Implies_in_synpred29_ANML4564); if (state.failed) return ; } } // $ANTLR end synpred29_ANML // $ANTLR start synpred30_ANML public final void synpred30_ANML_fragment() throws RecognitionException { // ANML.g:722:34: ( e_prefix ) // ANML.g:722:35: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred30_ANML4572); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred30_ANML // $ANTLR start synpred31_ANML public final void synpred31_ANML_fragment() throws RecognitionException { // ANML.g:726:13: ( EqualLog ) // ANML.g:726:14: EqualLog { match(input,EqualLog,FOLLOW_EqualLog_in_synpred31_ANML4596); if (state.failed) return ; } } // $ANTLR end synpred31_ANML // $ANTLR start synpred32_ANML public final void synpred32_ANML_fragment() throws RecognitionException { // ANML.g:726:36: ( e_prefix ) // ANML.g:726:37: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred32_ANML4604); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred32_ANML // $ANTLR start synpred33_ANML public final void synpred33_ANML_fragment() throws RecognitionException { // ANML.g:730:13: ( XorLog ) // ANML.g:730:14: XorLog { match(input,XorLog,FOLLOW_XorLog_in_synpred33_ANML4628); if (state.failed) return ; } } // $ANTLR end synpred33_ANML // $ANTLR start synpred34_ANML public final void synpred34_ANML_fragment() throws RecognitionException { // ANML.g:730:32: ( e_prefix ) // ANML.g:730:33: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred34_ANML4636); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred34_ANML // $ANTLR start synpred35_ANML public final void synpred35_ANML_fragment() throws RecognitionException { // ANML.g:746:13: ( OrLog ) // ANML.g:746:14: OrLog { match(input,OrLog,FOLLOW_OrLog_in_synpred35_ANML4673); if (state.failed) return ; } } // $ANTLR end synpred35_ANML // $ANTLR start synpred36_ANML public final void synpred36_ANML_fragment() throws RecognitionException { // ANML.g:746:30: ( e_prefix ) // ANML.g:746:31: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred36_ANML4681); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred36_ANML // $ANTLR start synpred37_ANML public final void synpred37_ANML_fragment() throws RecognitionException { // ANML.g:750:13: ( AndLog ) // ANML.g:750:14: AndLog { match(input,AndLog,FOLLOW_AndLog_in_synpred37_ANML4706); if (state.failed) return ; } } // $ANTLR end synpred37_ANML // $ANTLR start synpred38_ANML public final void synpred38_ANML_fragment() throws RecognitionException { // ANML.g:750:32: ( e_prefix ) // ANML.g:750:33: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred38_ANML4714); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred38_ANML // $ANTLR start synpred39_ANML public final void synpred39_ANML_fragment() throws RecognitionException { // ANML.g:754:4: ( NotLog ) // ANML.g:754:5: NotLog { match(input,NotLog,FOLLOW_NotLog_in_synpred39_ANML4735); if (state.failed) return ; } } // $ANTLR end synpred39_ANML // $ANTLR start synpred40_ANML public final void synpred40_ANML_fragment() throws RecognitionException { // ANML.g:754:23: ( e_prefix ) // ANML.g:754:24: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred40_ANML4743); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred40_ANML // $ANTLR start synpred41_ANML public final void synpred41_ANML_fragment() throws RecognitionException { // ANML.g:759:13: ( num_relop ) // ANML.g:759:14: num_relop { pushFollow(FOLLOW_num_relop_in_synpred41_ANML4770); num_relop(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred41_ANML // $ANTLR start synpred42_ANML public final void synpred42_ANML_fragment() throws RecognitionException { // ANML.g:759:38: ( e_prefix ) // ANML.g:759:39: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred42_ANML4778); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred42_ANML // $ANTLR start synpred43_ANML public final void synpred43_ANML_fragment() throws RecognitionException { // ANML.g:763:4: ( e_prefix ) // ANML.g:763:5: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred43_ANML4799); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred43_ANML // $ANTLR start synpred44_ANML public final void synpred44_ANML_fragment() throws RecognitionException { // ANML.g:768:13: ( XorBit ) // ANML.g:768:14: XorBit { match(input,XorBit,FOLLOW_XorBit_in_synpred44_ANML4821); if (state.failed) return ; } } // $ANTLR end synpred44_ANML // $ANTLR start synpred45_ANML public final void synpred45_ANML_fragment() throws RecognitionException { // ANML.g:768:32: ( e_prefix ) // ANML.g:768:33: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred45_ANML4829); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred45_ANML // $ANTLR start synpred46_ANML public final void synpred46_ANML_fragment() throws RecognitionException { // ANML.g:772:13: ( Plus | Minus | OrBit ) // ANML.g: { if ( (input.LA(1)>=Plus && input.LA(1)<=OrBit) ) { input.consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return ;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } } // $ANTLR end synpred46_ANML // $ANTLR start synpred47_ANML public final void synpred47_ANML_fragment() throws RecognitionException { // ANML.g:772:56: ( e_prefix ) // ANML.g:772:57: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred47_ANML4873); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred47_ANML // $ANTLR start synpred48_ANML public final void synpred48_ANML_fragment() throws RecognitionException { // ANML.g:777:4: ( Times | Divide | AndBit ) // ANML.g: { if ( (input.LA(1)>=Times && input.LA(1)<=AndBit) ) { input.consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return ;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } } // $ANTLR end synpred48_ANML // $ANTLR start synpred49_ANML public final void synpred49_ANML_fragment() throws RecognitionException { // ANML.g:778:5: ( e_prefix ) // ANML.g:778:6: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred49_ANML4924); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred49_ANML // $ANTLR start synpred50_ANML public final void synpred50_ANML_fragment() throws RecognitionException { // ANML.g:785:4: ( Minus | NotBit ) // ANML.g: { if ( input.LA(1)==NotBit||input.LA(1)==Minus ) { input.consume(); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return ;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } } // $ANTLR end synpred50_ANML // $ANTLR start synpred51_ANML public final void synpred51_ANML_fragment() throws RecognitionException { // ANML.g:786:4: ( e_prefix ) // ANML.g:786:5: e_prefix { pushFollow(FOLLOW_e_prefix_in_synpred51_ANML4974); e_prefix(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred51_ANML // $ANTLR start synpred52_ANML public final void synpred52_ANML_fragment() throws RecognitionException { // ANML.g:808:5: ( arg_list ) // ANML.g:808:6: arg_list { pushFollow(FOLLOW_arg_list_in_synpred52_ANML5121); arg_list(); state._fsp--; if (state.failed) return ; } } // $ANTLR end synpred52_ANML // $ANTLR start synpred53_ANML public final void synpred53_ANML_fragment() throws RecognitionException { // ANML.g:814:4: ( Bra LeftP ID RightP ) // ANML.g:814:5: Bra LeftP ID RightP { match(input,Bra,FOLLOW_Bra_in_synpred53_ANML5156); if (state.failed) return ; match(input,LeftP,FOLLOW_LeftP_in_synpred53_ANML5158); if (state.failed) return ; match(input,ID,FOLLOW_ID_in_synpred53_ANML5160); if (state.failed) return ; match(input,RightP,FOLLOW_RightP_in_synpred53_ANML5162); if (state.failed) return ; } } // $ANTLR end synpred53_ANML // $ANTLR start synpred54_ANML public final void synpred54_ANML_fragment() throws RecognitionException { // ANML.g:816:4: ( Start LeftP ID RightP ) // ANML.g:816:5: Start LeftP ID RightP { match(input,Start,FOLLOW_Start_in_synpred54_ANML5193); if (state.failed) return ; match(input,LeftP,FOLLOW_LeftP_in_synpred54_ANML5195); if (state.failed) return ; match(input,ID,FOLLOW_ID_in_synpred54_ANML5197); if (state.failed) return ; match(input,RightP,FOLLOW_RightP_in_synpred54_ANML5199); if (state.failed) return ; } } // $ANTLR end synpred54_ANML // $ANTLR start synpred55_ANML public final void synpred55_ANML_fragment() throws RecognitionException { // ANML.g:818:4: ( End LeftP ID RightP ) // ANML.g:818:5: End LeftP ID RightP { match(input,End,FOLLOW_End_in_synpred55_ANML5230); if (state.failed) return ; match(input,LeftP,FOLLOW_LeftP_in_synpred55_ANML5232); if (state.failed) return ; match(input,ID,FOLLOW_ID_in_synpred55_ANML5234); if (state.failed) return ; match(input,RightP,FOLLOW_RightP_in_synpred55_ANML5236); if (state.failed) return ; } } // $ANTLR end synpred55_ANML // $ANTLR start synpred56_ANML public final void synpred56_ANML_fragment() throws RecognitionException { // ANML.g:820:4: ( Duration LeftP ID RightP ) // ANML.g:820:5: Duration LeftP ID RightP { match(input,Duration,FOLLOW_Duration_in_synpred56_ANML5264); if (state.failed) return ; match(input,LeftP,FOLLOW_LeftP_in_synpred56_ANML5266); if (state.failed) return ; match(input,ID,FOLLOW_ID_in_synpred56_ANML5268); if (state.failed) return ; match(input,RightP,FOLLOW_RightP_in_synpred56_ANML5270); if (state.failed) return ; } } // $ANTLR end synpred56_ANML // $ANTLR start synpred57_ANML public final void synpred57_ANML_fragment() throws RecognitionException { // ANML.g:822:4: ( Ket LeftP ID RightP ) // ANML.g:822:5: Ket LeftP ID RightP { match(input,Ket,FOLLOW_Ket_in_synpred57_ANML5298); if (state.failed) return ; match(input,LeftP,FOLLOW_LeftP_in_synpred57_ANML5300); if (state.failed) return ; match(input,ID,FOLLOW_ID_in_synpred57_ANML5302); if (state.failed) return ; match(input,RightP,FOLLOW_RightP_in_synpred57_ANML5304); if (state.failed) return ; } } // $ANTLR end synpred57_ANML // Delegated rules public final boolean synpred19_ANML() { state.backtracking++; int start = input.mark(); try { synpred19_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred51_ANML() { state.backtracking++; int start = input.mark(); try { synpred51_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred52_ANML() { state.backtracking++; int start = input.mark(); try { synpred52_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred10_ANML() { state.backtracking++; int start = input.mark(); try { synpred10_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred54_ANML() { state.backtracking++; int start = input.mark(); try { synpred54_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred4_ANML() { state.backtracking++; int start = input.mark(); try { synpred4_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred5_ANML() { state.backtracking++; int start = input.mark(); try { synpred5_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred14_ANML() { state.backtracking++; int start = input.mark(); try { synpred14_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred37_ANML() { state.backtracking++; int start = input.mark(); try { synpred37_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred26_ANML() { state.backtracking++; int start = input.mark(); try { synpred26_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred18_ANML() { state.backtracking++; int start = input.mark(); try { synpred18_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred3_ANML() { state.backtracking++; int start = input.mark(); try { synpred3_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred28_ANML() { state.backtracking++; int start = input.mark(); try { synpred28_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred16_ANML() { state.backtracking++; int start = input.mark(); try { synpred16_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred11_ANML() { state.backtracking++; int start = input.mark(); try { synpred11_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred31_ANML() { state.backtracking++; int start = input.mark(); try { synpred31_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred42_ANML() { state.backtracking++; int start = input.mark(); try { synpred42_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred46_ANML() { state.backtracking++; int start = input.mark(); try { synpred46_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred56_ANML() { state.backtracking++; int start = input.mark(); try { synpred56_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred55_ANML() { state.backtracking++; int start = input.mark(); try { synpred55_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred48_ANML() { state.backtracking++; int start = input.mark(); try { synpred48_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred22_ANML() { state.backtracking++; int start = input.mark(); try { synpred22_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred13_ANML() { state.backtracking++; int start = input.mark(); try { synpred13_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred27_ANML() { state.backtracking++; int start = input.mark(); try { synpred27_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred38_ANML() { state.backtracking++; int start = input.mark(); try { synpred38_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred20_ANML() { state.backtracking++; int start = input.mark(); try { synpred20_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred39_ANML() { state.backtracking++; int start = input.mark(); try { synpred39_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred49_ANML() { state.backtracking++; int start = input.mark(); try { synpred49_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred12_ANML() { state.backtracking++; int start = input.mark(); try { synpred12_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred6_ANML() { state.backtracking++; int start = input.mark(); try { synpred6_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred30_ANML() { state.backtracking++; int start = input.mark(); try { synpred30_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred50_ANML() { state.backtracking++; int start = input.mark(); try { synpred50_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred41_ANML() { state.backtracking++; int start = input.mark(); try { synpred41_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred44_ANML() { state.backtracking++; int start = input.mark(); try { synpred44_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred1_ANML() { state.backtracking++; int start = input.mark(); try { synpred1_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred29_ANML() { state.backtracking++; int start = input.mark(); try { synpred29_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred43_ANML() { state.backtracking++; int start = input.mark(); try { synpred43_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred32_ANML() { state.backtracking++; int start = input.mark(); try { synpred32_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred2_ANML() { state.backtracking++; int start = input.mark(); try { synpred2_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred15_ANML() { state.backtracking++; int start = input.mark(); try { synpred15_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred34_ANML() { state.backtracking++; int start = input.mark(); try { synpred34_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred53_ANML() { state.backtracking++; int start = input.mark(); try { synpred53_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred36_ANML() { state.backtracking++; int start = input.mark(); try { synpred36_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred8_ANML() { state.backtracking++; int start = input.mark(); try { synpred8_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred17_ANML() { state.backtracking++; int start = input.mark(); try { synpred17_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred9_ANML() { state.backtracking++; int start = input.mark(); try { synpred9_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred25_ANML() { state.backtracking++; int start = input.mark(); try { synpred25_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred7_ANML() { state.backtracking++; int start = input.mark(); try { synpred7_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred57_ANML() { state.backtracking++; int start = input.mark(); try { synpred57_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred40_ANML() { state.backtracking++; int start = input.mark(); try { synpred40_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred23_ANML() { state.backtracking++; int start = input.mark(); try { synpred23_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred47_ANML() { state.backtracking++; int start = input.mark(); try { synpred47_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred45_ANML() { state.backtracking++; int start = input.mark(); try { synpred45_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred35_ANML() { state.backtracking++; int start = input.mark(); try { synpred35_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred21_ANML() { state.backtracking++; int start = input.mark(); try { synpred21_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred24_ANML() { state.backtracking++; int start = input.mark(); try { synpred24_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } public final boolean synpred33_ANML() { state.backtracking++; int start = input.mark(); try { synpred33_ANML_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } protected DFA1 dfa1 = new DFA1(this); protected DFA40 dfa40 = new DFA40(this); protected DFA42 dfa42 = new DFA42(this); protected DFA44 dfa44 = new DFA44(this); protected DFA45 dfa45 = new DFA45(this); protected DFA46 dfa46 = new DFA46(this); protected DFA47 dfa47 = new DFA47(this); protected DFA49 dfa49 = new DFA49(this); protected DFA66 dfa66 = new DFA66(this); protected DFA88 dfa88 = new DFA88(this); protected DFA89 dfa89 = new DFA89(this); protected DFA91 dfa91 = new DFA91(this); protected DFA93 dfa93 = new DFA93(this); protected DFA95 dfa95 = new DFA95(this); protected DFA97 dfa97 = new DFA97(this); protected DFA99 dfa99 = new DFA99(this); protected DFA101 dfa101 = new DFA101(this); protected DFA103 dfa103 = new DFA103(this); protected DFA105 dfa105 = new DFA105(this); protected DFA106 dfa106 = new DFA106(this); protected DFA109 dfa109 = new DFA109(this); protected DFA112 dfa112 = new DFA112(this); protected DFA115 dfa115 = new DFA115(this); protected DFA120 dfa120 = new DFA120(this); protected DFA121 dfa121 = new DFA121(this); static final String DFA1_eotS = "\15\uffff"; static final String DFA1_eofS = "\1\1\14\uffff"; static final String DFA1_minS = "\1\23\2\uffff\1\70\5\uffff\2\70\1\uffff\1\70"; static final String DFA1_maxS = "\1\176\2\uffff\1\121\5\uffff\1\121\1\166\1\uffff\1\166"; static final String DFA1_acceptS = "\1\uffff\1\10\1\1\1\uffff\1\2\1\3\1\4\1\6\1\7\2\uffff\1\5\1\uffff"; static final String DFA1_specialS = "\15\uffff}>"; static final String[] DFA1_transitionS = { "\1\2\1\5\1\uffff\1\4\2\uffff\1\6\5\uffff\2\10\23\uffff\1\10"+ "\3\uffff\1\10\10\uffff\1\5\3\uffff\1\10\3\uffff\1\10\1\uffff"+ "\2\5\1\3\1\10\1\uffff\2\10\2\uffff\1\7\2\10\2\uffff\1\10\1\uffff"+ "\2\10\10\uffff\1\10\1\uffff\1\10\7\uffff\1\10\4\uffff\2\10\1"+ "\uffff\10\10", "", "", "\1\12\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\10\uffff\1\11\1"+ "\uffff\2\13", "", "", "", "", "", "\1\14\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\11\uffff\3\13", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13", "", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13" }; static final short[] DFA1_eot = DFA.unpackEncodedString(DFA1_eotS); static final short[] DFA1_eof = DFA.unpackEncodedString(DFA1_eofS); static final char[] DFA1_min = DFA.unpackEncodedStringToUnsignedChars(DFA1_minS); static final char[] DFA1_max = DFA.unpackEncodedStringToUnsignedChars(DFA1_maxS); static final short[] DFA1_accept = DFA.unpackEncodedString(DFA1_acceptS); static final short[] DFA1_special = DFA.unpackEncodedString(DFA1_specialS); static final short[][] DFA1_transition; static { int numStates = DFA1_transitionS.length; DFA1_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA1_transition[i] = DFA.unpackEncodedString(DFA1_transitionS[i]); } } class DFA1 extends DFA { public DFA1(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 1; this.eot = DFA1_eot; this.eof = DFA1_eof; this.min = DFA1_min; this.max = DFA1_max; this.accept = DFA1_accept; this.special = DFA1_special; this.transition = DFA1_transition; } public String getDescription() { return "()* loopback of 181:2: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )*"; } } static final String DFA40_eotS = "\15\uffff"; static final String DFA40_eofS = "\15\uffff"; static final String DFA40_minS = "\1\23\2\uffff\1\70\5\uffff\2\70\1\uffff\1\70"; static final String DFA40_maxS = "\1\176\2\uffff\1\121\5\uffff\1\121\1\166\1\uffff\1\166"; static final String DFA40_acceptS = "\1\uffff\1\10\1\1\1\uffff\1\2\1\3\1\4\1\6\1\7\2\uffff\1\5\1\uffff"; static final String DFA40_specialS = "\15\uffff}>"; static final String[] DFA40_transitionS = { "\1\2\1\5\1\uffff\1\4\2\uffff\1\6\5\uffff\2\10\23\uffff\1\10"+ "\3\uffff\1\10\10\uffff\1\5\3\uffff\1\10\3\uffff\1\10\1\uffff"+ "\2\5\1\3\1\10\1\1\2\10\2\uffff\1\7\2\10\2\uffff\1\10\1\uffff"+ "\2\10\10\uffff\1\10\1\uffff\1\10\7\uffff\1\10\4\uffff\2\10\1"+ "\uffff\10\10", "", "", "\1\12\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\10\uffff\1\11\1"+ "\uffff\2\13", "", "", "", "", "", "\1\14\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\11\uffff\3\13", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13", "", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13" }; static final short[] DFA40_eot = DFA.unpackEncodedString(DFA40_eotS); static final short[] DFA40_eof = DFA.unpackEncodedString(DFA40_eofS); static final char[] DFA40_min = DFA.unpackEncodedStringToUnsignedChars(DFA40_minS); static final char[] DFA40_max = DFA.unpackEncodedStringToUnsignedChars(DFA40_maxS); static final short[] DFA40_accept = DFA.unpackEncodedString(DFA40_acceptS); static final short[] DFA40_special = DFA.unpackEncodedString(DFA40_specialS); static final short[][] DFA40_transition; static { int numStates = DFA40_transitionS.length; DFA40_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA40_transition[i] = DFA.unpackEncodedString(DFA40_transitionS[i]); } } class DFA40 extends DFA { public DFA40(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 40; this.eot = DFA40_eot; this.eof = DFA40_eof; this.min = DFA40_min; this.max = DFA40_max; this.accept = DFA40_accept; this.special = DFA40_special; this.transition = DFA40_transition; } public String getDescription() { return "()+ loopback of 381:3: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )+"; } } static final String DFA42_eotS = "\15\uffff"; static final String DFA42_eofS = "\15\uffff"; static final String DFA42_minS = "\1\23\2\uffff\1\70\5\uffff\2\70\1\uffff\1\70"; static final String DFA42_maxS = "\1\176\2\uffff\1\121\5\uffff\1\121\1\166\1\uffff\1\166"; static final String DFA42_acceptS = "\1\uffff\1\10\1\1\1\uffff\1\2\1\3\1\4\1\6\1\7\2\uffff\1\5\1\uffff"; static final String DFA42_specialS = "\15\uffff}>"; static final String[] DFA42_transitionS = { "\1\2\1\5\1\uffff\1\4\2\uffff\1\6\5\uffff\2\10\23\uffff\1\10"+ "\3\uffff\1\10\10\uffff\1\5\3\uffff\1\10\3\uffff\1\10\1\uffff"+ "\2\5\1\3\1\10\1\1\2\10\2\uffff\1\7\2\10\1\uffff\1\1\1\10\1\uffff"+ "\2\10\10\uffff\1\10\1\uffff\1\10\7\uffff\1\10\4\uffff\2\10\1"+ "\uffff\10\10", "", "", "\1\12\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\10\uffff\1\11\1"+ "\uffff\2\13", "", "", "", "", "", "\1\14\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\11\uffff\3\13", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13", "", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13" }; static final short[] DFA42_eot = DFA.unpackEncodedString(DFA42_eotS); static final short[] DFA42_eof = DFA.unpackEncodedString(DFA42_eofS); static final char[] DFA42_min = DFA.unpackEncodedStringToUnsignedChars(DFA42_minS); static final char[] DFA42_max = DFA.unpackEncodedStringToUnsignedChars(DFA42_maxS); static final short[] DFA42_accept = DFA.unpackEncodedString(DFA42_acceptS); static final short[] DFA42_special = DFA.unpackEncodedString(DFA42_specialS); static final short[][] DFA42_transition; static { int numStates = DFA42_transitionS.length; DFA42_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA42_transition[i] = DFA.unpackEncodedString(DFA42_transitionS[i]); } } class DFA42 extends DFA { public DFA42(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 42; this.eot = DFA42_eot; this.eof = DFA42_eof; this.min = DFA42_min; this.max = DFA42_max; this.accept = DFA42_accept; this.special = DFA42_special; this.transition = DFA42_transition; } public String getDescription() { return "()* loopback of 456:3: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )*"; } } static final String DFA44_eotS = "\15\uffff"; static final String DFA44_eofS = "\15\uffff"; static final String DFA44_minS = "\1\23\2\uffff\1\70\5\uffff\2\70\1\uffff\1\70"; static final String DFA44_maxS = "\1\176\2\uffff\1\121\5\uffff\1\121\1\166\1\uffff\1\166"; static final String DFA44_acceptS = "\1\uffff\1\10\1\1\1\uffff\1\2\1\3\1\4\1\6\1\7\2\uffff\1\5\1\uffff"; static final String DFA44_specialS = "\15\uffff}>"; static final String[] DFA44_transitionS = { "\1\2\1\5\1\uffff\1\4\2\uffff\1\6\5\uffff\2\10\23\uffff\1\10"+ "\3\uffff\1\10\10\uffff\1\5\3\uffff\1\10\3\uffff\1\10\1\uffff"+ "\2\5\1\3\1\10\1\1\2\10\2\uffff\1\7\2\10\1\uffff\1\1\1\10\1\uffff"+ "\2\10\10\uffff\1\10\1\uffff\1\10\7\uffff\1\10\4\uffff\2\10\1"+ "\uffff\10\10", "", "", "\1\12\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\10\uffff\1\11\1"+ "\uffff\2\13", "", "", "", "", "", "\1\14\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\11\uffff\3\13", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13", "", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13" }; static final short[] DFA44_eot = DFA.unpackEncodedString(DFA44_eotS); static final short[] DFA44_eof = DFA.unpackEncodedString(DFA44_eofS); static final char[] DFA44_min = DFA.unpackEncodedStringToUnsignedChars(DFA44_minS); static final char[] DFA44_max = DFA.unpackEncodedStringToUnsignedChars(DFA44_maxS); static final short[] DFA44_accept = DFA.unpackEncodedString(DFA44_acceptS); static final short[] DFA44_special = DFA.unpackEncodedString(DFA44_specialS); static final short[][] DFA44_transition; static { int numStates = DFA44_transitionS.length; DFA44_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA44_transition[i] = DFA.unpackEncodedString(DFA44_transitionS[i]); } } class DFA44 extends DFA { public DFA44(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 44; this.eot = DFA44_eot; this.eof = DFA44_eof; this.min = DFA44_min; this.max = DFA44_max; this.accept = DFA44_accept; this.special = DFA44_special; this.transition = DFA44_transition; } public String getDescription() { return "()* loopback of 478:3: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )*"; } } static final String DFA45_eotS = "\15\uffff"; static final String DFA45_eofS = "\15\uffff"; static final String DFA45_minS = "\1\23\2\uffff\1\70\5\uffff\2\70\1\uffff\1\70"; static final String DFA45_maxS = "\1\176\2\uffff\1\121\5\uffff\1\121\1\166\1\uffff\1\166"; static final String DFA45_acceptS = "\1\uffff\1\10\1\1\1\uffff\1\2\1\3\1\4\1\6\1\7\2\uffff\1\5\1\uffff"; static final String DFA45_specialS = "\15\uffff}>"; static final String[] DFA45_transitionS = { "\1\2\1\5\1\uffff\1\4\2\uffff\1\6\5\uffff\2\10\23\uffff\1\10"+ "\3\uffff\1\10\10\uffff\1\5\3\uffff\1\10\3\uffff\1\10\1\uffff"+ "\2\5\1\3\1\10\1\1\2\10\2\uffff\1\7\2\10\2\uffff\1\10\1\uffff"+ "\2\10\10\uffff\1\10\1\uffff\1\10\7\uffff\1\10\4\uffff\2\10\1"+ "\uffff\10\10", "", "", "\1\12\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\10\uffff\1\11\1"+ "\uffff\2\13", "", "", "", "", "", "\1\14\4\uffff\1\2\1\uffff\1\2\5\uffff\1\13\11\uffff\3\13", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13", "", "\1\2\11\uffff\2\2\1\uffff\1\13\3\uffff\1\13\10\uffff\2\13\42"+ "\uffff\1\13" }; static final short[] DFA45_eot = DFA.unpackEncodedString(DFA45_eotS); static final short[] DFA45_eof = DFA.unpackEncodedString(DFA45_eofS); static final char[] DFA45_min = DFA.unpackEncodedStringToUnsignedChars(DFA45_minS); static final char[] DFA45_max = DFA.unpackEncodedStringToUnsignedChars(DFA45_maxS); static final short[] DFA45_accept = DFA.unpackEncodedString(DFA45_acceptS); static final short[] DFA45_special = DFA.unpackEncodedString(DFA45_specialS); static final short[][] DFA45_transition; static { int numStates = DFA45_transitionS.length; DFA45_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA45_transition[i] = DFA.unpackEncodedString(DFA45_transitionS[i]); } } class DFA45 extends DFA { public DFA45(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 45; this.eot = DFA45_eot; this.eof = DFA45_eof; this.min = DFA45_min; this.max = DFA45_max; this.accept = DFA45_accept; this.special = DFA45_special; this.transition = DFA45_transition; } public String getDescription() { return "()* loopback of 499:3: (t+= type_decl | c+= const_decl | f+= fluent_decl | a+= action_decl | s+= fact_decl | s+= goal_decl | s+= stmt )*"; } } static final String DFA46_eotS = "\33\uffff"; static final String DFA46_eofS = "\33\uffff"; static final String DFA46_minS = "\1\37\1\uffff\6\0\23\uffff"; static final String DFA46_maxS = "\1\176\1\uffff\6\0\23\uffff"; static final String DFA46_acceptS = "\1\uffff\1\1\6\uffff\15\1\1\2\1\5\1\3\1\4\1\6\1\7"; static final String DFA46_specialS = "\1\0\1\uffff\1\1\1\2\1\3\1\4\1\5\1\6\23\uffff}>"; static final String[] DFA46_transitionS = { "\1\13\1\17\23\uffff\1\26\3\uffff\1\1\14\uffff\1\24\3\uffff\1"+ "\3\4\uffff\1\25\1\uffff\1\10\1\12\3\uffff\1\2\1\16\2\uffff\1"+ "\5\1\uffff\1\6\1\7\10\uffff\1\23\1\uffff\1\4\7\uffff\1\11\4"+ "\uffff\1\20\1\21\1\uffff\1\14\1\15\6\22", "", "\1\uffff", "\1\uffff", "\1\uffff", "\1\uffff", "\1\uffff", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA46_eot = DFA.unpackEncodedString(DFA46_eotS); static final short[] DFA46_eof = DFA.unpackEncodedString(DFA46_eofS); static final char[] DFA46_min = DFA.unpackEncodedStringToUnsignedChars(DFA46_minS); static final char[] DFA46_max = DFA.unpackEncodedStringToUnsignedChars(DFA46_maxS); static final short[] DFA46_accept = DFA.unpackEncodedString(DFA46_acceptS); static final short[] DFA46_special = DFA.unpackEncodedString(DFA46_specialS); static final short[][] DFA46_transition; static { int numStates = DFA46_transitionS.length; DFA46_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA46_transition[i] = DFA.unpackEncodedString(DFA46_transitionS[i]); } } class DFA46 extends DFA { public DFA46(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 46; this.eot = DFA46_eot; this.eof = DFA46_eof; this.min = DFA46_min; this.max = DFA46_max; this.accept = DFA46_accept; this.special = DFA46_special; this.transition = DFA46_transition; } public String getDescription() { return "518:1: stmt : ( ( stmt_primitive )=> stmt_primitive | ( stmt_block )=> stmt_block | ( stmt_timed )=> stmt_timed | stmt_contains | stmt_when | stmt_forall | stmt_exists );"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA46_0 = input.LA(1); int index46_0 = input.index(); input.rewind(); s = -1; if ( (LA46_0==ID) && (synpred3_ANML())) {s = 1;} else if ( (LA46_0==LeftB) ) {s = 2;} else if ( (LA46_0==LeftP) ) {s = 3;} else if ( (LA46_0==Dots) ) {s = 4;} else if ( (LA46_0==Contains) ) {s = 5;} else if ( (LA46_0==ForAll) ) {s = 6;} else if ( (LA46_0==Exists) ) {s = 7;} else if ( (LA46_0==NotLog) && (synpred3_ANML())) {s = 8;} else if ( (LA46_0==Minus) && (synpred3_ANML())) {s = 9;} else if ( (LA46_0==NotBit) && (synpred3_ANML())) {s = 10;} else if ( (LA46_0==Bra) && (synpred3_ANML())) {s = 11;} else if ( (LA46_0==Start) && (synpred3_ANML())) {s = 12;} else if ( (LA46_0==End) && (synpred3_ANML())) {s = 13;} else if ( (LA46_0==Duration) && (synpred3_ANML())) {s = 14;} else if ( (LA46_0==Ket) && (synpred3_ANML())) {s = 15;} else if ( (LA46_0==Unordered) && (synpred3_ANML())) {s = 16;} else if ( (LA46_0==Ordered) && (synpred3_ANML())) {s = 17;} else if ( ((LA46_0>=INT && LA46_0<=Infinity)) && (synpred3_ANML())) {s = 18;} else if ( (LA46_0==Delta) && (synpred3_ANML())) {s = 19;} else if ( (LA46_0==Semi) && (synpred3_ANML())) {s = 20;} else if ( (LA46_0==LeftC) && (synpred4_ANML())) {s = 21;} else if ( (LA46_0==When) ) {s = 22;} input.seek(index46_0); if ( s>=0 ) return s; break; case 1 : int LA46_2 = input.LA(1); int index46_2 = input.index(); input.rewind(); s = -1; if ( (synpred3_ANML()) ) {s = 20;} else if ( (synpred5_ANML()) ) {s = 23;} input.seek(index46_2); if ( s>=0 ) return s; break; case 2 : int LA46_3 = input.LA(1); int index46_3 = input.index(); input.rewind(); s = -1; if ( (synpred3_ANML()) ) {s = 20;} else if ( (synpred5_ANML()) ) {s = 23;} input.seek(index46_3); if ( s>=0 ) return s; break; case 3 : int LA46_4 = input.LA(1); int index46_4 = input.index(); input.rewind(); s = -1; if ( (synpred3_ANML()) ) {s = 20;} else if ( (synpred5_ANML()) ) {s = 23;} input.seek(index46_4); if ( s>=0 ) return s; break; case 4 : int LA46_5 = input.LA(1); int index46_5 = input.index(); input.rewind(); s = -1; if ( (synpred3_ANML()) ) {s = 20;} else if ( (true) ) {s = 24;} input.seek(index46_5); if ( s>=0 ) return s; break; case 5 : int LA46_6 = input.LA(1); int index46_6 = input.index(); input.rewind(); s = -1; if ( (synpred3_ANML()) ) {s = 20;} else if ( (true) ) {s = 25;} input.seek(index46_6); if ( s>=0 ) return s; break; case 6 : int LA46_7 = input.LA(1); int index46_7 = input.index(); input.rewind(); s = -1; if ( (synpred3_ANML()) ) {s = 20;} else if ( (true) ) {s = 26;} input.seek(index46_7); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 46, _s, input); error(nvae); throw nvae; } } static final String DFA47_eotS = "\30\uffff"; static final String DFA47_eofS = "\30\uffff"; static final String DFA47_minS = "\1\37\3\0\24\uffff"; static final String DFA47_maxS = "\1\176\3\0\24\uffff"; static final String DFA47_acceptS = "\4\uffff\1\2\22\uffff\1\1"; static final String DFA47_specialS = "\1\uffff\1\0\1\1\1\2\24\uffff}>"; static final String[] DFA47_transitionS = { "\2\4\23\uffff\1\4\3\uffff\1\4\14\uffff\1\4\3\uffff\1\2\4\uffff"+ "\1\4\1\uffff\2\4\3\uffff\1\1\1\4\2\uffff\1\4\1\uffff\2\4\10"+ "\uffff\1\4\1\uffff\1\3\7\uffff\1\4\4\uffff\2\4\1\uffff\10\4", "\1\uffff", "\1\uffff", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA47_eot = DFA.unpackEncodedString(DFA47_eotS); static final short[] DFA47_eof = DFA.unpackEncodedString(DFA47_eofS); static final char[] DFA47_min = DFA.unpackEncodedStringToUnsignedChars(DFA47_minS); static final char[] DFA47_max = DFA.unpackEncodedStringToUnsignedChars(DFA47_maxS); static final short[] DFA47_accept = DFA.unpackEncodedString(DFA47_acceptS); static final short[] DFA47_special = DFA.unpackEncodedString(DFA47_specialS); static final short[][] DFA47_transition; static { int numStates = DFA47_transitionS.length; DFA47_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA47_transition[i] = DFA.unpackEncodedString(DFA47_transitionS[i]); } } class DFA47 extends DFA { public DFA47(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 47; this.eot = DFA47_eot; this.eof = DFA47_eof; this.min = DFA47_min; this.max = DFA47_max; this.accept = DFA47_accept; this.special = DFA47_special; this.transition = DFA47_transition; } public String getDescription() { return "530:3: ( ( exist_time stmt )=> exist_time stmt -> ^( ContainsSomeStmt[$Contains] exist_time stmt ) | stmt -> ^( ContainsAllStmt[$Contains] stmt ) )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA47_1 = input.LA(1); int index47_1 = input.index(); input.rewind(); s = -1; if ( (synpred6_ANML()) ) {s = 23;} else if ( (true) ) {s = 4;} input.seek(index47_1); if ( s>=0 ) return s; break; case 1 : int LA47_2 = input.LA(1); int index47_2 = input.index(); input.rewind(); s = -1; if ( (synpred6_ANML()) ) {s = 23;} else if ( (true) ) {s = 4;} input.seek(index47_2); if ( s>=0 ) return s; break; case 2 : int LA47_3 = input.LA(1); int index47_3 = input.index(); input.rewind(); s = -1; if ( (synpred6_ANML()) ) {s = 23;} else if ( (true) ) {s = 4;} input.seek(index47_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 47, _s, input); error(nvae); throw nvae; } } static final String DFA49_eotS = "\27\uffff"; static final String DFA49_eofS = "\27\uffff"; static final String DFA49_minS = "\1\37\4\0\6\uffff\5\0\7\uffff"; static final String DFA49_maxS = "\1\176\4\0\6\uffff\5\0\7\uffff"; static final String DFA49_acceptS = "\5\uffff\6\1\5\uffff\3\1\1\3\1\5\1\2\1\4"; static final String DFA49_specialS = "\1\0\1\1\1\2\1\3\1\4\6\uffff\1\5\1\6\1\7\1\10\1\11\7\uffff}>"; static final String[] DFA49_transitionS = { "\1\13\1\17\27\uffff\1\1\14\uffff\1\24\3\uffff\1\3\6\uffff\1"+ "\10\1\12\3\uffff\1\2\1\16\2\uffff\1\5\1\uffff\1\6\1\7\10\uffff"+ "\1\23\1\uffff\1\4\7\uffff\1\11\4\uffff\1\20\1\21\1\uffff\1\14"+ "\1\15\6\22", "\1\uffff", "\1\uffff", "\1\uffff", "\1\uffff", "", "", "", "", "", "", "\1\uffff", "\1\uffff", "\1\uffff", "\1\uffff", "\1\uffff", "", "", "", "", "", "", "" }; static final short[] DFA49_eot = DFA.unpackEncodedString(DFA49_eotS); static final short[] DFA49_eof = DFA.unpackEncodedString(DFA49_eofS); static final char[] DFA49_min = DFA.unpackEncodedStringToUnsignedChars(DFA49_minS); static final char[] DFA49_max = DFA.unpackEncodedStringToUnsignedChars(DFA49_maxS); static final short[] DFA49_accept = DFA.unpackEncodedString(DFA49_acceptS); static final short[] DFA49_special = DFA.unpackEncodedString(DFA49_specialS); static final short[][] DFA49_transition; static { int numStates = DFA49_transitionS.length; DFA49_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA49_transition[i] = DFA.unpackEncodedString(DFA49_transitionS[i]); } } class DFA49 extends DFA { public DFA49(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 49; this.eot = DFA49_eot; this.eof = DFA49_eof; this.min = DFA49_min; this.max = DFA49_max; this.accept = DFA49_accept; this.special = DFA49_special; this.transition = DFA49_transition; } public String getDescription() { return "561:1: stmt_primitive : ( ( expr Semi )=> expr Semi | ( stmt_chain Semi )=> stmt_chain Semi | ( stmt_delta_chain Semi )=> stmt_delta_chain Semi | ( stmt_timeless Semi )=> stmt_timeless Semi | Semi -> Skip );"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA49_0 = input.LA(1); int index49_0 = input.index(); input.rewind(); s = -1; if ( (LA49_0==ID) ) {s = 1;} else if ( (LA49_0==LeftB) ) {s = 2;} else if ( (LA49_0==LeftP) ) {s = 3;} else if ( (LA49_0==Dots) ) {s = 4;} else if ( (LA49_0==Contains) && (synpred8_ANML())) {s = 5;} else if ( (LA49_0==ForAll) && (synpred8_ANML())) {s = 6;} else if ( (LA49_0==Exists) && (synpred8_ANML())) {s = 7;} else if ( (LA49_0==NotLog) && (synpred8_ANML())) {s = 8;} else if ( (LA49_0==Minus) && (synpred8_ANML())) {s = 9;} else if ( (LA49_0==NotBit) && (synpred8_ANML())) {s = 10;} else if ( (LA49_0==Bra) ) {s = 11;} else if ( (LA49_0==Start) ) {s = 12;} else if ( (LA49_0==End) ) {s = 13;} else if ( (LA49_0==Duration) ) {s = 14;} else if ( (LA49_0==Ket) ) {s = 15;} else if ( (LA49_0==Unordered) && (synpred8_ANML())) {s = 16;} else if ( (LA49_0==Ordered) && (synpred8_ANML())) {s = 17;} else if ( ((LA49_0>=INT && LA49_0<=Infinity)) && (synpred8_ANML())) {s = 18;} else if ( (LA49_0==Delta) && (synpred10_ANML())) {s = 19;} else if ( (LA49_0==Semi) ) {s = 20;} input.seek(index49_0); if ( s>=0 ) return s; break; case 1 : int LA49_1 = input.LA(1); int index49_1 = input.index(); input.rewind(); s = -1; if ( (synpred8_ANML()) ) {s = 18;} else if ( (synpred9_ANML()) ) {s = 21;} input.seek(index49_1); if ( s>=0 ) return s; break; case 2 : int LA49_2 = input.LA(1); int index49_2 = input.index(); input.rewind(); s = -1; if ( (synpred8_ANML()) ) {s = 18;} else if ( (synpred9_ANML()) ) {s = 21;} else if ( (synpred10_ANML()) ) {s = 19;} input.seek(index49_2); if ( s>=0 ) return s; break; case 3 : int LA49_3 = input.LA(1); int index49_3 = input.index(); input.rewind(); s = -1; if ( (synpred8_ANML()) ) {s = 18;} else if ( (synpred9_ANML()) ) {s = 21;} else if ( (synpred10_ANML()) ) {s = 19;} input.seek(index49_3); if ( s>=0 ) return s; break; case 4 : int LA49_4 = input.LA(1); int index49_4 = input.index(); input.rewind(); s = -1; if ( (synpred8_ANML()) ) {s = 18;} else if ( (synpred9_ANML()) ) {s = 21;} else if ( (synpred10_ANML()) ) {s = 19;} input.seek(index49_4); if ( s>=0 ) return s; break; case 5 : int LA49_11 = input.LA(1); int index49_11 = input.index(); input.rewind(); s = -1; if ( (synpred8_ANML()) ) {s = 18;} else if ( (synpred11_ANML()) ) {s = 22;} input.seek(index49_11); if ( s>=0 ) return s; break; case 6 : int LA49_12 = input.LA(1); int index49_12 = input.index(); input.rewind(); s = -1; if ( (synpred8_ANML()) ) {s = 18;} else if ( (synpred11_ANML()) ) {s = 22;} input.seek(index49_12); if ( s>=0 ) return s; break; case 7 : int LA49_13 = input.LA(1); int index49_13 = input.index(); input.rewind(); s = -1; if ( (synpred8_ANML()) ) {s = 18;} else if ( (synpred11_ANML()) ) {s = 22;} input.seek(index49_13); if ( s>=0 ) return s; break; case 8 : int LA49_14 = input.LA(1); int index49_14 = input.index(); input.rewind(); s = -1; if ( (synpred8_ANML()) ) {s = 18;} else if ( (synpred11_ANML()) ) {s = 22;} input.seek(index49_14); if ( s>=0 ) return s; break; case 9 : int LA49_15 = input.LA(1); int index49_15 = input.index(); input.rewind(); s = -1; if ( (synpred8_ANML()) ) {s = 18;} else if ( (synpred11_ANML()) ) {s = 22;} input.seek(index49_15); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 49, _s, input); error(nvae); throw nvae; } } static final String DFA66_eotS = "\16\uffff"; static final String DFA66_eofS = "\16\uffff"; static final String DFA66_minS = "\2\102\1\37\6\uffff\1\37\4\uffff"; static final String DFA66_maxS = "\2\u0082\1\176\6\uffff\1\176\4\uffff"; static final String DFA66_acceptS = "\3\uffff\1\2\1\3\1\4\1\5\1\6\1\7\1\uffff\1\10\1\11\1\12\1\1"; static final String DFA66_specialS = "\16\uffff}>"; static final String[] DFA66_transitionS = { "\1\12\1\2\2\uffff\1\1\1\uffff\1\14\12\uffff\1\11\11\uffff\1"+ "\3\1\4\1\5\1\6\1\7\2\10\1\13\32\uffff\4\12", "\1\12\1\2\4\uffff\1\14\12\uffff\1\11\11\uffff\1\3\1\4\1\5\1"+ "\6\1\7\2\10\1\13\32\uffff\4\12", "\2\15\27\uffff\1\15\16\uffff\1\14\1\uffff\1\15\7\uffff\1\15"+ "\3\uffff\2\15\2\uffff\1\15\1\uffff\2\15\12\uffff\1\15\7\uffff"+ "\1\15\4\uffff\2\15\1\uffff\10\15", "", "", "", "", "", "", "\2\12\27\uffff\1\12\20\uffff\1\12\7\uffff\1\12\3\uffff\2\12"+ "\2\uffff\1\12\1\uffff\2\12\7\uffff\1\13\2\uffff\1\12\7\uffff"+ "\1\12\4\uffff\2\12\1\uffff\10\12", "", "", "", "" }; static final short[] DFA66_eot = DFA.unpackEncodedString(DFA66_eotS); static final short[] DFA66_eof = DFA.unpackEncodedString(DFA66_eofS); static final char[] DFA66_min = DFA.unpackEncodedStringToUnsignedChars(DFA66_minS); static final char[] DFA66_max = DFA.unpackEncodedStringToUnsignedChars(DFA66_maxS); static final short[] DFA66_accept = DFA.unpackEncodedString(DFA66_acceptS); static final short[] DFA66_special = DFA.unpackEncodedString(DFA66_specialS); static final short[][] DFA66_transition; static { int numStates = DFA66_transitionS.length; DFA66_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA66_transition[i] = DFA.unpackEncodedString(DFA66_transitionS[i]); } } class DFA66 extends DFA { public DFA66(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 66; this.eot = DFA66_eot; this.eof = DFA66_eof; this.min = DFA66_min; this.max = DFA66_max; this.accept = DFA66_accept; this.special = DFA66_special; this.transition = DFA66_transition; } public String getDescription() { return "575:1: stmt_chain_1 : ( ( Comma )? Assign e_num | ( Comma )? o= Change b= e_num -> Undefine ^( Assign $b) | ( Comma )? o= Produce b= e_num | ( Comma )? o= Consume b= e_num | ( Comma )? o= Lend b= e_num -> ^( Produce $b) Skip ^( Consume $b) | ( Comma )? o= Use b= e_num -> ^( Consume $b) Skip ^( Produce $b) | ( Comma )? (o= Within | o= SetAssign ) s= set | ( Comma )? i= num_relop b= e_num | ( Comma )? (o= Equal Skip | o= Skip ) -> Skip | ( Comma )? (o= Assign Undefined | o= Undefine ) -> Undefine );"; } } static final String DFA88_eotS = "\23\uffff"; static final String DFA88_eofS = "\23\uffff"; static final String DFA88_minS = "\1\37\1\0\1\uffff\1\0\17\uffff"; static final String DFA88_maxS = "\1\176\1\0\1\uffff\1\0\17\uffff"; static final String DFA88_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\12\uffff"; static final String DFA88_specialS = "\1\0\1\1\1\uffff\1\2\17\uffff}>"; static final String[] DFA88_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\6\uffff\2\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA88_eot = DFA.unpackEncodedString(DFA88_eotS); static final short[] DFA88_eof = DFA.unpackEncodedString(DFA88_eofS); static final char[] DFA88_min = DFA.unpackEncodedStringToUnsignedChars(DFA88_minS); static final char[] DFA88_max = DFA.unpackEncodedStringToUnsignedChars(DFA88_maxS); static final short[] DFA88_accept = DFA.unpackEncodedString(DFA88_acceptS); static final short[] DFA88_special = DFA.unpackEncodedString(DFA88_specialS); static final short[][] DFA88_transition; static { int numStates = DFA88_transitionS.length; DFA88_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA88_transition[i] = DFA.unpackEncodedString(DFA88_transitionS[i]); } } class DFA88 extends DFA { public DFA88(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 88; this.eot = DFA88_eot; this.eof = DFA88_eof; this.min = DFA88_min; this.max = DFA88_max; this.accept = DFA88_accept; this.special = DFA88_special; this.transition = DFA88_transition; } public String getDescription() { return "689:1: expr : ( ( e_prefix )=> e_prefix | e_log_1 );"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA88_0 = input.LA(1); int index88_0 = input.index(); input.rewind(); s = -1; if ( (LA88_0==ID) ) {s = 1;} else if ( (LA88_0==LeftB) && (synpred25_ANML())) {s = 2;} else if ( (LA88_0==LeftP) ) {s = 3;} else if ( (LA88_0==Dots) && (synpred25_ANML())) {s = 4;} else if ( (LA88_0==Contains) && (synpred25_ANML())) {s = 5;} else if ( (LA88_0==ForAll) && (synpred25_ANML())) {s = 6;} else if ( (LA88_0==Exists) && (synpred25_ANML())) {s = 7;} else if ( ((LA88_0>=Bra && LA88_0<=Ket)||(LA88_0>=NotLog && LA88_0<=NotBit)||LA88_0==Duration||LA88_0==Minus||(LA88_0>=Unordered && LA88_0<=Ordered)||(LA88_0>=Start && LA88_0<=Infinity)) ) {s = 8;} input.seek(index88_0); if ( s>=0 ) return s; break; case 1 : int LA88_1 = input.LA(1); int index88_1 = input.index(); input.rewind(); s = -1; if ( (synpred25_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index88_1); if ( s>=0 ) return s; break; case 2 : int LA88_3 = input.LA(1); int index88_3 = input.index(); input.rewind(); s = -1; if ( (synpred25_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index88_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 88, _s, input); error(nvae); throw nvae; } } static final String DFA89_eotS = "\24\uffff"; static final String DFA89_eofS = "\24\uffff"; static final String DFA89_minS = "\1\37\3\0\20\uffff"; static final String DFA89_maxS = "\1\176\3\0\20\uffff"; static final String DFA89_acceptS = "\4\uffff\1\2\16\uffff\1\1"; static final String DFA89_specialS = "\1\uffff\1\0\1\1\1\2\20\uffff}>"; static final String[] DFA89_transitionS = { "\2\4\27\uffff\1\4\20\uffff\1\2\6\uffff\2\4\3\uffff\1\1\1\4\2"+ "\uffff\1\4\1\uffff\2\4\12\uffff\1\3\7\uffff\1\4\4\uffff\2\4"+ "\1\uffff\10\4", "\1\uffff", "\1\uffff", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA89_eot = DFA.unpackEncodedString(DFA89_eotS); static final short[] DFA89_eof = DFA.unpackEncodedString(DFA89_eofS); static final char[] DFA89_min = DFA.unpackEncodedStringToUnsignedChars(DFA89_minS); static final char[] DFA89_max = DFA.unpackEncodedStringToUnsignedChars(DFA89_maxS); static final short[] DFA89_accept = DFA.unpackEncodedString(DFA89_acceptS); static final short[] DFA89_special = DFA.unpackEncodedString(DFA89_specialS); static final short[][] DFA89_transition; static { int numStates = DFA89_transitionS.length; DFA89_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA89_transition[i] = DFA.unpackEncodedString(DFA89_transitionS[i]); } } class DFA89 extends DFA { public DFA89(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 89; this.eot = DFA89_eot; this.eof = DFA89_eof; this.min = DFA89_min; this.max = DFA89_max; this.accept = DFA89_accept; this.special = DFA89_special; this.transition = DFA89_transition; } public String getDescription() { return "704:3: ( ( exist_time expr )=> exist_time e= expr -> ^( ContainsSomeExpr[$Contains] exist_time $e) | e= expr -> ^( ContainsAllExpr[$Contains] $e) )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA89_1 = input.LA(1); int index89_1 = input.index(); input.rewind(); s = -1; if ( (synpred28_ANML()) ) {s = 19;} else if ( (true) ) {s = 4;} input.seek(index89_1); if ( s>=0 ) return s; break; case 1 : int LA89_2 = input.LA(1); int index89_2 = input.index(); input.rewind(); s = -1; if ( (synpred28_ANML()) ) {s = 19;} else if ( (true) ) {s = 4;} input.seek(index89_2); if ( s>=0 ) return s; break; case 2 : int LA89_3 = input.LA(1); int index89_3 = input.index(); input.rewind(); s = -1; if ( (synpred28_ANML()) ) {s = 19;} else if ( (true) ) {s = 4;} input.seek(index89_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 89, _s, input); error(nvae); throw nvae; } } static final String DFA91_eotS = "\23\uffff"; static final String DFA91_eofS = "\23\uffff"; static final String DFA91_minS = "\1\37\1\0\1\uffff\1\0\17\uffff"; static final String DFA91_maxS = "\1\176\1\0\1\uffff\1\0\17\uffff"; static final String DFA91_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\12\uffff"; static final String DFA91_specialS = "\1\0\1\1\1\uffff\1\2\17\uffff}>"; static final String[] DFA91_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\6\uffff\2\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA91_eot = DFA.unpackEncodedString(DFA91_eotS); static final short[] DFA91_eof = DFA.unpackEncodedString(DFA91_eofS); static final char[] DFA91_min = DFA.unpackEncodedStringToUnsignedChars(DFA91_minS); static final char[] DFA91_max = DFA.unpackEncodedStringToUnsignedChars(DFA91_maxS); static final short[] DFA91_accept = DFA.unpackEncodedString(DFA91_acceptS); static final short[] DFA91_special = DFA.unpackEncodedString(DFA91_specialS); static final short[][] DFA91_transition; static { int numStates = DFA91_transitionS.length; DFA91_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA91_transition[i] = DFA.unpackEncodedString(DFA91_transitionS[i]); } } class DFA91 extends DFA { public DFA91(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 91; this.eot = DFA91_eot; this.eof = DFA91_eof; this.min = DFA91_min; this.max = DFA91_max; this.accept = DFA91_accept; this.special = DFA91_special; this.transition = DFA91_transition; } public String getDescription() { return "722:33: ( ( e_prefix )=> e_prefix | e_log_1 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA91_0 = input.LA(1); int index91_0 = input.index(); input.rewind(); s = -1; if ( (LA91_0==ID) ) {s = 1;} else if ( (LA91_0==LeftB) && (synpred30_ANML())) {s = 2;} else if ( (LA91_0==LeftP) ) {s = 3;} else if ( (LA91_0==Dots) && (synpred30_ANML())) {s = 4;} else if ( (LA91_0==Contains) && (synpred30_ANML())) {s = 5;} else if ( (LA91_0==ForAll) && (synpred30_ANML())) {s = 6;} else if ( (LA91_0==Exists) && (synpred30_ANML())) {s = 7;} else if ( ((LA91_0>=Bra && LA91_0<=Ket)||(LA91_0>=NotLog && LA91_0<=NotBit)||LA91_0==Duration||LA91_0==Minus||(LA91_0>=Unordered && LA91_0<=Ordered)||(LA91_0>=Start && LA91_0<=Infinity)) ) {s = 8;} input.seek(index91_0); if ( s>=0 ) return s; break; case 1 : int LA91_1 = input.LA(1); int index91_1 = input.index(); input.rewind(); s = -1; if ( (synpred30_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index91_1); if ( s>=0 ) return s; break; case 2 : int LA91_3 = input.LA(1); int index91_3 = input.index(); input.rewind(); s = -1; if ( (synpred30_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index91_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 91, _s, input); error(nvae); throw nvae; } } static final String DFA93_eotS = "\23\uffff"; static final String DFA93_eofS = "\23\uffff"; static final String DFA93_minS = "\1\37\1\0\1\uffff\1\0\17\uffff"; static final String DFA93_maxS = "\1\176\1\0\1\uffff\1\0\17\uffff"; static final String DFA93_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\12\uffff"; static final String DFA93_specialS = "\1\0\1\1\1\uffff\1\2\17\uffff}>"; static final String[] DFA93_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\6\uffff\2\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA93_eot = DFA.unpackEncodedString(DFA93_eotS); static final short[] DFA93_eof = DFA.unpackEncodedString(DFA93_eofS); static final char[] DFA93_min = DFA.unpackEncodedStringToUnsignedChars(DFA93_minS); static final char[] DFA93_max = DFA.unpackEncodedStringToUnsignedChars(DFA93_maxS); static final short[] DFA93_accept = DFA.unpackEncodedString(DFA93_acceptS); static final short[] DFA93_special = DFA.unpackEncodedString(DFA93_specialS); static final short[][] DFA93_transition; static { int numStates = DFA93_transitionS.length; DFA93_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA93_transition[i] = DFA.unpackEncodedString(DFA93_transitionS[i]); } } class DFA93 extends DFA { public DFA93(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 93; this.eot = DFA93_eot; this.eof = DFA93_eof; this.min = DFA93_min; this.max = DFA93_max; this.accept = DFA93_accept; this.special = DFA93_special; this.transition = DFA93_transition; } public String getDescription() { return "726:35: ( ( e_prefix )=> e_prefix | e_log_3 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA93_0 = input.LA(1); int index93_0 = input.index(); input.rewind(); s = -1; if ( (LA93_0==ID) ) {s = 1;} else if ( (LA93_0==LeftB) && (synpred32_ANML())) {s = 2;} else if ( (LA93_0==LeftP) ) {s = 3;} else if ( (LA93_0==Dots) && (synpred32_ANML())) {s = 4;} else if ( (LA93_0==Contains) && (synpred32_ANML())) {s = 5;} else if ( (LA93_0==ForAll) && (synpred32_ANML())) {s = 6;} else if ( (LA93_0==Exists) && (synpred32_ANML())) {s = 7;} else if ( ((LA93_0>=Bra && LA93_0<=Ket)||(LA93_0>=NotLog && LA93_0<=NotBit)||LA93_0==Duration||LA93_0==Minus||(LA93_0>=Unordered && LA93_0<=Ordered)||(LA93_0>=Start && LA93_0<=Infinity)) ) {s = 8;} input.seek(index93_0); if ( s>=0 ) return s; break; case 1 : int LA93_1 = input.LA(1); int index93_1 = input.index(); input.rewind(); s = -1; if ( (synpred32_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index93_1); if ( s>=0 ) return s; break; case 2 : int LA93_3 = input.LA(1); int index93_3 = input.index(); input.rewind(); s = -1; if ( (synpred32_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index93_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 93, _s, input); error(nvae); throw nvae; } } static final String DFA95_eotS = "\23\uffff"; static final String DFA95_eofS = "\23\uffff"; static final String DFA95_minS = "\1\37\1\0\1\uffff\1\0\17\uffff"; static final String DFA95_maxS = "\1\176\1\0\1\uffff\1\0\17\uffff"; static final String DFA95_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\12\uffff"; static final String DFA95_specialS = "\1\0\1\1\1\uffff\1\2\17\uffff}>"; static final String[] DFA95_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\6\uffff\2\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA95_eot = DFA.unpackEncodedString(DFA95_eotS); static final short[] DFA95_eof = DFA.unpackEncodedString(DFA95_eofS); static final char[] DFA95_min = DFA.unpackEncodedStringToUnsignedChars(DFA95_minS); static final char[] DFA95_max = DFA.unpackEncodedStringToUnsignedChars(DFA95_maxS); static final short[] DFA95_accept = DFA.unpackEncodedString(DFA95_acceptS); static final short[] DFA95_special = DFA.unpackEncodedString(DFA95_specialS); static final short[][] DFA95_transition; static { int numStates = DFA95_transitionS.length; DFA95_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA95_transition[i] = DFA.unpackEncodedString(DFA95_transitionS[i]); } } class DFA95 extends DFA { public DFA95(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 95; this.eot = DFA95_eot; this.eof = DFA95_eof; this.min = DFA95_min; this.max = DFA95_max; this.accept = DFA95_accept; this.special = DFA95_special; this.transition = DFA95_transition; } public String getDescription() { return "730:31: ( ( e_prefix )=> e_prefix | e_log_4 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA95_0 = input.LA(1); int index95_0 = input.index(); input.rewind(); s = -1; if ( (LA95_0==ID) ) {s = 1;} else if ( (LA95_0==LeftB) && (synpred34_ANML())) {s = 2;} else if ( (LA95_0==LeftP) ) {s = 3;} else if ( (LA95_0==Dots) && (synpred34_ANML())) {s = 4;} else if ( (LA95_0==Contains) && (synpred34_ANML())) {s = 5;} else if ( (LA95_0==ForAll) && (synpred34_ANML())) {s = 6;} else if ( (LA95_0==Exists) && (synpred34_ANML())) {s = 7;} else if ( ((LA95_0>=Bra && LA95_0<=Ket)||(LA95_0>=NotLog && LA95_0<=NotBit)||LA95_0==Duration||LA95_0==Minus||(LA95_0>=Unordered && LA95_0<=Ordered)||(LA95_0>=Start && LA95_0<=Infinity)) ) {s = 8;} input.seek(index95_0); if ( s>=0 ) return s; break; case 1 : int LA95_1 = input.LA(1); int index95_1 = input.index(); input.rewind(); s = -1; if ( (synpred34_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index95_1); if ( s>=0 ) return s; break; case 2 : int LA95_3 = input.LA(1); int index95_3 = input.index(); input.rewind(); s = -1; if ( (synpred34_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index95_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 95, _s, input); error(nvae); throw nvae; } } static final String DFA97_eotS = "\23\uffff"; static final String DFA97_eofS = "\23\uffff"; static final String DFA97_minS = "\1\37\1\0\1\uffff\1\0\17\uffff"; static final String DFA97_maxS = "\1\176\1\0\1\uffff\1\0\17\uffff"; static final String DFA97_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\12\uffff"; static final String DFA97_specialS = "\1\0\1\1\1\uffff\1\2\17\uffff}>"; static final String[] DFA97_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\6\uffff\2\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA97_eot = DFA.unpackEncodedString(DFA97_eotS); static final short[] DFA97_eof = DFA.unpackEncodedString(DFA97_eofS); static final char[] DFA97_min = DFA.unpackEncodedStringToUnsignedChars(DFA97_minS); static final char[] DFA97_max = DFA.unpackEncodedStringToUnsignedChars(DFA97_maxS); static final short[] DFA97_accept = DFA.unpackEncodedString(DFA97_acceptS); static final short[] DFA97_special = DFA.unpackEncodedString(DFA97_specialS); static final short[][] DFA97_transition; static { int numStates = DFA97_transitionS.length; DFA97_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA97_transition[i] = DFA.unpackEncodedString(DFA97_transitionS[i]); } } class DFA97 extends DFA { public DFA97(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 97; this.eot = DFA97_eot; this.eof = DFA97_eof; this.min = DFA97_min; this.max = DFA97_max; this.accept = DFA97_accept; this.special = DFA97_special; this.transition = DFA97_transition; } public String getDescription() { return "746:29: ( ( e_prefix )=> e_prefix | e_log_5 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA97_0 = input.LA(1); int index97_0 = input.index(); input.rewind(); s = -1; if ( (LA97_0==ID) ) {s = 1;} else if ( (LA97_0==LeftB) && (synpred36_ANML())) {s = 2;} else if ( (LA97_0==LeftP) ) {s = 3;} else if ( (LA97_0==Dots) && (synpred36_ANML())) {s = 4;} else if ( (LA97_0==Contains) && (synpred36_ANML())) {s = 5;} else if ( (LA97_0==ForAll) && (synpred36_ANML())) {s = 6;} else if ( (LA97_0==Exists) && (synpred36_ANML())) {s = 7;} else if ( ((LA97_0>=Bra && LA97_0<=Ket)||(LA97_0>=NotLog && LA97_0<=NotBit)||LA97_0==Duration||LA97_0==Minus||(LA97_0>=Unordered && LA97_0<=Ordered)||(LA97_0>=Start && LA97_0<=Infinity)) ) {s = 8;} input.seek(index97_0); if ( s>=0 ) return s; break; case 1 : int LA97_1 = input.LA(1); int index97_1 = input.index(); input.rewind(); s = -1; if ( (synpred36_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index97_1); if ( s>=0 ) return s; break; case 2 : int LA97_3 = input.LA(1); int index97_3 = input.index(); input.rewind(); s = -1; if ( (synpred36_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index97_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 97, _s, input); error(nvae); throw nvae; } } static final String DFA99_eotS = "\23\uffff"; static final String DFA99_eofS = "\23\uffff"; static final String DFA99_minS = "\1\37\1\0\1\uffff\1\0\17\uffff"; static final String DFA99_maxS = "\1\176\1\0\1\uffff\1\0\17\uffff"; static final String DFA99_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\12\uffff"; static final String DFA99_specialS = "\1\0\1\1\1\uffff\1\2\17\uffff}>"; static final String[] DFA99_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\6\uffff\2\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA99_eot = DFA.unpackEncodedString(DFA99_eotS); static final short[] DFA99_eof = DFA.unpackEncodedString(DFA99_eofS); static final char[] DFA99_min = DFA.unpackEncodedStringToUnsignedChars(DFA99_minS); static final char[] DFA99_max = DFA.unpackEncodedStringToUnsignedChars(DFA99_maxS); static final short[] DFA99_accept = DFA.unpackEncodedString(DFA99_acceptS); static final short[] DFA99_special = DFA.unpackEncodedString(DFA99_specialS); static final short[][] DFA99_transition; static { int numStates = DFA99_transitionS.length; DFA99_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA99_transition[i] = DFA.unpackEncodedString(DFA99_transitionS[i]); } } class DFA99 extends DFA { public DFA99(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 99; this.eot = DFA99_eot; this.eof = DFA99_eof; this.min = DFA99_min; this.max = DFA99_max; this.accept = DFA99_accept; this.special = DFA99_special; this.transition = DFA99_transition; } public String getDescription() { return "750:31: ( ( e_prefix )=> e_prefix | e_log_6 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA99_0 = input.LA(1); int index99_0 = input.index(); input.rewind(); s = -1; if ( (LA99_0==ID) ) {s = 1;} else if ( (LA99_0==LeftB) && (synpred38_ANML())) {s = 2;} else if ( (LA99_0==LeftP) ) {s = 3;} else if ( (LA99_0==Dots) && (synpred38_ANML())) {s = 4;} else if ( (LA99_0==Contains) && (synpred38_ANML())) {s = 5;} else if ( (LA99_0==ForAll) && (synpred38_ANML())) {s = 6;} else if ( (LA99_0==Exists) && (synpred38_ANML())) {s = 7;} else if ( ((LA99_0>=Bra && LA99_0<=Ket)||(LA99_0>=NotLog && LA99_0<=NotBit)||LA99_0==Duration||LA99_0==Minus||(LA99_0>=Unordered && LA99_0<=Ordered)||(LA99_0>=Start && LA99_0<=Infinity)) ) {s = 8;} input.seek(index99_0); if ( s>=0 ) return s; break; case 1 : int LA99_1 = input.LA(1); int index99_1 = input.index(); input.rewind(); s = -1; if ( (synpred38_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index99_1); if ( s>=0 ) return s; break; case 2 : int LA99_3 = input.LA(1); int index99_3 = input.index(); input.rewind(); s = -1; if ( (synpred38_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index99_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 99, _s, input); error(nvae); throw nvae; } } static final String DFA101_eotS = "\23\uffff"; static final String DFA101_eofS = "\23\uffff"; static final String DFA101_minS = "\1\37\1\0\1\uffff\1\0\17\uffff"; static final String DFA101_maxS = "\1\176\1\0\1\uffff\1\0\17\uffff"; static final String DFA101_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\12\uffff"; static final String DFA101_specialS = "\1\0\1\1\1\uffff\1\2\17\uffff}>"; static final String[] DFA101_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\6\uffff\2\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA101_eot = DFA.unpackEncodedString(DFA101_eotS); static final short[] DFA101_eof = DFA.unpackEncodedString(DFA101_eofS); static final char[] DFA101_min = DFA.unpackEncodedStringToUnsignedChars(DFA101_minS); static final char[] DFA101_max = DFA.unpackEncodedStringToUnsignedChars(DFA101_maxS); static final short[] DFA101_accept = DFA.unpackEncodedString(DFA101_acceptS); static final short[] DFA101_special = DFA.unpackEncodedString(DFA101_specialS); static final short[][] DFA101_transition; static { int numStates = DFA101_transitionS.length; DFA101_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA101_transition[i] = DFA.unpackEncodedString(DFA101_transitionS[i]); } } class DFA101 extends DFA { public DFA101(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 101; this.eot = DFA101_eot; this.eof = DFA101_eof; this.min = DFA101_min; this.max = DFA101_max; this.accept = DFA101_accept; this.special = DFA101_special; this.transition = DFA101_transition; } public String getDescription() { return "754:22: ( ( e_prefix )=> e_prefix | e_log_6 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA101_0 = input.LA(1); int index101_0 = input.index(); input.rewind(); s = -1; if ( (LA101_0==ID) ) {s = 1;} else if ( (LA101_0==LeftB) && (synpred40_ANML())) {s = 2;} else if ( (LA101_0==LeftP) ) {s = 3;} else if ( (LA101_0==Dots) && (synpred40_ANML())) {s = 4;} else if ( (LA101_0==Contains) && (synpred40_ANML())) {s = 5;} else if ( (LA101_0==ForAll) && (synpred40_ANML())) {s = 6;} else if ( (LA101_0==Exists) && (synpred40_ANML())) {s = 7;} else if ( ((LA101_0>=Bra && LA101_0<=Ket)||(LA101_0>=NotLog && LA101_0<=NotBit)||LA101_0==Duration||LA101_0==Minus||(LA101_0>=Unordered && LA101_0<=Ordered)||(LA101_0>=Start && LA101_0<=Infinity)) ) {s = 8;} input.seek(index101_0); if ( s>=0 ) return s; break; case 1 : int LA101_1 = input.LA(1); int index101_1 = input.index(); input.rewind(); s = -1; if ( (synpred40_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index101_1); if ( s>=0 ) return s; break; case 2 : int LA101_3 = input.LA(1); int index101_3 = input.index(); input.rewind(); s = -1; if ( (synpred40_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index101_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 101, _s, input); error(nvae); throw nvae; } } static final String DFA103_eotS = "\22\uffff"; static final String DFA103_eofS = "\22\uffff"; static final String DFA103_minS = "\1\37\1\0\1\uffff\1\0\16\uffff"; static final String DFA103_maxS = "\1\176\1\0\1\uffff\1\0\16\uffff"; static final String DFA103_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\11\uffff"; static final String DFA103_specialS = "\1\0\1\1\1\uffff\1\2\16\uffff}>"; static final String[] DFA103_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\7\uffff\1\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA103_eot = DFA.unpackEncodedString(DFA103_eotS); static final short[] DFA103_eof = DFA.unpackEncodedString(DFA103_eofS); static final char[] DFA103_min = DFA.unpackEncodedStringToUnsignedChars(DFA103_minS); static final char[] DFA103_max = DFA.unpackEncodedStringToUnsignedChars(DFA103_maxS); static final short[] DFA103_accept = DFA.unpackEncodedString(DFA103_acceptS); static final short[] DFA103_special = DFA.unpackEncodedString(DFA103_specialS); static final short[][] DFA103_transition; static { int numStates = DFA103_transitionS.length; DFA103_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA103_transition[i] = DFA.unpackEncodedString(DFA103_transitionS[i]); } } class DFA103 extends DFA { public DFA103(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 103; this.eot = DFA103_eot; this.eof = DFA103_eof; this.min = DFA103_min; this.max = DFA103_max; this.accept = DFA103_accept; this.special = DFA103_special; this.transition = DFA103_transition; } public String getDescription() { return "759:37: ( ( e_prefix )=> e_prefix | e_num_1 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA103_0 = input.LA(1); int index103_0 = input.index(); input.rewind(); s = -1; if ( (LA103_0==ID) ) {s = 1;} else if ( (LA103_0==LeftB) && (synpred42_ANML())) {s = 2;} else if ( (LA103_0==LeftP) ) {s = 3;} else if ( (LA103_0==Dots) && (synpred42_ANML())) {s = 4;} else if ( (LA103_0==Contains) && (synpred42_ANML())) {s = 5;} else if ( (LA103_0==ForAll) && (synpred42_ANML())) {s = 6;} else if ( (LA103_0==Exists) && (synpred42_ANML())) {s = 7;} else if ( ((LA103_0>=Bra && LA103_0<=Ket)||LA103_0==NotBit||LA103_0==Duration||LA103_0==Minus||(LA103_0>=Unordered && LA103_0<=Ordered)||(LA103_0>=Start && LA103_0<=Infinity)) ) {s = 8;} input.seek(index103_0); if ( s>=0 ) return s; break; case 1 : int LA103_1 = input.LA(1); int index103_1 = input.index(); input.rewind(); s = -1; if ( (synpred42_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index103_1); if ( s>=0 ) return s; break; case 2 : int LA103_3 = input.LA(1); int index103_3 = input.index(); input.rewind(); s = -1; if ( (synpred42_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index103_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 103, _s, input); error(nvae); throw nvae; } } static final String DFA105_eotS = "\22\uffff"; static final String DFA105_eofS = "\22\uffff"; static final String DFA105_minS = "\1\37\1\0\1\uffff\1\0\16\uffff"; static final String DFA105_maxS = "\1\176\1\0\1\uffff\1\0\16\uffff"; static final String DFA105_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\11\uffff"; static final String DFA105_specialS = "\1\0\1\1\1\uffff\1\2\16\uffff}>"; static final String[] DFA105_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\7\uffff\1\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA105_eot = DFA.unpackEncodedString(DFA105_eotS); static final short[] DFA105_eof = DFA.unpackEncodedString(DFA105_eofS); static final char[] DFA105_min = DFA.unpackEncodedStringToUnsignedChars(DFA105_minS); static final char[] DFA105_max = DFA.unpackEncodedStringToUnsignedChars(DFA105_maxS); static final short[] DFA105_accept = DFA.unpackEncodedString(DFA105_acceptS); static final short[] DFA105_special = DFA.unpackEncodedString(DFA105_specialS); static final short[][] DFA105_transition; static { int numStates = DFA105_transitionS.length; DFA105_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA105_transition[i] = DFA.unpackEncodedString(DFA105_transitionS[i]); } } class DFA105 extends DFA { public DFA105(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 105; this.eot = DFA105_eot; this.eof = DFA105_eof; this.min = DFA105_min; this.max = DFA105_max; this.accept = DFA105_accept; this.special = DFA105_special; this.transition = DFA105_transition; } public String getDescription() { return "762:1: e_num : ( ( e_prefix )=> e_prefix | e_num_1 );"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA105_0 = input.LA(1); int index105_0 = input.index(); input.rewind(); s = -1; if ( (LA105_0==ID) ) {s = 1;} else if ( (LA105_0==LeftB) && (synpred43_ANML())) {s = 2;} else if ( (LA105_0==LeftP) ) {s = 3;} else if ( (LA105_0==Dots) && (synpred43_ANML())) {s = 4;} else if ( (LA105_0==Contains) && (synpred43_ANML())) {s = 5;} else if ( (LA105_0==ForAll) && (synpred43_ANML())) {s = 6;} else if ( (LA105_0==Exists) && (synpred43_ANML())) {s = 7;} else if ( ((LA105_0>=Bra && LA105_0<=Ket)||LA105_0==NotBit||LA105_0==Duration||LA105_0==Minus||(LA105_0>=Unordered && LA105_0<=Ordered)||(LA105_0>=Start && LA105_0<=Infinity)) ) {s = 8;} input.seek(index105_0); if ( s>=0 ) return s; break; case 1 : int LA105_1 = input.LA(1); int index105_1 = input.index(); input.rewind(); s = -1; if ( (synpred43_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index105_1); if ( s>=0 ) return s; break; case 2 : int LA105_3 = input.LA(1); int index105_3 = input.index(); input.rewind(); s = -1; if ( (synpred43_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index105_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 105, _s, input); error(nvae); throw nvae; } } static final String DFA106_eotS = "\22\uffff"; static final String DFA106_eofS = "\22\uffff"; static final String DFA106_minS = "\1\37\1\0\1\uffff\1\0\16\uffff"; static final String DFA106_maxS = "\1\176\1\0\1\uffff\1\0\16\uffff"; static final String DFA106_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\11\uffff"; static final String DFA106_specialS = "\1\0\1\1\1\uffff\1\2\16\uffff}>"; static final String[] DFA106_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\7\uffff\1\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA106_eot = DFA.unpackEncodedString(DFA106_eotS); static final short[] DFA106_eof = DFA.unpackEncodedString(DFA106_eofS); static final char[] DFA106_min = DFA.unpackEncodedStringToUnsignedChars(DFA106_minS); static final char[] DFA106_max = DFA.unpackEncodedStringToUnsignedChars(DFA106_maxS); static final short[] DFA106_accept = DFA.unpackEncodedString(DFA106_acceptS); static final short[] DFA106_special = DFA.unpackEncodedString(DFA106_specialS); static final short[][] DFA106_transition; static { int numStates = DFA106_transitionS.length; DFA106_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA106_transition[i] = DFA.unpackEncodedString(DFA106_transitionS[i]); } } class DFA106 extends DFA { public DFA106(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 106; this.eot = DFA106_eot; this.eof = DFA106_eof; this.min = DFA106_min; this.max = DFA106_max; this.accept = DFA106_accept; this.special = DFA106_special; this.transition = DFA106_transition; } public String getDescription() { return "768:31: ( ( e_prefix )=> e_prefix | e_num_2 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA106_0 = input.LA(1); int index106_0 = input.index(); input.rewind(); s = -1; if ( (LA106_0==ID) ) {s = 1;} else if ( (LA106_0==LeftB) && (synpred45_ANML())) {s = 2;} else if ( (LA106_0==LeftP) ) {s = 3;} else if ( (LA106_0==Dots) && (synpred45_ANML())) {s = 4;} else if ( (LA106_0==Contains) && (synpred45_ANML())) {s = 5;} else if ( (LA106_0==ForAll) && (synpred45_ANML())) {s = 6;} else if ( (LA106_0==Exists) && (synpred45_ANML())) {s = 7;} else if ( ((LA106_0>=Bra && LA106_0<=Ket)||LA106_0==NotBit||LA106_0==Duration||LA106_0==Minus||(LA106_0>=Unordered && LA106_0<=Ordered)||(LA106_0>=Start && LA106_0<=Infinity)) ) {s = 8;} input.seek(index106_0); if ( s>=0 ) return s; break; case 1 : int LA106_1 = input.LA(1); int index106_1 = input.index(); input.rewind(); s = -1; if ( (synpred45_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index106_1); if ( s>=0 ) return s; break; case 2 : int LA106_3 = input.LA(1); int index106_3 = input.index(); input.rewind(); s = -1; if ( (synpred45_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index106_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 106, _s, input); error(nvae); throw nvae; } } static final String DFA109_eotS = "\22\uffff"; static final String DFA109_eofS = "\22\uffff"; static final String DFA109_minS = "\1\37\1\0\1\uffff\1\0\16\uffff"; static final String DFA109_maxS = "\1\176\1\0\1\uffff\1\0\16\uffff"; static final String DFA109_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\11\uffff"; static final String DFA109_specialS = "\1\0\1\1\1\uffff\1\2\16\uffff}>"; static final String[] DFA109_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\7\uffff\1\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA109_eot = DFA.unpackEncodedString(DFA109_eotS); static final short[] DFA109_eof = DFA.unpackEncodedString(DFA109_eofS); static final char[] DFA109_min = DFA.unpackEncodedStringToUnsignedChars(DFA109_minS); static final char[] DFA109_max = DFA.unpackEncodedStringToUnsignedChars(DFA109_maxS); static final short[] DFA109_accept = DFA.unpackEncodedString(DFA109_acceptS); static final short[] DFA109_special = DFA.unpackEncodedString(DFA109_specialS); static final short[][] DFA109_transition; static { int numStates = DFA109_transitionS.length; DFA109_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA109_transition[i] = DFA.unpackEncodedString(DFA109_transitionS[i]); } } class DFA109 extends DFA { public DFA109(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 109; this.eot = DFA109_eot; this.eof = DFA109_eof; this.min = DFA109_min; this.max = DFA109_max; this.accept = DFA109_accept; this.special = DFA109_special; this.transition = DFA109_transition; } public String getDescription() { return "772:55: ( ( e_prefix )=> e_prefix | e_num_3 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA109_0 = input.LA(1); int index109_0 = input.index(); input.rewind(); s = -1; if ( (LA109_0==ID) ) {s = 1;} else if ( (LA109_0==LeftB) && (synpred47_ANML())) {s = 2;} else if ( (LA109_0==LeftP) ) {s = 3;} else if ( (LA109_0==Dots) && (synpred47_ANML())) {s = 4;} else if ( (LA109_0==Contains) && (synpred47_ANML())) {s = 5;} else if ( (LA109_0==ForAll) && (synpred47_ANML())) {s = 6;} else if ( (LA109_0==Exists) && (synpred47_ANML())) {s = 7;} else if ( ((LA109_0>=Bra && LA109_0<=Ket)||LA109_0==NotBit||LA109_0==Duration||LA109_0==Minus||(LA109_0>=Unordered && LA109_0<=Ordered)||(LA109_0>=Start && LA109_0<=Infinity)) ) {s = 8;} input.seek(index109_0); if ( s>=0 ) return s; break; case 1 : int LA109_1 = input.LA(1); int index109_1 = input.index(); input.rewind(); s = -1; if ( (synpred47_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index109_1); if ( s>=0 ) return s; break; case 2 : int LA109_3 = input.LA(1); int index109_3 = input.index(); input.rewind(); s = -1; if ( (synpred47_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index109_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 109, _s, input); error(nvae); throw nvae; } } static final String DFA112_eotS = "\22\uffff"; static final String DFA112_eofS = "\22\uffff"; static final String DFA112_minS = "\1\37\1\0\1\uffff\1\0\16\uffff"; static final String DFA112_maxS = "\1\176\1\0\1\uffff\1\0\16\uffff"; static final String DFA112_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\11\uffff"; static final String DFA112_specialS = "\1\0\1\1\1\uffff\1\2\16\uffff}>"; static final String[] DFA112_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\7\uffff\1\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA112_eot = DFA.unpackEncodedString(DFA112_eotS); static final short[] DFA112_eof = DFA.unpackEncodedString(DFA112_eofS); static final char[] DFA112_min = DFA.unpackEncodedStringToUnsignedChars(DFA112_minS); static final char[] DFA112_max = DFA.unpackEncodedStringToUnsignedChars(DFA112_maxS); static final short[] DFA112_accept = DFA.unpackEncodedString(DFA112_acceptS); static final short[] DFA112_special = DFA.unpackEncodedString(DFA112_specialS); static final short[][] DFA112_transition; static { int numStates = DFA112_transitionS.length; DFA112_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA112_transition[i] = DFA.unpackEncodedString(DFA112_transitionS[i]); } } class DFA112 extends DFA { public DFA112(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 112; this.eot = DFA112_eot; this.eof = DFA112_eof; this.min = DFA112_min; this.max = DFA112_max; this.accept = DFA112_accept; this.special = DFA112_special; this.transition = DFA112_transition; } public String getDescription() { return "778:4: ( ( e_prefix )=> e_prefix | e_num_4 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA112_0 = input.LA(1); int index112_0 = input.index(); input.rewind(); s = -1; if ( (LA112_0==ID) ) {s = 1;} else if ( (LA112_0==LeftB) && (synpred49_ANML())) {s = 2;} else if ( (LA112_0==LeftP) ) {s = 3;} else if ( (LA112_0==Dots) && (synpred49_ANML())) {s = 4;} else if ( (LA112_0==Contains) && (synpred49_ANML())) {s = 5;} else if ( (LA112_0==ForAll) && (synpred49_ANML())) {s = 6;} else if ( (LA112_0==Exists) && (synpred49_ANML())) {s = 7;} else if ( ((LA112_0>=Bra && LA112_0<=Ket)||LA112_0==NotBit||LA112_0==Duration||LA112_0==Minus||(LA112_0>=Unordered && LA112_0<=Ordered)||(LA112_0>=Start && LA112_0<=Infinity)) ) {s = 8;} input.seek(index112_0); if ( s>=0 ) return s; break; case 1 : int LA112_1 = input.LA(1); int index112_1 = input.index(); input.rewind(); s = -1; if ( (synpred49_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index112_1); if ( s>=0 ) return s; break; case 2 : int LA112_3 = input.LA(1); int index112_3 = input.index(); input.rewind(); s = -1; if ( (synpred49_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index112_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 112, _s, input); error(nvae); throw nvae; } } static final String DFA115_eotS = "\22\uffff"; static final String DFA115_eofS = "\22\uffff"; static final String DFA115_minS = "\1\37\1\0\1\uffff\1\0\16\uffff"; static final String DFA115_maxS = "\1\176\1\0\1\uffff\1\0\16\uffff"; static final String DFA115_acceptS = "\2\uffff\1\1\1\uffff\4\1\1\2\11\uffff"; static final String DFA115_specialS = "\1\0\1\1\1\uffff\1\2\16\uffff}>"; static final String[] DFA115_transitionS = { "\2\10\27\uffff\1\1\20\uffff\1\3\7\uffff\1\10\3\uffff\1\2\1\10"+ "\2\uffff\1\5\1\uffff\1\6\1\7\12\uffff\1\4\7\uffff\1\10\4\uffff"+ "\2\10\1\uffff\10\10", "\1\uffff", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA115_eot = DFA.unpackEncodedString(DFA115_eotS); static final short[] DFA115_eof = DFA.unpackEncodedString(DFA115_eofS); static final char[] DFA115_min = DFA.unpackEncodedStringToUnsignedChars(DFA115_minS); static final char[] DFA115_max = DFA.unpackEncodedStringToUnsignedChars(DFA115_maxS); static final short[] DFA115_accept = DFA.unpackEncodedString(DFA115_acceptS); static final short[] DFA115_special = DFA.unpackEncodedString(DFA115_specialS); static final short[][] DFA115_transition; static { int numStates = DFA115_transitionS.length; DFA115_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA115_transition[i] = DFA.unpackEncodedString(DFA115_transitionS[i]); } } class DFA115 extends DFA { public DFA115(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 115; this.eot = DFA115_eot; this.eof = DFA115_eof; this.min = DFA115_min; this.max = DFA115_max; this.accept = DFA115_accept; this.special = DFA115_special; this.transition = DFA115_transition; } public String getDescription() { return "786:3: ( ( e_prefix )=> e_prefix | e_num_4 )"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA115_0 = input.LA(1); int index115_0 = input.index(); input.rewind(); s = -1; if ( (LA115_0==ID) ) {s = 1;} else if ( (LA115_0==LeftB) && (synpred51_ANML())) {s = 2;} else if ( (LA115_0==LeftP) ) {s = 3;} else if ( (LA115_0==Dots) && (synpred51_ANML())) {s = 4;} else if ( (LA115_0==Contains) && (synpred51_ANML())) {s = 5;} else if ( (LA115_0==ForAll) && (synpred51_ANML())) {s = 6;} else if ( (LA115_0==Exists) && (synpred51_ANML())) {s = 7;} else if ( ((LA115_0>=Bra && LA115_0<=Ket)||LA115_0==NotBit||LA115_0==Duration||LA115_0==Minus||(LA115_0>=Unordered && LA115_0<=Ordered)||(LA115_0>=Start && LA115_0<=Infinity)) ) {s = 8;} input.seek(index115_0); if ( s>=0 ) return s; break; case 1 : int LA115_1 = input.LA(1); int index115_1 = input.index(); input.rewind(); s = -1; if ( (synpred51_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index115_1); if ( s>=0 ) return s; break; case 2 : int LA115_3 = input.LA(1); int index115_3 = input.index(); input.rewind(); s = -1; if ( (synpred51_ANML()) ) {s = 7;} else if ( (true) ) {s = 8;} input.seek(index115_3); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 115, _s, input); error(nvae); throw nvae; } } static final String DFA120_eotS = "\65\uffff"; static final String DFA120_eofS = "\1\1\64\uffff"; static final String DFA120_minS = "\1\37\36\uffff\1\0\25\uffff"; static final String DFA120_maxS = "\1\u0082\36\uffff\1\0\25\uffff"; static final String DFA120_acceptS = "\1\uffff\1\3\61\uffff\1\1\1\2"; static final String DFA120_specialS = "\37\uffff\1\0\25\uffff}>"; static final String[] DFA120_transitionS = { "\2\1\23\uffff\1\1\3\uffff\1\1\11\uffff\2\1\1\uffff\2\1\1\uffff"+ "\1\1\1\37\1\1\3\uffff\6\1\1\uffff\3\1\1\uffff\1\1\1\uffff\13"+ "\1\1\uffff\1\1\1\uffff\15\1\1\63\14\1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\1\uffff", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA120_eot = DFA.unpackEncodedString(DFA120_eotS); static final short[] DFA120_eof = DFA.unpackEncodedString(DFA120_eofS); static final char[] DFA120_min = DFA.unpackEncodedStringToUnsignedChars(DFA120_minS); static final char[] DFA120_max = DFA.unpackEncodedStringToUnsignedChars(DFA120_maxS); static final short[] DFA120_accept = DFA.unpackEncodedString(DFA120_acceptS); static final short[] DFA120_special = DFA.unpackEncodedString(DFA120_specialS); static final short[][] DFA120_transition; static { int numStates = DFA120_transitionS.length; DFA120_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA120_transition[i] = DFA.unpackEncodedString(DFA120_transitionS[i]); } } class DFA120 extends DFA { public DFA120(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 120; this.eot = DFA120_eot; this.eof = DFA120_eof; this.min = DFA120_min; this.max = DFA120_max; this.accept = DFA120_accept; this.special = DFA120_special; this.transition = DFA120_transition; } public String getDescription() { return "()* loopback of 806:3: ( Dot ID -> ^( Access[$Dot,\"AccessField\"] $ref ^( Ref ID ) ) | ( arg_list )=> arg_list -> ^( Bind[$arg_list.tree,\"BindParameters\"] $ref arg_list ) )*"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA120_31 = input.LA(1); int index120_31 = input.index(); input.rewind(); s = -1; if ( (synpred52_ANML()) ) {s = 52;} else if ( (true) ) {s = 1;} input.seek(index120_31); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 120, _s, input); error(nvae); throw nvae; } } static final String DFA121_eotS = "\20\uffff"; static final String DFA121_eofS = "\20\uffff"; static final String DFA121_minS = "\1\37\5\0\12\uffff"; static final String DFA121_maxS = "\1\170\5\0\12\uffff"; static final String DFA121_acceptS = "\6\uffff\1\1\1\11\1\2\1\6\1\3\1\7\1\4\1\10\1\5\1\12"; static final String DFA121_specialS = "\1\uffff\1\0\1\1\1\2\1\3\1\4\12\uffff}>"; static final String[] DFA121_transitionS = { "\1\1\1\5\65\uffff\1\4\40\uffff\1\2\1\3", "\1\uffff", "\1\uffff", "\1\uffff", "\1\uffff", "\1\uffff", "", "", "", "", "", "", "", "", "", "" }; static final short[] DFA121_eot = DFA.unpackEncodedString(DFA121_eotS); static final short[] DFA121_eof = DFA.unpackEncodedString(DFA121_eofS); static final char[] DFA121_min = DFA.unpackEncodedStringToUnsignedChars(DFA121_minS); static final char[] DFA121_max = DFA.unpackEncodedStringToUnsignedChars(DFA121_maxS); static final short[] DFA121_accept = DFA.unpackEncodedString(DFA121_acceptS); static final short[] DFA121_special = DFA.unpackEncodedString(DFA121_specialS); static final short[][] DFA121_transition; static { int numStates = DFA121_transitionS.length; DFA121_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA121_transition[i] = DFA.unpackEncodedString(DFA121_transitionS[i]); } } class DFA121 extends DFA { public DFA121(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 121; this.eot = DFA121_eot; this.eof = DFA121_eof; this.min = DFA121_min; this.max = DFA121_max; this.accept = DFA121_accept; this.special = DFA121_special; this.transition = DFA121_transition; } public String getDescription() { return "813:1: time_primitive : ( ( Bra LeftP ID RightP )=> Bra LeftP ID RightP -> ^( LabelRef ID Bra ) | ( Start LeftP ID RightP )=> Start LeftP ID RightP -> ^( LabelRef ID Start ) | ( End LeftP ID RightP )=> End LeftP ID RightP -> ^( LabelRef ID End ) | ( Duration LeftP ID RightP )=> Duration LeftP ID RightP -> ^( LabelRef ID Duration ) | ( Ket LeftP ID RightP )=> Ket LeftP ID RightP -> ^( LabelRef ID Ket ) | Start -> ^( LabelRef This Start ) | End -> ^( LabelRef This End ) | Duration -> ^( LabelRef This Duration ) | Bra -> ^( LabelRef This Bra ) | Ket -> ^( LabelRef This Ket ) );"; } public int specialStateTransition(int s, IntStream _input) throws NoViableAltException { TokenStream input = (TokenStream)_input; int _s = s; switch ( s ) { case 0 : int LA121_1 = input.LA(1); int index121_1 = input.index(); input.rewind(); s = -1; if ( (synpred53_ANML()) ) {s = 6;} else if ( (true) ) {s = 7;} input.seek(index121_1); if ( s>=0 ) return s; break; case 1 : int LA121_2 = input.LA(1); int index121_2 = input.index(); input.rewind(); s = -1; if ( (synpred54_ANML()) ) {s = 8;} else if ( (true) ) {s = 9;} input.seek(index121_2); if ( s>=0 ) return s; break; case 2 : int LA121_3 = input.LA(1); int index121_3 = input.index(); input.rewind(); s = -1; if ( (synpred55_ANML()) ) {s = 10;} else if ( (true) ) {s = 11;} input.seek(index121_3); if ( s>=0 ) return s; break; case 3 : int LA121_4 = input.LA(1); int index121_4 = input.index(); input.rewind(); s = -1; if ( (synpred56_ANML()) ) {s = 12;} else if ( (true) ) {s = 13;} input.seek(index121_4); if ( s>=0 ) return s; break; case 4 : int LA121_5 = input.LA(1); int index121_5 = input.index(); input.rewind(); s = -1; if ( (synpred57_ANML()) ) {s = 14;} else if ( (true) ) {s = 15;} input.seek(index121_5); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = new NoViableAltException(getDescription(), 121, _s, input); error(nvae); throw nvae; } } public static final BitSet FOLLOW_type_decl_in_model398 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_const_decl_in_model406 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_fluent_decl_in_model414 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_action_decl_in_model422 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_fact_decl_in_model429 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_goal_decl_in_model437 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_stmt_in_model445 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_set_in_builtinType0 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_builtinType_in_type_spec567 = new BitSet(new long[]{0x0000000000000002L,0x0000000000204000L}); public static final BitSet FOLLOW_set_in_type_spec569 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_type_spec589 = new BitSet(new long[]{0x0000000000000002L,0x0000000000204000L}); public static final BitSet FOLLOW_set_in_type_spec591 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Vector_in_type_spec611 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_param_list_in_type_spec613 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_type_enumeration_in_type_spec629 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_builtinType_in_type_ref644 = new BitSet(new long[]{0x0000000000000002L,0x0000000000204000L}); public static final BitSet FOLLOW_set_in_type_ref646 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_type_ref666 = new BitSet(new long[]{0x0000000000000002L,0x0000000000204000L}); public static final BitSet FOLLOW_set_in_type_ref668 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_user_type_ref698 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Symbol_in_enumerated_type_ref720 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Object_in_enumerated_type_ref733 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_enumerated_type_ref746 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Predicate_in_predicate_helper768 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_param_helper792 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_var_decl_helper813 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000108L}); public static final BitSet FOLLOW_init_in_var_decl_helper815 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_fun_decl_helper839 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_param_list_in_fun_decl_helper841 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_const_var_decl_helper863 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000108L}); public static final BitSet FOLLOW_init_in_const_var_decl_helper865 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_const_fun_decl_helper889 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_param_list_in_const_fun_decl_helper891 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_type_decl_helper914 = new BitSet(new long[]{0x0000000000000002L,0x000000000000001CL}); public static final BitSet FOLLOW_LessThan_in_type_decl_helper921 = new BitSet(new long[]{0xFD00000000000000L}); public static final BitSet FOLLOW_type_ref_in_type_decl_helper925 = new BitSet(new long[]{0x0000000000000002L,0x000000000000001CL}); public static final BitSet FOLLOW_Assign_in_type_decl_helper932 = new BitSet(new long[]{0xFD00000000000000L,0x0000000000004001L}); public static final BitSet FOLLOW_type_spec_in_type_decl_helper936 = new BitSet(new long[]{0x0000000000000002L,0x000000000000001CL}); public static final BitSet FOLLOW_With_in_type_decl_helper943 = new BitSet(new long[]{0x0000000000000000L,0x0000000000004000L}); public static final BitSet FOLLOW_object_block_in_type_decl_helper947 = new BitSet(new long[]{0x0000000000000002L,0x000000000000001CL}); public static final BitSet FOLLOW_user_type_ref_in_type_refine_helper998 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000004L}); public static final BitSet FOLLOW_LessThan_in_type_refine_helper1000 = new BitSet(new long[]{0xFD00000000000000L}); public static final BitSet FOLLOW_type_ref_in_type_refine_helper1002 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_type_refine_helper1004 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_user_type_ref_in_type_refine_helper1026 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_Assign_in_type_refine_helper1028 = new BitSet(new long[]{0xFD00000000000000L,0x0000000000004001L}); public static final BitSet FOLLOW_type_spec_in_type_refine_helper1030 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_type_refine_helper1032 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_enumerated_type_ref_in_type_refine_helper1054 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_type_refine_helper1058 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Comma_in_type_refine_helper1061 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_type_refine_helper1063 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Semi_in_type_refine_helper1067 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Assign_in_init1094 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_init1097 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Assign_in_init1102 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000080L}); public static final BitSet FOLLOW_Undefined_in_init1105 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Undefine_in_init1111 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftP_in_param_list1124 = new BitSet(new long[]{0xFD00000000000000L}); public static final BitSet FOLLOW_param_in_param_list1128 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000440L}); public static final BitSet FOLLOW_Comma_in_param_list1131 = new BitSet(new long[]{0xFD00000000000000L}); public static final BitSet FOLLOW_param_in_param_list1135 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000440L}); public static final BitSet FOLLOW_RightP_in_param_list1139 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftP_in_param_list1157 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_param_list1159 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_type_ref_in_param1189 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_param_helper_in_param1191 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000040L}); public static final BitSet FOLLOW_Comma_in_param1194 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_param_helper_in_param1196 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000040L}); public static final BitSet FOLLOW_Type_in_type_decl1223 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_type_decl_helper_in_type_decl1227 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Comma_in_type_decl1230 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_type_decl_helper_in_type_decl1234 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Semi_in_type_decl1238 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_type_refine_in_type_decl1252 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Constant_in_const_decl1269 = new BitSet(new long[]{0xFD00000000000000L}); public static final BitSet FOLLOW_type_ref_in_const_decl1271 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_const_var_decl_helper_in_const_decl1278 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Comma_in_const_decl1281 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_const_var_decl_helper_in_const_decl1285 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Semi_in_const_decl1289 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_const_fun_decl_helper_in_const_decl1296 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Comma_in_const_decl1299 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_const_fun_decl_helper_in_const_decl1303 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Semi_in_const_decl1307 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Fluent_in_fluent_decl1339 = new BitSet(new long[]{0xFD00000000000000L}); public static final BitSet FOLLOW_type_ref_in_fluent_decl1341 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_var_decl_helper_in_fluent_decl1351 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Comma_in_fluent_decl1354 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_var_decl_helper_in_fluent_decl1358 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Semi_in_fluent_decl1362 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_fun_decl_helper_in_fluent_decl1372 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Comma_in_fluent_decl1375 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_fun_decl_helper_in_fluent_decl1379 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Semi_in_fluent_decl1383 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Variable_in_fluent_decl1394 = new BitSet(new long[]{0xFD00000000000000L}); public static final BitSet FOLLOW_type_ref_in_fluent_decl1396 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_var_decl_helper_in_fluent_decl1400 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Comma_in_fluent_decl1403 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_var_decl_helper_in_fluent_decl1407 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Semi_in_fluent_decl1411 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Function_in_fluent_decl1417 = new BitSet(new long[]{0xFD00000000000000L}); public static final BitSet FOLLOW_type_ref_in_fluent_decl1419 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_fun_decl_helper_in_fluent_decl1423 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Comma_in_fluent_decl1426 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_fun_decl_helper_in_fluent_decl1430 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Semi_in_fluent_decl1434 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_predicate_helper_in_fluent_decl1440 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_fun_decl_helper_in_fluent_decl1444 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Comma_in_fluent_decl1447 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_fun_decl_helper_in_fluent_decl1451 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000060L}); public static final BitSet FOLLOW_Semi_in_fluent_decl1455 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Fact_in_type_refine1478 = new BitSet(new long[]{0xA100000000000000L,0x0000000000004000L}); public static final BitSet FOLLOW_LeftC_in_type_refine1484 = new BitSet(new long[]{0xA100000000000000L,0x0000000000004000L}); public static final BitSet FOLLOW_type_refine_helper_in_type_refine1486 = new BitSet(new long[]{0xA100000000000000L,0x000000000000C000L}); public static final BitSet FOLLOW_RightC_in_type_refine1489 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_type_refine_helper_in_type_refine1503 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ref_in_fact_decl_helper1534 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_fact_decl_helper1536 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_NotLog_in_fact_decl_helper1587 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_NotBit_in_fact_decl_helper1591 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_ref_in_fact_decl_helper1594 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_fact_decl_helper1596 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ref_in_fact_decl_helper1631 = new BitSet(new long[]{0x0000000000000000L,0x00000000000C0000L}); public static final BitSet FOLLOW_EqualLog_in_fact_decl_helper1636 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_Equal_in_fact_decl_helper1640 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_fact_decl_helper1643 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_fact_decl_helper1645 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Semi_in_fact_decl_helper1680 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expr_in_goal_decl_helper1691 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_goal_decl_helper1693 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Semi_in_goal_decl_helper1721 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Fact_in_fact_decl1732 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A634220L}); public static final BitSet FOLLOW_LeftC_in_fact_decl1740 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A63C220L}); public static final BitSet FOLLOW_fact_decl_helper_in_fact_decl1742 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A63C220L}); public static final BitSet FOLLOW_RightC_in_fact_decl1745 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_fact_decl_helper_in_fact_decl1764 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Goal_in_goal_decl1791 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A634220L}); public static final BitSet FOLLOW_LeftC_in_goal_decl1797 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A63C220L}); public static final BitSet FOLLOW_goal_decl_helper_in_goal_decl1799 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A63C220L}); public static final BitSet FOLLOW_RightC_in_goal_decl1802 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_goal_decl_helper_in_goal_decl1815 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftC_in_object_block1846 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_type_decl_in_object_block1854 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_const_decl_in_object_block1863 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_fluent_decl_in_object_block1872 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_action_decl_in_object_block1881 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_fact_decl_in_object_block1889 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_goal_decl_in_object_block1898 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_stmt_in_object_block1907 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_RightC_in_object_block1917 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Action_in_action_decl2022 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_action_decl2024 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_param_list_in_action_decl2030 = new BitSet(new long[]{0x0000000000000000L,0x0000000000204000L}); public static final BitSet FOLLOW_LeftB_in_action_decl2034 = new BitSet(new long[]{0x0000000000000000L,0x0000000000400000L}); public static final BitSet FOLLOW_Duration_in_action_decl2036 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L}); public static final BitSet FOLLOW_RightB_in_action_decl2038 = new BitSet(new long[]{0x0000000000000000L,0x0000000000204000L}); public static final BitSet FOLLOW_action_block_in_action_decl2044 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftB_in_durative_action_block2099 = new BitSet(new long[]{0x0000000000000000L,0x0000000000400000L}); public static final BitSet FOLLOW_Duration_in_durative_action_block2102 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L}); public static final BitSet FOLLOW_RightB_in_durative_action_block2104 = new BitSet(new long[]{0x0000000000000000L,0x0000000000204000L}); public static final BitSet FOLLOW_action_block_h_in_durative_action_block2107 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_action_block_h_in_action_block2130 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftC_in_action_block_h2141 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01B73FA22L}); public static final BitSet FOLLOW_type_decl_in_action_block_h2149 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01B73FA22L}); public static final BitSet FOLLOW_const_decl_in_action_block_h2158 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01B73FA22L}); public static final BitSet FOLLOW_fluent_decl_in_action_block_h2167 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01B73FA22L}); public static final BitSet FOLLOW_action_decl_in_action_block_h2176 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01B73FA22L}); public static final BitSet FOLLOW_fact_decl_in_action_block_h2184 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01B73FA22L}); public static final BitSet FOLLOW_goal_decl_in_action_block_h2193 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01B73FA22L}); public static final BitSet FOLLOW_stmt_in_action_block_h2202 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01B73FA22L}); public static final BitSet FOLLOW_decomp_block_in_action_block_h2214 = new BitSet(new long[]{0x0000000000000000L,0x0000000001008000L}); public static final BitSet FOLLOW_RightC_in_action_block_h2220 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Decomposition_in_decomp_block2310 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_type_decl_in_decomp_block2320 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_const_decl_in_decomp_block2329 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_fluent_decl_in_decomp_block2338 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_action_decl_in_decomp_block2347 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_fact_decl_in_decomp_block2355 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_goal_decl_in_decomp_block2364 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_stmt_in_decomp_block2373 = new BitSet(new long[]{0x0110000182580002L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_LeftC_in_stmt_block2464 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_type_decl_in_stmt_block2472 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_const_decl_in_stmt_block2481 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_fluent_decl_in_stmt_block2490 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_action_decl_in_stmt_block2499 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_fact_decl_in_stmt_block2507 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_goal_decl_in_stmt_block2516 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_stmt_in_stmt_block2525 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A73FA22L}); public static final BitSet FOLLOW_RightC_in_stmt_block2537 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_primitive_in_stmt2628 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_block_in_stmt2638 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_timed_in_stmt2648 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_contains_in_stmt2653 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_when_in_stmt2658 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_forall_in_stmt2663 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_exists_in_stmt2668 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Contains_in_stmt_contains2678 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_exist_time_in_stmt_contains2691 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_stmt_in_stmt_contains2693 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_in_stmt_contains2713 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_When_in_stmt_when2740 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_guard_in_stmt_when2742 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01E737A22L}); public static final BitSet FOLLOW_stmt_in_stmt_when2744 = new BitSet(new long[]{0x0000000000000002L,0x0000000004000000L}); public static final BitSet FOLLOW_Else_in_stmt_when2757 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_stmt_in_stmt_when2759 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ForAll_in_stmt_forall2807 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_param_list_in_stmt_forall2809 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_stmt_in_stmt_forall2811 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Exists_in_stmt_exists2834 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_param_list_in_stmt_exists2836 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_stmt_in_stmt_exists2838 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_interval_in_stmt_timed2861 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_stmt_in_stmt_timed2863 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expr_in_stmt_primitive2899 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_stmt_primitive2901 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_chain_in_stmt_primitive2916 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_stmt_primitive2918 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_delta_chain_in_stmt_primitive2931 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_stmt_primitive2933 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_timeless_in_stmt_primitive2948 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_stmt_primitive2950 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Semi_in_stmt_primitive2958 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ref_in_stmt_chain2972 = new BitSet(new long[]{0x0000000000000000L,0x8000001FE008014CL,0x0000000000000007L}); public static final BitSet FOLLOW_stmt_chain_1_in_stmt_chain2976 = new BitSet(new long[]{0x0000000000000002L,0x8000001FE008014CL,0x0000000000000007L}); public static final BitSet FOLLOW_interval_in_stmt_chain3043 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_ref_in_stmt_chain3045 = new BitSet(new long[]{0x0000000000000000L,0x8000001FE008014CL,0x0000000000000007L}); public static final BitSet FOLLOW_stmt_chain_1_in_stmt_chain3049 = new BitSet(new long[]{0x0000000000000002L,0x8000001FE008014CL,0x0000000000000007L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13078 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_Assign_in_stmt_chain_13082 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_in_stmt_chain_13085 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13093 = new BitSet(new long[]{0x0000000000000000L,0x0000000020000000L}); public static final BitSet FOLLOW_Change_in_stmt_chain_13098 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_in_stmt_chain_13102 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13133 = new BitSet(new long[]{0x0000000000000000L,0x0000000040000000L}); public static final BitSet FOLLOW_Produce_in_stmt_chain_13139 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_in_stmt_chain_13144 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13152 = new BitSet(new long[]{0x0000000000000000L,0x0000000080000000L}); public static final BitSet FOLLOW_Consume_in_stmt_chain_13158 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_in_stmt_chain_13163 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13171 = new BitSet(new long[]{0x0000000000000000L,0x0000000100000000L}); public static final BitSet FOLLOW_Lend_in_stmt_chain_13176 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_in_stmt_chain_13180 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13223 = new BitSet(new long[]{0x0000000000000000L,0x0000000200000000L}); public static final BitSet FOLLOW_Use_in_stmt_chain_13228 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_in_stmt_chain_13232 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13276 = new BitSet(new long[]{0x0000000000000000L,0x0000000C00000000L}); public static final BitSet FOLLOW_Within_in_stmt_chain_13283 = new BitSet(new long[]{0x0000000000000000L,0x0000000000204000L}); public static final BitSet FOLLOW_SetAssign_in_stmt_chain_13287 = new BitSet(new long[]{0x0000000000000000L,0x0000000000204000L}); public static final BitSet FOLLOW_set_in_stmt_chain_13293 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13301 = new BitSet(new long[]{0x0000000000000000L,0x8000000000080044L,0x0000000000000007L}); public static final BitSet FOLLOW_num_relop_in_stmt_chain_13307 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_in_stmt_chain_13312 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13318 = new BitSet(new long[]{0x0000000000000000L,0x0000001000080000L}); public static final BitSet FOLLOW_Equal_in_stmt_chain_13324 = new BitSet(new long[]{0x0000000000000000L,0x0000001000000000L}); public static final BitSet FOLLOW_Skip_in_stmt_chain_13326 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Skip_in_stmt_chain_13332 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_chain_13347 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000108L}); public static final BitSet FOLLOW_Assign_in_stmt_chain_13353 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000080L}); public static final BitSet FOLLOW_Undefined_in_stmt_chain_13355 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Undefine_in_stmt_chain_13361 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Delta_in_stmt_delta_chain3383 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_ref_in_stmt_delta_chain3385 = new BitSet(new long[]{0x0000000000000000L,0x0000001820080148L}); public static final BitSet FOLLOW_stmt_delta_chain_1_in_stmt_delta_chain3389 = new BitSet(new long[]{0x0000000000000002L,0x0000001820080148L}); public static final BitSet FOLLOW_interval_in_stmt_delta_chain3461 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_ref_in_stmt_delta_chain3463 = new BitSet(new long[]{0x0000000000000000L,0x0000001820080148L}); public static final BitSet FOLLOW_stmt_delta_chain_1_in_stmt_delta_chain3467 = new BitSet(new long[]{0x0000000000000002L,0x0000001820080148L}); public static final BitSet FOLLOW_Comma_in_stmt_delta_chain_13502 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_Assign_in_stmt_delta_chain_13505 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_in_stmt_delta_chain_13510 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_delta_chain_13518 = new BitSet(new long[]{0x0000000000000000L,0x0000000020000000L}); public static final BitSet FOLLOW_Change_in_stmt_delta_chain_13523 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_in_stmt_delta_chain_13527 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_delta_chain_13557 = new BitSet(new long[]{0x0000000000000000L,0x0000000800000000L}); public static final BitSet FOLLOW_SetAssign_in_stmt_delta_chain_13560 = new BitSet(new long[]{0x0000000000000000L,0x0000000000204000L}); public static final BitSet FOLLOW_set_in_stmt_delta_chain_13565 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_delta_chain_13570 = new BitSet(new long[]{0x0000000000000000L,0x0000001000080000L}); public static final BitSet FOLLOW_Equal_in_stmt_delta_chain_13576 = new BitSet(new long[]{0x0000000000000000L,0x0000001000000000L}); public static final BitSet FOLLOW_Skip_in_stmt_delta_chain_13578 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Skip_in_stmt_delta_chain_13584 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Comma_in_stmt_delta_chain_13599 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000108L}); public static final BitSet FOLLOW_Assign_in_stmt_delta_chain_13605 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000080L}); public static final BitSet FOLLOW_Undefined_in_stmt_delta_chain_13607 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Undefine_in_stmt_delta_chain_13613 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_time_primitive_in_stmt_timeless3634 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_Assign_in_stmt_timeless3636 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_stmt_timeless3639 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expr_in_guard3652 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_univ_time_in_interval3667 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_exist_time_in_interval3676 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_bra_in_univ_time3702 = new BitSet(new long[]{0x0000000000000000L,0x0000004000000000L}); public static final BitSet FOLLOW_All_in_univ_time3704 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_univ_time3706 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftB_in_univ_time3754 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_univ_time3758 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L}); public static final BitSet FOLLOW_RightB_in_univ_time3760 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_bra_in_univ_time3782 = new BitSet(new long[]{0x0100000180000000L,0x7FB080A01A630200L}); public static final BitSet FOLLOW_delta_time_in_univ_time3792 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000040L}); public static final BitSet FOLLOW_Comma_in_univ_time3794 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_univ_time3798 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_univ_time3800 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expr_in_univ_time3835 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000040L}); public static final BitSet FOLLOW_Comma_in_univ_time3837 = new BitSet(new long[]{0x0100000180000000L,0x7FB080A01A630200L}); public static final BitSet FOLLOW_delta_time_in_univ_time3846 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_univ_time3848 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expr_in_univ_time3884 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_univ_time3886 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftB_in_exist_time3945 = new BitSet(new long[]{0x0000000000000000L,0x0000001000000000L}); public static final BitSet FOLLOW_Skip_in_exist_time3947 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L}); public static final BitSet FOLLOW_RightB_in_exist_time3949 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_bra_in_exist_time3969 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_exist_time3973 = new BitSet(new long[]{0x0000000000000000L,0x0000008000000000L}); public static final BitSet FOLLOW_rLimit_in_exist_time3975 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_lLimit_in_exist_time4006 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_exist_time4010 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_exist_time4012 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_bra_in_exist_time4034 = new BitSet(new long[]{0x0100000180000000L,0x7FB080B01A630200L}); public static final BitSet FOLLOW_delta_time_in_exist_time4049 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000040L}); public static final BitSet FOLLOW_Comma_in_exist_time4051 = new BitSet(new long[]{0x0000000000000000L,0x0000001000800400L}); public static final BitSet FOLLOW_Skip_in_exist_time4053 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_exist_time4056 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Skip_in_exist_time4085 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000040L}); public static final BitSet FOLLOW_Comma_in_exist_time4087 = new BitSet(new long[]{0x0100000180000000L,0x7FB080B01A630200L}); public static final BitSet FOLLOW_delta_time_in_exist_time4103 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_exist_time4105 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Skip_in_exist_time4133 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_exist_time4135 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expr_in_exist_time4154 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_exist_time4156 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expr_in_exist_time4186 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000040L}); public static final BitSet FOLLOW_Comma_in_exist_time4188 = new BitSet(new long[]{0x0000000000000000L,0x0000001000000000L}); public static final BitSet FOLLOW_Skip_in_exist_time4190 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_exist_time4192 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Delta_in_delta_time4223 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_num_1_in_delta_time4226 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftB_in_bra4238 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftP_in_bra4253 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_RightB_in_ket4273 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_RightP_in_ket4288 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Dots_in_lLimit4306 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Dots_in_rLimit4322 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_expr4346 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_log_1_in_expr4351 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_e_prefix4368 = new BitSet(new long[]{0x0000000000000000L,0x0000010000000000L}); public static final BitSet FOLLOW_Colon_in_e_prefix4370 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_e_prefix4374 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_interval_in_e_prefix4400 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_e_prefix4404 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Contains_in_e_prefix4429 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_exist_time_in_e_prefix4442 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_e_prefix4446 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expr_in_e_prefix4470 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ForAll_in_e_prefix4494 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_param_list_in_e_prefix4496 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_e_prefix4500 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Exists_in_e_prefix4519 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_param_list_in_e_prefix4521 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_e_prefix4525 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_log_2_in_e_log_14560 = new BitSet(new long[]{0x0000000000000002L,0x0000020000000000L}); public static final BitSet FOLLOW_Implies_in_e_log_14567 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_log_14575 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_log_1_in_e_log_14579 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_log_3_in_e_log_24592 = new BitSet(new long[]{0x0000000000000002L,0x0000000000040000L}); public static final BitSet FOLLOW_EqualLog_in_e_log_24599 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_log_24607 = new BitSet(new long[]{0x0000000000000002L,0x0000000000040000L}); public static final BitSet FOLLOW_e_log_3_in_e_log_24611 = new BitSet(new long[]{0x0000000000000002L,0x0000000000040000L}); public static final BitSet FOLLOW_e_log_4_in_e_log_34624 = new BitSet(new long[]{0x0000000000000002L,0x0000040000000000L}); public static final BitSet FOLLOW_XorLog_in_e_log_34631 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_log_34639 = new BitSet(new long[]{0x0000000000000002L,0x0000040000000000L}); public static final BitSet FOLLOW_e_log_4_in_e_log_34643 = new BitSet(new long[]{0x0000000000000002L,0x0000040000000000L}); public static final BitSet FOLLOW_e_log_5_in_e_log_44669 = new BitSet(new long[]{0x0000000000000002L,0x0000080000000000L}); public static final BitSet FOLLOW_OrLog_in_e_log_44676 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_log_44684 = new BitSet(new long[]{0x0000000000000002L,0x0000080000000000L}); public static final BitSet FOLLOW_e_log_5_in_e_log_44688 = new BitSet(new long[]{0x0000000000000002L,0x0000080000000000L}); public static final BitSet FOLLOW_e_log_6_in_e_log_54702 = new BitSet(new long[]{0x0000000000000002L,0x0000100000000000L}); public static final BitSet FOLLOW_AndLog_in_e_log_54709 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_log_54717 = new BitSet(new long[]{0x0000000000000002L,0x0000100000000000L}); public static final BitSet FOLLOW_e_log_6_in_e_log_54721 = new BitSet(new long[]{0x0000000000000002L,0x0000100000000000L}); public static final BitSet FOLLOW_NotLog_in_e_log_64738 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_log_64746 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_log_6_in_e_log_64750 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_log_7_in_e_log_64756 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_num_1_in_e_log_74766 = new BitSet(new long[]{0x0000000000000002L,0x8000000000080044L,0x0000000000000007L}); public static final BitSet FOLLOW_num_relop_in_e_log_74773 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_log_74781 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_num_1_in_e_log_74785 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_e_num4802 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_num_1_in_e_num4807 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_num_2_in_e_num_14817 = new BitSet(new long[]{0x0000000000000002L,0x0000200000000000L}); public static final BitSet FOLLOW_XorBit_in_e_num_14824 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_num_14832 = new BitSet(new long[]{0x0000000000000002L,0x0000200000000000L}); public static final BitSet FOLLOW_e_num_2_in_e_num_14836 = new BitSet(new long[]{0x0000000000000002L,0x0000200000000000L}); public static final BitSet FOLLOW_e_num_3_in_e_num_24849 = new BitSet(new long[]{0x0000000000000002L,0x0001C00000000000L}); public static final BitSet FOLLOW_Plus_in_e_num_24861 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_Minus_in_e_num_24864 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_OrBit_in_e_num_24867 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_num_24876 = new BitSet(new long[]{0x0000000000000002L,0x0001C00000000000L}); public static final BitSet FOLLOW_e_num_3_in_e_num_24880 = new BitSet(new long[]{0x0000000000000002L,0x0001C00000000000L}); public static final BitSet FOLLOW_e_num_4_in_e_num_34893 = new BitSet(new long[]{0x0000000000000002L,0x000E000000000000L}); public static final BitSet FOLLOW_Times_in_e_num_34908 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_Divide_in_e_num_34911 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_AndBit_in_e_num_34914 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_num_34927 = new BitSet(new long[]{0x0000000000000002L,0x000E000000000000L}); public static final BitSet FOLLOW_e_num_4_in_e_num_34935 = new BitSet(new long[]{0x0000000000000002L,0x000E000000000000L}); public static final BitSet FOLLOW_Minus_in_e_num_44962 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_NotBit_in_e_num_44965 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_e_prefix_in_e_num_44977 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_num_4_in_e_num_44984 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_atomic_in_e_num_44993 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftP_in_e_atomic5003 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_e_atomic5006 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_e_atomic5008 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_time_primitive_in_e_atomic5014 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_time_complex_in_e_atomic5019 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_literal_in_e_atomic5024 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ref_in_e_atomic5029 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Unordered_in_time_complex5042 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_Ordered_in_time_complex5045 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_time_complex5049 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_time_complex5052 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000440L}); public static final BitSet FOLLOW_Comma_in_time_complex5055 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_time_complex5058 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000440L}); public static final BitSet FOLLOW_RightP_in_time_complex5062 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_ref5076 = new BitSet(new long[]{0x0000000000000002L,0x0040000000000200L}); public static final BitSet FOLLOW_Dot_in_ref5093 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_ref5095 = new BitSet(new long[]{0x0000000000000002L,0x0040000000000200L}); public static final BitSet FOLLOW_arg_list_in_ref5125 = new BitSet(new long[]{0x0000000000000002L,0x0040000000000200L}); public static final BitSet FOLLOW_Bra_in_time_primitive5166 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_time_primitive5168 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_time_primitive5170 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_time_primitive5172 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Start_in_time_primitive5203 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_time_primitive5205 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_time_primitive5207 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_time_primitive5209 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_End_in_time_primitive5240 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_time_primitive5242 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_time_primitive5244 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_time_primitive5246 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Duration_in_time_primitive5274 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_time_primitive5276 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_time_primitive5278 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_time_primitive5280 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Ket_in_time_primitive5308 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_time_primitive5310 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_time_primitive5312 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_time_primitive5314 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Start_in_time_primitive5334 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_End_in_time_primitive5354 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Duration_in_time_primitive5374 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Bra_in_time_primitive5394 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Ket_in_time_primitive5414 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_enumeration_in_set5438 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_range_in_set5442 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftC_in_enumeration5451 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_enumeration5453 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A638240L}); public static final BitSet FOLLOW_Comma_in_enumeration5456 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_enumeration5459 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A638240L}); public static final BitSet FOLLOW_RightC_in_enumeration5463 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftB_in_range5485 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_range5489 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630240L}); public static final BitSet FOLLOW_Comma_in_range5491 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_range5496 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L}); public static final BitSet FOLLOW_RightB_in_range5498 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftC_in_type_enumeration5522 = new BitSet(new long[]{0x0100000000000000L,0x7E00000000000000L}); public static final BitSet FOLLOW_type_enumeration_element_in_type_enumeration5524 = new BitSet(new long[]{0x0100000000000000L,0x7E00000000008040L}); public static final BitSet FOLLOW_Comma_in_type_enumeration5527 = new BitSet(new long[]{0x0100000000000000L,0x7E00000000000000L}); public static final BitSet FOLLOW_type_enumeration_element_in_type_enumeration5530 = new BitSet(new long[]{0x0100000000000000L,0x7E00000000008040L}); public static final BitSet FOLLOW_RightC_in_type_enumeration5534 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_type_enumeration_element5559 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_literal_in_type_enumeration_element5563 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftP_in_arg_list5576 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630600L}); public static final BitSet FOLLOW_expr_in_arg_list5579 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630640L}); public static final BitSet FOLLOW_Comma_in_arg_list5582 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_arg_list5585 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630640L}); public static final BitSet FOLLOW_RightP_in_arg_list5591 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_literal0 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_num_relop0 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ref_in_synpred1_ANML1528 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_synpred1_ANML1530 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_synpred2_ANML1572 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_ref_in_synpred2_ANML1578 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_synpred2_ANML1580 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_primitive_in_synpred3_ANML2624 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_block_in_synpred4_ANML2634 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_timed_in_synpred5_ANML2644 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_exist_time_in_synpred6_ANML2685 = new BitSet(new long[]{0x0110000182580000L,0x7FB080A01A737A22L}); public static final BitSet FOLLOW_stmt_in_synpred6_ANML2687 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Else_in_synpred7_ANML2753 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_expr_in_synpred8_ANML2893 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_synpred8_ANML2895 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_chain_in_synpred9_ANML2910 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_synpred9_ANML2912 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_delta_chain_in_synpred10_ANML2925 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_synpred10_ANML2927 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_stmt_timeless_in_synpred11_ANML2942 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000020L}); public static final BitSet FOLLOW_Semi_in_synpred11_ANML2944 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_interval_in_synpred12_ANML3034 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_ref_in_synpred12_ANML3036 = new BitSet(new long[]{0x0000000000000000L,0x8000001FE008014CL,0x0000000000000007L}); public static final BitSet FOLLOW_stmt_chain_1_in_synpred12_ANML3038 = new BitSet(new long[]{0x0000000000000002L,0x8000001FE008014CL,0x0000000000000007L}); public static final BitSet FOLLOW_interval_in_synpred13_ANML3452 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_ref_in_synpred13_ANML3454 = new BitSet(new long[]{0x0000000000000000L,0x0000001820080148L}); public static final BitSet FOLLOW_stmt_delta_chain_1_in_synpred13_ANML3456 = new BitSet(new long[]{0x0000000000000002L,0x0000001820080148L}); public static final BitSet FOLLOW_univ_time_in_synpred14_ANML3664 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_exist_time_in_synpred15_ANML3673 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_bra_in_synpred16_ANML3694 = new BitSet(new long[]{0x0000000000000000L,0x0000004000000000L}); public static final BitSet FOLLOW_All_in_synpred16_ANML3696 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_synpred16_ANML3698 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftB_in_synpred17_ANML3746 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_synpred17_ANML3748 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L}); public static final BitSet FOLLOW_RightB_in_synpred17_ANML3750 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LeftB_in_synpred18_ANML3937 = new BitSet(new long[]{0x0000000000000000L,0x0000001000000000L}); public static final BitSet FOLLOW_Skip_in_synpred18_ANML3939 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L}); public static final BitSet FOLLOW_RightB_in_synpred18_ANML3941 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_bra_in_synpred19_ANML3961 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_synpred19_ANML3963 = new BitSet(new long[]{0x0000000000000000L,0x0000008000000000L}); public static final BitSet FOLLOW_rLimit_in_synpred19_ANML3965 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_lLimit_in_synpred20_ANML3998 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_synpred20_ANML4000 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800400L}); public static final BitSet FOLLOW_ket_in_synpred20_ANML4002 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Delta_in_synpred21_ANML4043 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Skip_in_synpred22_ANML4081 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Delta_in_synpred23_ANML4097 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Skip_in_synpred24_ANML4129 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred25_ANML4343 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_interval_in_synpred26_ANML4394 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_synpred26_ANML4396 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Contains_in_synpred27_ANML4425 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_exist_time_in_synpred28_ANML4436 = new BitSet(new long[]{0x0100000180000000L,0x7FB080801A630200L}); public static final BitSet FOLLOW_expr_in_synpred28_ANML4438 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Implies_in_synpred29_ANML4564 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred30_ANML4572 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_EqualLog_in_synpred31_ANML4596 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred32_ANML4604 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_XorLog_in_synpred33_ANML4628 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred34_ANML4636 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_OrLog_in_synpred35_ANML4673 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred36_ANML4681 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_AndLog_in_synpred37_ANML4706 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred38_ANML4714 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_NotLog_in_synpred39_ANML4735 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred40_ANML4743 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_num_relop_in_synpred41_ANML4770 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred42_ANML4778 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred43_ANML4799 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_XorBit_in_synpred44_ANML4821 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred45_ANML4829 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_synpred46_ANML4852 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred47_ANML4873 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_synpred48_ANML4899 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred49_ANML4924 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_synpred50_ANML4955 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_e_prefix_in_synpred51_ANML4974 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_arg_list_in_synpred52_ANML5121 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Bra_in_synpred53_ANML5156 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_synpred53_ANML5158 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_synpred53_ANML5160 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_synpred53_ANML5162 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Start_in_synpred54_ANML5193 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_synpred54_ANML5195 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_synpred54_ANML5197 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_synpred54_ANML5199 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_End_in_synpred55_ANML5230 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_synpred55_ANML5232 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_synpred55_ANML5234 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_synpred55_ANML5236 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Duration_in_synpred56_ANML5264 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_synpred56_ANML5266 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_synpred56_ANML5268 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_synpred56_ANML5270 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_Ket_in_synpred57_ANML5298 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000200L}); public static final BitSet FOLLOW_LeftP_in_synpred57_ANML5300 = new BitSet(new long[]{0x0100000000000000L}); public static final BitSet FOLLOW_ID_in_synpred57_ANML5302 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000400L}); public static final BitSet FOLLOW_RightP_in_synpred57_ANML5304 = new BitSet(new long[]{0x0000000000000002L}); }
Java
package gov.nasa.anml.parsing; import org.antlr.runtime.*; import gov.nasa.anml.utility.SimpleString; import java.io.Serializable; import javax.print.DocFlavor.INPUT_STREAM; import org.antlr.runtime.tree.*; public class ANMLToken extends BaseTree implements Token, Serializable { // token imp public int type=INVALID_TOKEN_TYPE; public int line; public int charPositionInLine = -1; // set to invalid position public int channel=DEFAULT_CHANNEL; public transient ANMLCharStream input; /** We need to be able to change the textSimple once in a while. If * this is non-null, then getText should return this. Note that * start/stop are not affected by changing this. */ public String text; public SimpleString textSimple; /** What token number is this from 0..n-1 tokens; < 0 implies invalid index */ public int index = -1; /** The char position into the input buffer where this token starts */ public int start; /** The char position into the input buffer where this token stops */ public int stop; public ANMLToken(int type) { this.type = type; } public ANMLToken(CharStream input, int type, int channel, int start, int stop) { this.input = (ANMLCharStream) input; this.type = type; this.channel = channel; this.start = start; this.stop = stop; } public ANMLToken(int type, String text) { this.type = type; this.text = text; if (text != null) this.textSimple = new SimpleString(text); } public ANMLToken(Token oldToken) { if (oldToken == null) return; text = oldToken.getText(); if (text != null) textSimple = new SimpleString(text); type = oldToken.getType(); line = oldToken.getLine(); index = oldToken.getTokenIndex(); charPositionInLine = oldToken.getCharPositionInLine(); channel = oldToken.getChannel(); input = (ANMLCharStream) oldToken.getInputStream(); if ( oldToken instanceof ANMLToken ) { ANMLToken old = (ANMLToken) oldToken; start = old.start; stop = old.stop; this.startIndex = old.startIndex; this.stopIndex = old.stopIndex; } } public int getType() { return type; } public void setLine(int line) { this.line = line; } public String getText() { if ( textSimple!=null ) { if (text == null) text = new String(textSimple.v); return text; } if ( input==null ) { return null; } textSimple = input.makeSimpleString(start,stop); text = new String(textSimple.v); return text; } public SimpleString getSimpleText() { if ( textSimple!=null ) { return textSimple; } if ( input==null ) { return SimpleString.Empty; } textSimple = input.makeSimpleString(start,stop); return textSimple; } public String toPositionString() { return "_l" + line + "_c" + (charPositionInLine+1); } /** Override the textSimple for this token. getText() will return this textSimple * rather than pulling from the buffer. Note that this does not mean * that start/stop indexes are not valid. It means that that input * was converted to a new string in the token object. */ public void setText(String text) { this.text = text; if (text != null) { if (textSimple == null) { this.textSimple = new SimpleString(text); } else { this.textSimple.length=0; } } } public int getLine() { return line; } public int getCharPositionInLine() { return charPositionInLine; } public void setCharPositionInLine(int charPositionInLine) { this.charPositionInLine = charPositionInLine; } public int getChannel() { return channel; } public void setChannel(int channel) { this.channel = channel; } public void setType(int type) { this.type = type; } public int getStartIndex() { return start; } public void setStartIndex(int start) { this.start = start; } public int getStopIndex() { return stop; } public void setStopIndex(int stop) { this.stop = stop; } public int getTokenIndex() { return index; } public void setTokenIndex(int index) { this.index = index; } public CharStream getInputStream() { return input; } public void setInputStream(CharStream input) { this.input = ((ANMLCharStream)input); // will break loudly and ungracefully if wrong input is provided } public void setInputStream(ANMLCharStream input) { this.input = input; } public String toString() { return getText(); /* String channelStr = ""; if ( channel>0 ) { channelStr=",channel="+channel; } String txt = getText(); if ( txt!=null ) { txt = txt.replaceAll("\n","\\\\n"); txt = txt.replaceAll("\r","\\\\r"); txt = txt.replaceAll("\t","\\\\t"); } else { txt = "<no text>"; } return "[@"+getTokenIndex()+","+start+":"+stop+"='"+txt+"',<"+type+">"+channelStr+","+line+":"+getCharPositionInLine()+"]"; */ } // tree imp protected int startIndex=-1, stopIndex=-1; /** Who is the parent node of this node; if null, implies node is root */ public ANMLToken parent; /** What index is this node in the child list? Range: 0..n-1 */ public int childIndex = -1; public ANMLToken() { } public ANMLToken getToken() { return this; } public ANMLToken dupNode() { return new ANMLToken(this); } public boolean isNil() { return type==INVALID_TOKEN_TYPE; } public int getTokenStartIndex() { return startIndex; } public void setTokenStartIndex(int index) { startIndex = index; } public int getTokenStopIndex() { return stopIndex; } public void setTokenStopIndex(int index) { stopIndex = index; } public int getChildIndex() { return childIndex; } public ANMLToken getParent() { return parent; } public void setParent(ANMLToken t) { this.parent = (ANMLToken)t; } public void setChildIndex(int index) { this.childIndex = index; } public static StringBuilder newlineAndIndent = new StringBuilder(""); public static StringBuilder buf = new StringBuilder(); public String toStringTree() { if (children == null || children.size() == 0) return this.toString(); newlineAndIndent.setLength(1); newlineAndIndent.append('\n'); buf.setLength(0); if (!isNil()) { buf.append('('); buf.append(this.toString()); newlineAndIndent.append('\t'); } ANMLToken t; int i=0; do { t = (ANMLToken) children.get(i); buf.append(' '); t._toStringTree(buf); } while (++i < children.size()); if (!isNil()) { buf.append("\n)\n"); } return buf.toString(); /* if ( children==null || children.size()==0 ) { return prefix+this.toString(); } StringBuffer buf = new StringBuffer(); char sep = ' '; if ( !isNil() ) { sep = '\n'; buf.append(prefix).append("("); buf.append(this.toString()); buf.append(sep); prefix.append('\t'); } BaseTree t; if (children != null && children.size() > 0) { t = (BaseTree) children.get(0); buf.append(t.toStringTree()); for (int i = 1; i < children.size(); i++) { t = (BaseTree) children.get(i); buf.append(sep); buf.append(t.toStringTree()); } } if ( !isNil() ) { buf.append(")"); prefix.setLength(prefix.length()-1); } return buf.toString();*/ } public void _toStringTree(StringBuilder buf) { if ( children==null || children.size()==0 ) { buf.append(this.toString()); return; } CharSequence sep = " "; if ( !isNil() ) { // if (children.size() > 3) // sep = newlineAndIndent; buf.append(newlineAndIndent).append("("); buf.append(this.toString()); newlineAndIndent.append('\t'); } ANMLToken t; int i=0; do { t = (ANMLToken) children.get(i); buf.append(sep); t._toStringTree(buf); } while (++i < children.size()); if ( !isNil() ) { newlineAndIndent.setLength(newlineAndIndent.length()-1); buf.append(')'); //if (children.size() > 3) } } }
Java
package gov.nasa.anml; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.iHashMap; public class LocalState extends Context { // psuedo-constants (defined by future expressions, so different with // different plans) // real constants can be compiled away public iHashMap<? extends SimpleObject<?>> constants = new iHashMap<SimpleObject<?>>(); public iFluentHistoryMap fluents = new iFluentHistoryMap(); public iFunctionHistoryMap functions = new iFunctionHistoryMap(); public iHashMap<LocalState> contexts = new iHashMap<LocalState>(); { // unnecessary? contexts.put(-1,this); } }
Java
package gov.nasa.anml; import gov.nasa.anml.lifted.Action; import gov.nasa.anml.utility.SimpleFloat; import gov.nasa.anml.utility.SimpleObject; public class Step { public Action action; public SimpleObject<?>[] parameters; public SimpleFloat start; // have to start at definite times }
Java
package gov.nasa.anml; import java.util.ArrayList; import gov.nasa.anml.lifted.*; import gov.nasa.anml.utility.*; public class PDDL { public String name; public ArrayList<Type> types = new ArrayList<Type>(); public ArrayList<TypeRelation> typeRelations = new ArrayList<TypeRelation>(); public ArrayList<Object> domainObjects = new ArrayList<Object>(); public ArrayList<Predicate> predicates = new ArrayList<Predicate>(); public ArrayList<Function> functions = new ArrayList<Function>(); public ArrayList<Action> actions = new ArrayList<Action>(); public ArrayList<ComplexAction> complexActions = new ArrayList<ComplexAction>(); public Problem prob = new Problem(); // for collapsing scopes during the translation public transient StringBuilder buf = new StringBuilder(); // the names of scopes down to this level. // scheme can fail if input scope names play tricky games like // a="fly_" b="fly_fly" c="fly", then scope chains ac and b have identical representation, but different depth. // to get same depth, just invert the trick -- acb and bac to get two identical depth 2 (zero-based) representations. // methods around this either requires // a) too much analysis // b) incomprehensible symbols [c.f. C++ name mangling; gensym()] public transient int depth = -1; // how deep; actions are at level 0 (Domains are at level -1) public transient ArrayList<Parameter> context = new ArrayList<Parameter>(); // the parameters of all parent scopes // this is needed for local declarations // almost certainly also need an ArrayList of PDDL actions, or ANML units, in order to ensure that PDDL plans respect scoping rules // e.g., if there are domain constraints, then all actions need to use the domain-executing predicate in order to force // the domain constraints to be included. public int bufAppend(SimpleString name) { int length = buf.length(); if (length > 0) buf.append('_'); buf.append(name.v,0,name.length); return length; } public String bufToString() { return buf.toString(); } public void bufReset(int length) { buf.setLength(length); } public StringBuilder append(StringBuilder buf) { buf.append("(define (domain ").append(name) .append(")\n(:requirements :typing :durative-actions)\n(:types"); for (Type t : types) { t.append(buf.append("\n\t")); } buf.append(" - object"); for (TypeRelation t : typeRelations) { t.append(buf.append("\n\t")); } buf.append("\n)\n(:predicates (true) (alive) ;; initial state needs to have `(alive)' and it and the goal ought to have `(true)'"); for (Predicate p : predicates) { p.append(buf.append("\n\t")); } buf.append("\n)\n(:functions"); for (Function f : functions) { f.append(buf.append("\n\t")); } buf.append("\n)\n(:constants"); for (Object o : domainObjects) { o.append(buf.append("\n\t")); } buf.append("\n)\n"); for (Action a : actions) { a.append(buf.append('\n')); } buf.append('\n'); for (ComplexAction a : complexActions) { a.append(buf.append('\n')); } buf.append("\n\n)\n"); return buf; } public Effect makeEffect(Time time, PDDL.FunctionReference r, PDDL.FloatExpression e) { return wrap(time,makeEffect(r,e)); } public FloatEffect makeEffect(FunctionReference r, FloatExpression e) { return this.new AtomicFloatEffect(Op.assign,r,e); } public Effect makeEffect(Time time, Op o, PDDL.FunctionReference r, PDDL.FloatExpression e) { return wrap(time,makeEffect(o,r,e)); } public FloatEffect makeEffect(Op o, PDDL.FunctionReference r, PDDL.FloatExpression e) { return this.new AtomicFloatEffect(o,r,e); } public Effect makeEffect(Time time, PDDL.PredicateReference r, PDDL.BooleanExpression expression) { return wrap(time,makeEffect(r,expression)); } public Effect makeEffect(PDDL.PredicateReference r, PDDL.BooleanExpression expression) { if (expression == TrueRef) return makeEffect(r,true); if (expression == FalseRef) return makeEffect(r,false); BooleanEffect effT = this.new AtomicBooleanEffect(r,true); ConditionalEffect ceffT = this.new ConditionalEffect(expression,effT); BooleanEffect effF = this.new AtomicBooleanEffect(r,false); UnaryBooleanExpression expressionF = this.new UnaryBooleanExpression(Op.not,expression); ConditionalEffect ceffF = this.new ConditionalEffect(expressionF,effF); return this.new BinaryEffect(Op.and,ceffT,ceffF); } public Effect makeEffect(BooleanExpression guard, PDDL.PredicateReference r, PDDL.BooleanExpression expression) { if (guard == FalseRef) return makeEffect(TrueRef,true); Effect eff = makeEffect(r,expression); return this.new ConditionalEffect(guard,eff); } public Effect makeEffect(BooleanExpression guard, PDDL.PredicateReference r, boolean v) { if (guard == FalseRef) return makeEffect(TrueRef,true); Effect eff = makeEffect(r,v); return this.new ConditionalEffect(guard,eff); } public TimedBooleanEffect makeEffect(Time time,PDDL.PredicateReference r, boolean v) { return wrap(time,makeEffect(r,v)); } public BooleanEffect makeEffect(PDDL.PredicateReference r, boolean v) { return this.new AtomicBooleanEffect(r,v); } public BooleanExpression negate(BooleanExpression l) { if (l instanceof TimedBooleanExpression) { TimedBooleanExpression t = (TimedBooleanExpression) l; return wrap(t.time,negate(t.e)); } if (l==FalseRef) return TrueRef; if (l==TrueRef) return FalseRef; return wrap(Op.not,l); } public BooleanEffect negate(BooleanEffect l) { if (l instanceof TimedBooleanEffect) { TimedBooleanEffect t = (TimedBooleanEffect) l; return wrap(t.time,negate(t.e)); } else if (l instanceof AtomicBooleanEffect) { AtomicBooleanEffect a = (AtomicBooleanEffect) l; return this.new AtomicBooleanEffect(a.ref,!a.v); } System.err.println("Warning: Don't know how to negate complex effects (killing container with `true' := false)."); return this.new AtomicBooleanEffect(TrueRef,false); } public BooleanExpression wrap(Op o,BooleanExpression l) { return this.new UnaryBooleanExpression(o,l); } public FloatExpression wrap(Op o,FloatExpression l) { return this.new UnaryFloatExpression(o,l); } public Expression wrap(Op o,Expression l) { return this.new UnaryExpression(o,l); } public BooleanExpression wrap(Op o,BooleanExpression l, BooleanExpression r) { return this.new BinaryBooleanExpression(o,l,r); } public FloatExpression wrap(Op o,FloatExpression l, FloatExpression r) { return this.new BinaryFloatExpression(o,l,r); } public BinaryExpression wrap(Op o, Expression l,Expression r) { return new BinaryExpression(o,l,r); } public BooleanExpression wrap(Op o,ArrayList<BooleanExpression> operands) { return this.new CompoundBooleanExpression(o,operands); } public Effect wrap(Op o,ArrayList<Effect> operands) { return this.new CompoundEffect(o,operands); } public BooleanExpression wrap(Time time, BooleanExpression l) { if (l.isTimed()) return l; return this.new TimedBooleanExpression(time,l); } public FloatExpression wrap(Time time, FloatExpression l) { if (l.isTimed()) return l; return this.new TimedFloatExpression(time,l); } public TimedBooleanEffect wrap(Time time, BooleanEffect e) { return this.new TimedBooleanEffect(time,e); } public TimedFloatEffect wrap(Time time, FloatEffect e) { return this.new TimedFloatEffect(time,e); } public <T extends Effect> TimedEffect<T> wrap(Time time, T e) { return this.new TimedEffect<T>(time,e); } public BooleanExpression makeTest(PDDL.FloatExpression l, PDDL.FloatExpression r) { return this.new RelOp(PDDL.Op.equals,l,r); } public BooleanExpression makeTest(Op o, PDDL.FloatExpression l, PDDL.FloatExpression r) { return this.new RelOp(o,l,r); } public BooleanExpression makeTest(BooleanExpression l, boolean v) { PDDL.BooleanExpression c; if (v) c = l; else c = negate(l); return c; } public BooleanExpression makeTest(Op o,BooleanExpression l, boolean v) { PDDL.BooleanExpression lt,lf,c; switch(o) { case lt: lf = negate(l); if (!v) c = wrap(Op.and,lf,FalseRef); // not simplified to assist debugging of models else c = lf; break; case gt: lt = l; if (v) c = wrap(Op.and,FalseRef,lt); // not simplified to assist debugging of models else c = lt; break; case gte: lt = l; if(v) c = lt; else // could omit entirely, but leaving it in helps at least a little in debugging c = TrueRef; // perhaps a bug, but not one that would typically destroy solvability (unless nested underneath a not), so simplify break; case lte: case implies: lf = negate(l); if (v) // could omit entirely, but leaving it in helps at least a little in debugging c = TrueRef; // perhaps a bug, but not one that would typically destroy solvability (unless nested underneath a not), so simplify else c = lf; break; case equals: lt = l; lf = negate(l); if (v) c = lt; else c = lf; break; case and: if (v) c = l; else c = FalseRef; break; case or: if (v) c = TrueRef; else c = l; break; default: System.err.println("Operation '" + o + "' not supported, and unexpected, for generic boolean expressions at this time (perhaps never)."); System.err.println(l); c = TrueRef; } return c; } public PDDL.BooleanExpression makeTest(Op o, BooleanExpression l, BooleanExpression r) { if (r == TrueRef) return makeTest(o,l,true); if (r == FalseRef) return makeTest(o,l,false); BooleanExpression lt,lf,rt,rf,c; switch(o) { case lt: lf = negate(l); rt = r; c = wrap(Op.and,lf,rt); break; case gt: rf = negate(r); lt = l; c = wrap(Op.and,rf,lt); break; case gte: rf = negate(r); lt = l; if (lt == FalseRef) c = rf; else if (lt == TrueRef) c = TrueRef; else c = wrap(Op.or,rf,lt); break; case lte: case implies: lf = negate(l); rt = r; if (lf == FalseRef) c = rt; else if (lf == TrueRef) c = TrueRef; else c = wrap(Op.or,lf,rt); break; case equals: if (l == TrueRef || l == FalseRef) return makeTest(r,l); lt = l; lf = negate(l); rt = r; rf = negate(r); c = wrap(Op.or,wrap(Op.and, lf, rf), wrap(Op.and, lt,rt)); //c = doOp(Op.and,doOp(Op.or,negate(l),r),doOp(Op.or,negate(r),l))); // equivalent construction //c = doOp(Op.and,doOp(Op.imply,l,r),doOp(Op.imply,r,l))); // but allows this; // which has nice parallels with Op.when. break; case and: c = wrap(o,l,r); break; case or: if (l == FalseRef) c = r; else if (l == TrueRef) c = TrueRef; else c = wrap(o,l,r); break; default: System.err.println("Operation " + o + " not supported, and unexpected, for generic boolean expressions at this time (perhaps never)."); c = TrueRef; } return c; } public BooleanExpression makeTest(BooleanExpression l, BooleanExpression r) { if (r == TrueRef) return makeTest(l,true); if (r == FalseRef) return makeTest(l,false); if (l == TrueRef) return makeTest(r,true); if (l == FalseRef) return makeTest(r,false); BooleanExpression lt,lf,rt,rf,c; lt = l; lf = negate(l); rt = r; rf = negate(r); c = wrap(Op.or,wrap(Op.and, lf, rf), wrap(Op.and, lt,rt)); return c; } interface Append { StringBuilder append(StringBuilder buf); } class Compound<T extends Append> implements Append { public Op o; public ArrayList<T> arguments; public StringBuilder append(StringBuilder buf) { if (arguments.size() > 1) indent(buf); buf.append('(').append(o.name); for (T arg : arguments) { arg.append(buf.append(' ')); } buf.append(')'); if (arguments.size() > 1) dedent(buf); return buf; } public Compound(Op o) { this.o = o; this.arguments = new ArrayList<T>(); } public Compound(Op o,T a) { this.o = o; this.arguments = new ArrayList<T>(); this.arguments.add(a); System.err.println("There are better options."); } public Compound(Op o,T a, T b) { this.o = o; this.arguments = new ArrayList<T>(); this.arguments.add(a); this.arguments.add(b); System.err.println("There are better options."); } public Compound(Op o, ArrayList<T> args) { this.o = o; this.arguments = args; } } public interface Expression extends Append {} public interface BooleanExpression extends Expression, Append { boolean isTimed(); } public interface FloatExpression extends Expression, Append { boolean isTimed();} public interface Effect extends Append {} public interface BooleanEffect extends Effect, Append { } public interface FloatEffect extends Effect, Append {} public interface Argument extends Append {} public interface Timed<T> extends Append {} public class TypeRelation { public Type subType; public Type superType; public TypeRelation(Type subType, Type superType) { super(); this.subType = subType; this.superType = superType; } public StringBuilder append(StringBuilder buf) { buf.append(subType.name).append(" - ").append(superType.name); return buf; } } public class Type { public String name; public StringBuilder append(StringBuilder buf) { buf.append(name); return buf; } public Type(String name) { this.name = name; } } // action lock(Array a) { // duration := 1; // a.lock == false :-> true; // } // action unlock(Array a) { // duration := 1; // a.lock == true :-> false; // } // // real-time performance guarantee! // action arraycopy(Array a, b) { // duration := 20; // Array temp; // action read() { // duration := 5; // temp.data := a.data; // } // action write() { // duration := 5; // b.data := temp.data; // } // [all] contains ordered(lock(a),read(a),unlock(a),lock(b),write(b),unlock(b)) // } // Array a,b,c; // a.data = "hello"; // b.data = "world"; // c.data = "foo"; // [0,20] { arraycopy(a,b); arraycopy(b,c); } // // b/c of the duration constraint, the write to b cannot precede the read from b // // ergo b is read from, to temp, before the write, from temp, to b. // // is temp the same object in the two instances of arraycopy...or different? // // different is a better interpretation in context // // but what a colossal headache to deal with... // // consider that one could do // action foo (Type1 blah ) { // Type2 a; // [all] bar(a); // <operations on blah> // // which is 'a' of Type1 of bar() // } // action bar (Type2 blah ) { // Type1 a; // [all] foo(a); // <operations on blah> // // which is 'a' of Type2 of foo() // } // // So that one needs to process effects on properties of objects // // in such a manner that they can be read by other actions without // // knowing that they are reading from a local object that is // // instantiation dependent w.r.t. the action creating the local object // // // // One can do it by doing (#schema+1) ^ (k), where k is the maximum arity; // // each action is then like: // action fly-s1-s2-s3... (<args to s1>, <args to s2>, ... ) // // with the +1 for the null schema, so that sometimes one simplifies to // action fly-null-null-... (<atomic arg 1>, <atomic arg 2>, ...) // // and then each of these actions then has sufficient information // // to find all the properties of every possible object // // // // local objects kept to local scope are much easier, but still // // cumbersome. One still needs just as much storage, but // // there can be less schema proliferation. // // // // so for all those reasons, I'm taking 'static' as the default // // access for local objects/symbols. Effectively, the referent // // of the identifier is the literal text in the model -- the token. // // so two objects of the same name in different scopes are different // // objects, but two invocations of the same lexical scope with different // // bindings are still in the same lexical scope and so see the same // // referent. In particular the arraycopy model would not have the // // intended effect; instead of a and b moving to b and c respectively // // either b and c both contain "World" or b and c both contain "Hello" // // [the plans that work are a little tricky to find; since temp.data // // is the same fluent the write effects of the read() actions are mutex] // // constants and fluents, on the other hand, do not have this problem // because their classes, in the sense of object types, are local to // the action declaring them; in the pddl they look like // (foo a_x a_y a_x f_x f_y f_z) where the first set of parameters is // that of the action. For an object that is kept local (not passed) // , as mentioned above, the situation simplifies, and context becomes // 'easy' to incorporate in the same manner as constants and fluents. // the issue is that the schema of context changes if multiple actions // have to access the same fluent, which isn't possible for action-local // fluents, but is possible for properties of action-declared, but non-local, // objects. // // A real machine has a memory space, and what ends up happening // is that the method/function local objects end up being dynamically // associated with the fixed pool of constant symbols (memory locations). // A similar approach could be pursued in this compilation, but // then no pddl planner would have even a remote chance of succeeding, // if the symbol pool is large enough to maintain semantic consistency // with the anml. An anml planner can succeed because it is running // on a machine with dynamic allocation, and so can dynamically allocate // just enough symbols for the plan under consideration, instead of // having to pre-allocate enough symbols to stand for simultaneously // executing every instantiation of fly(o,x,y). // // For any realistic model, it would be possible to bound the number // of concurrently accessible instances of any given type, and then employ // the dynamic memory approach: // arraycopy(Array x,y) -> (arraycopy x y - Array u v t - __Memory) // Array t -> :condition (and (null t) ...) // Array t -> :effect (and (at start (not (null t)) (array t) (data t null) (= (length t) 0)) ... ) // [p] t.data := a.data -> :condition (and (at start (data a u) ...) ...) // :effect (... (at p (data t u)) ...) // and so forth; the critical part being to have an internal __Memory type // that is a pool of symbols standing for references to memory locations, the validity // and type of which is dynamically tracked. // so then every property would be declared as // (<prop> <objectarg> - ANMLObject <typed_args> ) // and (:types __Memory - ANMLObject ...) // and of course any normal object type would also subclass ANMLObject // so that both statically and dynamically declared objects could be handled, // with an optimization for the statically declared case. public class ObjectRef implements Argument { public Object ref; public ObjectRef(Object ref) { super(); this.ref = ref; } public StringBuilder append(StringBuilder buf) { return buf.append(ref.name); } } public class Object implements Append { public String name; public Type type; public Object(String name) { super(); this.name = name; this.type = PDDL.this.Object; } public Object(String name,Type type) { super(); this.name = name; this.type = type; } public StringBuilder append(StringBuilder buf) { buf.append(name).append(" - "); type.append(buf); return buf; } } public class Predicate { public String name; public ArrayList<Parameter> context = new ArrayList<Parameter>(); public ArrayList<Parameter> parameters = new ArrayList<Parameter>(); PredicateReference trivialRef=null; public PredicateReference trivialRef() { if (trivialRef != null) return trivialRef; trivialRef = new PredicateReference(this); // predicate references happen in the same context necessarily, so // PredicateReference just calls back to find the context variables // (PredicateReference.ref.context == this.context) // for (Parameter p : context) { // trivialRef.arguments.add(p.ref); // } for (Parameter p : parameters) { trivialRef.arguments.add(p.ref); } return trivialRef; } public StringBuilder append(StringBuilder buf) { buf.append('(').append(name); for (Parameter arg : context) { arg.append(buf.append(' ')); } for (Parameter arg : parameters) { arg.append(buf.append(' ')); } buf.append(')'); return buf; } public Predicate(String name) { super(); this.name = name; } } public class Function { public String name; public ArrayList<Parameter> context = new ArrayList<Parameter>(); public ArrayList<Parameter> parameters = new ArrayList<Parameter>(); public FunctionReference trivialRef; public FunctionReference trivialRef() { if (trivialRef != null) return trivialRef; trivialRef = new FunctionReference(this); for (Parameter p : parameters) { trivialRef.arguments.add(p.ref); } return trivialRef; } public StringBuilder append(StringBuilder buf) { buf.append('(').append(name); for (Parameter arg : context) { arg.append(buf.append(' ')); } for (Parameter arg : parameters) { arg.append(buf.append(' ')); } buf.append(')'); return buf; } public Function(String name) { super(); this.name = name; } } public class Parameter { public String name; public Type type; public ParameterReference ref; public Parameter(String name, Type type) { super(); this.name = name; this.type = type; this.ref = new ParameterReference(this); } public StringBuilder append(StringBuilder buf) { buf.append('?').append(name).append(" - "); return type.append(buf); } } public class ParameterReference implements Argument { Parameter ref; public ParameterReference(Parameter ref) { super(); this.ref = ref; } public StringBuilder append(StringBuilder buf) { buf.append('?').append(ref.name); return buf; } } public class PredicateReference implements BooleanExpression { public Predicate ref; public ArrayList<Argument> arguments = new ArrayList<Argument>(); public StringBuilder append(StringBuilder buf) { buf.append('(').append(ref.name); for (Parameter p : ref.context) { p.ref.append(buf.append(' ')); } for (Argument arg : arguments) { arg.append(buf.append(' ')); } buf.append(')'); return buf; } public PredicateReference(Predicate ref) { super(); this.ref = ref; } public boolean isTimed() { return false; } } public class FunctionReference implements FloatExpression { public Function ref; public ArrayList<Argument> arguments = new ArrayList<Argument>(); public FunctionReference(Function ref) { super(); this.ref = ref; } public StringBuilder append(StringBuilder buf) { buf.append('(').append(ref.name); for (Parameter p : ref.context) { p.ref.append(buf.append(' ')); } for (Argument arg : arguments) { arg.append(buf.append(' ')); } buf.append(')'); return buf; } public boolean isTimed() { return false; } } public static PDDL.Time getShape(Interval i) { //gov.nasa.anml.lifted.Constant<SimpleFloat> s,d,e; gov.nasa.anml.lifted.Constant<SimpleInteger> b,k; b = i.getBra(); // s = i.getStart(); // d = i.getDuration(); // e = i.getEnd(); k = i.getKet(); // null might be a better return; or a new code // for indeterminate shape if (b.value == null || k.value == null) return PDDL.Time.Timeless; switch(b.value.v) { case gov.nasa.anml.lifted.Time.Before: case gov.nasa.anml.lifted.Time.At: switch(k.value.v) { case gov.nasa.anml.lifted.Time.Before: return PDDL.Time.StartHalf; case gov.nasa.anml.lifted.Time.At: case gov.nasa.anml.lifted.Time.After: return PDDL.Time.All; } case gov.nasa.anml.lifted.Time.After: switch(k.value.v) { case gov.nasa.anml.lifted.Time.Before: return PDDL.Time.Interim; case gov.nasa.anml.lifted.Time.At: case gov.nasa.anml.lifted.Time.After: return PDDL.Time.EndHalf; } } return PDDL.Time.Timeless; } // works only if t is in fact some piece of s, so that its start/end/duration/bra/ket refer to // the parent's variables _by reference_. This is what will happen by default in the parser. public static PDDL.Time getPart(Interval s, Interval t) { gov.nasa.anml.lifted.Expression<SimpleFloat,?> s1,e1,s2,e2; s1 = s.getStart(); s2 = t.getStart(); e1 = s.getEnd(); e2 = t.getEnd(); if (s1 == s2) { if (e1 == e2) { SimpleInteger b = t.getBra().value(null); SimpleInteger k = t.getKet().value(null); if (b == null || k == null) return null; if (b.v > 0) { if (k.v < 0) return PDDL.Time.Interim; else return PDDL.Time.EndHalf; } else { if (k.v < 0) return PDDL.Time.StartHalf; else return PDDL.Time.All; } } else if (s1 == e2) { return PDDL.Time.Start; } return null; } else if (e1 == s2 && s2 == e2) { return PDDL.Time.End; } //System.err.println("OOOPS"); return PDDL.Time.Timeless; } public class Action { public String name = ""; public ArrayList<Parameter> context = new ArrayList<Parameter>(); public ArrayList<Parameter> parameters = new ArrayList<Parameter>(); public FloatExpression duration = Zero; public CompoundBooleanExpression condition = new CompoundBooleanExpression(Op.and); public CompoundEffect effect = new CompoundEffect(Op.and); public Predicate executing; // can invert to executable if negative preconditions are frowned upon, i.e., sapa // in that case, the (now negative) interim condition can be omitted b/c we would only // do this in a pure STRIPS context, so that testing for the negative is guaranteed redundant. // Either that, or do the negative split ourself (track an executable and an executing). public Predicate makeExecuting() { if (executing == null) { executing = new Predicate(this.name + "_executing"); executing.context.addAll(context); executing.parameters.addAll(parameters); // consider being smarter about these. PredicateReference trivialRef = executing.trivialRef(); //condition.arguments.add(new TimedBooleanExpression(Time.Start,new UnaryBooleanExpression(Op.not,trivialRef))); condition.arguments.add(new TimedBooleanExpression(Time.Interim,trivialRef)); effect.arguments.add(wrap(Time.Start,new AtomicBooleanEffect(trivialRef,true))); effect.arguments.add(wrap(Time.End,new AtomicBooleanEffect(trivialRef,false))); predicates.add(executing); } return executing; } public Action() { super(); } public Action(String name) { super(); this.name = name; // makeExecutingPredicate(); // only make the executing predicate for real anml actions, not helper actions } public StringBuilder append(StringBuilder buf) { buf.append("(:durative-action ").append(name); if (parameters.isEmpty()) { buf.append("\n:parameters ()\n:duration (= ?duration "); } else { buf.append("\n:parameters ("); for(Parameter p : context) { p.append(buf).append(' '); } for(Parameter p : parameters) { p.append(buf).append(' '); } buf.setCharAt(buf.length()-1,')'); buf.append("\n:duration (= ?duration "); } duration.append(buf); buf.append(")\n:condition "); condition.append(buf); buf.append("\n:effect "); effect.append(buf); buf.append("\n)\n"); return buf; } } // the duration field can be empty, and yet durations can still be constrained // as normal conditions. Technically. public class ComplexAction extends Action { public BooleanExpression durationConstraint = new CompoundBooleanExpression(Op.and); { duration = null; } public ComplexAction() { super(); } public ComplexAction(String name) { super(name); } public StringBuilder append(StringBuilder buf) { buf.append("(:durative-action ").append(name); if (parameters.isEmpty()) { buf.append("\n:parameters ()\n:duration "); } else { buf.append("\n:parameters ("); for(Parameter p : context) { p.append(buf).append(' '); } for(Parameter p : parameters) { p.append(buf).append(' '); } buf.setCharAt(buf.length()-1,')'); buf.append("\n:duration "); } durationConstraint.append(buf); buf.append("\n:condition "); condition.append(buf); buf.append("\n:effect "); effect.append(buf); buf.append("\n)\n"); return buf; } } public enum Op { plus("+"), minus("-"), times("*"), divided_by("/"), increase("increase"), decrease("decrease"), assign("="), // should be assign("assign"), but that makes handling initial state ugly equals("="), lte("<="), gte(">="), lt("<"), gt(">"), and("and"), or("or"), not("not"), implies("imply"), when("when"), exists("exists"), forall("forall"), ; public String name; private Op(String n) { name = n; } public String toString () { return name; } public StringBuilder append(StringBuilder buf) { return buf.append(name); } } public class ConditionalEffect implements Effect { public BooleanExpression guard; public Effect eff; public ConditionalEffect(BooleanExpression g, Effect e) { guard = g; eff = e; } public StringBuilder append(StringBuilder buf) { indent(buf); buf.append("(when "); guard.append(buf).append(' '); eff.append(buf).append(')'); dedent(buf); return buf; } } public class AtomicBooleanEffect implements BooleanEffect { public PredicateReference ref; public boolean v; public AtomicBooleanEffect(PredicateReference ref, boolean v) { this.ref = ref; this.v = v; } public StringBuilder append(StringBuilder buf) { if (v) return ref.append(buf); buf.append("(not "); return ref.append(buf).append(')'); } } public class AtomicFloatEffect implements FloatEffect { public Op o; public FunctionReference ref; public FloatExpression e; public AtomicFloatEffect(Op o, FunctionReference ref, FloatExpression e) { this.o = o; this.ref = ref; this.e = e; } public StringBuilder append(StringBuilder buf) { buf.append('(').append(o.name).append(' '); ref.append(buf).append(' '); e.append(buf).append(')'); return buf; } } public class Exists implements BooleanExpression { public ArrayList<Parameter> parameters = new ArrayList<Parameter>(); public BooleanExpression c; public StringBuilder append(StringBuilder buf) { indent(buf); buf.append('(').append(Op.exists.name); parameters.get(0).append(buf.append(" (")); for (int i=1; i < parameters.size(); ++i) { parameters.get(i).append(buf.append(' ')); } buf.append(')'); c.append(buf.append(' ')); buf.append(')'); dedent(buf); return buf; } public Exists(ArrayList<Parameter> parameters, BooleanExpression c) { super(); this.c = c; this.parameters = parameters; } public boolean isTimed() { return c.isTimed(); } } public class ForAll implements BooleanExpression { public ArrayList<Parameter> parameters = new ArrayList<Parameter>(); public BooleanExpression c; public StringBuilder append(StringBuilder buf) { indent(buf); buf.append('(').append(Op.forall.name); parameters.get(0).append(buf.append('(')); for (int i=1; i < parameters.size(); ++i) { parameters.get(i).append(buf.append(' ')); } buf.append(')'); c.append(buf.append(' ')); buf.append(')'); dedent(buf); return buf; } public ForAll(ArrayList<Parameter> parameters, BooleanExpression c) { super(); this.c = c; this.parameters = parameters; } public boolean isTimed() { return c.isTimed(); } } public class Binary<T extends Append> { public Op o; public T l; public T r; public Binary(Op o, T l, T r) { this.o = o; this.l = l; this.r = r; } public StringBuilder append(StringBuilder buf) { //indent(buf); buf.append('(').append(o.name).append(' '); l.append(buf).append(' '); r.append(buf).append(')'); //dedent(buf); return buf; } } public class Unary<T extends Append> { public Op o; public T l; public Unary(Op o, T l) { this.o = o; this.l = l; } public StringBuilder append(StringBuilder buf) { buf.append('(').append(o.name).append(' '); l.append(buf).append(')'); return buf; } } public class UnaryExpression extends Unary<Expression> implements Expression { public UnaryExpression(Op o, Expression e) { super(o,e); } } // i.e., the not function. Albeit, set high, set low, and pass through are also functions -- // just not overly useful ones. public class UnaryBooleanExpression extends Unary<BooleanExpression> implements BooleanExpression { public UnaryBooleanExpression(Op o, BooleanExpression e) { super(o,e); } public boolean isTimed() { return l.isTimed(); } } public class UnaryFloatExpression extends Unary<FloatExpression> implements FloatExpression { public UnaryFloatExpression(Op o, FloatExpression e) { super(o,e); } public boolean isTimed() { return l.isTimed(); } } public class UnaryEffect extends Unary<Effect> implements Effect { public UnaryEffect(Op o, Effect e) { super(o,e); } } public class BinaryEffect extends Binary<Effect> implements Effect{ public BinaryEffect(Op o, Effect l, Effect r) {super(o,l,r);} } public class BinaryBooleanEffect extends Binary<BooleanEffect> implements BooleanEffect { public BinaryBooleanEffect(Op o, BooleanEffect l, BooleanEffect r) {super(o,l,r);} } public class BinaryExpression extends Binary<Expression> implements Expression { public BinaryExpression(Op o, Expression l, Expression r) { super(o, l, r); } } public class BinaryBooleanExpression extends Binary<BooleanExpression> implements BooleanExpression { public BinaryBooleanExpression(Op o, BooleanExpression l, BooleanExpression r) { super(o, l, r); } public boolean isTimed() { return l.isTimed() && r.isTimed(); } public StringBuilder append(StringBuilder buf) { indent(buf); buf.append('(').append(o.name).append(' '); l.append(buf).append(' '); r.append(buf).append(')'); dedent(buf); return buf; } } public class BinaryFloatExpression extends Binary<FloatExpression> implements FloatExpression { public BinaryFloatExpression(Op o, FloatExpression l, FloatExpression r) { super(o, l, r); } public boolean isTimed() { return l.isTimed() && r.isTimed(); } } public class RelOp extends Binary<FloatExpression> implements BooleanExpression { public RelOp(Op o, FloatExpression l, FloatExpression r) { super(o, l, r); } public boolean isTimed() { return l.isTimed() && r.isTimed(); } } public class FloatLiteral implements FloatExpression, Timed<FloatExpression> { public float v; public FloatLiteral(float v) { this.v = v; } public StringBuilder append(StringBuilder buf) { return buf.append(v); } public boolean isTimed() { return true; } } public class CompoundExpression extends Compound<Expression> implements Expression { public CompoundExpression(Op o) { super(o); } public CompoundExpression(Op o, Expression a, Expression b) { super(o, a, b); } public CompoundExpression(Op o, Expression a) { super(o, a); } } public class CompoundBooleanExpression extends Compound<BooleanExpression> implements BooleanExpression { public CompoundBooleanExpression(Op o) { super(o); } public CompoundBooleanExpression(Op o, ArrayList<BooleanExpression> args) { super(o, args); } public CompoundBooleanExpression(Op o, BooleanExpression a, BooleanExpression b) { super(o, a, b); } public CompoundBooleanExpression(Op o, BooleanExpression a) { super(o, a); } public boolean isTimed() { for(int i=0; i<arguments.size();++i) { if (!arguments.get(i).isTimed()) return false; } return true; } } public class CompoundEffect extends Compound<Effect> implements Effect { public CompoundEffect(Op o) { super(o); } public CompoundEffect(Op o, ArrayList<Effect> args) { super(o,args); } public CompoundEffect(Op o, Effect a, Effect b) { super(o, a, b); } public CompoundEffect(Op o, Effect a) { super(o, a); } } public enum Time { Start("at start"), // 'before' for conditions and expressions, 'at' for effects Interim("over all"), // (all) End("at end"), // 'before' for conditions and expressions, 'at' for effects // below are all the super-intervals of the atomically accessible intervals (above) // only useful during translation, maybe not even then All("[all]"), StartHalf("[all)"), EndHalf("(all]"), Timeless(""), ; public String name; private Time(String s) { name = s; } } public class TimedBooleanExpression extends TimedImp<BooleanExpression> implements BooleanExpression { public TimedBooleanExpression(Time time, BooleanExpression b) { super(time,b); } public boolean isTimed() { return true; } } public class TimedFloatExpression extends TimedImp<FloatExpression> implements FloatExpression { public TimedFloatExpression(Time time, FloatExpression b) { super(time,b); } public boolean isTimed() { return true; } } public abstract class TimedImp<T extends Append> implements Timed<T> { public Time time; public T e; public TimedImp(Time time, T e) { if (e == null) System.err.println("Oopsies: null expression in a timed expression"); this.time = time; this.e = e; } public StringBuilder append(StringBuilder buf) { indent(buf); buf.append('(').append(time.name).append(' '); e.append(buf).append(')'); dedent(buf); return buf; } } public class TimedEffect<T extends Effect> extends TimedImp<T> implements Effect { public TimedEffect(Time time, T e) {super(time, e);} } public class TimedBooleanEffect extends TimedEffect<BooleanEffect> implements BooleanEffect { public TimedBooleanEffect(Time time, BooleanEffect e) {super(time,e);} } public class TimedFloatEffect extends TimedEffect<FloatEffect> implements FloatEffect { public TimedFloatEffect(Time time, FloatEffect e) {super(time,e);} } public final Predicate Alive = new Predicate("alive"); public final PredicateReference AliveRef = new PredicateReference(Alive); public final Predicate True = new Predicate("true"); public final PredicateReference TrueRef = new PredicateReference(True); public final UnaryBooleanExpression FalseRef = new UnaryBooleanExpression(Op.not,TrueRef); public final TimedBooleanExpression TrueCondition = new TimedBooleanExpression(Time.Interim,TrueRef); public final TimedBooleanExpression FalseCondition = new TimedBooleanExpression(Time.Interim,FalseRef); public final FloatLiteral One = new FloatLiteral(1.0f); public final FloatLiteral Zero = new FloatLiteral(0.0f); public final FloatExpression FloatUndefined = new BinaryFloatExpression(Op.divided_by,One,Zero); public final Type Object = new Type("object"); private final Object Null = new Object("null"); public final ObjectRef NullRef = new ObjectRef(Null); public final Function DurationParameter = new Function("?duration"); public final FunctionReference DurationRef = new FunctionReference(DurationParameter); public class Problem { public String name; public ArrayList<ObjectRef> objects = new ArrayList<ObjectRef>(); public State init = new State(); public Goal goal = new Goal(); public Problem(String name) { super(); this.name = name; } public Problem() { } public StringBuilder append(StringBuilder buf) { buf.append("(define (problem ").append(name) .append(")\n(:domain ").append(PDDL.this.name).append(")\n(:objects"); for (ObjectRef o : objects) { o.append(buf.append(' ')); } buf.append(")\n"); init.append(buf); goal.append(buf); buf.append("\n\n)\n"); return buf; } } public class State { public ArrayList<Effect> effects = new ArrayList<Effect>(); public StringBuilder append(StringBuilder buf) { buf.append("(:init (true)"); for (Effect e : effects) { e.append(buf.append("\n\t")); } buf.append("\n)\n"); return buf; } } public class Goal { public ArrayList<BooleanExpression> booleanExpressions = new ArrayList<BooleanExpression>(); public StringBuilder append(StringBuilder buf) { buf.append("(:goal (and"); for (BooleanExpression c : booleanExpressions) { c.append(buf.append("\n\t")); } buf.append("\n\t)\n)\n"); return buf; } } static StringBuilder newlineAndIndent = new StringBuilder("\n\t"); protected void indent(StringBuilder buf) { buf.append(newlineAndIndent); newlineAndIndent.append('\t'); } protected void dedent(StringBuilder buf) { newlineAndIndent.setLength(newlineAndIndent.length()-1); } }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.TypeRelation; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; import gov.nasa.anml.utility.SimpleVoid; // a symbol is an object with no properties public class ObjectType extends Unit<SimpleString,SimpleVoid> implements ExtensibleType<ObjectLiteral> { //extends Type<SimpleObject> implements Scope { public Enumeration<ObjectLiteral> members; public ArrayList<ObjectType> subTypes = new ArrayList<ObjectType>(); public ArrayList<ObjectType> superTypes = new ArrayList<ObjectType>(); public boolean open=true; public ObjectType(Scope parent) { super(parent); members = new Enumeration<ObjectLiteral>(); } public ObjectType(Scope parent, SimpleString n) { super(parent,n); members = new Enumeration<ObjectLiteral>(); } // object type goes second in order to distinguish from Scope public ObjectType(Enumeration<ObjectLiteral> c, ObjectType o) { super(o.parent); members = c; open = false; //if (o.open) o.subTypes.add(this); // this is okay, because c \subset o already, and this.closed = true superTypes.add(o); for (ObjectLiteral l : members) { l.addType(this); } inherit(o); // this inheritance thing, is, however, quite suspect. investigate eliminating it // and just doing proper lookup/shadowing/override } public ObjectType(Scope parent, Enumeration<ObjectLiteral> c) { super(parent); members = c; open = false; for (ObjectLiteral l : members) { l.addType(this); } } public void extend(ExtensibleType<ObjectLiteral> s) { ObjectType o = (ObjectType) s; o.addSubType(this); superTypes.add(o); inherit(o); } public boolean addSubType(ExtensibleType<ObjectLiteral> s) { ObjectType o = (ObjectType) s; if (open) subTypes.add(o); else { System.err.println("Error: trying to extend the closed type `" + this + "' with '" + s + "."); } return open; } public void addSuperType(ExtensibleType<ObjectLiteral> s) { ObjectType o = (ObjectType) s; superTypes.add(o); } public final TypeCode typeCode() { return TypeCode.Object; } public IdentifierCode idCode() { return IdentifierCode.Type; } // a type alias. Keep members shallow-copied so that changes to either // type propagate to both. Similarly for super/sub-types. public ObjectType clone() { ObjectType ret = null; ret = (ObjectType) super.clone(); //open = false; // can't really close an alias, because someone might declare something // through the alias instead of the main type. // unfortunately this lets someone add something to a closed type. // FIXME return ret; } public Enumeration<ObjectLiteral> members() { return members; } public Type<ObjectLiteral> constrain(Constraint<ObjectLiteral> c) { if (c == null) return this; if (c instanceof Enumeration) { Enumeration<ObjectLiteral> e = (Enumeration<ObjectLiteral>) c; if (members.containsAll(e)) return new ObjectType(e,this); // FIXME: take the intersection // (and report an error/warning on the extra stuff in c?) } return null; } public void set(Enumeration<ObjectLiteral> n) { if (members != null) { System.err.println("Error: The members of: " + name + " are already defined. Proceeding by overwriting. This will likely wreak havoc (concerning semantics of the model produced)."); for (ObjectLiteral l : members) { l.types.remove(this); } } members = n; open = false; for (ObjectLiteral l : members) { l.addType(this); } } public boolean isSubType(ObjectType t) { if (this == t) return true; for (int i=0; i<superTypes.size(); ++i) { if (superTypes.get(i).isSubType(t)) return true; } return false; } public void add(ObjectLiteral m) { if (!open) System.err.println("Cannot add members to a closed type"); else { members.add(m); m.addType(this); } } transient PDDL.Type asPDDLType; public void translateDecl(PDDL pddl,Interval unit) { if (asPDDLType != null) return; if (this != Unit.objectType) { int length = pddl.bufAppend(name); asPDDLType = pddl.new Type(pddl.bufToString()); pddl.types.add(asPDDLType); pddl.bufReset(length); ArrayList<PDDL.TypeRelation> typeRelations = pddl.typeRelations; for (ObjectType f : superTypes) { if (f != Unit.objectType) typeRelations.add(pddl.new TypeRelation(asPDDLType,f.asPDDLType())); } } else { asPDDLType = pddl.Object; } this._translateDecl(pddl,unit); // since we do not make a PDDL.Action representation, we cannot use this: // this._translateDecl(pddl,this); for (ObjectLiteral m : members) { // the proper call is m.translateDecl(pddl,this) // for any subtype of unit, in general, but // we aren't compiling this out as a pddlAction, so we pass up to the next container if we have to. // where that would matter is class-local statements, which will likely become domain-level statements, // and that will be incorrect. To enforce a class-local statement requires representing the type as an action // (its constructor), so that statements and constraints could be checked. m.translateDecl(pddl,unit); } } public PDDL.Type asPDDLType() { return asPDDLType; } /* // Scope implementation public SymbolTable<Type<?>> types = new SymbolTable<Type<?>>(); public SymbolTable<Constant<?>> cFluents = new SymbolTable<Constant<?>>(); public SymbolTable<ConstantFunction<?>> cFluentFunctions = new SymbolTable<ConstantFunction<?>>(); public SymbolTable<Fluent<?>> fluents = new SymbolTable<Fluent<?>>(); public SymbolTable<FluentFunction<?>> fluentFunctions = new SymbolTable<FluentFunction<?>>(); public SymbolTable<Parameter<?>> parameters ;//= new SymbolTable<Parameter<?>>(); public SymbolTable<Action> actions ;//= new SymbolTable<Action>(); public ArrayList<Statement> statements = new ArrayList<Statement>(); // one namespace by simple id. Should eventually implement // type-signature mapping. public HashMap<SimpleString,ObjectLiteral> symbols = new HashMap<SimpleString,ObjectLiteral>(); public ObjectLiteral addSymbol(IdentifierImp s) { return symbols.put(s.name,s); } public ObjectLiteral getSymbol(SimpleString s) { return symbols.get(s); } public <T extends SimpleObject<? super T>> Parameter<T> addParameter(Parameter<T> t) { symbols.put(t.name,t); return (Parameter<T>) parameters.put(t); } public <T extends SimpleObject<? super T>> Type<T> addType(Type<T> t) { symbols.put(t.name(),t); return (Type<T>) types.put(t); } public <T extends SimpleObject<? super T>> Constant<T> addConstant(Constant<T> c) { symbols.put(c.name,c); return (Constant<T>) cFluents.put(c); } public <T extends SimpleObject<? super T>> ConstantFunction<T> addConstantFunction(ConstantFunction<T> c) { symbols.put(c.name,c); return (ConstantFunction<T>) cFluentFunctions.put(c); } public <T extends SimpleObject<? super T>> Fluent<T> addFluent(Fluent<T> f) { symbols.put(f.name,f); return (Fluent<T>) fluents.put(f); } public <T extends SimpleObject<? super T>> FluentFunction<T> addFluentFunction(FluentFunction<T> f) { symbols.put(f.name,f); return (FluentFunction<T>) fluentFunctions.put(f); } public Action addAction(Action a) { symbols.put(a.name,a); return actions.put(a); } public SimpleString getParameterName(int p) { return parameters.getName(p); } public SimpleString getTypeName(int t) { return types.getName(t); } public SimpleString getConstantFluentName(int c) { return cFluents.getName(c); } public SimpleString getConstantFunctionName(int c) { return cFluentFunctions.getName(c); } public SimpleString getFluentName(int f) { return fluents.getName(f); } public SimpleString getFunctionName(int f) { return fluentFunctions.getName(f); } public SimpleString getActionName(int a) { return actions.getName(a); } public Parameter<?> getParameter(int p) { return parameters.get(p); } public Type<?> getType(int t) { return types.get(t); } public Constant<?> getConstant(int c) { return cFluents.get(c); } public ConstantFunction<?> getConstantFunction(int c) { return cFluentFunctions.get(c); } public Fluent<?> getFluent(int f) { return fluents.get(f); } public FluentFunction<?> getFluentFunction(int f) { return fluentFunctions.get(f); } public Action getAction(int a) { return actions.get(a); } public Parameter<?> getParameter(SimpleString p) { return parameters.get(p); } public Type<?> getType(SimpleString t) { return types.get(t); } public Constant<?> getConstant(SimpleString c) { return cFluents.get(c); } public ConstantFunction<?> getConstantFunction(SimpleString c) { return cFluentFunctions.get(c); } public Fluent<?> getFluent(SimpleString f) { return fluents.get(f); } public FluentFunction<?> getFluentFunction(SimpleString f) { return fluentFunctions.get(f); } public Action getAction(SimpleString a) { return actions.get(a); } */ }
Java
package gov.nasa.anml.lifted; public enum IdentifierCode { Domain, Type, Fluent, Constant, FluentFunction, ConstantFunction, Symbol, Object, Action, Parameter, Label, Block }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.FloatExpression; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; import gov.nasa.anml.utility.SimpleVoid; public class VectorType extends Term<SimpleString,SimpleVoid> implements Type<ArrayList<SimpleObject<?>>> { //extends Type<SimpleObject> implements Scope { public Constraint<ArrayList<SimpleObject<?>>> constraint=null; //public StructuredType parent; public VectorType() { super(); } public VectorType(SimpleString n) { super(n); } public VectorType(SimpleString n,int i) { super(n,i); } public VectorType(Constraint<ArrayList<SimpleObject<?>>> c) { super(); constraint = c; } public final TypeCode typeCode() { return TypeCode.Vector; } public IdentifierCode idCode() { return IdentifierCode.Type; } public VectorType constrain(Constraint<ArrayList<SimpleObject<?>>> c) { if (constraint == null || constraint.containsAll(c)) return new VectorType(c); return null; } public VectorType clone() { VectorType ret = null; ret = (VectorType) super.clone(); return ret; } public History<SimpleVoid> storage(State p, State c) { return null; } public SimpleString value(State s) { System.err.println("This is not really implemented (VectorType)."); return name; // a pretty arbitrary choice, but helps avoid NPE. } // see PrimitiveType // a vector of symbols could sortof be handled, but translating out component-wise assignments // in the cartesian product space would be really annoying. The right way is to use functions (to symbols), // which don't exist in PDDL [as they amount to vector types at best, and much worse if unrestricted]. public PDDL.Type asPDDLType() { return null; } public void translateDecl(PDDL pddl,Interval unit) { } /* // Scope implementation public SymbolTable<Type<?>> types = new SymbolTable<Type<?>>(); public SymbolTable<Constant<?>> cFluents = new SymbolTable<Constant<?>>(); public SymbolTable<ConstantFunction<?>> cFluentFunctions = new SymbolTable<ConstantFunction<?>>(); public SymbolTable<Fluent<?>> fluents = new SymbolTable<Fluent<?>>(); public SymbolTable<FluentFunction<?>> fluentFunctions = new SymbolTable<FluentFunction<?>>(); public SymbolTable<Parameter<?>> parameters ;//= new SymbolTable<Parameter<?>>(); public SymbolTable<Action> actions ;//= new SymbolTable<Action>(); public ArrayList<Statement> statements = new ArrayList<Statement>(); // one namespace by simple id. Should eventually implement // type-signature mapping. public HashMap<SimpleString,Identifier> symbols = new HashMap<SimpleString,Identifier>(); public Identifier addSymbol(IdentifierImp s) { return symbols.put(s.name,s); } public Identifier getSymbol(SimpleString s) { return symbols.get(s); } public <T extends SimpleObject<? super T>> Parameter<T> addParameter(Parameter<T> t) { symbols.put(t.name,t); return (Parameter<T>) parameters.put(t); } public <T extends SimpleObject<? super T>> Type<T> addType(Type<T> t) { symbols.put(t.name(),t); return (Type<T>) types.put(t); } public <T extends SimpleObject<? super T>> Constant<T> addConstant(Constant<T> c) { symbols.put(c.name,c); return (Constant<T>) cFluents.put(c); } public <T extends SimpleObject<? super T>> ConstantFunction<T> addConstantFunction(ConstantFunction<T> c) { symbols.put(c.name,c); return (ConstantFunction<T>) cFluentFunctions.put(c); } public <T extends SimpleObject<? super T>> Fluent<T> addFluent(Fluent<T> f) { symbols.put(f.name,f); return (Fluent<T>) fluents.put(f); } public <T extends SimpleObject<? super T>> FluentFunction<T> addFluentFunction(FluentFunction<T> f) { symbols.put(f.name,f); return (FluentFunction<T>) fluentFunctions.put(f); } public Action addAction(Action a) { symbols.put(a.name,a); return actions.put(a); } public SimpleString getParameterName(int p) { return parameters.getName(p); } public SimpleString getTypeName(int t) { return types.getName(t); } public SimpleString getConstantFluentName(int c) { return cFluents.getName(c); } public SimpleString getConstantFunctionName(int c) { return cFluentFunctions.getName(c); } public SimpleString getFluentName(int f) { return fluents.getName(f); } public SimpleString getFunctionName(int f) { return fluentFunctions.getName(f); } public SimpleString getActionName(int a) { return actions.getName(a); } public Parameter<?> getParameter(int p) { return parameters.get(p); } public Type<?> getType(int t) { return types.get(t); } public Constant<?> getConstant(int c) { return cFluents.get(c); } public ConstantFunction<?> getConstantFunction(int c) { return cFluentFunctions.get(c); } public Fluent<?> getFluent(int f) { return fluents.get(f); } public FluentFunction<?> getFluentFunction(int f) { return fluentFunctions.get(f); } public Action getAction(int a) { return actions.get(a); } public Parameter<?> getParameter(SimpleString p) { return parameters.get(p); } public Type<?> getType(SimpleString t) { return types.get(t); } public Constant<?> getConstant(SimpleString c) { return cFluents.get(c); } public ConstantFunction<?> getConstantFunction(SimpleString c) { return cFluentFunctions.get(c); } public Fluent<?> getFluent(SimpleString f) { return fluents.get(f); } public FluentFunction<?> getFluentFunction(SimpleString f) { return fluentFunctions.get(f); } public Action getAction(SimpleString a) { return actions.get(a); } */ }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.utility.*; public abstract class Term<L,R extends SimpleObject<? super R>> extends Tuple<L,R> implements Identifier<L,R> { // just a "mix-in" class. // IdentifierImp public int id; public SimpleString name; public Term() { super(); name = null; id = -1; } public Term(SimpleString n) { super(); name = n; id=-1; } public Term(SimpleString n, int i) { super(); name = n; id = i; } public final Identifier<L,R> id(int id) { this.id = id; return this; } public final int id() { return this.id; } public final SimpleString name() { return this.name; } public final Identifier<L,R> name(SimpleString name) { this.name = name; return this; } public int compareTo(Identifier<L,R> i) { return name.compareTo(i.name()); } public boolean apply(State p, int contextID, State c) { // there shouldn't be a way to apply a term to a state; // should have to perform some kind of operation upon the term. return false; } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Argument; import gov.nasa.anml.PDDL.FloatExpression; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.*; // if there is any storage, it ought to be boolean // the purpose of this class is to capture the satisficing instance of a temporal disjunction, // and/or the extent of the interval that satisfies a timed sub-expression. The sub-expression will have // narrower time (a point, for example), and this class has to go find the whole interval where the sub-expression // does not change value; or at least doesn't syntactically change value in the sense of controlling process. public class TimeOfExpression extends IntervalExpression<SimpleBoolean> { public Expression<SimpleBoolean,?> e; { start = new Constant<SimpleFloat>(startName,Domain.floatType); duration = new Constant<SimpleFloat>(durationName,Domain.floatType); end = new Constant<SimpleFloat>(endName,Domain.floatType); // currently delimiting values are represented as references to Interval.constant(Before/At/After)(Bra/Ket) // rather than as storage locations to be written to. So if the result of some expression figures out the right bra value, it should // set bra to the appropriate constant, rather than manipulating bra.value. bra = null; // only at or after ket = null; // only at or before } public TimeOfExpression() { } public TimeOfExpression(Expression<SimpleBoolean,?> e) { this.e = e; } public boolean apply(State p, int contextID, State c) { if (e.value(p) == ANMLBoolean.True) { // TODO: manage timing information for the instantiation that // allowed the expression to succeed. // Perhaps implement a special Conditional class that extends // Expression by returning a set of simple intervals // for which the condition is satisfied return true; } return false; } public TypeCode typeCode() { return TypeCode.Boolean; } // this might be a label of a predicate, in which case it is both // boolean and has storage. Otherwise not. For that matter, allows: // [all] (f_foo_l : f == foo) :-> bar // not that the construction is obvious...because // ((f == foo) := bar ) := baz; // is legal, but non-obvious // is.... // [all] ( f == (foo := ( bar := baz))); // legal? // I guess so, albeit foo and bar must be variables too. // should mean: // [all] f == foo // [all] foo := bar // [all] bar := baz // I.e., fundamental operations telescope in time on the left // but not on the right. If the left is atomic, the entire remaining // interval is consumed, which gets confusing in situations like // [all] f == foo := bar // which can be disallowed for the sake of sanity. // (but would mean [all) f == foo; [end] f := bar;) public SimpleBoolean value(State s) { return e.value(s); } public void translateDecl(PDDL pddl, Interval unit) { e.translateDecl(pddl,unit); // The subtlety here is that this might be a disjunct in the larger context. The notion // of satisficing sub-expression then gets messy. This is related to 'motivated' and multiple ways // of decomposing actions. } // The manner in which this differs from an unlabeled expression is that this has a side-effect of establishing the identity of the label // History<> is particularly relevant. // public PDDL.Expression translateExpr(PDDL pddl,CompoundTime unit) { // return e.translateExpr(pddl,unit); // } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { PDDL.Time part = PDDL.getPart(unit,this); if (part == null) { System.err.println("Haven't implemented non-PDDL time access (yet)."); //unit.asPDDLAction().condition.arguments.add(pddl.FalseCondition); part = PDDL.Time.All; // might work? } else if (part == Time.Timeless) { part = PDDL.Time.All; System.err.println("A timeless timed expression? In TimeOfExpression.translateExpr(), interpreting as All."); } copyPDDL(unit); PDDL.Expression exp = e.translateExpr(pddl,this); if (e instanceof ConstantExpression<?>) return exp; switch(e.typeCode()) { case Boolean: PDDL.BooleanExpression b = (PDDL.BooleanExpression) exp; ArrayList<PDDL.BooleanExpression> a = new ArrayList<PDDL.BooleanExpression>(); switch(part) { case Start: case End: case Interim: return pddl.wrap(part,b); case All: a.add(pddl.wrap(PDDL.Time.Start,b)); case EndHalf: a.add(pddl.wrap(PDDL.Time.Interim,b)); a.add(pddl.wrap(PDDL.Time.End,b)); break; case StartHalf: a.add(pddl.wrap(PDDL.Time.Start,b)); a.add(pddl.wrap(PDDL.Time.Interim,b)); break; default: System.err.println("New PDDL.Time constant unaccounted for in TimedExpression."); return exp; } return pddl.wrap(PDDL.Op.and,a); case Float: FloatExpression f = (FloatExpression) exp; switch(part) { case Start: case End: case Interim: return pddl.wrap(part,f); case All: case StartHalf: return pddl.wrap(Time.Start,f); case EndHalf: return pddl.wrap(Time.Interim,f); default: System.err.println("New PDDL.Time constant unaccounted for in ConstantFunctionRef."); return exp; } default: System.err.println("Oops!"); return exp; } } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.utility.SimpleFloat; import gov.nasa.anml.utility.SimpleObject; import static gov.nasa.anml.lifted.Time.*; public class History<T extends SimpleObject> implements Cloneable { public SimpleFloat start; // only At or After, not Before // (definitions cannot start Before) public int bra; public T value; //public boolean locked; public History<T> prev; public History() { start = new SimpleFloat(0); bra = At; value = null; //locked = false; prev = null; } public History(T v) { start = new SimpleFloat(0); bra = At; value = v; //locked = false; prev = null; } public T value() { return value; } // public boolean locked() { // return locked; // } // public void lock() { // locked = true; // } // public void unlock() { // locked = false; // } public History<T> clone() { History<T> ret = null; try { ret = (History<T>) super.clone(); // don't make copy of past. Also don't change the past... } catch (CloneNotSupportedException e) { // assert false; } ret.value = (T) value.clone(); return ret; } } /* public class IntegerLiteral extends SimpleInteger implements Expression<SimpleInteger> implements Comparable<Literal<T>>, Constant { public static int n=0; public static HashMap<SimpleObject,Literal<?>> pool; public static <T extends SimpleObject> Literal<T> make(T w) { Literal<T> probe = (Literal<T>) pool.get(w); if (probe == null) { probe = new Literal<T>(n++,w); pool.put(w,probe); } return probe; } public int id; public T w; // what's the difference between not implementing the default constructor // and making it private, as far as the outside is concerned? //private Literal() {} private Literal(int id, T w) { this.id = id; this.w = w; } public int compareTo(Literal<T> l) { // assert this != null && o != null; return this.w.compareTo(l.w); } @Override public boolean equals(Object l) { if (l instanceof Literal && id == (((Literal<T>)l).id)) return true; return false; } @Override public int hashCode() { return id; } @Override public String toString() { return w.toString(); } public T value() { return w; } public T value(State s) { return w; } } */
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.CompoundEffect; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleBoolean; import static gov.nasa.anml.lifted.ANMLBoolean.*; public class WhenElseStatement extends WhenStatement { public Statement sElse; public boolean apply(State p, int contextID,State c) { if (guard.value(p)==True) return sThen.apply(p,contextID,c); else return sElse.apply(p,contextID,c); } public WhenElseStatement(Expression<SimpleBoolean,?> guard,Statement sThen,Statement sElse) { super(guard,sThen); this.sElse = sElse; } public Statement addStatement(Statement s) { if (sThen == null) return sThen = s; if (sElse == null) return sElse = s; return null; } public void translateDecl(PDDL pddl, Interval unit) { guard.translateDecl(pddl,unit); sThen.translateDecl(pddl,unit); sElse.translateDecl(pddl,unit); } public void translateStmt(PDDL pddl, Interval unit, Time part) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); ArrayList<PDDL.Effect> effects = unit.getPDDLEffects(); IntervalImp iThen = new IntervalImp(unit); iThen.copyPDDL(unit); iThen.pddlConditions = new ArrayList<PDDL.BooleanExpression>(); iThen.pddlEffects = new ArrayList<PDDL.Effect>(); guard.translateStmt(pddl,iThen,part); PDDL.BooleanExpression head; if (iThen.pddlConditions.size() == 1) { head = iThen.pddlConditions.get(0); iThen.pddlConditions.clear(); } else { head = pddl.wrap(PDDL.Op.and,iThen.pddlConditions); iThen.pddlConditions = new ArrayList<PDDL.BooleanExpression>(); } unit.getPDDLEffects().addAll(iThen.pddlEffects); iThen.pddlEffects.clear(); sThen.translateStmt(pddl,iThen,part); switch(iThen.pddlConditions.size()) { case 0: break; case 1: conditions.add(pddl.makeTest(PDDL.Op.implies,head,iThen.pddlConditions.get(0))); break; default: conditions.add(pddl.makeTest(PDDL.Op.implies,head,pddl.wrap(PDDL.Op.and,iThen.pddlConditions))); } switch(iThen.pddlEffects.size()) { case 0: break; case 1: effects.add(pddl.new ConditionalEffect(head,iThen.pddlEffects.get(0))); break; default: effects.add(pddl.new ConditionalEffect(head,pddl.wrap(PDDL.Op.and,iThen.pddlEffects))); } head = pddl.negate(head); IntervalImp iElse = new IntervalImp(unit); iElse.copyPDDL(unit); iElse.pddlConditions = new ArrayList<PDDL.BooleanExpression>(); iElse.pddlEffects = new ArrayList<PDDL.Effect>(); sElse.translateStmt(pddl,iElse,part); switch(iElse.pddlConditions.size()) { case 0: break; case 1: conditions.add(pddl.makeTest(PDDL.Op.implies,head,iElse.pddlConditions.get(0))); break; default: conditions.add(pddl.makeTest(PDDL.Op.implies,head,pddl.wrap(PDDL.Op.and,iElse.pddlConditions))); } switch(iElse.pddlEffects.size()) { case 0: break; case 1: effects.add(pddl.new ConditionalEffect(head,iElse.pddlEffects.get(0))); break; default: effects.add(pddl.new ConditionalEffect(head,pddl.wrap(PDDL.Op.and,iElse.pddlEffects))); } } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.*; import gov.nasa.anml.utility.*; // the better solution is to introduce explicit Cast expressions // also, this should be an operation class that does every operation // and condition should be the conversion of expressions to conditions, i.e., // conditions == expression statements (<expression> ';') // In line with that, to convert float expressions into conditions (e.g.), // in pddl, one can write (== (* <float-expression> 0) 0) // as that ensures that all the referenced functions are defined, and perhaps // also that the operations don't result in NaN. Or if multiplication is verboten // (?why?) then one can do (== (- <e> <e>) 0) where <e> == <float-expression> public class OpBinary<I extends SimpleObject<? super I>,V extends SimpleObject<? super V>,S extends SimpleObject<? super S>> extends BinaryExpression<I,V,S> { public Op op; public TypeCode baseType; public OpBinary(TypeCode baseType, Op op, Expression<I,S> l, Expression<I,?> r) { super(l,r); this.op = op; this.baseType = baseType; } public <I extends SimpleObject<? super I>,S extends SimpleObject<? super S>> OpBinary<I,?,S> make(Op o, Expression<I,S> l, Expression<I,?> r) { switch(o) { case equal: case greaterThan: case greaterThanE: case lessThan: case lessThanE: return new OpBinary(TypeCode.Boolean,o,l,r); default: return new OpBinary(l.typeCode(),o,l,r); } } // should implement following in expression // and then do leftSide.toInfix() etc. public String toInfix() { StringBuilder s = new StringBuilder(); s.append('(').append(left). append(' ').append(op). append(' ').append(right). append(')'); return s.toString(); } public String toPrefix() { StringBuilder s = new StringBuilder(); s.append('(').append(op). append(' ').append(left). append(' ').append(right). append(')'); return s.toString(); } public String toPostfix() { StringBuilder s = new StringBuilder(); s.append('(').append(left). append(' ').append(right). append(' ').append(op). append(')'); return s.toString(); } public V value(State s) { I l = left.value(s); I r = right.value(s); if (l == null || r == null) return null; switch(left.typeCode()) { case Boolean: return (V) op.eval((SimpleBoolean)l,(SimpleBoolean)r); case Byte: break; case Short: break; case Integer: return (V) op.eval((SimpleInteger)l,(SimpleInteger)r); case Long: break; case Float: return (V) op.eval((SimpleFloat)l,(SimpleFloat)r); case Double: break; case String: return (V) op.eval((SimpleString)l,(SimpleString)r); case Symbol: break; case Vector: break; case Object: break; } return null; } public TypeCode typeCode() { return baseType; } public History<S> storage(State p, State c) { return null; } public boolean apply(State p, int contextID, State c) { if (baseType != TypeCode.Boolean) return false; I l = left.value(p); I r = right.value(p); if (l == null || r == null) return false; SimpleBoolean ret = null; switch(left.typeCode()) { case Boolean: ret = (SimpleBoolean) op.eval((SimpleBoolean)l,(SimpleBoolean)r); break; case Byte: break; case Short: break; case Integer: ret = (SimpleBoolean) op.eval((SimpleInteger)l,(SimpleInteger)r); case Long: break; case Float: ret = (SimpleBoolean) op.eval((SimpleFloat)l,(SimpleFloat)r); case Double: break; case String: ret = (SimpleBoolean) op.eval((SimpleString)l,(SimpleString)r); case Symbol: break; case Vector: break; case Object: break; } if (ret != ANMLBoolean.True) return false; return true; } public transient PDDL.Expression asPDDLExpression; public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { if (asPDDLExpression != null) return asPDDLExpression; TypeCode code = left.typeCode(); switch(baseType) { case Boolean: switch(code) { case Boolean: PDDL.BooleanExpression lb = (PDDL.BooleanExpression) left.translateExpr(pddl,unit); PDDL.BooleanExpression rb = (PDDL.BooleanExpression) right.translateExpr(pddl,unit); if (lb == null) lb = pddl.TrueRef; if (rb == null) rb = pddl.TrueRef; return asPDDLExpression = pddl.makeTest(op.pddl,lb,rb); case Float: FloatExpression lf = (FloatExpression) left.translateExpr(pddl,unit); FloatExpression rf = (FloatExpression) right.translateExpr(pddl,unit); if (lf == null) lf = pddl.FloatUndefined; if (rf == null) rf = pddl.FloatUndefined; return asPDDLExpression = pddl.makeTest(op.pddl,lf,rf); default: System.err.println("Unsupported type: "+code+" in " + left + " --- during: " + this); return pddl.FalseCondition; // the following is not safe because I assume typeCode() == Boolean means translateExpr() instanceof BooleanExpression // and this line would defeat that. //return asPDDLExpression = pddl.wrap(op.pddl,left.translateExpr(pddl,unit),right.translateExpr(pddl,unit)); } case Float: FloatExpression lf = (FloatExpression) left.translateExpr(pddl,unit); FloatExpression rf = (FloatExpression) right.translateExpr(pddl,unit); if (lf == null) lf = pddl.FloatUndefined; if (rf == null) rf = pddl.FloatUndefined; return asPDDLExpression = pddl.new BinaryFloatExpression(op.pddl,lf,rf); default: System.err.println("Unsupported result type: "+baseType+" --- during: " + this); // this too should probably just return Falsecondition, but locally it would work for a while not too. // ah well, to play a little safer... //return asPDDLExpression = pddl.new CompoundExpression(op.pddl,left.translateExpr(pddl,unit),right.translateExpr(pddl,unit)); return pddl.FalseCondition; } } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.utility.SimpleFloat; public class OpenInterval implements AtomicTime { public Expression<SimpleFloat,?> start,end; public OpenInterval(Expression<SimpleFloat,?> start, Expression<SimpleFloat,?> end) { this.start = start; this.end = end; } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; public interface Identifier<L,R extends SimpleObject<? super R>> extends Expression<L,R>, Comparable<Identifier<L,R>> { public abstract IdentifierCode idCode(); // psuedo-fields-access. R-value public abstract SimpleString name(); public abstract int id(); // psuedo-fields-assignment. Chainable public abstract Identifier<L,R> name(SimpleString name); public abstract Identifier<L,R> id(int id); }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Object; import gov.nasa.anml.PDDL.ObjectRef; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleString; import gov.nasa.anml.utility.SimpleVoid; import static gov.nasa.anml.lifted.IdentifierCode.*; // useless? Everything should be object literals? // (some simply fail to have properties...) public class SymbolLiteral extends IdentifierImp<SimpleString,SimpleVoid> implements ConstantExpression<SimpleString> { public SymbolLiteral() { super(); } public SymbolLiteral(SimpleString n) { super(n); } public SymbolLiteral(SimpleString n, int i) { super(n,i); } public IdentifierCode idCode() { return Symbol; } public TypeCode typeCode() { return TypeCode.Symbol; } public SimpleString value(State s) { return name; } public boolean apply(State p, int contextID, State c) { return false; } public ArrayList<SymbolType> types = new ArrayList<SymbolType>(); public void addType(SymbolType t) { int i=0; while (i<types.size()) { if (t.isSubType(types.get(i))) { types.remove(i); } else { ++i; } } types.add(t); } public transient PDDL.Object asPDDLObject; public transient PDDL.ObjectRef asPDDLArgument; public PDDL.Argument translateArgument(PDDL pddl, Interval unit) { if (asPDDLArgument != null) return asPDDLArgument; return asPDDLArgument = pddl.new ObjectRef(asPDDLObject); } public void translateDecl(PDDL pddl,Interval unit) { if (asPDDLObject != null) return; int length = pddl.bufAppend(name); String fullName = pddl.bufToString(); if (types.size() > 1) { SymbolType myType = new SymbolType(new SimpleString(fullName+"Type")); myType.superTypes.addAll(this.types); this.types.clear(); this.types.add(myType); myType.members.add(this); myType.translateDecl(pddl,unit); } asPDDLObject = pddl.new Object(fullName,types.get(0).asPDDLType); pddl.bufReset(length); pddl.domainObjects.add(asPDDLObject); } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import java.util.List; import gov.nasa.anml.PDDL; import gov.nasa.anml.PDDL.Action; import gov.nasa.anml.PDDL.ComplexAction; import gov.nasa.anml.PDDL.FloatExpression; import gov.nasa.anml.PDDL.FloatLiteral; import gov.nasa.anml.utility.*; public class Domain extends Unit<SimpleBoolean,SimpleVoid> { public static final SimpleString defaultName = new SimpleString("TheDomain"); public Domain() {super(null,defaultName);_Domain_init();} public Domain(SimpleString n) {super(null,n);_Domain_init();} public Domain(Scope parent) {super(parent,defaultName);_Domain_init();} public Domain(Scope parent, SimpleString n) {super(parent,n);_Domain_init();} protected final void _Domain_init() { types.put(objectType); types.put(symbolType); types.put(booleanType); types.put(integerType); types.put(stringType); types.put(floatType); // if we do want to give an absolute deadline on all activity then we need to avoid setting duration.init to a parameter; // instead duration.value has to be set to something. duration.init = new Parameter<SimpleFloat>(IntervalImp.durationName,floatType); start.value = ANMLFloat.ZeroF; end.init = duration.init; labels.put(this); } public Type<?> getType(TypeCode builtin) { return types.get(builtin.name); // switch(builtin) { // case Boolean: // return booleanType; // case Integer: // return integerType; // case String: // return stringType; // case Float: // return floatType; // case Object: // return objectType; // case Symbol: // return symbolType; // default: // System.err.println("Undefined type"); // return null; // } } public IdentifierCode idCode() { return IdentifierCode.Domain; } public TypeCode typeCode() { return TypeCode.String; } // very, very, close to Unit.translateDecl() public void translate(PDDL pddl) { pddl.name = name.toString(); if (duration.init instanceof Parameter || (duration.init == null && duration.value == null)) { asPDDLAction = pddl.new ComplexAction(pddl.name); } else { asPDDLAction = pddl.new Action(pddl.name); if(duration.init != null) { asPDDLAction.duration = (PDDL.FloatExpression) duration.init.translateExpr(pddl,this); } else { asPDDLAction.duration = pddl.new FloatLiteral(duration.value.v); } } pddl.actions.add(asPDDLAction); // should do nothing for (PDDL.Parameter p : pddl.context) { asPDDLAction.context.add(p); } int s = pddl.context.size(); // also shouldn't be doing anything for (Parameter<? extends SimpleObject<?>> p : parameters.table) { p.translateDecl(pddl,this); if (p.asPDDLParameter() != null) pddl.context.add(p.asPDDLParameter()); } ++pddl.depth; // the better technique does // s: +alive // o: ?true // e: -alive, -true // ...fix it later. ArrayList<PDDL.BooleanExpression> conditions = this.getPDDLConditions(); ArrayList<PDDL.Effect> effects = this.getPDDLEffects(); // conditions.add(pddl.wrap(PDDL.Time.Start,pddl.FalseRef)); // effects.add(pddl.makeEffect(PDDL.Time.Start,pddl.TrueRef,true)); // conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.TrueRef)); // conditions.add(pddl.TrueCondition); // same as above line // effects.add(pddl.makeEffect(PDDL.Time.End,pddl.TrueRef,false)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.AliveRef)); effects.add(pddl.makeEffect(PDDL.Time.End,pddl.AliveRef,false)); _translateDecl(pddl,this); _translateStmt(pddl,this,PDDL.Time.Timeless); // only safe because the Domain is uber-global. int l = pddl.context.size() - s; while (--l >= 0) pddl.context.remove(s); --pddl.depth; } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.FloatExpression; import gov.nasa.anml.utility.*; public class ANMLString extends SimpleString implements ConstantExpression<SimpleString> { public static final cArrHashMap<ANMLString> pool = new cArrHashMap<ANMLString>(); // grabs the char array as key; must not modify further public static ANMLString make(char[] v) { ANMLString probe = pool.get(v); if (probe == null) { probe = new ANMLString(v); pool.put(v,probe); } return probe; } protected ANMLString(char[] v) { super(v); } protected ANMLString(char[] v, int l) { super(v, l); } protected ANMLString(SimpleString s) { super(s); } protected ANMLString(String n) { super(n); } public ANMLString value(State s) { return this; } public ANMLString value() { return this; } public TypeCode typeCode() { return TypeCode.String; } public History<SimpleVoid> storage(State p, State c) { return null; } public boolean apply(State p, int contextID, State c) { return false; } public PDDL.Argument translateArgument(PDDL pddl, Interval unit) { return null; } public PDDL.FloatExpression asPDDLFloatExpr() { return null; } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { return null; } public void translateDecl(PDDL pddl, Interval unit) { } public PDDL.Expression translateLValue(PDDL pddl, Interval unit) { return null; } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { unit.getPDDLConditions().add(pddl.FalseCondition); } }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; import static gov.nasa.anml.lifted.IdentifierCode.*; // do need decl and refs for functions because of args. // but don't need to use long-winded "declaration" suffix public class FluentFunction<T extends SimpleObject<? super T>> extends Term<T,T> { public Type<T> type; public ArrayList<HashSet<SimpleObject<?>>> reachable; public FluentFunction() {} public FluentFunction(String n) {name=new SimpleString(n);} public FluentFunction(SimpleString n) {name=n;} public FluentFunction(SimpleString n,Type<T> t) {name=n;type=t;} public void initGrounding() { reachable = new ArrayList<HashSet<SimpleObject<?>>>(); for (int i = parameters.count - 1; i >= 0; --i) { reachable.add(new HashSet<SimpleObject<?>>()); } } public TypeCode typeCode() { return type.typeCode(); } public IdentifierCode idCode() { return FluentFunction; } transient PDDL.Predicate boolPDDL; transient PDDL.Function floatPDDL; public void translateDecl(PDDL pddl,Interval unit) { if (typeCode() == TypeCode.Boolean) { if (boolPDDL != null) return; int length = pddl.bufAppend(name); boolPDDL = pddl.new Predicate(pddl.bufToString()); pddl.bufReset(length); pddl.predicates.add(boolPDDL); boolPDDL.context.addAll(pddl.context); for (Parameter<?> p : parameters.table) { p.translateDecl(pddl,boolPDDL); } } else if (typeCode() == TypeCode.Float) { if (floatPDDL != null) return; int length = pddl.bufAppend(name); floatPDDL = pddl.new Function(pddl.bufToString()); pddl.bufReset(length); pddl.functions.add(floatPDDL); floatPDDL.context.addAll(pddl.context); for (Parameter<?> p : parameters.table) { p.translateDecl(pddl,floatPDDL); } } } public History<T> storage(State p, State c) { // the more general thing is to find the function id, instead of the first 0, // and then to find the correct binding of the parameters to arguments instead of the second 0. return (History<T>) p.functions.get(0).get(this.reachable.get(0)); } public T value(State s) { return (T) s.functions.get(0).get(this.reachable.get(0)).value; } }
Java
package gov.nasa.anml.lifted; public interface StatementContainer { public Statement addStatement(Statement s); }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.utility.SimpleFloat; import gov.nasa.anml.utility.SimpleInteger; import gov.nasa.anml.utility.SimpleString; public interface Interval extends Time { public abstract Constant<SimpleFloat> getStart(); public abstract Constant<SimpleFloat> getDuration(); public abstract Constant<SimpleFloat> getEnd(); public abstract Constant<SimpleInteger> getBra(); public abstract Constant<SimpleInteger> getKet(); public abstract ArrayList<PDDL.BooleanExpression> getPDDLConditions(); public abstract ArrayList<PDDL.Effect> getPDDLEffects(); public abstract ArrayList<PDDL.Parameter> getPDDLParameters(); public abstract PDDL.FloatExpression getPDDLDuration(); public abstract PDDL.Predicate getPDDLExecuting(); public abstract PDDL.Action getPDDLAction(); public abstract PDDL.Predicate makePDDLExecuting(); public static final SimpleString startName = new SimpleString("start"); public static final SimpleString durationName = new SimpleString("duration"); public static final SimpleString endName = new SimpleString("end"); public static final SimpleString braName = new SimpleString("bra"); public static final SimpleString ketName = new SimpleString("ket"); public static final SimpleString makespanName = new SimpleString("makespan"); }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.CompoundEffect; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleBoolean; import static gov.nasa.anml.lifted.ANMLBoolean.*; public class WhenStatement implements Statement, StatementContainer { public Expression<SimpleBoolean,?> guard; public Statement sThen; public boolean apply(State p, int contextID,State c) { if (guard.value(p)==True) return sThen.apply(p,contextID,c); return true; } public WhenStatement(Expression<SimpleBoolean,?> guard,Statement sThen) { super(); this.guard = guard; this.sThen = sThen; } public Statement addStatement(Statement s) { if (sThen == null) return sThen = s; return null; } public void translateDecl(PDDL pddl, Interval unit) { guard.translateDecl(pddl,unit); sThen.translateDecl(pddl,unit); } public void translateStmt(PDDL pddl, Interval unit, Time part) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); ArrayList<PDDL.Effect> effects = unit.getPDDLEffects(); IntervalImp iThen = new IntervalImp(unit); iThen.copyPDDL(unit); iThen.pddlConditions = new ArrayList<PDDL.BooleanExpression>(); iThen.pddlEffects = new ArrayList<PDDL.Effect>(); guard.translateStmt(pddl,iThen,part); PDDL.BooleanExpression head; if (iThen.pddlConditions.size() == 1) { head = iThen.pddlConditions.get(0); iThen.pddlConditions.clear(); } else { // this takes control of the entire array iThen.pddlConditions head = pddl.wrap(PDDL.Op.and,iThen.pddlConditions); // so we need a new array -- calling .clear() would really muck things up. iThen.pddlConditions = new ArrayList<PDDL.BooleanExpression>(); } // this probably shouldn't happen; it would mean side-effects in the guard evaluation unit.getPDDLEffects().addAll(iThen.pddlEffects); iThen.pddlEffects.clear(); sThen.translateStmt(pddl,iThen,part); switch(iThen.pddlConditions.size()) { case 0: break; case 1: conditions.add(pddl.makeTest(PDDL.Op.implies,head,iThen.pddlConditions.get(0))); break; default: conditions.add(pddl.makeTest(PDDL.Op.implies,head,pddl.wrap(PDDL.Op.and,iThen.pddlConditions))); } switch(iThen.pddlEffects.size()) { case 0: break; case 1: effects.add(pddl.new ConditionalEffect(head,iThen.pddlEffects.get(0))); break; default: effects.add(pddl.new ConditionalEffect(head,pddl.wrap(PDDL.Op.and,iThen.pddlEffects))); } /* head = pddl.wrap(PDDL.Op.not,head); Interval iElse = new Interval(unit); iElse.copyPDDL(unit); iElse.pddlConditions = new ArrayList<PDDL.BooleanExpression>(); iElse.pddlEffects = new ArrayList<PDDL.Effect>(); sElse.translateStmt(pddl,iElse,part); switch(iElse.pddlConditions.size()) { case 0: break; case 1: conditions.add(pddl.wrap(PDDL.Op.imply,head,iElse.pddlConditions.get(0))); break; default: conditions.add(pddl.wrap(PDDL.Op.imply,head,pddl.wrap(PDDL.Op.and,iElse.pddlConditions))); } switch(iElse.pddlEffects.size()) { case 0: break; case 1: effects.add(pddl.new ConditionalEffect(head,iElse.pddlEffects.get(0))); break; default: effects.add(pddl.new ConditionalEffect(head,pddl.wrap(PDDL.Op.and,iElse.pddlEffects))); } */ } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import java.util.List; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; public abstract class ScopedIdentifierImp<L,R extends SimpleObject<? super R>> extends ScopeImp implements Identifier<L,R> { public SimpleString name=SimpleString.Empty; public int id; public ScopedIdentifierImp() {} public ScopedIdentifierImp(Scope parent) {super(parent);} public ScopedIdentifierImp(Scope parent, SimpleString n) {init(parent,n);} public final void init(Scope parent, SimpleString n) { super.init(parent); this.name = n; } public ScopedIdentifierImp(Scope parent, SimpleString n, int id) {init(parent,n,id);} public final void init(Scope parent, SimpleString n, int id) { super.init(parent); this.name = n; this.id = id; } public final Identifier<L,R> id(int id) { this.id = id; return this; } public final int id() { return this.id; } public final SimpleString name() { return this.name; } public final Identifier<L,R> name(SimpleString name) { this.name = name; return this; } public int compareTo(Identifier<L,R> i) { return name.compareTo(i.name()); } public History<R> storage(State p, State c) { return null; } public L value(State s) { return null; } public boolean apply(State p, int contextID, State c) { return false; } // Scoped Identifiers do not typically have values as float expressions // or, for that matter, as boolean expressions, except actions // which exhibit that behavior due to also existing as CompoundTime // Domain does not, despite CompoundTime, because Domain is all of time // so the only reasonable value would be 'true', which is nonetheless not // a float expression // maybe change name to realPDDL or refRealPDDL or refFloatPDDL ? // (RealNumber is too verbose...) public void translateDecl(PDDL pddl, Interval unit) { } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time time) { ExpressionImp.translateStmt(this,pddl,unit,time); } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { return pddl.FalseRef; } public PDDL.Argument translateArgument(PDDL pddl, Interval unit) { return pddl.NullRef; } public PDDL.Expression translateLValue(PDDL pddl, Interval unit) { return pddl.TrueRef; } /* for extends IdentifierImp implements Scope * public SymbolTable<Type<?>> types = new SymbolTable<Type<?>>(); public SymbolTable<Constant<?>> cFluents = new SymbolTable<Constant<?>>(); public SymbolTable<ConstantFunction<?>> cFunctions = new SymbolTable<ConstantFunction<?>>(); public SymbolTable<Fluent<?>> fluents = new SymbolTable<Fluent<?>>(); public SymbolTable<FluentFunction<?>> fluentFunctions = new SymbolTable<FluentFunction<?>>(); public SymbolTable<Parameter<?>> parameters = new SymbolTable<Parameter<?>>(); public SymbolTable<Action> actions = new SymbolTable<Action>(); public HashMap<SimpleString, IdentifierImp> symbols = new HashMap<SimpleString,IdentifierImp>(); public ArrayList<Statement> statements = new ArrayList<Statement>(); // array would be more efficient, especially in the case of actions. // but lots of things can be tweaked for processing, so probably there // should exist stages of action representation anyways. // If so, then it is a bit easier at the high level to have more mutable // structures -- and the final level can do int fID, Statement[] statements, // etc. public ScopedIdentifierImp() { super(); } public ScopedIdentifierImp(SimpleString n, int i) { super(n, i); } public ScopedIdentifierImp(SimpleString n) { super(n); } public Identifier addSymbol(IdentifierImp s) { return symbols.put(s.name,s); } public Identifier getSymbol(SimpleString s) { return symbols.get(s); } public <T extends SimpleObject<? super T>> Parameter<T> addParameter(Parameter<T> t) { symbols.put(t.name,t); return (Parameter<T>) parameters.put(t); } public <T extends SimpleObject<? super T>> Type<T> addType(Type<T> t) { symbols.put(t.name,t); return (Type<T>) types.put(t); } public <T extends SimpleObject<? super T>> Constant<T> addConstant(Constant<T> c) { symbols.put(c.name,c); return (Constant<T>) cFluents.put(c); } public <T extends SimpleObject<? super T>> ConstantFunction<T> addConstantFunction(ConstantFunction<T> c) { symbols.put(c.name,c); return (ConstantFunction<T>) cFunctions.put(c); } public <T extends SimpleObject<? super T>> Fluent<T> addFluent(Fluent<T> f) { symbols.put(f.name,f); return (Fluent<T>) fluents.put(f); } public <T extends SimpleObject<? super T>> FluentFunction<T> addFluentFunction(FluentFunction<T> f) { symbols.put(f.name,f); return (FluentFunction<T>) fluentFunctions.put(f); } public Action addAction(Action a) { symbols.put(a.name,a); return actions.put(a); } public SimpleString getParameterName(int p) { return parameters.getName(p); } public SimpleString getTypeName(int t) { return types.getName(t); } public SimpleString getConstantFluentName(int c) { return cFluents.getName(c); } public SimpleString getConstantFunctionName(int c) { return cFunctions.getName(c); } public SimpleString getFluentName(int f) { return fluents.getName(f); } public SimpleString getFunctionName(int f) { return fluentFunctions.getName(f); } public SimpleString getActionName(int a) { return actions.getName(a); } public Parameter<?> getParameter(int p) { return parameters.get(p); } public Type<?> getType(int t) { return types.get(t); } public Constant<?> getConstant(int c) { return cFluents.get(c); } public ConstantFunction<?> getConstantFunction(int c) { return cFunctions.get(c); } public Fluent<?> getFluent(int f) { return fluents.get(f); } public FluentFunction<?> getFluentFunction(int f) { return fluentFunctions.get(f); } public Action getAction(int a) { return actions.get(a); } public Parameter<?> getParameter(SimpleString p) { return parameters.get(p); } public Type<?> getType(SimpleString t) { return types.get(t); } public Constant<?> getConstant(SimpleString c) { return cFluents.get(c); } public ConstantFunction<?> getConstantFunction(SimpleString c) { return cFunctions.get(c); } public Fluent<?> getFluent(SimpleString f) { return fluents.get(f); } public FluentFunction<?> getFluentFunction(SimpleString f) { return fluentFunctions.get(f); } public Action getAction(SimpleString a) { return actions.get(a); } */ }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Argument; import gov.nasa.anml.PDDL.BooleanExpression; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleObject; public abstract class ExpressionImp<T, S extends SimpleObject<? super S>> implements Expression<T, S> { public static final void translateStmt(Expression<?,?> e, PDDL pddl, Interval unit, PDDL.Time time) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); if (e.typeCode() != TypeCode.Boolean) { System.err.println("Warning: Non-boolean expression-as-statement (i.e., a condition) found in: " + e); conditions.add(pddl.FalseCondition); return; } BooleanExpression b = (BooleanExpression)e.translateExpr(pddl,unit); if (e instanceof ConstantExpression<?>) { System.err.println("Someone should be calling the translateStmt that expects constants."); conditions.add(b); return; } translateStmt(b,pddl,unit,time); } public static final void translateStmt(PDDL.BooleanExpression b, PDDL pddl, Interval unit, PDDL.Time time) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); switch(time) { case Start: case End: case Interim: conditions.add(pddl.wrap(time,b)); break; case All: conditions.add(pddl.wrap(PDDL.Time.Start,b)); case EndHalf: conditions.add(pddl.wrap(PDDL.Time.Interim,b)); conditions.add(pddl.wrap(PDDL.Time.End,b)); break; case StartHalf: conditions.add(pddl.wrap(PDDL.Time.Start,b)); conditions.add(pddl.wrap(PDDL.Time.Interim,b)); break; case Timeless: conditions.add(b); break; default: System.err.println("New PDDL.Time constant unaccounted for in ExpressionImp."); conditions.add(pddl.FalseCondition); } } // keep the method signature the same besides the first argument so that the compiler can figure out which // to call without us having to think about it. public static final void translateStmt(ConstantExpression<?> e, PDDL pddl, Interval unit, PDDL.Time time) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); if (e.typeCode() != TypeCode.Boolean) { System.err.println("Warning: Non-boolean expression-as-statement (i.e., a condition) found in: " + e); conditions.add(pddl.FalseCondition); return; } BooleanExpression b = (BooleanExpression)e.translateExpr(pddl,unit); conditions.add(b); } public void translateDecl(PDDL pddl, Interval unit) { // expressions shouldn't have to be declaring anything. } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time time) { translateStmt(this,pddl,unit,time); } // Very few things are valid PDDL arguments; public PDDL.Argument translateArgument(PDDL pddl, Interval unit) { //System.err.println("Someone is misusing ExpressionImp: " + this); return pddl.NullRef; // better than returning (java) null; allows us to get further without NPE. } // Likewise very few expressions have l-values. public PDDL.Expression translateLValue(PDDL pddl, Interval unit) { //System.err.println("Someone is misusing ExpressionImp: " + this); return pddl.TrueRef; // ought to break most PDDL models. // better than returning null; allows us to get further without NPE. } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { //System.err.println("Someone is misusing ExpressionImp: " + this); return pddl.FalseRef; } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Expression; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; public abstract class IdentifierImp<L,R extends SimpleObject<? super R>> extends ExpressionImp<L,R> implements Identifier<L,R> { // should delete the following three to force subclasses to implement. public History<R> storage(State p, State c) { return null; } public L value(State s) { return null; } public boolean apply(State p, int contextID, State c) { return false; } public int id; public SimpleString name; public IdentifierImp() { name = null; id = -1; } public IdentifierImp(SimpleString n) { name = n; id=-1; } public IdentifierImp(SimpleString n, int i) { name = n; id = i; } public final Identifier<L,R> id(int id) { this.id = id; return this; } public final int id() { return this.id; } public final SimpleString name() { return this.name; } public final Identifier<L,R> name(SimpleString name) { this.name = name; return this; } // ids will be chronological within groups of same code identifiers // names will be alphabetical public int compareTo(Identifier<L,R> i) { return id - i.id(); //return name.compareTo(i.name()); } public boolean equals(Identifier<L,R> i) { if (id != i.id()) return false; /* if (SimpleString.compareTo(name,i.name()) != 0) return false; */ return true; } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleVoid; // This means the expression is constant with respect to its scope. A constant is a single identifier that is constant in the same fashion; // as such identifiers must be initialized, with expressions, the difference is whether or not the expression has/is-given a name. // A non-intuitive but correct usage is '[start] f >= 3' With respect to the scope it is in, and the trajectory up to that point, it is constant. // 'f >= 3' is, in contrast, not a constant expression. '[all] f >= 3' is a constant expression also --- it is either entirely true or false, // but, it is only finally initialized at [end]. That is, imagine 'constant boolean reserve-met = ([all] f >= 3);' // and compare with 'constant boolean reserve-met = \forall t \in [all] : f(t) >= 3;' to understand why the given expression is 'constant'. // An easier way to understand the same thing: the past is immutable. // This has a storage type, because constants aren't always constant, but the .storage() method in general returns null, // although that could easily change to some sort of empty History object (to avoid having to make null checks everywhere). public interface ConstantExpression<T> extends Expression<T,SimpleVoid> { }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.utility.*; public abstract class Tuple<V,S extends SimpleObject<? super S>> extends ExpressionImp<V,S> implements Cloneable { public SymbolTable<Parameter<?>> parameters = new SymbolTable<Parameter<?>>(); public Tuple clone() { Tuple ret=null; try { ret = (Tuple) super.clone(); } catch(CloneNotSupportedException c) { //assert false; } // shallow copy -- the table is copied, but not the contents. // be careful... return ret; } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; import gov.nasa.anml.utility.SimpleVoid; public interface Type<T> extends Identifier<SimpleString,SimpleVoid>, ConstantExpression<SimpleString>, Cloneable { public abstract TypeCode typeCode(); public abstract Type<T> constrain(Constraint<T> c); public abstract Type<T> clone(); //public abstract void translateDecl(PDDL pddl); public abstract PDDL.Type asPDDLType(); }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.utility.*; /** * Action: Store the action structure specified in the domain * file. Will be used as the action template to ground actions using object * instances from the problem file */ public class Action extends Unit<SimpleBoolean,SimpleVoid> { //public Action(Scope parent) {super(parent);} public Action(Scope parent, SimpleString n) {super(parent,n);labels.put(this);} //Interval.constantDurationOne // bah, sharing doesn't work. public IdentifierCode idCode() { return IdentifierCode.Action; } public TypeCode typeCode() { return TypeCode.Boolean; } public boolean apply(State p, int contextID, State c) { // TODO implement action application return false; } public History<SimpleVoid> storage(State p, State c) { // TODO lookup its local storage // probably change the storage type to LocalState or something like that // but perhaps SimpleInteger instead as a lookup into a table to circumvent the SimpleObject // supertype restriction. // maybe change existing SimpleObject to SimpleBase // and then have: class SimpleObject extends SimpleBase<SimpleObject> ? // this then lets simple objects have structured members, supporting // object and vector types, as well as action storage, which is like // object storage (?) return null; } public SimpleBoolean value(State s) { // TODO implement lookup of whether or not action is executing in // the given state return ANMLBoolean.False; } @Override public void translateDecl(PDDL pddl, Interval unit) { super.translateDecl(pddl, unit); pddl.actions.add(asPDDLAction); } public gov.nasa.anml.PDDL.Action getPDDLAction() { return this.asPDDLAction; } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Argument; import gov.nasa.anml.PDDL.Expression; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.*; public interface LabeledInterval<Value,Storage extends SimpleObject<? super Storage>> extends Interval, Identifier<Value,Storage> { }
Java
package gov.nasa.anml.lifted; public interface AtomicTime extends Time { }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.*; import gov.nasa.anml.utility.*; // really this is a function binding public abstract class Bind<S,T,V extends SimpleObject<? super V>> extends ExpressionImp<T,V> { public S ref; public ArrayList<Expression<? extends SimpleObject<?>,?>> arguments = new ArrayList<Expression<? extends SimpleObject<?>,?>>(); protected SimpleObject<?>[] args; // cut down on memory bloat public Bind() {} public Bind(S ref) { this.ref=ref; } public void addArgument(Expression<? extends SimpleObject<?>,?> p) { arguments.add(p); } public void init() { args = new SimpleObject[arguments.size()]; } protected final SimpleObject<?>[] setArgs(State s) { int i=0; for (Expression<? extends SimpleObject<?>,?> e : arguments) { args[i++] = e.value(s); } return args; } }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; // like an action in the disjunction, but instead of Kleen * it is all and only one occurrence. // i.e., the difference between [a-z]* and [a-z], with the latter being disjunction. public class Decomposition extends Action { public Decomposition(Scope parent, SimpleString n) { super(parent,n); } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Argument; import gov.nasa.anml.PDDL.Expression; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleFloat; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleVoid; public class Skip extends ExpressionImp<SimpleVoid,SimpleVoid> implements ChainableExpression<SimpleVoid,SimpleVoid>{ public Skip() { } public boolean apply(State p, int contextID, State c) { return true; } public void translateDecl(PDDL pddl, Interval unit) { } public void translateStmt(PDDL pddl, Interval unit, Time part) { } public Time splitFirst(Time t) { return Chain.splitFirst(t); } public Time splitRest(Time t) { return Chain.splitRest(t); } public History<SimpleVoid> storage(State p, State c) { return null; } public Argument translateArgument(PDDL pddl, Interval unit) { return null; } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { return pddl.TrueCondition; } public PDDL.Expression translateLValue(PDDL pddl, Interval unit) { return pddl.TrueRef; } public TypeCode typeCode() { return TypeCode.Void; } public SimpleVoid value(State s) { return null; } }
Java
/** * */ package gov.nasa.anml.lifted; import java.util.Arrays; import gov.nasa.anml.PDDL; import gov.nasa.anml.utility.*; //import static gov.nasa.anml.lifted.SimpleBoolean.False; //import static gov.nasa.anml.lifted.SimpleBoolean.True; import static gov.nasa.anml.lifted.ANMLBoolean.*; import static gov.nasa.anml.lifted.ANMLInteger.*; import static gov.nasa.anml.lifted.ANMLFloat.*; public enum Op { and(PDDL.Op.and) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return (a.v && b.v) ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return a.v * b.v != 0 ? True : False; } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return a.v * b.v != 0 ? True : False; } }, or(PDDL.Op.or) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return (a.v || b.v) ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return (a.v != 0 || b.v != 0) ? True : False; //return a.v*a.v + b.v*b.v > 0 ? True : False; // Math.abs } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return (a.v != 0f || b.v != 0f) ? True : False; } }, not(PDDL.Op.not) { public SimpleBoolean eval(SimpleBoolean a) { return !a.v ? True : False; } public SimpleBoolean eval(SimpleInteger a) { return a.v == 0 ? True : False; } public SimpleBoolean eval(SimpleFloat a) { return a.v == 0f ? True : False; } }, negate(null) { public SimpleBoolean eval(SimpleBoolean a) { return !a.v ? True : False; } public SimpleInteger eval(SimpleInteger a) { return ANMLInteger.make(-a.v); } public SimpleFloat eval(SimpleFloat a) { return ANMLFloat.make(-a.v); } }, equal(PDDL.Op.equals) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return a.v == b.v ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return a.v == b.v ? True : False; } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return a.v == b.v ? True : False; } public SimpleBoolean eval(SimpleString a,SimpleString b) { return SimpleString.equals(a,b) ? True : False; } }, notEqual(null) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return a.v != b.v ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return a.v != b.v ? True : False; } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return a.v != b.v ? True : False; } public SimpleBoolean eval(SimpleString a,SimpleString b) { return !SimpleString.equals(a,b) ? True : False; } }, lessThan(PDDL.Op.lt) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return !a.v && b.v ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return a.v < b.v ? True : False; } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return a.v < b.v ? True : False; } public SimpleBoolean eval(SimpleString a,SimpleString b) { return SimpleString.compareTo(a,b) < 0 ? True : False; } }, lessThanE(PDDL.Op.lte) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return !a.v || b.v ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return a.v <= b.v ? True : False; } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return a.v <= b.v ? True : False; } public SimpleBoolean eval(SimpleString a,SimpleString b) { return SimpleString.compareTo(a,b) <= 0 ? True : False; } }, greaterThan(PDDL.Op.gt) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return a.v && !b.v ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return a.v > b.v ? True : False; } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return a.v > b.v ? True : False; } public SimpleBoolean eval(SimpleString a,SimpleString b) { return SimpleString.compareTo(a,b) > 0 ? True : False; } }, greaterThanE(PDDL.Op.gte) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return a.v || !b.v ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return a.v >= b.v ? True : False; } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return a.v >= b.v ? True : False; } public SimpleBoolean eval(SimpleString a,SimpleString b) { return SimpleString.compareTo(a,b) >= 0 ? True : False; } }, implies(PDDL.Op.implies) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return !a.v || b.v ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return a.v == 0 || b.v != 0 ? True : False; } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return a.v == 0 || b.v != 0 ? True : False; } }, xor(null) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return a.v ^ b.v ? True : False; } public SimpleBoolean eval(SimpleInteger a,SimpleInteger b) { return (a.v != 0) ^ (b.v != 0) ? True : False; } public SimpleBoolean eval(SimpleFloat a,SimpleFloat b) { return (a.v != 0f) ^ (b.v != 0f) ? True : False; } }, add(PDDL.Op.plus) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return a.v || b.v ? True : False; } public SimpleInteger eval(SimpleInteger a,SimpleInteger b) { return ANMLInteger.make(a.v + b.v); } public SimpleFloat eval(SimpleFloat a,SimpleFloat b) { return ANMLFloat.make(a.v + b.v); } public SimpleString eval(SimpleString a,SimpleString b) { int al = a.length, bl = b.length; char []d = new char[al + bl]; System.arraycopy(a.v,0,d,0,al); System.arraycopy(b.v,0,d,al,bl); return ANMLString.make(d); } }, subtract(PDDL.Op.minus) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return a.v || !b.v ? True : False; } public SimpleInteger eval(SimpleInteger a,SimpleInteger b) { return ANMLInteger.make(a.v - b.v); } public SimpleFloat eval(SimpleFloat a,SimpleFloat b) { return ANMLFloat.make(a.v - b.v); } }, multiply(PDDL.Op.times) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return a.v && b.v ? True : False; } public SimpleInteger eval(SimpleInteger a,SimpleInteger b) { return ANMLInteger.make(a.v * b.v); } public SimpleFloat eval(SimpleFloat a,SimpleFloat b) { return ANMLFloat.make(a.v * b.v); } }, divide(PDDL.Op.divided_by) { public SimpleBoolean eval(SimpleBoolean a,SimpleBoolean b) { return b.v ? a : null; } public SimpleInteger eval(SimpleInteger a,SimpleInteger b) { return ANMLInteger.make(a.v / b.v); } public SimpleFloat eval(SimpleFloat a,SimpleFloat b) { return ANMLFloat.make(a.v / b.v); } }, exists(null) { public SimpleBoolean eval(SimpleBoolean a) { return a != null ? True : False; } public SimpleBoolean eval(SimpleInteger a) { return a != null ? True : False; } public SimpleBoolean eval(SimpleFloat a) { return a != null ? True : False; } public SimpleBoolean eval(SimpleString a) { return a != null ? True : False; } }, booleanCast(null) { public SimpleBoolean eval(SimpleBoolean a) { return a; } public SimpleBoolean eval(SimpleInteger a) { return a.v == 0 ? False : True; } public SimpleBoolean eval(SimpleFloat a) { return a.v == 0f ? False : True; } }, intCast(null) { public SimpleInteger eval(SimpleBoolean a) { return a.v ? One : Zero; } public SimpleInteger eval(SimpleInteger a) { return a; } public SimpleInteger eval(SimpleFloat a) { return ANMLInteger.make((int)a.v); } }, floatCast(null) { public SimpleFloat eval(SimpleBoolean a) { return a.v ? OneF : ZeroF; } public SimpleFloat eval(SimpleInteger a) { return ANMLFloat.make(a.v); } public SimpleFloat eval(SimpleFloat a) { return a; } }, ref(null) { public SimpleObject<?> eval(SimpleBoolean a) {return a;} public SimpleObject<?> eval(SimpleInteger a) {return a;} public SimpleObject<?> eval(SimpleFloat a) {return a;} public SimpleObject<?> eval(SimpleString a) {return a;} }, refNot(PDDL.Op.not) { public SimpleObject<?> eval(SimpleBoolean a) {return not.eval(a);} public SimpleObject<?> eval(SimpleInteger a) {return not.eval(a);} public SimpleObject<?> eval(SimpleFloat a) {return not.eval(a);} public SimpleObject<?> eval(SimpleString a) {return not.eval(a);} }, ; // Literal instead of Value<?> in order to allow typeCode? // ditto in state? // need a better name than literal... // // in line with that -- BooleanLiteral? // instead of make() [asymmetry...] // course...asymmetry makes a bit of sense there, as bool is just two-valued... public SimpleObject<?> eval(SimpleBoolean a) {return null;} public SimpleObject<?> eval(SimpleInteger a) {return null;} public SimpleObject<?> eval(SimpleFloat a) {return null;} public SimpleObject<?> eval(SimpleString a) {return null;} public SimpleObject<?> eval(SimpleBoolean a, SimpleBoolean b) {return null;} public SimpleObject<?> eval(SimpleInteger a, SimpleInteger b) { return null;} public SimpleObject<?> eval(SimpleFloat a, SimpleFloat b) { return null; } public SimpleObject<?> eval(SimpleString a, SimpleString b) { return null; } //public SimpleObject<?> eval(Object a, Object b) { return null; } public PDDL.Op pddl; Op(PDDL.Op pddl) { this.pddl = pddl; } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleBoolean; import gov.nasa.anml.utility.SimpleFloat; import gov.nasa.anml.utility.SimpleObject; public class Undefine<T extends SimpleObject<? super T>> extends ChainableExpressionImp<T,T> { public Expression<T,T> left; public Undefine(Expression<T, T> e) { this.left = e; } public boolean apply(State p, int contextID, State c) { History<T> place = left.storage(p,c); // will throw nullpointerexception if left is not an l-value // if (place.locked) // return false; History<T> last = left.storage(p,p); int bra = c.bra; SimpleFloat start = c.start; // do generation of child from parent by copying and advancing time // (bra from before to at, simulate, to after, simulate, // start to next time bra to before, simulate, done) place.value = null; // place.locked = true; place.prev = last; place.start = start; place.bra = bra; return true; } public T value(State s) { // if correctly applied, the assignment to null (undefined) // has taken place, and e.value(s) will return null return null; //return e.value(s); } public History<T> storage(State p, State c) { return left.storage(p,c); } public TypeCode typeCode() { return left.typeCode(); } public void translateDecl(PDDL pddl, Interval unit) { left.translateDecl(pddl,unit); } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); ArrayList<PDDL.Effect> effects = unit.getPDDLEffects(); switch(left.typeCode()) { case Boolean: PDDL.PredicateReference refB = (PDDL.PredicateReference) left.translateLValue(pddl,unit); // pretend false means undefined switch(part) { case Start: case End: effects.add(pddl.makeEffect(part,refB,false)); break; case Interim: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,false)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,false))); break; case All: case EndHalf: effects.add(pddl.makeEffect(PDDL.Time.End,refB,false)); case StartHalf: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,false)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,false))); break; default: System.err.println("New PDDL.Time constant unaccounted for in Undefine."); } case Float: PDDL.FunctionReference refF = (PDDL.FunctionReference) left.translateLValue(pddl,unit); switch(part) { case Start: case End: effects.add(pddl.makeEffect(part,refF,pddl.FloatUndefined)); break; case Interim: effects.add(pddl.makeEffect(PDDL.Time.Start,refF,pddl.FloatUndefined)); break; case All: case EndHalf: // PDDL can't do effects just after start, so I settle for at start. effects.add(pddl.makeEffect(PDDL.Time.End,refF,pddl.FloatUndefined)); case StartHalf: effects.add(pddl.makeEffect(PDDL.Time.Start,refF,pddl.FloatUndefined)); break; default: System.err.println("New PDDL.Time constant unaccounted for in Undefine."); } default: System.err.println("Oops!"); } } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.*; import gov.nasa.anml.PDDL.Parameter; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleFloat; import gov.nasa.anml.utility.SimpleInteger; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleVoid; public class Chain extends IntervalImp implements Statement { public ArrayList<ChainableExpression<?,?>> expressions; public Chain() {super(); this.expressions = new ArrayList<ChainableExpression<?,?>>();} public Chain(ArrayList<ChainableExpression<?,?>> expressions) { super(); this.expressions = expressions; } public History<SimpleVoid> storage(State p, State c) { return null; } public boolean apply(State p, int contextID, State c) { return false; } public static final PDDL.Time splitFirst(PDDL.Time t) { switch(t) { case All: return PDDL.Time.Start; case StartHalf: return PDDL.Time.Start; case EndHalf: return PDDL.Time.Interim; // if crammed into splitting atomic pieces up.... case Interim: // immediately before immediately after start = at start return PDDL.Time.Start; case Start: // should be immediately before start: ...start) return PDDL.Time.Start; case End: // should be immediately before end: ...end) // instead of (start, end) return PDDL.Time.Interim; case Timeless: default: return t; } } public static final PDDL.Time splitRest(PDDL.Time t) { switch(t) { case All: return PDDL.Time.EndHalf; case StartHalf: return PDDL.Time.Interim; case EndHalf: return PDDL.Time.End; // if forced to split atomic things... case Interim: return PDDL.Time.End; case Start: return PDDL.Time.Interim; case End: return PDDL.Time.End; case Timeless: default: return t; } } public static final PDDL.Time splitLeft(PDDL.Time t) { switch(t) { case All: return PDDL.Time.StartHalf; case StartHalf: return PDDL.Time.Start; case EndHalf: return PDDL.Time.Interim; case Interim: case Start: case End: return null; } return null; } public static final PDDL.Time splitRight(PDDL.Time t) { switch(t) { case All: return PDDL.Time.End; case StartHalf: return PDDL.Time.Interim; case EndHalf: return PDDL.Time.End; case Interim: case Start: case End: return t; } return null; } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { PDDL.Time t = PDDL.getShape(this); if (t == null || t == PDDL.Time.Timeless) { System.err.println("Shucks, Chain.java."); unit.getPDDLConditions().add(pddl.FalseCondition); return; } copyPDDL(unit); ChainableExpression<?,?> e; int i; for(i=0; i<expressions.size()-1;++i) { e = expressions.get(i); e.translateStmt(pddl,this,e.splitFirst(t)); t = e.splitRest(t); } e = expressions.get(i); e.translateStmt(pddl,this,t); } public void translateDecl(PDDL pddl, Interval unit) { ChainableExpression<?,?> e; copyPDDL(unit); for(int i=0; i<expressions.size()-1;++i) { e = expressions.get(i); e.translateDecl(pddl,this); } } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Action; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.*; // if an effect, then definite time. If indefinite time, then a condition. // maybe should split? // Kind of like "actions are a set of timed statements, qualified by // a set of timed conditions" // semantics are not p => e -- rather // semantics are that e always happens, but not(p) => fail // i.e., (s':=do(a,s)) => s'==do(e,s) ^ holds(p,s') // which could contradict or be self-supporting // seeing as how the conditions (p) are _timed_, however, it could easily // be the case that holds(p,s') iff holds(p',s), where p' are a set of // untimed statements (preconditions, if that is what p happens to be) // expressions, in general, would be of this latter kind -- because // they are used to determine the effects that happen the determinization // of the expression's value has to be independent of the dependent effects. // // this makes things complicated. // public class TimedStatement extends IntervalImp implements Statement { public Statement s; public TimedStatement() { } public TimedStatement(int bra, Constant<SimpleFloat> start,Constant<SimpleFloat> dur, Constant<SimpleFloat> end, int ket, Statement s) { super(bra,start,dur,end,ket); this.s = s; } public boolean apply(State p, int contextID, State c) { return true; } public void translateDecl(PDDL pddl, Interval unit) { s.translateDecl(pddl,unit); } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time p) { // FIXME: see error msg. // not sure what that means. oh well. PDDL.Time part = PDDL.getPart(unit,this); if (part == null) { System.err.println("Haven't implemented non-PDDL time access (yet)."); part = PDDL.Time.All; } else if (part == Time.Timeless) { System.err.println("A timeless timed statement. Intriguing."); part = PDDL.Time.All; System.err.println(s.toString()); } copyPDDL(unit); s.translateStmt(pddl, this, part); } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.utility.SimpleBoolean; import gov.nasa.anml.utility.SimpleObject; public abstract class CompoundIntervalExpression extends IntervalExpression<SimpleBoolean> { public ArrayList<IntervalExpression<SimpleBoolean>> expressions = new ArrayList<IntervalExpression<SimpleBoolean>>(); public void add(IntervalExpression<SimpleBoolean> e) { expressions.add(e); } public void add(Expression<SimpleBoolean,?> e) { if (e instanceof IntervalExpression) { expressions.add((IntervalExpression<SimpleBoolean>)e); } else { TimeOfExpression f = new TimeOfExpression(e); expressions.add(f); } } public boolean apply(State p, int contextID, State c) { return value(p).v ? true : false; } public TypeCode typeCode() { return TypeCode.Boolean; } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { ArrayList<PDDL.BooleanExpression> a = new ArrayList<PDDL.BooleanExpression>(); for (int i=0; i<this.expressions.size();++i) { IntervalExpression e = expressions.get(i); if (e.typeCode() != TypeCode.Boolean) continue; PDDL.BooleanExpression b = (PDDL.BooleanExpression) e.translateExpr(pddl,unit); a.add(b); } return pddl.wrap(PDDL.Op.and,a); } /* public SimpleBoolean value(State p) { for (int i=0;i<expressions.size();++i) { if (expressions.get(i).value(p) != ANMLBoolean.True) return ANMLBoolean.False; } return ANMLBoolean.True; } */ }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.utility.SimpleBoolean; import gov.nasa.anml.utility.SimpleObject; public class Produce<T extends SimpleObject<? super T>> extends BinaryExpression<T,T,T> { public Produce(Expression<T, T> l, Expression<T, ?> r) { super(l, r); } public boolean apply(State p, int contextID, State c) { return false; } public T value(State s) { return null; } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); ArrayList<PDDL.Effect> effects = unit.getPDDLEffects(); PDDL.Time pl,pr; switch(part) { case Start: case End: pl = pr = part; break; default: pl = PDDL.Time.Start; pr = PDDL.Time.End; break; } switch(left.typeCode()) { case Boolean: assert right.typeCode() == TypeCode.Boolean : "No operation combines booleans and other types directly"; PDDL.PredicateReference refB = (PDDL.PredicateReference) left.translateLValue(pddl,unit); if (right instanceof SimpleBoolean) { boolean v = ((SimpleBoolean)right).v; if (v) { conditions.add(pddl.wrap(pl,pddl.makeTest(refB,false))); effects.add(pddl.makeEffect(pl,refB,true)); if (pl != pr) conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,true))); } } else { PDDL.BooleanExpression r = (PDDL.BooleanExpression) right.translateExpr(pddl,unit); conditions.add(pddl.wrap(pl,pddl.makeTest(PDDL.Op.or,pddl.negate(refB),pddl.negate(r)))); effects.add(pddl.wrap(pl,pddl.makeEffect(r,refB,true))); // not easy to implement the interim portion // if we had upper and lower bounds on bools and floats then it wouldn't be so bad. //conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,true))); } break; case Float: assert right.typeCode() == TypeCode.Float : "No operation combines floats and non-floats (at present)."; PDDL.FunctionReference refF = (PDDL.FunctionReference) left.translateLValue(pddl,unit); PDDL.FloatExpression v = (PDDL.FloatExpression) right.translateExpr(pddl,unit); //conditions.add(pddl.wrap(pl,pddl.makeTest(PDDL.Op.lt,refF,??))); effects.add(pddl.makeEffect(pr,PDDL.Op.increase,refF,v)); // or could move it to pl, but this is the standard way // could add this constraint, but it would be better to just throw it in the domain action and be done with it once. //conditions.add(pddl.wrap(PDDL.Time.Interim/End,pddl.makeTest(PDDL.Op.gte,refF,pddl.Zero))); break; default: System.err.println("Oops!"); } } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Argument; import gov.nasa.anml.PDDL.BooleanExpression; import gov.nasa.anml.PDDL.Effect; import gov.nasa.anml.PDDL.FloatExpression; import gov.nasa.anml.PDDL.Parameter; import gov.nasa.anml.PDDL.Predicate; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.*; public class TimedExpression<T extends SimpleObject<? super T>> extends IntervalExpression<T> { public Expression<T,?> e; public TimedExpression() { } public boolean apply(State p, int contextID, State c) { // have to shift time before applying return false; } public TypeCode typeCode() { return e.typeCode(); } public T value(State s) { T ret=null; if (false /* last time */) { ret = e.value(s); } while(ANMLBoolean.True.v == false /* scan history */) { if (ret.compareTo(e.value(s)) != 0) return null; } return e.value(s); // return ret; } // TODO // FIXME // all of the following public void translateDecl(PDDL pddl, Interval unit) { e.translateDecl(pddl,unit); } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { PDDL.Time part = PDDL.getPart(unit,this); if (part == null) { System.err.println("Haven't implemented non-PDDL time access (yet)."); //unit.asPDDLAction().condition.arguments.add(pddl.FalseCondition); part = PDDL.Time.All; // might work? } else if (part == Time.Timeless) { part = PDDL.Time.All; System.err.println("A timeless timed expression? In Timed.translateExpr(), interpreting as All. " + e); } copyPDDL(unit); PDDL.Expression exp = e.translateExpr(pddl,this); if (e instanceof ConstantExpression<?>) return exp; switch(e.typeCode()) { case Boolean: PDDL.BooleanExpression b = (PDDL.BooleanExpression) exp; ArrayList<PDDL.BooleanExpression> a = new ArrayList<PDDL.BooleanExpression>(); switch(part) { case Start: case End: case Interim: return pddl.wrap(part,b); case All: a.add(pddl.wrap(PDDL.Time.Start,b)); case EndHalf: a.add(pddl.wrap(PDDL.Time.Interim,b)); a.add(pddl.wrap(PDDL.Time.End,b)); break; case StartHalf: a.add(pddl.wrap(PDDL.Time.Start,b)); a.add(pddl.wrap(PDDL.Time.Interim,b)); break; default: System.err.println("New PDDL.Time constant unaccounted for in TimedExpression."); return exp; } return pddl.wrap(PDDL.Op.and,a); case Float: FloatExpression f = (FloatExpression) exp; switch(part) { case Start: case End: case Interim: return pddl.wrap(part,f); case All: case StartHalf: return pddl.wrap(Time.Start,f); case EndHalf: return pddl.wrap(Time.Interim,f); default: System.err.println("New PDDL.Time constant unaccounted for in ConstantFunctionRef."); return exp; } default: System.err.println("Oops!"); return exp; } } @Override public void translateStmt(PDDL pddl, Interval unit, PDDL.Time time) { PDDL.Time part = PDDL.getPart(unit,this); if (part == null) { System.err.println("Haven't implemented non-PDDL time access (yet)."); part = PDDL.Time.All; } else if (part == Time.Timeless) { System.err.println("A timeless timed expression. Intriguing."); part = PDDL.Time.All; System.err.println(e.toString()); } copyPDDL(unit); if (e.typeCode() != TypeCode.Boolean) { System.err.println("Warning: Non-boolean expression-as-statement (i.e., a condition) found in: " + e.toString()); getPDDLConditions().add(pddl.FalseCondition); return; } e.translateStmt(pddl, this, part); } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import java.util.HashMap; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; public class ScopeImp implements Scope, Cloneable{ protected Scope parent; // one namespace by simple id. Should eventually implement // type-signature mapping. // well an alternative is also just to have terms have variable args // (be their own type signature mappings) public HashMap<SimpleString,Identifier<?,?>> symbols = new HashMap<SimpleString,Identifier<?,?>>(); public SymbolTable<Type<?>> types = new SymbolTable<Type<?>>(); public SymbolTable<Constant<?>> constants = new SymbolTable<Constant<?>>(); public SymbolTable<ConstantFunction<?>> constantFunctions = new SymbolTable<ConstantFunction<?>>(); public SymbolTable<Fluent<?>> fluents = new SymbolTable<Fluent<?>>(); public SymbolTable<FluentFunction<?>> fluentFunctions = new SymbolTable<FluentFunction<?>>(); public SymbolTable<Parameter<?>> parameters = new SymbolTable<Parameter<?>>(); public SymbolTable<LabeledInterval<?,?>> labels = new SymbolTable<LabeledInterval<?,?>>(); // voluntary public SymbolTable<Action> actions = new SymbolTable<Action>(); // compulsory public ArrayList<Statement> statements = new ArrayList<Statement>(); // disjunctive compulsion public ArrayList<Decomposition> decompositions = new ArrayList<Decomposition>(); public ScopeImp clone() { ScopeImp ret = null; try { ret = (ScopeImp) super.clone(); } catch (CloneNotSupportedException e) { //assert false; } ret.symbols = new HashMap<SimpleString,Identifier<?,?>>(); ret.types = new SymbolTable<Type<?>>(); ret.constants = new SymbolTable<Constant<?>>(); ret.constantFunctions = new SymbolTable<ConstantFunction<?>>(); ret.fluents = new SymbolTable<Fluent<?>>(); ret.fluentFunctions = new SymbolTable<FluentFunction<?>>(); ret.parameters = new SymbolTable<Parameter<?>>(); ret.actions = new SymbolTable<Action>(); ret.statements = new ArrayList<Statement>(); ret.decompositions = new ArrayList<Decomposition>(); ret.inherit(this); return ret; } // numbering will be off unless there is a sole inheritance preceding all extension of the scope. // inheritance is object/class inheritance. nesting is different; that is handled through the parent pointer public void inherit(ScopeImp s) { symbols.putAll(s.symbols); parameters.inherit(s.parameters); types.inherit(s.types); constants.inherit(s.constants); constantFunctions.inherit(s.constantFunctions); fluents.inherit(s.fluents); fluentFunctions.inherit(s.fluentFunctions); actions.inherit(s.actions); statements.addAll(s.statements); decompositions.addAll(s.decompositions); } public ScopeImp() {} public ScopeImp(Scope parent) {init(parent);} public final void init(Scope parent) { this.parent = parent; } public Action addAction(Action a) { if (a == null) return null; symbols.put(a.name,a); return actions.put(a); } public Statement addStatement(Statement s) { if(s==null) return null; if(statements.add(s)) return s; return null; } public Identifier<?,?> resolveSymbol(SimpleString n) { Identifier<?,?> s=symbols.get(n); if (s==null) return parent == null ? null : parent.resolveSymbol(n); return s; } public Identifier<?, ?> addSymbol(IdentifierImp<?,?> s) { return symbols.put(s.name,s); } public Identifier<?, ?> addSymbol(Identifier<?,?> s) { return symbols.put(s.name(),s); } public Identifier<?, ?> getSymbol(SimpleString s) { return symbols.get(s); } public <T extends SimpleObject<? super T>> Parameter<T> addParameter(Parameter<T> t) { symbols.put(t.name,t); return parameters.put(t); } public <T extends SimpleObject<? super T>> Type<T> addType(Type<T> t) { symbols.put(t.name(),t); return types.put(t); } public <T extends SimpleObject<? super T>> Constant<T> addConstant(Constant<T> c) { symbols.put(c.name,c); return constants.put(c); } public <T extends SimpleObject<? super T>> LabeledInterval addLabel(LabeledInterval l) { symbols.put(l.name(),l); return labels.put(l); } public <T extends SimpleObject<? super T>> ConstantFunction<T> addConstantFunction(ConstantFunction<T> c) { symbols.put(c.name,c); return constantFunctions.put(c); } public <T extends SimpleObject<? super T>> Fluent<T> addFluent(Fluent<T> f) { symbols.put(f.name,f); return fluents.put(f); } public <T extends SimpleObject<? super T>> FluentFunction<T> addFluentFunction(FluentFunction<T> f) { symbols.put(f.name,f); return fluentFunctions.put(f); } public SimpleString getParameterName(int p) { return parameters.getName(p); } public SimpleString getTypeName(int t) { return types.getName(t); } public SimpleString getConstantName(int c) { return constants.getName(c); } public SimpleString getConstantFunctionName(int c) { return constantFunctions.getName(c); } public SimpleString getFluentName(int f) { return fluents.getName(f); } public SimpleString getFluentFunctionName(int f) { return fluentFunctions.getName(f); } public SimpleString getActionName(int a) { return actions.getName(a); } public Parameter<?> getParameter(int p) { return parameters.get(p); } public Type<?> getType(int t) { return types.get(t); } public Constant<?> getConstant(int c) { return constants.get(c); } public ConstantFunction<?> getConstantFunction(int c) { return constantFunctions.get(c); } public Fluent<?> getFluent(int f) { return fluents.get(f); } public FluentFunction<?> getFluentFunction(int f) { return fluentFunctions.get(f); } public Action getAction(int a) { return actions.get(a); } public Parameter<?> getParameter(SimpleString p) { return parameters.get(p); } public Type<?> getType(SimpleString t) { return types.get(t); } public Constant<?> getConstant(SimpleString c) { return constants.get(c); } public ConstantFunction<?> getConstantFunction(SimpleString c) { return constantFunctions.get(c); } public Fluent<?> getFluent(SimpleString f) { return fluents.get(f); } public LabeledInterval getLabel(SimpleString l) { return labels.get(l); } public FluentFunction<?> getFluentFunction(SimpleString f) { return fluentFunctions.get(f); } public Action getAction(SimpleString a) { return actions.get(a); } public Action resolveAction(SimpleString n) { Action s = actions.get(n); if (s == null) return parent == null ? null : parent.resolveAction(n); return s; } public Constant<?> resolveConstant(SimpleString n) { Constant<?> s = constants.get(n); if (s == null) return parent == null ? null : parent.resolveConstant(n); return s; } public ConstantFunction<?> resolveConstantFunction(SimpleString n) { ConstantFunction<?> s = constantFunctions.get(n); if (s == null) return parent == null ? null : parent.resolveConstantFunction(n); return s; } public Fluent<?> resolveFluent(SimpleString n) { Fluent<?> s = fluents.get(n); if (s == null) return parent == null ? null : parent.resolveFluent(n); return s; } public FluentFunction<?> resolveFluentFunction(SimpleString n) { FluentFunction<?> s = fluentFunctions.get(n); if (s == null) return parent == null ? null : parent.resolveFluentFunction(n); return s; } public Parameter<?> resolveParameter(SimpleString n) { Parameter<?> s = parameters.get(n); if (s == null) return parent == null ? null : parent.resolveParameter(n); return s; } public Type<?> resolveType(SimpleString n) { Type<?> s = types.get(n); if (s == null) { if (parent == this) { System.err.println("Circular scopes?"); return null; } return parent == null ? null : parent.resolveType(n); } return s; } public Scope getParent() { return parent; } public void setParent(Scope parent) { if (parent != this) this.parent = parent; else System.err.println("Setting circular types"); } public void addDecomposition(Decomposition d) { if (d != null) decompositions.add(d); } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Argument; import gov.nasa.anml.PDDL.FloatExpression; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleBoolean; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleVoid; public class ContainsExpression<E extends Expression<?,?>> extends ConstantExpressionImp<SimpleBoolean> { public E e; public ContainsExpression() { super(); e=null; } public ContainsExpression(E e) { super(); this.e = e; } public TypeCode typeCode() { return TypeCode.Boolean; } public boolean apply(State p, int contextID, State c) { if (e.value(p) == ANMLBoolean.True) { //if supplied timewindow for application contains all of e // i.e., e.getStart() and so forth // then return true return true; } return false; } public SimpleBoolean value(State s) { // the correct semantics are to check whether the history of that expression's truth is contained // within the surrounding interval. This class may need to extend IntervalImp in order to know what // that surrounding context is supposed to be. return e.value(s) == ANMLBoolean.True ? ANMLBoolean.True : ANMLBoolean.False; // the details of what the contained expression's history exactly is depends on the subclass. } // FIXME: implement for real public void translateDecl(PDDL pddl, Interval unit) { e.translateDecl(pddl,unit); } public void translateStmt(PDDL pddl, Interval unit, Time part) { e.translateStmt(pddl,unit,part); } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { return e.translateExpr(pddl,unit); } public PDDL.Argument translateArgument(PDDL pddl, Interval unit) { return e.translateArgument(pddl,unit); } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import java.util.HashMap; import gov.nasa.anml.utility.SimpleString; public class SymbolTable<T extends Identifier<?, ?>> { public int count = 0; public ArrayList<T> table = new ArrayList<T>(); public HashMap<SimpleString,T> map = new HashMap<SimpleString,T>(); public SymbolTable() { } public SymbolTable(T s) { put(s); } public <S extends T> S put(S s) { SimpleString v = s.name(); T o = map.get(v); if (o != null) { return (S) o; } map.put(v, s); table.add(s); s.id(count++); return s; } // if this is done in the wrong order there will be id collisions (maybe) // with later declared symbols, and table[id] won't map to the symbol // with that id. But one can still iterate over the table to get all the symbols // and count is still the number of symbols, so one can use other integer spaces // for inherited ids if that is useful (like negative numbers, avoiding id collisions) public void inherit(T s) { map.put(s.name(),s); table.add(s); ++count; } public void inherit(SymbolTable<T> s) { for (T t : s.table) { map.put(t.name(),t); table.add(t); } count += s.count; } public T get(SimpleString k) { T r = map.get(k); return r; } public T get(int i) { return table.get(i); } public SimpleString getName(int i) { return table.get(i).name(); } public String toString() { return table.toString(); } }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Type; import gov.nasa.anml.PDDL.TypeRelation; import gov.nasa.anml.utility.SimpleString; import gov.nasa.anml.utility.SimpleVoid; // a symbol is an Symbol with no properties public class SymbolType extends IdentifierImp<SimpleString,SimpleVoid> implements ExtensibleType<SymbolLiteral> { //extends Type<SimpleSymbol> implements Scope { public Enumeration<SymbolLiteral> members; public ArrayList<SymbolType> subTypes = new ArrayList<SymbolType>(); public ArrayList<SymbolType> superTypes = new ArrayList<SymbolType>(); public boolean open=true; public SymbolType() { members = new Enumeration<SymbolLiteral>(); } public SymbolType(SimpleString n) { super(n); members = new Enumeration<SymbolLiteral>(); } public SymbolType(SimpleString n,int i) { super(n,i); members = new Enumeration<SymbolLiteral>(); } public SymbolType(Enumeration<SymbolLiteral> c, SymbolType o) { members = c; open = false; o.subTypes.add(this); // see ObjectType superTypes.add(o); for (SymbolLiteral l : members) { l.addType(this); } } public SymbolType(Enumeration<SymbolLiteral> c) { members = c; open = false; for (SymbolLiteral l : members) { l.addType(this); } } public void extend(ExtensibleType<SymbolLiteral> s) { SymbolType o = (SymbolType) s; o.addSubType(this); superTypes.add(o); } public boolean addSubType(ExtensibleType<SymbolLiteral> s) { SymbolType o = (SymbolType) s; if (open) subTypes.add(o); else { System.err.println("Error: trying to extend the closed type `" + this + "' with '" + s + "."); } return open; } public void addSuperType(ExtensibleType<SymbolLiteral> s) { SymbolType o = (SymbolType) s; superTypes.add(o); } public void add(SymbolLiteral m) { if (!open) System.err.println("Cannot add members to a closed type"); else { members.add(m); m.addType(this); } } public void set(Enumeration<SymbolLiteral> n) { if (members != null) { System.err.println("Error: The members of: " + name + " are already defined. Proceeding by overwriting. This will likely wreak havoc (concerning semantics of the model produced)."); for (SymbolLiteral l : members) { l.types.remove(this); } } members = n; open = false; for (SymbolLiteral l : members) { l.addType(this); } } public SymbolType constrain(Constraint<SymbolLiteral> c) { if (c == null) return this; if (c instanceof Enumeration) { Enumeration<SymbolLiteral> e = (Enumeration<SymbolLiteral>) c; if (members.containsAll(e)) return new SymbolType(e,this); // FIXME: take the intersection // (and report an error/warning on the extra stuff in c?) } return null; } // a type alias. Keep members duplicated so that changes to either // type propagate to both. // the alias can be closed though, since it is exactly equal to something // else (which may or may not itself be closed) public SymbolType clone() { SymbolType ret = null; try { ret = (SymbolType) super.clone(); } catch (CloneNotSupportedException e) { //assert false; } open = false; return ret; } public final TypeCode typeCode() { return TypeCode.Symbol; } public IdentifierCode idCode() { return IdentifierCode.Type; } public Enumeration<SymbolLiteral> members() { return members; } public boolean isSubType(SymbolType t) { if (this == t) return true; for (int i=0; i<superTypes.size(); ++i) { if (superTypes.get(i).isSubType(t)) return true; } return false; } transient PDDL.Type asPDDLType; public void translateDecl(PDDL pddl,Interval unit) { if (asPDDLType != null) return; if (this != Unit.symbolType) { int length = pddl.bufAppend(name); asPDDLType = pddl.new Type(pddl.bufToString()); pddl.types.add(asPDDLType); pddl.bufReset(length); ArrayList<PDDL.TypeRelation> typeRelations = pddl.typeRelations; for (SymbolType f : superTypes) { if (f != Unit.symbolType) typeRelations.add(pddl.new TypeRelation(asPDDLType,f.asPDDLType())); } } else { asPDDLType = pddl.Object; } for (SymbolLiteral m : members) { // the proper call is m.translateDecl(pddl,this) // for any subtype of unit, in general, but // we aren't compiling this out as a pddlAction, so we pass up to the next container if we have to. // where that would matter is class-local statements, which will likely become domain-level statements, // and that will be incorrect. To enforce a class-local statement requires representing the type as an action // (its constructor), so that statements and constraints could be checked. m.translateDecl(pddl,unit); } } public PDDL.Type asPDDLType() { return asPDDLType; } /* // Scope implementation public SymbolTable<Type<?>> types = new SymbolTable<Type<?>>(); public SymbolTable<Constant<?>> cFluents = new SymbolTable<Constant<?>>(); public SymbolTable<ConstantFunction<?>> cFluentFunctions = new SymbolTable<ConstantFunction<?>>(); public SymbolTable<Fluent<?>> fluents = new SymbolTable<Fluent<?>>(); public SymbolTable<FluentFunction<?>> fluentFunctions = new SymbolTable<FluentFunction<?>>(); public SymbolTable<Parameter<?>> parameters ;//= new SymbolTable<Parameter<?>>(); public SymbolTable<Action> actions ;//= new SymbolTable<Action>(); public ArrayList<Statement> statements = new ArrayList<Statement>(); // one namespace by simple id. Should eventually implement // type-signature mapping. public HashMap<SimpleString,SymbolLiteral> symbols = new HashMap<SimpleString,SymbolLiteral>(); public SymbolLiteral addSymbol(IdentifierImp s) { return symbols.put(s.name,s); } public SymbolLiteral getSymbol(SimpleString s) { return symbols.get(s); } public <T extends SimpleSymbol<? super T>> Parameter<T> addParameter(Parameter<T> t) { symbols.put(t.name,t); return (Parameter<T>) parameters.put(t); } public <T extends SimpleSymbol<? super T>> Type<T> addType(Type<T> t) { symbols.put(t.name(),t); return (Type<T>) types.put(t); } public <T extends SimpleSymbol<? super T>> Constant<T> addConstant(Constant<T> c) { symbols.put(c.name,c); return (Constant<T>) cFluents.put(c); } public <T extends SimpleSymbol<? super T>> ConstantFunction<T> addConstantFunction(ConstantFunction<T> c) { symbols.put(c.name,c); return (ConstantFunction<T>) cFluentFunctions.put(c); } public <T extends SimpleSymbol<? super T>> Fluent<T> addFluent(Fluent<T> f) { symbols.put(f.name,f); return (Fluent<T>) fluents.put(f); } public <T extends SimpleSymbol<? super T>> FluentFunction<T> addFluentFunction(FluentFunction<T> f) { symbols.put(f.name,f); return (FluentFunction<T>) fluentFunctions.put(f); } public Action addAction(Action a) { symbols.put(a.name,a); return actions.put(a); } public SimpleString getParameterName(int p) { return parameters.getName(p); } public SimpleString getTypeName(int t) { return types.getName(t); } public SimpleString getConstantFluentName(int c) { return cFluents.getName(c); } public SimpleString getConstantFunctionName(int c) { return cFluentFunctions.getName(c); } public SimpleString getFluentName(int f) { return fluents.getName(f); } public SimpleString getFunctionName(int f) { return fluentFunctions.getName(f); } public SimpleString getActionName(int a) { return actions.getName(a); } public Parameter<?> getParameter(int p) { return parameters.get(p); } public Type<?> getType(int t) { return types.get(t); } public Constant<?> getConstant(int c) { return cFluents.get(c); } public ConstantFunction<?> getConstantFunction(int c) { return cFluentFunctions.get(c); } public Fluent<?> getFluent(int f) { return fluents.get(f); } public FluentFunction<?> getFluentFunction(int f) { return fluentFunctions.get(f); } public Action getAction(int a) { return actions.get(a); } public Parameter<?> getParameter(SimpleString p) { return parameters.get(p); } public Type<?> getType(SimpleString t) { return types.get(t); } public Constant<?> getConstant(SimpleString c) { return cFluents.get(c); } public ConstantFunction<?> getConstantFunction(SimpleString c) { return cFluentFunctions.get(c); } public Fluent<?> getFluent(SimpleString f) { return fluents.get(f); } public FluentFunction<?> getFluentFunction(SimpleString f) { return fluentFunctions.get(f); } public Action getAction(SimpleString a) { return actions.get(a); } */ }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Function; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; import gov.nasa.anml.utility.SimpleVoid; // Scheme: value(State s, int contextID) // The state is the state of all memory, including a list of the active // contexts. Contexts are the state of registers // [and the ids of executing steps that contain storage]; // context-switching then lets the same names refer to concurrent sets // of values. This supports parameter references. // Also local state. Past references can be dealt with by accumulating // local state, or by keeping a closed list and walking up. // The local state approach is handy for compilations to other languages public class Parameter<T extends SimpleObject<? super T>> extends IdentifierImp<T,SimpleVoid> implements ConstantExpression<T> { // remember the containing term? public Type<T> type; public T value; // the currently bound value public Parameter(SimpleString n,Type<T> t) { super(n); type = t; } public Parameter(Type<T> t) { type = t; } public TypeCode typeCode() { return type.typeCode(); } public T value(State s) { return value; } public History<SimpleVoid> storage(State p, State c) { return null; } public IdentifierCode idCode() { return IdentifierCode.Parameter; } public boolean apply(State p, int contextID, State c) { if (value != ANMLBoolean.True) return false; return true; } transient public PDDL.Parameter asPDDLParameter; public PDDL.Parameter asPDDLParameter() { return asPDDLParameter; } public PDDL.ParameterReference translateArgument(PDDL pddl, Interval unit) { return asPDDLParameter.ref; } void _translateDecl(PDDL pddl) { if (name == Interval.startName || name == Interval.durationName || name == Interval.endName || name == Interval.braName || name == Interval.ketName) return; if (typeCode() == TypeCode.Symbol || typeCode() == TypeCode.Object) { if (pddl.depth > 0) { StringBuilder buf = new StringBuilder(name.toString()); buf.append('_').append(pddl.depth); asPDDLParameter = pddl.new Parameter(buf.toString(),type.asPDDLType()); if (type.asPDDLType() == null) System.err.println("Null type?"); } else { asPDDLParameter = pddl.new Parameter(name.toString(),type.asPDDLType()); if (type.asPDDLType() == null) { System.err.println("Null type?"); } } } else { System.err.println("Cannot translate parameter '" + name + "' of type '" + type.name() + "' (" + typeCode() + ")."); } } public void translateDecl(PDDL pddl, Interval unit) { if (asPDDLParameter != null) return; _translateDecl(pddl); if (asPDDLParameter != null) { unit.getPDDLParameters().add(asPDDLParameter); } } public void translateDecl(PDDL pddl, PDDL.Function realPDDL) { if (asPDDLParameter != null) return; _translateDecl(pddl); if (asPDDLParameter != null) { realPDDL.parameters.add(asPDDLParameter); } } public void translateDecl(PDDL pddl, PDDL.Predicate boolPDDL) { if (asPDDLParameter != null) return; _translateDecl(pddl); if (asPDDLParameter != null) { boolPDDL.parameters.add(asPDDLParameter); } } }
Java
package gov.nasa.anml.lifted; import java.util.HashMap; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.FloatExpression; import gov.nasa.anml.utility.*; public class ANMLFloat extends SimpleFloat implements ConstantExpression<SimpleFloat> { public static final fHashMap<ANMLFloat> pool = new fHashMap<ANMLFloat>(); // warning: testing for NaN cannot be done by == Float.NaN // however, testing ANMLFloats for == ANMLFloat.NaN does work // because of the extra check in make() //public static final ANMLFloat NaN = new ANMLFloat(Float.NaN); // just use null for NaN, because other types don't have an internal // 'undefined' public static final ANMLFloat PInf = make(Float.POSITIVE_INFINITY); public static final ANMLFloat NInf = make(Float.NEGATIVE_INFINITY); public static final ANMLFloat ZeroF = make(0f); public static final ANMLFloat OneF = make(1f); // epsilon, non-final, with initial value at 0.01? or too pddl specific? // "unit" instead of "epsilon" is maybe better, but still kludgy... public static ANMLFloat make(float v) { ANMLFloat probe = pool.get(v); if (probe == null) { if (v != v) return null; probe = new ANMLFloat(v); pool.put(v,probe); } return probe; } protected ANMLFloat(float v) { super(v); } public ANMLFloat value(State s) { return this; } public ANMLFloat value() { return this; } public TypeCode typeCode() { return TypeCode.Float; } public History<SimpleVoid> storage(State p, State c) { return null; } public boolean apply(State p, int contextID, State c) { return false; } public transient PDDL.FloatLiteral asPDDLFloatExpression; public FloatExpression asPDDLFloatExpr() { return asPDDLFloatExpression; } public void translateDecl(PDDL pddl, Interval unit) { } public PDDL.FloatExpression translateExpr(PDDL pddl, Interval unit) { return asPDDLFloatExpression = pddl.new FloatLiteral(v); } public PDDL.Expression translateLValue(PDDL pddl, Interval unit) { return null; } public PDDL.Argument translateArgument(PDDL pddl, Interval unit) { return null; } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { unit.getPDDLConditions().add(pddl.FalseCondition); } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleObject; public class ChainableExpressionImp<V, S extends SimpleObject<? super S>> extends ExpressionImp<V, S> implements ChainableExpression<V,S> { public History<S> storage(State p, State c) { return null; } public TypeCode typeCode() { return TypeCode.Void; } public V value(State s) { return null; } public boolean apply(State p, int contextID, State c) { return false; } public Time splitFirst(Time t) { return Chain.splitFirst(t); } public Time splitRest(Time t) { return Chain.splitRest(t); } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.utility.SimpleString; public enum TypeCode { Boolean("boolean"), Byte("byte"), Short("short"), Character("character"), Integer("integer"), Long("long"), Float("float"), Double("double"), String("string"), Symbol("symbol"), Vector("vector"), Object("object"), Void("void"), ; SimpleString name; TypeCode(SimpleString n) {this.name = n;} TypeCode(String n) {this.name = new SimpleString(n);} }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.State; import gov.nasa.anml.utility.SimpleBoolean; public class Ordered extends CompoundIntervalExpression { public SimpleBoolean value(State p) { for (int i=0;i<expressions.size();++i) { if (expressions.get(i).value(p) != ANMLBoolean.True) return ANMLBoolean.False; } // TODO: remember envelop and enforce linear order return ANMLBoolean.True; } }
Java
/** * Adapted from Sapa */ package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.BooleanExpression; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.*; // the better solution is to introduce explicit Cast expressions // also, this should be an operation class that does every operation // and condition should be the conversion of expressions to conditions, i.e., // conditions == expression statements (<expression> ';') // In line with that, to convert float expressions into conditions (e.g.), // in pddl, one can write (== (* <float-expression> 0) 0) // as that ensures that all the referenced functions are defined, and perhaps // also that the operations don't result in NaN. Or if multiplication is verboten // (?why?) then one can do (== (- <e> <e>) 0) where <e> == <float-expression> public class OpUnary<I,O extends SimpleObject<? super O>> extends ExpressionImp<O,O> { public Op op; public Expression<I,?> exp; public TypeCode baseType; public OpUnary() { op = Op.exists; exp = null; baseType = TypeCode.Boolean; } public OpUnary(TypeCode baseType, Op op, Expression<I,?> exp) { this.exp = exp; this.op = op; this.baseType = baseType; } // should implement following in expression // and then do leftSide.toInfix() etc. public String toString() { StringBuilder s = new StringBuilder(); s.append('(').append(op). append(' ').append(exp). append(')'); return s.toString(); } public O value(State s) { I e = exp.value(s); if (e == null) return null; switch(exp.typeCode()) { case Boolean: return (O) op.eval((SimpleBoolean)e); case Byte: break; case Short: break; case Integer: return (O) op.eval((SimpleInteger)e); case Long: break; case Float: return (O) op.eval((SimpleFloat)e); case Double: break; case String: return (O) op.eval((SimpleString)e); case Symbol: break; case Vector: break; case Object: break; } return null; } public TypeCode typeCode() { return baseType; } public History<O> storage(State p, State c) { return null; } public boolean apply(State p, int contextID, State c) { if (baseType != TypeCode.Boolean) return false; I e = exp.value(p); if (e == null) return false; SimpleBoolean ret = null; switch(exp.typeCode()) { case Boolean: ret = (SimpleBoolean) op.eval((SimpleBoolean)e); case Byte: break; case Short: break; case Integer: ret = (SimpleBoolean) op.eval((SimpleInteger)e); case Long: break; case Float: ret = (SimpleBoolean) op.eval((SimpleFloat)e); case Double: break; case String: ret = (SimpleBoolean) op.eval((SimpleString)e); case Symbol: break; case Vector: break; case Object: break; } if (ret != ANMLBoolean.True) return false; return true; } public transient PDDL.Expression asPDDLExpression; public void translateDecl(PDDL pddl, Interval unit) { exp.translateDecl(pddl,unit); } public PDDL.Argument translateArgument(PDDL pddl, Interval unit) { switch(op) { case ref: return exp.translateArgument(pddl,unit); case refNot: case not: default: return super.translateArgument(pddl,unit); } } public PDDL.Expression translateLValue(PDDL pddl,Interval unit) { switch(op) { case ref: return exp.translateLValue(pddl,unit); case refNot: case not: default: return super.translateLValue(pddl,unit); } } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { if (asPDDLExpression != null) return asPDDLExpression; if(op == Op.ref) return asPDDLExpression = exp.translateExpr(pddl,unit); switch(baseType) { case Boolean: switch(op) { case refNot: case not: return asPDDLExpression = pddl.negate((BooleanExpression)exp.translateExpr(pddl,unit)); default: return asPDDLExpression = pddl.wrap(op.pddl,(PDDL.BooleanExpression) exp.translateExpr(pddl,unit)); } case Float: return asPDDLExpression = pddl.wrap(op.pddl,(PDDL.FloatExpression) exp.translateExpr(pddl,unit)); } System.err.println("Uh-oh, don't know how to translate: "+this); return asPDDLExpression = pddl.wrap(op.pddl,translateExpr(pddl,unit)); } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; public interface Scope extends StatementContainer { //public abstract Scope nest(Scope o); // as in nesting/parent/reference //public abstract Scope extend(Scope o); // as in inheritance/copy public abstract Identifier<?,?> resolveSymbol(SimpleString n); public abstract Parameter<?> resolveParameter(SimpleString n); public abstract Type<?> resolveType(SimpleString n); public abstract Constant<?> resolveConstant(SimpleString n); public abstract ConstantFunction<?> resolveConstantFunction(SimpleString n); public abstract Fluent<?> resolveFluent(SimpleString n); public abstract FluentFunction<?> resolveFluentFunction(SimpleString n); public abstract Action resolveAction(SimpleString n); public abstract Identifier<?,?> addSymbol(Identifier<?,?> s); public abstract Identifier<?,?> getSymbol(SimpleString s); public abstract <T extends SimpleObject<? super T>> Parameter<T> addParameter(Parameter<T> t); public abstract <T extends SimpleObject<? super T>> Constant<T> addConstant(Constant<T> c); public abstract <T extends SimpleObject<? super T>> ConstantFunction<T> addConstantFunction(ConstantFunction<T> c); public abstract <T extends SimpleObject<? super T>> Fluent<T> addFluent(Fluent<T> f); public abstract <T extends SimpleObject<? super T>> FluentFunction<T> addFluentFunction(FluentFunction<T> f); public abstract <T extends SimpleObject<? super T>> Type<T> addType(Type<T> t); public abstract Action addAction(Action a); public abstract SimpleString getParameterName(int p); public abstract SimpleString getConstantName(int c); public abstract SimpleString getConstantFunctionName(int c); public abstract SimpleString getFluentName(int f); public abstract SimpleString getFluentFunctionName(int f); public abstract SimpleString getActionName(int a); public abstract Parameter<?> getParameter(int p); public abstract Constant<?> getConstant(int c); public abstract ConstantFunction<?> getConstantFunction(int c); public abstract Fluent<?> getFluent(int f); public abstract FluentFunction<?> getFluentFunction(int f); public abstract Action getAction(int a); public abstract Parameter<?> getParameter(SimpleString p); public abstract Constant<?> getConstant(SimpleString c); public abstract ConstantFunction<?> getConstantFunction(SimpleString c); public abstract Fluent<?> getFluent(SimpleString f); public abstract FluentFunction<?> getFluentFunction(SimpleString f); public abstract Action getAction(SimpleString a); public abstract Type<?> getType(SimpleString t); public abstract SimpleString getTypeName(int t); public abstract Type<?> getType(int t); public Statement addStatement(Statement s); public Scope getParent(); public void setParent(Scope parent); }
Java
package gov.nasa.anml.lifted; public interface Time { // could use an enum, but then one writes Time.Code.At. Ew. // could make Time itself an enum, but one cannot implement enums (or inherit from them?). // ...so I revert to C-style code. public static int Before=-1; public static int At=0; public static int After=1; }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.CompoundEffect; import gov.nasa.anml.utility.SimpleBoolean; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; import gov.nasa.anml.utility.SimpleVoid; public class Exists extends Block { public Exists(Scope parent, SimpleString n) { super(parent,n); } public boolean apply(State p, int contextID, State c) { statementLoop: for(int i=0; i < statements.size(); ++i) { Statement s = statements.get(i); for(int j=0; j < 1; ++j) { //test each binding... if (s.apply(p,contextID,c)) continue statementLoop; } return false; } return true; } public TypeCode typeCode() { return TypeCode.Boolean; } public History<SimpleVoid> storage(State p, State c) { return null; } public ANMLBoolean value(State p) { statementLoop: for(int i=0; i < statements.size(); ++i) { Statement s = statements.get(i); for(int j=0; j < 1; ++j) { //test each binding... if (s.apply(p,0,null)) continue statementLoop; } return ANMLBoolean.False; } return ANMLBoolean.True; } static int exists_count=0; public void translateDecl(PDDL pddl, Interval unit) { if (asPDDLAction != null) return; if ( name == null || name.length == 0) { name = new SimpleString("exists_" + ++exists_count); } super.translateDecl(pddl,unit); } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { if (asPDDLAction == null) translateDecl(pddl,unit); //part = PDDL.getPart(unit,this); // this is wrong, because, the internal start/duration/end etc. // are for the endpoints of the compiled action, but the interval that this is timed over // wraps this object already -- Action.statements.TimedStatement.Exists.statements // is the hierarchy, abusing notation. // // the two intervals are very closely related. ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); ArrayList<PDDL.Effect> effects = unit.getPDDLEffects(); ArrayList<PDDL.BooleanExpression> myConditions = getPDDLConditions(); ArrayList<PDDL.Effect> myEffects = getPDDLEffects(); PDDL.Exists e; switch(part) { case All: case Interim: case StartHalf: case EndHalf: _translateStmt(pddl,this,PDDL.Time.Interim); e = pddl.new Exists(getPDDLParameters(),this.getPDDLExecuting().trivialRef()); conditions.add(pddl.wrap(PDDL.Time.Interim,e)); myConditions.add(pddl.wrap(PDDL.Time.Interim,unit.getPDDLExecuting().trivialRef())); break; default: System.err.println("Existentials over anything besides (all) will likely compile incorrectly, especially if they contain effects."); myConditions.clear(); _translateStmt(pddl,this,PDDL.Time.Timeless); assert myEffects.size() == 0 : "Existential effects not on (all) are ignored."; e = pddl.new Exists(getPDDLParameters(),pddl.wrap(PDDL.Op.and,myConditions)); conditions.add(pddl.wrap(part,e)); pddl.actions.remove(this); pddl.predicates.remove(this.getPDDLExecuting()); } } public PDDL.Expression translateLValue(PDDL pddl, Interval unit) { System.err.println("Shouldn't happen"); return super.translateLValue(pddl,unit); } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.PDDL.BooleanExpression; import gov.nasa.anml.PDDL.Effect; import gov.nasa.anml.PDDL.FloatExpression; import gov.nasa.anml.PDDL.Parameter; import gov.nasa.anml.PDDL.Predicate; import gov.nasa.anml.utility.SimpleFloat; import gov.nasa.anml.utility.SimpleInteger; import gov.nasa.anml.utility.SimpleString; // use nulls to deal with order of evaluation? // because i.start cannot be specified using i.end? // so one has: // [s,d] s d null // [s,e] s null e // [d,e] null d e // points: // [s] s null null // ...s) and extended ...s] (but this is mostly [s]) ? // (s... and extended [s... (ditto) ? // [] null null null public class IntervalImp implements Interval { public static Constant<SimpleInteger> constantBeforeBra; public static Constant<SimpleInteger> constantAtBra; public static Constant<SimpleInteger> constantAfterBra; public static Constant<SimpleInteger> constantBeforeKet; public static Constant<SimpleInteger> constantAtKet; public static Constant<SimpleInteger> constantAfterKet; public static Constant<SimpleFloat> constantDurationZero; public static Constant<SimpleFloat> constantDurationOne; // Constant is almost surely a better type than Expression, because the // definition of a temporal interval cannot itself be temporally varying. // In fact, that is so true I'm just going to change the type right now. // So for the comment to make sense, realize that previously 'Constant' was // 'Expression'. // this could be a sub-interval, sharing references with parent intervals. public Constant<SimpleFloat> start = null; public Constant<SimpleFloat> duration = null; public Constant<SimpleFloat> end = null; public Constant<SimpleInteger> bra = constantAtBra; public Constant<SimpleInteger> ket = constantAtKet; // dynamically computed bra/ket doesn't typically make sense. public transient ArrayList<PDDL.BooleanExpression> pddlConditions; public transient ArrayList<PDDL.Effect> pddlEffects; public transient ArrayList<PDDL.Parameter> pddlParameters; public transient PDDL.FloatExpression pddlDuration; public transient PDDL.Predicate pddlExecuting; public transient PDDL.Action pddlAction; public ArrayList<PDDL.BooleanExpression> getPDDLConditions() { return pddlConditions; } public FloatExpression getPDDLDuration() { return pddlDuration; } public ArrayList<Effect> getPDDLEffects() { return pddlEffects; } public Predicate getPDDLExecuting() { return pddlExecuting; } public ArrayList<Parameter> getPDDLParameters() { return pddlParameters; } public PDDL.Action getPDDLAction() { return pddlAction; } public Predicate makePDDLExecuting() { if (pddlExecuting == null) pddlExecuting = pddlAction.makeExecuting(); return pddlExecuting; } public void copyPDDL(Interval unit) { pddlConditions = unit.getPDDLConditions(); pddlEffects = unit.getPDDLEffects(); pddlParameters = unit.getPDDLParameters(); pddlDuration = unit.getPDDLDuration(); pddlExecuting = unit.getPDDLExecuting(); pddlAction = unit.getPDDLAction(); } public IntervalImp() { } public IntervalImp(int b, int k) { setShape(b, k); } // fully specified interval. // start + duration == end had better hold... public IntervalImp(int b, Constant<SimpleFloat> s, Constant<SimpleFloat> d, Constant<SimpleFloat> e, int k) { setShape(b, k); this.start = s; this.duration = d; this.end = e; } // fully specified interval of the 'normal' kind; i.e., ? s, ^d ? // that is, a dispatch time and a duration, e.g., actions. public IntervalImp(int b, Constant<SimpleFloat> s, Constant<SimpleFloat> d, int k) { setShape(b, k); this.start = s; this.duration = d; inferEnd(); } // dynamic shape! public IntervalImp(Constant<SimpleInteger> b, Constant<SimpleFloat> s, Constant<SimpleFloat> d, Constant<SimpleFloat> e, Constant<SimpleInteger> k) { this.bra = b; this.start = s; this.duration = d; this.end = e; this.ket = k; } // makes a point public IntervalImp(Constant<SimpleFloat> t) { this.start = t; this.duration = constantDurationZero; this.end = t; } public IntervalImp(IntervalImp i) { this.start = i.start; this.duration = i.duration; this.end = i.end; this.bra = i.bra; this.ket = i.ket; } public IntervalImp(Interval u) { this.start = u.getStart(); this.duration = u.getDuration(); this.end = u.getEnd(); this.bra = u.getBra(); this.ket = u.getKet(); } public void setShape(int b, int k) { setBra(b); setKet(k); } public void setShape(Expression b, Expression k) { makeBra(b); makeKet(k); } public static final Constant<SimpleInteger> makeBra(int b) { switch (b) { case Before: // Not a fantastic concept. For points, ...t] is the notation. // for intervals, ...s,t] is I think right. return constantBeforeBra; case At: return constantAtBra; case After: return constantAfterBra; default: System.err.println("Invalid Time Code"); return null; } } public void setBra(int b) { bra = makeBra(b); } public static final Constant<SimpleInteger> makeKet(int k) { switch (k) { case Before: return constantBeforeKet; case At: return constantAtKet; case After: // Not a fantastic concept, but I guess the notation is [t... for points // for intervals, [s,t... might be acceptable? Probably. return constantAfterKet; default: System.err.println("Invalid Time Code"); return null; } } public void setKet(int k) { ket = makeKet(k); } public void inferStart() { start = new Constant<SimpleFloat>(startName, Unit.floatType, new OpBinary(TypeCode.Float, Op.subtract, end, duration)); } public void inferDuration() { duration = new Constant<SimpleFloat>(durationName, Unit.floatType, new OpBinary(TypeCode.Float, Op.subtract, end, start)); } public void inferEnd() { end = new Constant<SimpleFloat>(endName, Unit.floatType, new OpBinary( TypeCode.Float, Op.add, start, duration)); } public void set(Constant<SimpleFloat> s, Constant<SimpleFloat> d, Constant<SimpleFloat> e, Constant<SimpleInteger> b, Constant<SimpleInteger> k) { start = s; duration = d; end = e; bra = b; ket = k; } public void set(IntervalImp i) { start = i.start; duration = i.duration; end = i.end; bra = i.bra; ket = i.ket; } public void set(Interval i) { start = i.getStart(); duration = i.getDuration(); end = i.getEnd(); bra = i.getBra(); ket = i.getKet(); } /* * public void split() { int k = ket.value(null).v; int b = * bra.value(null).v; int l = k - b + 3; pieces = new AtomicTime[l]; if (b < * 1) { pieces[0] = new Point(start,b); ++b; if (b < 1) { pieces[1] = new * Point(start,b); pieces[2] = new OpenInterval(start,end); b=3; } else { * pieces[1] = new OpenInterval(start,end); ++b; } } else { pieces[0] = new * OpenInterval(start,end); } if (k >= 0) { pieces[b] = new Point(end,0); * ++b; if (k >= 1) { pieces[b] = new Point(end,1); } } } * * public AtomicTime getPiece(int k) { return pieces[k]; } */ public Constant<SimpleFloat> getStart() { return start; } public Constant<SimpleFloat> getDuration() { return duration; } public Constant<SimpleFloat> getEnd() { return end; } public Constant<SimpleInteger> getBra() { return bra; } public Constant<SimpleInteger> getKet() { return ket; } public void setStart(Constant<SimpleFloat> start) { this.start = start; } public void setDuration(Constant<SimpleFloat> duration) { this.duration = duration; } public void setEnd(Constant<SimpleFloat> end) { this.end = end; } public void setBra(Constant<SimpleInteger> bra) { this.bra = bra; } public void setKet(Constant<SimpleInteger> ket) { this.ket = ket; } public void makeBra(Expression<SimpleInteger, ?> b) { if (b instanceof Constant) bra = (Constant<SimpleInteger>) b; else bra = new Constant<SimpleInteger>(braName,Unit.integerType,b); } public void makeKet(Expression<SimpleInteger, ?> k) { if (k instanceof Constant) ket = (Constant<SimpleInteger>) k; else ket = new Constant<SimpleInteger>(ketName,Unit.integerType,k); } public void makeStart(Expression<SimpleFloat, ?> s) { if (s instanceof Constant) start = (Constant<SimpleFloat>) s; else start = new Constant<SimpleFloat>(startName,Unit.floatType,s); } public void makeDuration(Expression<SimpleFloat, ?> d) { if (d instanceof Constant) duration = (Constant<SimpleFloat>) d; else duration = new Constant<SimpleFloat>(durationName,Unit.floatType,d); } public void makeEnd(Expression<SimpleFloat, ?> e) { if (e instanceof Constant) end = (Constant<SimpleFloat>) e; else end = new Constant<SimpleFloat>(endName,Unit.floatType,e); } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.utility.SimpleFloat; import gov.nasa.anml.utility.SimpleInteger; import gov.nasa.anml.utility.SimpleVoid; //get rid of me; use an atomic update thingy instead? // start, interim, end // point, interval, point // null?, null?, null? public class Point extends ConstantExpressionImp<SimpleFloat> implements AtomicTime { public Expression<SimpleFloat,?> start; public Constant<SimpleInteger> bra; public Point() { bra = IntervalImp.constantAtBra; } public Point(Expression<SimpleFloat,?> s) { start = s; bra = IntervalImp.constantAtBra; } public Point(Expression<SimpleFloat,?> s, int b) { start = s; bra = IntervalImp.makeBra(b); } public TypeCode typeCode() { return TypeCode.Float; } public SimpleFloat value(State s) { return start.value(s); } public boolean apply(State p, int contextID, State c) { return false; } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Argument; import gov.nasa.anml.PDDL.BooleanExpression; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleVoid; public abstract class IntervalExpression<T> extends IntervalImp implements ConstantExpression<T> { public void translateDecl(PDDL pddl, Interval unit) { } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time time) { ExpressionImp.translateStmt(this,pddl,unit,time); } public Argument translateArgument(PDDL pddl, Interval unit) { return pddl.NullRef; } public PDDL.Expression translateLValue(PDDL pddl,Interval unit) { return pddl.TrueRef; } public History<SimpleVoid> storage(State p, State c) { return null; } // apply and value are more interesting to implement in subclasses. }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.FloatExpression; import gov.nasa.anml.utility.*; public class ANMLInteger extends SimpleInteger implements ConstantExpression<SimpleInteger> { public static final iHashMap<ANMLInteger> pool = new iHashMap<ANMLInteger>(); public static final ANMLInteger One = make(1); public static final ANMLInteger Zero = make(0); public static ANMLInteger make(int v) { ANMLInteger probe = pool.get(v); if (probe == null) { probe = new ANMLInteger(v); pool.put(v,probe); } return probe; } protected ANMLInteger(int v) { super(v); } public ANMLInteger value(State s) { return this; } public ANMLInteger value() { return this; } public TypeCode typeCode() { return TypeCode.Integer; } public History<SimpleVoid> storage(State p, State c) { return null; } public boolean apply(State p, int contextID, State c) { return false; } public transient PDDL.FloatLiteral asPDDLFloatExpression; public PDDL.FloatExpression asPDDLFloatExpr() { return asPDDLFloatExpression; } public PDDL.Argument translateArgument(PDDL pddl, Interval unit) { return null; } public PDDL.FloatExpression translateExpr(PDDL pddl, Interval unit) { return asPDDLFloatExpression = pddl.new FloatLiteral(v); } public void translateDecl(PDDL pddl, Interval unit) { } public PDDL.Expression translateLValue(PDDL pddl, Interval unit) { return null; } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { unit.getPDDLConditions().add(pddl.FalseCondition); } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Function; import gov.nasa.anml.PDDL.FunctionReference; import gov.nasa.anml.utility.*; import static gov.nasa.anml.lifted.IdentifierCode.*; // more or less a copy of fluent, but in a separate class and id-space // because we can more or less compile these away during grounding // the exception is action-local constants with initialization expressions. // These could change every time the action is invoked. public class Constant<T extends SimpleObject<? super T>> extends IdentifierImp<T,SimpleVoid> implements ConstantExpression<T> { public Type<T> type; //if type matches exactly (or subsumed by), don't have to check for // value inclusion into type, i.e., for enumerations // or structured types public T value; public Expression<T,?> init; // constant can mean with respect to the execution of a particular action // so that its value changes each time action fires, but, other than that is constant. public Constant() { } public Constant(String n) { name = new SimpleString(n); } public Constant(SimpleString n) { super(n); } public Constant(SimpleString n, Type<T> t) { super(n); this.type = t; } public Constant(SimpleString n, Type<T> t, Expression<T,?> init) { super(n); this.type = t; this.init = init; } public Constant(T v, SimpleString n, Type<T> t) { super(n); this.type = t; this.value = v; this.init = null; } public T value(State s) { return value; } // constants can change per action invocation // so this has to be re-evaluated in those states. // not that this approach will work, because there is only one // constant per action schema -- and even separate invocations // of the same schema anyways need multiple storage locations // (alternatively, one can view Start as a parameter) public T init(State s) { return value = init.value(s); //return (T) init.value(s); //return (T) s.get(id); } public TypeCode typeCode() { return type.typeCode(); } public History<SimpleVoid> storage(State p, State c) { return null; // other possibilities: // return (StateValue<T>) s.get(id); // return (StateValue<T>) constantPool.get(id); } public IdentifierCode idCode() { return Constant; } public boolean apply(State p, int contextID, State c) { if (type.typeCode() != TypeCode.Boolean) return false; if (value(p) != ANMLBoolean.True) return false; return true; } public transient PDDL.Predicate boolPDDL; public transient PDDL.Function floatPDDL; public transient PDDL.PredicateReference asPDDLPredicateReference; public transient PDDL.FunctionReference asPDDLFunctionReference; public transient PDDL.Expression asPDDLExpression; public PDDL.Expression translateLValue(PDDL pddl,Interval unit) { if (asPDDLExpression != null) return asPDDLExpression; return super.translateLValue(pddl,unit); } public PDDL.Argument translateArgument(PDDL pddl, Interval unit) { System.err.println("Constants as arguments ought to work. But it doesn't."); return super.translateArgument(pddl,unit); } public void translateDecl(PDDL pddl,Interval unit) { ArrayList<PDDL.Effect> effects = unit.getPDDLEffects(); if (name == IntervalImp.durationName) { asPDDLExpression = pddl.DurationRef; return; } if (name == IntervalImp.startName) { System.err.println("PDDL lacks access to absolute time. Substituting 0 for start."); asPDDLExpression = pddl.Zero; return; } if (name == IntervalImp.endName) { System.err.println("PDDL lacks access to absolute time. Substituting ?duration for end."); asPDDLExpression = pddl.DurationRef; return; } if (init == null && value == null) System.err.println("Uh-oh, a constant lacking initialization. Troublesome. " + this); int length = pddl.bufAppend(name); String nameString = pddl.bufToString(); pddl.bufReset(length); switch(typeCode()) { case Boolean: if (boolPDDL != null) return; boolPDDL = pddl.new Predicate(nameString); boolPDDL.context.addAll(pddl.context); pddl.predicates.add(boolPDDL); asPDDLExpression = asPDDLPredicateReference = pddl.new PredicateReference(boolPDDL); if (init != null) init.translateStmt(pddl,unit,PDDL.Time.Start); else if (value != null) { effects.add(pddl.makeEffect(PDDL.Time.Start,asPDDLPredicateReference,((SimpleBoolean)value).v)); } break; case Float: if (floatPDDL != null) return; floatPDDL = pddl.new Function(nameString); floatPDDL.context.addAll(pddl.context); pddl.functions.add(floatPDDL); asPDDLExpression = asPDDLFunctionReference = pddl.new FunctionReference(floatPDDL); if (init != null) init.translateStmt(pddl,unit,PDDL.Time.Start); else if (value != null) { effects.add(pddl.makeEffect(PDDL.Time.Start,PDDL.Op.assign,asPDDLFunctionReference,pddl.new FloatLiteral(((SimpleFloat)value).v))); } break; case Integer: // be nice by relaxing integers to floats in the compilation to PDDL if (floatPDDL != null) // shouldn't happen... return; floatPDDL = pddl.new Function(nameString); floatPDDL.context.addAll(pddl.context); pddl.functions.add(floatPDDL); asPDDLExpression = asPDDLFunctionReference = pddl.new FunctionReference(floatPDDL); type = (Type<T>) Unit.floatType; // make sure all future references see this as a float if (init != null) init.translateStmt(pddl,unit,PDDL.Time.Start); else if (value != null) { effects.add(pddl.makeEffect(PDDL.Time.Start,PDDL.Op.assign,asPDDLFunctionReference,pddl.new FloatLiteral(((SimpleInteger)value).v))); } break; default: System.err.println("Unsupported type: " + this.type + " in: " + this + "."); } } public PDDL.Expression translateExpr(PDDL pddl, Interval unit) { if (asPDDLExpression != null) return asPDDLExpression; System.err.println("Oops: translateExpr() on a constant, " + this + ", without a PDDL.Expression attached. Missing declaration?"); return super.translateExpr(pddl,unit); } // interesting to test whether it figures out the method dispatch of super.translateStmt() `correctly'. public void translateStmt(PDDL pddl, Interval unit, PDDL.Time time) { translateStmt(this,pddl,unit,time); } }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Expression; import gov.nasa.anml.PDDL.FloatLiteral; import gov.nasa.anml.PDDL.Function; import gov.nasa.anml.PDDL.FunctionReference; import gov.nasa.anml.PDDL.Predicate; import gov.nasa.anml.PDDL.PredicateReference; import gov.nasa.anml.utility.*; import static gov.nasa.anml.lifted.IdentifierCode.*; public class ConstantFunction<T extends SimpleObject<? super T>> extends Term<T,SimpleVoid> implements ConstantExpression<T> { public Type<T> type; public ArrHashMap<SimpleObject<?>[],ConstantExpression<T>> init; //public Statement initializer; public ConstantFunction() {} public ConstantFunction(String n) {name=new SimpleString(n);} public ConstantFunction(SimpleString n) {name=n;} public ConstantFunction(SimpleString n, Type<T> t) {name=n;type=t;} public TypeCode typeCode() { return type.typeCode(); } public IdentifierCode idCode() { return ConstantFunction; } transient PDDL.Predicate boolPDDL; transient PDDL.Function floatPDDL; private Object asPDDLExpression; public void translateDecl(PDDL pddl,Interval unit) { int length = pddl.bufAppend(name); String nameString = pddl.bufToString(); pddl.bufReset(length); switch(typeCode()) { case Boolean: if (boolPDDL != null) return; boolPDDL = pddl.new Predicate(nameString); boolPDDL.context.addAll(pddl.context); for (Parameter<?> p : parameters.table) { p.translateDecl(pddl,boolPDDL); } pddl.predicates.add(boolPDDL); asPDDLExpression = boolPDDL.trivialRef(); // initialization...? break; case Float: if (floatPDDL != null) return; floatPDDL = pddl.new Function(nameString); floatPDDL.context.addAll(pddl.context); for (Parameter<?> p : parameters.table) { p.translateDecl(pddl,floatPDDL); } pddl.functions.add(floatPDDL); asPDDLExpression = floatPDDL.trivialRef(); break; case Integer: // be nice by relaxing integers to floats in the compilation to PDDL if (floatPDDL != null) // shouldn't happen... return; // make sure all future references see this as a float type = (Type<T>) Unit.floatType; floatPDDL = pddl.new Function(nameString); floatPDDL.context.addAll(pddl.context); for (Parameter<?> p : parameters.table) { p.translateDecl(pddl,floatPDDL); } pddl.functions.add(floatPDDL); asPDDLExpression = floatPDDL.trivialRef(); break; default: System.err.println("Unsupported type: " + this.type + " in: " + this + "."); } } public History<SimpleVoid> storage(State p, State c) { return null; } public T value(State s) { return null; } public boolean apply(State p, int contextID, State c) { return false; } // cannot occur as expression or statement; see ConstantFunctionReference instead }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.utility.SimpleBoolean; import gov.nasa.anml.utility.SimpleObject; import gov.nasa.anml.utility.SimpleString; import gov.nasa.anml.utility.SimpleVoid; public class LabeledExpression extends TimeOfExpression implements LabeledInterval<SimpleBoolean, SimpleVoid> { public SimpleString name; public int id; public LabeledExpression() { super(); name = null; id = -1; } public LabeledExpression(SimpleString n) { super(); name = n; id = -1; } public LabeledExpression(SimpleString n,Expression<SimpleBoolean,?> e) { super(e); name = n; id = -1; } public int id() { return id; } public Identifier<SimpleBoolean,SimpleVoid> id(int id) { this.id = id; return this; } public IdentifierCode idCode() { return IdentifierCode.Label; } public SimpleString name() { return this.name; } public Identifier<SimpleBoolean, SimpleVoid> name(SimpleString name) { this.name = name; return this; } public int compareTo(Identifier<SimpleBoolean, SimpleVoid> o) { return this.id - o.id(); } }
Java
package gov.nasa.anml.lifted; import java.util.*; import gov.nasa.anml.utility.Pair; import gov.nasa.anml.utility.SimpleObject; public class Range<T extends Comparable> implements Constraint<T> { // optional enumeration of all possible values // setting this incorrectly will break Enumeration.containsAll // if set correctly, then Range additionally guarantees that // every number inside the bounds are covered, as opposed // to Enumeration, which does not. public Set<T> values; public Pair<T,T> bounds; public Range(T lower, T upper) { bounds = new Pair<T,T>(lower,upper); } public Pair<T,T> bounds() { return bounds; } public boolean contains(Object o) { T v = (T) o; // actually casts from object to object...pretty pointless. if (bounds.left.compareTo(v) <= 0 && bounds.right.compareTo(v) >= 0) return true; return false; } public boolean containsAll(Constraint<T> t) { Pair<T,T> b = t.bounds(); if (bounds.left.compareTo(b.left) <= 0 && bounds.right.compareTo(b.right) >= 0) return true; return false; } public Set<T> values() { return values; } public boolean add(T e) { // TODO Auto-generated method stub return false; } public boolean addAll(Collection<? extends T> c) { // TODO Auto-generated method stub return false; } public void clear() { // TODO Auto-generated method stub } public boolean containsAll(Collection<?> c) { for (T o : (Collection<T>) c) { if (bounds.left.compareTo(o) > 0) return false; if (bounds.right.compareTo(o) < 0) return false; } return true; } public boolean isEmpty() { // TODO Auto-generated method stub return false; } public Iterator<T> iterator() { // TODO Auto-generated method stub return null; } public boolean remove(Object o) { // TODO Auto-generated method stub return false; } public boolean removeAll(Collection<?> c) { // TODO Auto-generated method stub return false; } public boolean retainAll(Collection<?> c) { // TODO Auto-generated method stub return false; } public int size() { // TODO Auto-generated method stub return 0; } public Object[] toArray() { // TODO Auto-generated method stub return null; } public <T> T[] toArray(T[] a) { // TODO Auto-generated method stub return null; } // careful; this ought to make new memory for left and right, but it doesn't public Range<T> clone() { Range<T> r = null; try { r = (Range<T>) super.clone(); } catch (CloneNotSupportedException e) { //assert false; } r.bounds = new Pair<T,T>(bounds.left,bounds.right); return r; } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.utility.SimpleObject; // Timed Statements know when to load, up to context (i.e. intervals are // evaluated in the context of the enclosing action so that all,start,end // have the right values, i.e., so that such intervals are relative). // Timed Statements include untimed statements, which are/include the actual // primitive operations of the underlying state transition machine // Applying a Timed Statement loads untimed statements into the child state // Unfortunately it cannot immediately apply untimed statements when delay // is unnecessary because the search finds sets of simul. actions via // multiple steps, so that moving forward in time has to wait over multiple // search operations. Alternatively search states could be pairs -- the last state // where time advanced to, and the child state being incrementally constructed // in *that* case one could immediately apply [start] statements. // and then there is the alternative of keeping parent pointers around indef. // and just updating the state one is passed (so copy, and then apply transformations) // later applied, but still simul., action can implement parallelism by following // parent pointers [i.e., accurately evaluate [start) expression]. Prior idea // is just this idea, but search states know the correct ancestor to walk to immediately; // and parent pointers don't have to be kept (allowing closed list purging). // Going back to prior idea: search states are something like (real state [no past knowledge], future state) // with actions being applied at the time of the first state, but transforming the future state. // forward in time then amounts to advancing the clock on 'future state' to the next // set of discrete changes to get r', simulate them to get f', and then then the // search state is (r',f') -- i.e., allowing the search to swoop in and add // simul. change with the new timepoint (the time of r'). public interface Statement { // parallel change has to be non-mutex, so // sequential application from the template parent onto the child // implements parallelism without having to build memory // into the parent of expressions // if children have parent pointers anyways it is unnecessary to supply // the parent object explicitly, but does save a bit of time for the common // case; evaluation should never be against the child if one is to support // parallelism via sequential application. // In the general case, in one implementation paradigm, one would walk // back the whole ancestry to find old values. // if one uses special value objects for fluents, one can have fields // for write locks and the whole interval of the current value and // the prior interval, sneakily linking backwards along the ancestry (but more // efficient because of skipping generations). Essentially forces // keeping the whole closed list, because it keeps all of the closed list's // data (State objects hold mostly references, and these could be lost, but // the referenced data would mostly not be lost). Well, wrapping // collections like HashMap would also be reclaimed, as well as wrapping Entries... // just the bare value objects would be retained. Perhaps that isn't so bad... // Destroys notion of State a lot though. Fix is to forget past the earliest // unfinished action; earlier than that is inaccessible. In the context // of sequential execution the only non-state like states are in the middle // of each individual action, as it should be -- in between each action // is a bona fide state. // need a context id // return indicates whether or not c remains valid // (respects locks/mutexes/constraints/etc.) public abstract boolean apply(State p, int contextID, State c); //public abstract boolean start(State p, int contextID, State c); //public abstract boolean end(State p, int contextID, State c); // apply for points, start/end for intervals public abstract void translateStmt(PDDL pddl, Interval unit, PDDL.Time part); public void translateDecl(PDDL pddl, Interval unit); // more? Decomposition? Scope? // need a do() method for callbacks...or yet another heirarchy // or just primitive vs. compound statements? // compound statements generate child states with primitive statement callbacks; // primitive statements use themselves? }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.utility.SimpleFloat; import gov.nasa.anml.utility.SimpleObject; import static gov.nasa.anml.lifted.Time.*; public class Process<T extends SimpleObject<? super T>> extends TimedExpression<T> { public Process<T> next; public SimpleFloat nextTime = new SimpleFloat(0f); // the next time this interval's status // can potentially change public Process(TimedExpression<T> program) { super(program); } public Process(TimedExpression<T> program, Process<T> n) { super(program); this.next = n; } public Process<T> clone() { Process<T> ret = null; try { ret = (Process<T>) super.clone(); // don't make copy of past. Also don't change the past... } catch (CloneNotSupportedException e) { // assert false; } ret.nextTime = ret.nextTime.clone(); return ret; } } /* public class IntegerLiteral extends SimpleInteger implements Expression<SimpleInteger> implements Comparable<Literal<T>>, Constant { public static int n=0; public static HashMap<SimpleObject,Literal<?>> pool; public static <T extends SimpleObject> Literal<T> make(T w) { Literal<T> probe = (Literal<T>) pool.get(w); if (probe == null) { probe = new Literal<T>(n++,w); pool.put(w,probe); } return probe; } public int id; public T w; // what's the difference between not implementing the default constructor // and making it private, as far as the outside is concerned? //private Literal() {} private Literal(int id, T w) { this.id = id; this.w = w; } public int compareTo(Literal<T> l) { // assert this != null && o != null; return this.w.compareTo(l.w); } @Override public boolean equals(Object l) { if (l instanceof Literal && id == (((Literal<T>)l).id)) return true; return false; } @Override public int hashCode() { return id; } @Override public String toString() { return w.toString(); } public T value() { return w; } public T value(State s) { return w; } } */
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.TimedBooleanExpression; import gov.nasa.anml.PDDL.BooleanEffect; import gov.nasa.anml.PDDL.FloatEffect; import gov.nasa.anml.utility.SimpleBoolean; import gov.nasa.anml.utility.SimpleObject; public class Use<T extends SimpleObject<? super T>> extends BinaryExpression<T,T,T> { public Use(Expression<T, T> l, Expression<T, ?> r) { super(l, r); } public PDDL.Time splitFirst(PDDL.Time t) { switch(t) { case All: return PDDL.Time.All; case StartHalf: return PDDL.Time.All; case EndHalf: return PDDL.Time.All; // if crammed into splitting atomic pieces up.... case Interim: return PDDL.Time.All; case Start: // should be immediately before start: ...start) return PDDL.Time.Start; case End: // should be immediately before end: ...end) // instead of (start, end) return PDDL.Time.End; case Timeless: default: return t; } } public PDDL.Time splitRest(PDDL.Time t) { switch(t) { case All: return PDDL.Time.End; case StartHalf: return PDDL.Time.End; case EndHalf: return PDDL.Time.End; // if forced to split atomic things... case Interim: return PDDL.Time.End; case Start: return PDDL.Time.Interim; case End: return PDDL.Time.End; case Timeless: default: return t; } } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); ArrayList<PDDL.Effect> effects = unit.getPDDLEffects(); PDDL.Time pl,pr; switch(part) { case Start: case End: pl = pr = part; break; default: pl = PDDL.Time.Start; pr = PDDL.Time.End; break; } switch(left.typeCode()) { case Boolean: assert right.typeCode() == TypeCode.Boolean : "No operation combines booleans and other types directly"; PDDL.PredicateReference refB = (PDDL.PredicateReference) left.translateLValue(pddl,unit); if (right instanceof SimpleBoolean) { boolean v = ((SimpleBoolean)right).v; if (v) { conditions.add(pddl.wrap(pl,pddl.makeTest(refB,true))); //if (pl != pr) effects.add(pddl.wrap(pl,pddl.makeEffect(refB,false))); effects.add(pddl.wrap(pr,pddl.makeEffect(refB,true))); } } else { PDDL.BooleanExpression r = (PDDL.BooleanExpression) right.translateExpr(pddl,unit); conditions.add(pddl.wrap(pl,pddl.makeTest(PDDL.Op.implies,r,refB))); // heh...deletes before adds, so...technically...don't need the following if. //if (pl != pr) effects.add(pddl.wrap(pl,pddl.makeEffect(r,refB,false))); effects.add(pddl.wrap(pr,pddl.makeEffect(r,refB,true))); } break; case Float: assert right.typeCode() == TypeCode.Float : "No operation combines floats and non-floats (at present)."; PDDL.FunctionReference refF = (PDDL.FunctionReference) left.translateLValue(pddl,unit); PDDL.FloatExpression v = (PDDL.FloatExpression) right.translateExpr(pddl,unit); conditions.add(pddl.wrap(pl,pddl.makeTest(PDDL.Op.gte,refF,v))); effects.add(pddl.wrap(pl,pddl.makeEffect(PDDL.Op.decrease,refF,v))); effects.add(pddl.wrap(pr,pddl.makeEffect(PDDL.Op.increase,refF,pddl.wrap(pl,v)))); // the latter wrap is to make it very clear at what time we want the expression to be evaluated // in order to calculate the amount of increase. // however, the resulting syntax is likely to break PDDL planners. break; default: System.err.println("Oops!"); conditions.add(pddl.FalseCondition); } } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.lifted.*; import gov.nasa.anml.utility.*; public class Change<S extends SimpleObject<? super S>> extends BinaryExpression<S,S,S> { public Change(Expression<S, S> l, Expression<S, ?> r) { super(l, r); } public S value(State s) { return right.value(s); } public PDDL.Time splitFirst(PDDL.Time t) { switch(t) { case All: return PDDL.Time.StartHalf; case StartHalf: return PDDL.Time.StartHalf; case EndHalf: return PDDL.Time.EndHalf; // if crammed into splitting atomic pieces up.... case Interim: return PDDL.Time.Interim; case Start: // should be immediately before start: ...start) return PDDL.Time.Start; case End: // should be immediately before end: ...end) // instead of (start, end) return PDDL.Time.Interim; case Timeless: default: return t; } } public PDDL.Time splitRest(PDDL.Time t) { switch(t) { case All: return PDDL.Time.End; case StartHalf: return PDDL.Time.End; case EndHalf: return PDDL.Time.End; // if forced to split atomic things... case Interim: return PDDL.Time.End; case Start: return PDDL.Time.Interim; case End: return PDDL.Time.End; case Timeless: default: return t; } } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); ArrayList<PDDL.Effect> effects = unit.getPDDLEffects(); switch(left.typeCode()) { case Boolean: assert right.typeCode() == TypeCode.Boolean : "No operation combines booleans and other types directly"; PDDL.PredicateReference refB = (PDDL.PredicateReference) left.translateLValue(pddl,unit); if (refB == null) System.err.println("huh?"); if (right instanceof SimpleBoolean) { boolean v = ((SimpleBoolean)right).v; switch(part) { case Start: case End: effects.add(pddl.makeEffect(part,refB,v)); break; case Interim: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,!v)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,!v))); effects.add(pddl.makeEffect(PDDL.Time.End,refB,v)); break; case All: case EndHalf: case StartHalf: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,!v)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,!v))); effects.add(pddl.makeEffect(PDDL.Time.End,refB,v)); break; default: System.err.println("New PDDL.Time constant unaccounted for in Change."); } } else { // Pretend STRIPS assumption works. PDDL.BooleanExpression r = (PDDL.BooleanExpression) right.translateExpr(pddl,unit); switch(part) { case Start: case End: effects.add(pddl.makeEffect(part,refB,r)); break; case Interim: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,false)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,false))); effects.add(pddl.makeEffect(PDDL.Time.Start,refB,r)); break; case All: case EndHalf: case StartHalf: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,false)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,false))); effects.add(pddl.makeEffect(PDDL.Time.End,refB,r)); break; default: System.err.println("New PDDL.Time constant unaccounted for in Change."); } } break; case Float: assert right.typeCode() == TypeCode.Float : "No operation combines floats and non-floats (at present)."; PDDL.FunctionReference refF = (PDDL.FunctionReference) left.translateLValue(pddl,unit); PDDL.FloatExpression v = (PDDL.FloatExpression) right.translateExpr(pddl,unit); switch(part) { case Start: case End: effects.add(pddl.makeEffect(part,refF,v)); break; case Interim: effects.add(pddl.makeEffect(PDDL.Time.Start,refF,pddl.FloatUndefined)); // can't realy test for undefined, but, pddl mutual exclusion rules should work...maybe effects.add(pddl.makeEffect(PDDL.Time.Start,refF,v)); break; case All: case EndHalf: case StartHalf: effects.add(pddl.makeEffect(PDDL.Time.Start,refF,pddl.FloatUndefined)); effects.add(pddl.makeEffect(PDDL.Time.End,refF,v)); break; default: System.err.println("New PDDL.Time constant unaccounted for in Change."); } break; default: System.err.println("Oops!"); } } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.Time; import gov.nasa.anml.utility.*; //change expressions get broken down by tree walker //nah; instead should have beginChange and endChange classes, //analogous with, respectively, Assign and Unlock in semantics //and in implementation, Undefine and Assign public class Assign<S extends SimpleObject<? super S>> extends BinaryExpression<S,S,S> { public Assign(Expression<S,S> l,Expression<S,?> r) { super(l,r); } public boolean apply(State p, int contextID, State c) { History<S> place = left.storage(p,c); // will throw nullpointerexception if left is not an l-value // if (place.locked) // return false; History<S> last = left.storage(p,p); int bra = c.bra; SimpleFloat start = c.start; // do generation of child from parent by copying and advancing time // (bra from before to at, simulate, to after, simulate, // start to next time bra to before, simulate, done) place.value.assign(right.value(p)); // place.locked = true; place.prev = last; place.start = start; place.bra = bra; return true; } public S value(State s) { return right.value(s); } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time part) { ArrayList<PDDL.BooleanExpression> conditions = unit.getPDDLConditions(); ArrayList<PDDL.Effect> effects = unit.getPDDLEffects(); switch(left.typeCode()) { case Boolean: assert right.typeCode() == TypeCode.Boolean : "No operation combines booleans and other types directly"; PDDL.PredicateReference refB = (PDDL.PredicateReference) left.translateLValue(pddl,unit); if (right instanceof SimpleBoolean) { boolean v = ((SimpleBoolean)right).v; switch(part) { case Start: case End: effects.add(pddl.makeEffect(part,refB,v)); break; case Interim: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,v)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,v))); break; case All: case EndHalf: effects.add(pddl.makeEffect(PDDL.Time.End,refB,v)); case StartHalf: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,v)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,v))); break; default: System.err.println("New PDDL.Time constant unaccounted for in Assign."); } } else { PDDL.BooleanExpression r = (PDDL.BooleanExpression) right.translateExpr(pddl,unit); switch(part) { case Start: case End: effects.add(pddl.makeEffect(part,refB,r)); break; case Interim: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,r)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,r))); break; case All: case EndHalf: effects.add(pddl.makeEffect(PDDL.Time.End,refB,r)); case StartHalf: effects.add(pddl.makeEffect(PDDL.Time.Start,refB,r)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refB,r))); break; default: System.err.println("New PDDL.Time constant unaccounted for in Assign."); } } break; case Float: assert right.typeCode() == TypeCode.Float : "No operation combines floats and non-floats (at present)."; PDDL.FunctionReference refF = (PDDL.FunctionReference) left.translateLValue(pddl,unit); PDDL.FloatExpression v = (PDDL.FloatExpression) right.translateExpr(pddl,unit); switch(part) { case Start: case End: effects.add(pddl.makeEffect(part,refF,v)); break; case Interim: effects.add(pddl.makeEffect(PDDL.Time.Start,refF,v)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refF,v))); break; case All: case EndHalf: // PDDL can't do effects just after start, so I settle for at start. effects.add(pddl.makeEffect(PDDL.Time.End,refF,v)); case StartHalf: effects.add(pddl.makeEffect(PDDL.Time.Start,refF,v)); conditions.add(pddl.wrap(PDDL.Time.Interim,pddl.makeTest(refF,v))); break; default: System.err.println("New PDDL.Time constant unaccounted for in Assign."); } break; default: System.err.println("Oops!"); } } }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import java.util.List; import gov.nasa.anml.PDDL; import gov.nasa.anml.PDDL.Predicate; import gov.nasa.anml.utility.*; public abstract class Unit<Value,Storage extends SimpleObject<? super Storage>> extends ScopedIdentifierImp<Value, Storage> implements LabeledInterval<Value,Storage> { public static ObjectType objectType; public static SymbolType symbolType; public static PrimitiveType<SimpleBoolean> booleanType; public static PrimitiveType<SimpleInteger> integerType; public static PrimitiveType<SimpleString> stringType; public static PrimitiveType<SimpleFloat> floatType; public static PrimitiveType<SimpleCharacter> characterType; // All, or as much as reasonable, (global) initialization should happen here, so that the order can be guaranteed, since // the ClassLoader doesn't provide good guarantees. In particular the types need to exist before most things. static { // primitive types must be declared before structured types, because structured types // have time scopes, which are represented as constants with references to the primitive types // (so these have to exist first) booleanType = new PrimitiveType<SimpleBoolean>(TypeCode.Boolean); integerType = new PrimitiveType<SimpleInteger>(TypeCode.Integer); stringType = new PrimitiveType<SimpleString>(TypeCode.String); floatType = new PrimitiveType<SimpleFloat>(TypeCode.Float); characterType = new PrimitiveType<SimpleCharacter>(TypeCode.Character); objectType = new ObjectType(null,TypeCode.Object.name); symbolType = new SymbolType(TypeCode.Symbol.name); // // char[] bName = {'b','o','o','l','e','a','n'}; // booleanType.name = new SimpleString(bName); // char[] iName = {'i','n','t','e','g','e','r'}; // integerType.name = new SimpleString(iName); // char[] sName = {'s','t','r','i','n','g'}; // stringType.name = new SimpleString(sName); // char[] fName = {'f','l','o','a','t'}; // floatType.name = new SimpleString(fName); // char[] chName = {'c','h','a','r','a','c','t','e','r'}; // characterType.name = new SimpleString(chName); // char[] oName = {'o','b','j','e','c','t'}; // objectType.name = new SimpleString(oName); // char[] syName = {'s','y','m','b','o','l'}; // symbolType.name = new SimpleString(syName); // array literals are (or rumored to be) quite inefficient, unlike String // literals, which is bizarre. // the many levels of nesting are useful for start/duration/end, // but less useful for the delimiters. Still, we can imagine a way of // referring to a containing interval's shape, and this would have some kind // of name. Whatever that name is the correct initialization strings below // -- // these would be inserted into a symbol table so that the parser doesn't // even realize what's going on. IntervalImp.constantBeforeBra = new Constant<SimpleInteger>((SimpleInteger)ANMLInteger.make(Time.Before), new SimpleString("..."), Unit.integerType); IntervalImp.constantAtBra = new Constant<SimpleInteger>((SimpleInteger)ANMLInteger.make(Time.At), new SimpleString("["), Unit.integerType); IntervalImp.constantAfterBra = new Constant<SimpleInteger>((SimpleInteger)ANMLInteger.make(Time.After), new SimpleString("("), Unit.integerType); IntervalImp.constantBeforeKet = new Constant<SimpleInteger>((SimpleInteger)ANMLInteger.make(Time.Before), new SimpleString(")"), Unit.integerType); IntervalImp.constantAtKet = new Constant<SimpleInteger>((SimpleInteger)ANMLInteger.make(Time.At), new SimpleString("]"), Unit.integerType); IntervalImp.constantAfterKet = new Constant<SimpleInteger>((SimpleInteger)ANMLInteger.make(Time.After), new SimpleString("..."), Unit.integerType); // do not use these without a lot more thought. IntervalImp.constantDurationZero = new Constant<SimpleFloat>((SimpleFloat)ANMLFloat.ZeroF, Interval.durationName, Unit.floatType); IntervalImp.constantDurationOne = new Constant<SimpleFloat>((SimpleFloat)ANMLFloat.OneF,Interval.durationName,Unit.floatType); } public Constant<SimpleFloat> start; public Constant<SimpleFloat> duration; public Constant<SimpleFloat> end; public Constant<SimpleInteger> bra; public Constant<SimpleInteger> ket; public Unit() {} public Unit(Scope parent) { super(parent);_Unit_init();} public Unit(Scope parent, SimpleString n) {super(parent,n);_Unit_init();} public Unit(Scope parent, SimpleString n,Constant<SimpleFloat> dur) {init(parent,n,dur);} public Unit(Scope parent, SimpleString n,Constant<SimpleFloat> s, Constant<SimpleFloat> dur) {init(parent,n,s,dur);} public Unit(Scope parent, SimpleString n,Constant<SimpleFloat> s,Constant<SimpleFloat> dur, Constant<SimpleFloat> e) {init(parent,n,Time.At,s,dur,e,Time.At);} protected final void _Unit_init() { start = new Constant<SimpleFloat>(IntervalImp.startName,Unit.floatType); duration = new Constant<SimpleFloat>(IntervalImp.durationName,Unit.floatType); end = new Constant<SimpleFloat>(IntervalImp.endName,Unit.floatType); bra = IntervalImp.constantAtBra; ket = IntervalImp.constantAtKet; } public final void init(Scope parent, SimpleString n, Constant<SimpleFloat> dur) { start = new Constant<SimpleFloat>(IntervalImp.startName,Unit.floatType); duration = dur; end = new Constant<SimpleFloat>(IntervalImp.endName,Unit.floatType); bra = IntervalImp.constantAtBra; ket = IntervalImp.constantAtKet; } public final void init(Scope parent, SimpleString n, Constant<SimpleFloat> s, Constant<SimpleFloat> dur) { start = s; duration = dur; end = new Constant<SimpleFloat>(IntervalImp.endName,Unit.floatType,new OpBinary<SimpleFloat,SimpleFloat,SimpleVoid>(TypeCode.Float,Op.add,s,dur)); bra = IntervalImp.constantAtBra; ket = IntervalImp.constantAtKet; } public final void init(int b, Constant<SimpleFloat> s, Constant<SimpleFloat> dur, int k) { start = s; duration = dur; end = new Constant<SimpleFloat>(IntervalImp.endName,Unit.floatType,new OpBinary<SimpleFloat,SimpleFloat,SimpleVoid>(TypeCode.Float,Op.add,s,dur)); bra = IntervalImp.makeBra(b); ket = IntervalImp.makeKet(k); } // end - start - duration == 0 had better hold... public final void init(Scope parent, SimpleString n, int b, Constant<SimpleFloat> s, Constant<SimpleFloat> dur, Constant<SimpleFloat> e, int k) { start = s; duration = dur; end = e; bra = IntervalImp.makeBra(b); ket = IntervalImp.makeKet(k); } public Constant<SimpleFloat> getStart() { return start; } public Constant<SimpleFloat> getDuration() { return duration; } public Constant<SimpleFloat> getEnd() { return end; } public Constant<SimpleInteger> getBra() { return bra; } public Constant<SimpleInteger> getKet() { return ket; } public void setStart(Constant<SimpleFloat> start) { this.start = start; } public void setDuration(Constant<SimpleFloat> duration) { this.duration = duration; } public void setEnd(Constant<SimpleFloat> end) { this.end = end; } // setShape, setBra, and setKet are copied from Interval. One could make Unit inherit from Interval instead, but, // more mileage is obtained by inheriting from the SymbolTable/Scope hierarchy. // This is a good example of where multiple-inheritance, prohibited by Java, makes sense. public void setShape(int b, int k) { setBra(b); setKet(k); } public void setBra(int b) { switch(b) { case Before: bra = IntervalImp.constantBeforeBra; // Not a fantastic concept. For points, ...t] is the notation. // for intervals, ...s,t] is I think right. break; case At: bra = IntervalImp.constantAtBra; break; case After: bra = IntervalImp.constantAfterBra; break; default: System.err.println("Invalid Time Code"); } } public void setKet(int k) { switch(k) { case Before: ket = IntervalImp.constantBeforeKet; break; case At: ket = IntervalImp.constantAtKet; break; case After: ket = IntervalImp.constantAfterKet; // Not a fantastic concept, but I guess the notation is [t... for points // for intervals, [s,t... might be acceptable? Probably. break; default: System.err.println("Invalid Time Code"); } } public transient PDDL.Action asPDDLAction; public ArrayList<PDDL.BooleanExpression> getPDDLConditions() { return asPDDLAction.condition.arguments; } public ArrayList<PDDL.Effect> getPDDLEffects() { return asPDDLAction.effect.arguments; } public PDDL.FloatExpression getPDDLDuration() { return asPDDLAction.duration; } public ArrayList<PDDL.Parameter> getPDDLParameters() { return asPDDLAction.parameters; } public Predicate getPDDLExecuting() { return asPDDLAction.executing; } public PDDL.Action getPDDLAction() { return this.asPDDLAction; } public Predicate makePDDLExecuting() { return asPDDLAction.makeExecuting(); } protected void _translateDecl(PDDL pddl,Interval unit) { for(Type t : this.types.table) { t.translateDecl(pddl,unit); } for (Constant c : this.constants.table) { c.translateDecl(pddl,unit); } for (ConstantFunction c : this.constantFunctions.table) { c.translateDecl(pddl,unit); } for (Fluent f : this.fluents.table) { f.translateDecl(pddl,unit); } for (FluentFunction f : this.fluentFunctions.table) { f.translateDecl(pddl,unit); } // labels? for (Action a : this.actions.table) { a.translateDecl(pddl,unit); } for (Statement s : this.statements) { s.translateDecl(pddl,unit); } for (Decomposition d : this.decompositions) { d.translateDecl(pddl,unit); } } protected void _translateStmt(PDDL pddl, Interval unit, PDDL.Time time) { for (Action a : this.actions.table) { a.translateStmt(pddl,unit,time); } for (Statement s : this.statements) { s.translateStmt(pddl,unit,time); } for (Decomposition d : this.decompositions) { d.translateStmt(pddl,unit,time); } } // make all blocks have time scopes...? // get rid of special-ness of domain...? // scopeimp // identscopeimp // object types aren't timed (?) // so compulsory and choosable // 'unit' == timedidentscopeimp // labels // compulsory units // choosable units // decomps [disjunction over compulsory units] // // block == anonymous unit (name == null) [non-special] // action == choosable 'unit' [also not particularly special] // 'action' is like '[all]', it is a time-spec // an existential, and choosable, spec. public void translateDecl(PDDL pddl,Interval unit) { if (asPDDLAction != null) return; int length = pddl.bufAppend(name); String n = pddl.bufToString(); if (duration.init instanceof Parameter || (duration.init == null && duration.value == null)) { asPDDLAction = pddl.new ComplexAction(n); } else { asPDDLAction = pddl.new Action(n); if(duration.init != null) { asPDDLAction.duration = (PDDL.FloatExpression) duration.init.translateExpr(pddl,this); } else { asPDDLAction.duration = pddl.new FloatLiteral(duration.value.v); } } for (PDDL.Parameter p : pddl.context) { asPDDLAction.context.add(p); } int s = pddl.context.size(); for (Parameter<? extends SimpleObject<?>> p : parameters.table) { p.translateDecl(pddl,this); if (p.asPDDLParameter() != null) pddl.context.add(p.asPDDLParameter()); } ++pddl.depth; if (unit != null) { PDDL.Predicate executing = unit.makePDDLExecuting(); asPDDLAction.condition.arguments.add(pddl.wrap(PDDL.Time.Interim,executing.trivialRef())); } //asPDDLAction.condition.arguments.add(pddl.TrueCondition); //asPDDLAction.makeExecuting(); _translateDecl(pddl,this); //_translateStmt(pddl); //not safe if statements inside depend on later declarations. // despite having the structures built here, the corresponding structures have not yet been made // within the PDDL object. // ....duh. Stupid bug. pddl.bufReset(length); int l = pddl.context.size() - s; while (--l >= 0) pddl.context.remove(s); --pddl.depth; } public void translateStmt(PDDL pddl,Interval unit,PDDL.Time time) { /* setup context for declarations. Probably not needed. */ /* int length = pddl.bufAppend(name); //String n = pddl.bufToString();// this is inside asPDDLAction.name or whatever its called. int s = pddl.context.size(); for (Parameter<? extends SimpleObject<?>> p : parameters.table) { pddl.context.add(p.asPDDLParameter()); } ++pddl.depth; */ _translateStmt(pddl,this,PDDL.Time.Timeless); /* * Back up context (exit scope). Probably not needed. */ /* pddl.bufReset(length); int l = pddl.context.size() - s; while (--l >= 0) pddl.context.remove(s); --pddl.depth; */ } }
Java
package gov.nasa.anml.lifted; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.utility.*; // T can (should?) be restricted to SimpleObject // should do l-values and r-values // so that assignment can be properly handled public interface Expression<T, S extends SimpleObject<? super S>> extends Statement { public abstract T value(State s); public abstract History<S> storage(State p, State c); public abstract TypeCode typeCode(); public abstract PDDL.Expression translateExpr(PDDL pddl, Interval unit); // the difference with translateStmt is that the statement version modifies unit.asPDDLAction() by directly // adding conditions and effects. This one only builds the logic to appear as a sub-expression managed by // its owner. E.g., disjunctions over conjunctions. public abstract PDDL.Argument translateArgument(PDDL pddl, Interval unit); public abstract PDDL.Expression translateLValue(PDDL pddl, Interval unit); }
Java
package gov.nasa.anml.lifted; import java.util.ArrayList; import java.util.HashMap; import gov.nasa.anml.PDDL; import gov.nasa.anml.State; import gov.nasa.anml.PDDL.ComplexAction; import gov.nasa.anml.PDDL.FloatLiteral; import gov.nasa.anml.utility.*; public class Block extends Unit<ANMLBoolean,SimpleVoid> { // working on naming of blocks by line numbers public Block(Scope parent, SimpleString n) { super(parent,n); } public boolean apply(State p, int contextID, State c) { for (Statement s : statements) if (!s.apply(p,contextID,c)) return false; return true; } public IdentifierCode idCode() { return IdentifierCode.Block; } public TypeCode typeCode() { return TypeCode.Boolean; } public void translateDecl(PDDL pddl, Interval unit) { // for a simple block, don't add a level of nesting to the translation. if(isSimple()) { _translateDecl(pddl,unit); } else { super.translateDecl(pddl,unit); } } public boolean isSimple() { if (this.parameters.count != 0) return false; if (this.fluents.count != 0) return false; if (this.fluentFunctions.count != 0) return false; if (this.decompositions.size() != 0) return false; return true; } public void translateStmt(PDDL pddl, Interval unit, PDDL.Time time) { /* int length = pddl.bufAppend(name); int sz = pddl.context.size(); for (Parameter<?> p : parameters.table) { if (p.asPDDLParameter() != null) pddl.context.add(p.asPDDLParameter); } ++pddl.depth; */ if(isSimple()) { _translateStmt(pddl,unit,time); // instead of _translateStmt(pddl,this,PDDL.Time.Timeless); } else { super.translateStmt(pddl,unit,time); } /* pddl.bufReset(length); int l = pddl.context.size() - sz; while (--l >= 0) pddl.context.remove(sz); --pddl.depth; */ } // The reason to need this is if Block's don't have names that work. // Currently, they may have names that work. We shall see. /* public void translateDecl(PDDL pddl, CompoundTime unit) { if (asPDDLAction != null) return; int s = pddl.context.size(); if (duration.init instanceof Parameter) { asPDDLAction = pddl.new ComplexAction(); } else { asPDDLAction = pddl.new Action(); if(duration.init != null) { asPDDLAction.duration = (PDDL.FloatExpression) duration.init.translateExpr(pddl,this); } else { if (duration.value != null) asPDDLAction.duration = pddl.new FloatLiteral(duration.value.v); else asPDDLAction.duration = pddl.One; } } for (PDDL.Parameter p : pddl.context) { asPDDLAction.context.add(p); } for (Parameter<?> p : parameters.table) { p.translateDecl(pddl,this); pddl.context.add(p.asPDDLParameter); } ++pddl.depth; _translateDecl(pddl); int l = pddl.context.size() - s; while (--l >= 0) pddl.context.remove(s); --pddl.depth; } */ }
Java