projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
checkpoint
[sbp.git]
/
src
/
edu
/
berkeley
/
sbp
/
Forest.java
diff --git
a/src/edu/berkeley/sbp/Forest.java
b/src/edu/berkeley/sbp/Forest.java
index
bdaedca
..
353e256
100644
(file)
--- a/
src/edu/berkeley/sbp/Forest.java
+++ b/
src/edu/berkeley/sbp/Forest.java
@@
-158,6
+158,14
@@
public abstract class Forest<NodeType> implements GraphViz.ToGraphViz {
void gather(HashSet<Forest<NodeType>> ht) {
touched();
void gather(HashSet<Forest<NodeType>> ht) {
touched();
+
+ // FIXME: do something more sensible here
+ if (ht.contains(this)) {
+ System.err.println("WARNING: grammar produced a circular forest\n" + this);
+ //throw new Error("grammar produced a circular forest:\n" + this);
+ return;
+ }
+
ht.add(this);
for(Forest<NodeType> f : hp) f.gather(ht);
}
ht.add(this);
for(Forest<NodeType> f : hp) f.gather(ht);
}