projects
/
sbp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
98ae759
)
checkpoint
author
adam
<adam@megacz.com>
Wed, 28 Jun 2006 22:09:24 +0000
(18:09 -0400)
committer
adam
<adam@megacz.com>
Wed, 28 Jun 2006 22:09:24 +0000
(18:09 -0400)
darcs-hash:
20060628220924
-5007d-
c2445187f5807325bda5f062bbc4ab45acfac345
.gz
src/edu/berkeley/sbp/misc/Demo.java
patch
|
blob
|
history
diff --git
a/src/edu/berkeley/sbp/misc/Demo.java
b/src/edu/berkeley/sbp/misc/Demo.java
index
02482fa
..
9c205d8
100644
(file)
--- a/
src/edu/berkeley/sbp/misc/Demo.java
+++ b/
src/edu/berkeley/sbp/misc/Demo.java
@@
-70,14
+70,14
@@
public class Demo {
Production p = new Production(tag, nonTerminalName, els, labels, drops);
for(Method m : _cl.getMethods())
if (new TargetMethod(m).isCompatible(p))
Production p = new Production(tag, nonTerminalName, els, labels, drops);
for(Method m : _cl.getMethods())
if (new TargetMethod(m).isCompatible(p))
- return Sequence.rewritingSequence(m, els, labels, drops);
+ return new TargetMethod(m).makeSequence(p);
for(Class c : _inner)
for(Constructor con : c.getConstructors())
if (new TargetConstructor(con).isCompatible(p))
for(Class c : _inner)
for(Constructor con : c.getConstructors())
if (new TargetConstructor(con).isCompatible(p))
- return Sequence.rewritingSequence(con, els, labels, drops);
+ return new TargetConstructor(con).makeSequence(p);
for(Class c : _inner)
if (new TargetClass(c).isCompatible(p))
for(Class c : _inner)
if (new TargetClass(c).isCompatible(p))
- return Sequence.rewritingSequence(c, els, labels, drops);
+ return new TargetClass(c).makeSequence(p);
throw new RuntimeException("could not find a Java method/class/ctor matching tag \""+tag+"\", nonterminal \""+nonTerminalName+"\"");
}
}
throw new RuntimeException("could not find a Java method/class/ctor matching tag \""+tag+"\", nonterminal \""+nonTerminalName+"\"");
}
}
@@
-156,6
+156,7
@@
public class Demo {
public abstract tag getTag();
public abstract nonterminal getNonTerminal();
public abstract boolean buildSequence(Production p);
public abstract tag getTag();
public abstract nonterminal getNonTerminal();
public abstract boolean buildSequence(Production p);
+ public abstract Sequence makeSequence(Production p);
public boolean isCompatible(Production p) {
tag t = getTag();
if (t != null &&
public boolean isCompatible(Production p) {
tag t = getTag();
if (t != null &&
@@
-215,6
+216,9
@@
public class Demo {
return true;
return false;
}
return true;
return false;
}
+ public Sequence makeSequence(Production p) {
+ return Sequence.rewritingSequence(_class, p.elements, p.labels, p.drops);
+ }
}
public static class TargetConstructor extends Target {
public final Constructor _ctor;
}
public static class TargetConstructor extends Target {
public final Constructor _ctor;
@@
-241,6
+245,9
@@
public class Demo {
if (ret!=null) return true;
return false;
}
if (ret!=null) return true;
return false;
}
+ public Sequence makeSequence(Production p) {
+ return Sequence.rewritingSequence(_ctor, p.elements, p.labels, p.drops);
+ }
}
public static class TargetMethod extends Target {
public final Method _method;
}
public static class TargetMethod extends Target {
public final Method _method;
@@
-260,6
+267,9
@@
public class Demo {
if (ret!=null) return true;
return false;
}
if (ret!=null) return true;
return false;
}
+ public Sequence makeSequence(Production p) {
+ return Sequence.rewritingSequence(_method, p.elements, p.labels, p.drops);
+ }
}
public class MG {
}
public class MG {