1 package edu.berkeley.sbp;
2 import edu.berkeley.sbp.util.*;
3 import edu.berkeley.sbp.*;
4 import edu.berkeley.sbp.*;
7 import java.lang.reflect.*;
8 import java.lang.ref.*;
10 /** the root superclass for all components of the grammar (terminals, nonterminals, literals, etc) */
11 public abstract class Element {
13 abstract Topology toAtom();
14 public Topology noFollow() { return null; }
15 Forest epsilonForm() { throw new Error("no epsilon form: " + this); }
16 final boolean possiblyEpsilon(Walk.Cache cache) {
17 Boolean ret = cache==null ? null : cache.possiblyEpsilon.get(this);
18 if (ret != null) return ret.booleanValue();
19 ret = new Walk.PossiblyEpsilon().walk(this) ? Boolean.TRUE : Boolean.FALSE;
20 if (cache != null) cache.possiblyEpsilon.put(this, ret);