this._cl = c;
this._inner = inner;
}
- private boolean match(Method m, String s) { return match(m.getAnnotation(bind.as.class), null, s); }
- private boolean match(bind.as t, Class c, String s) {
- if (t==null) return false;
- if (t.value().equals(s)) return true;
- if (c != null && t.equals("") && c.getSimpleName().equals(s)) return true;
- return false;
- }
- /*
- private boolean match(nonterminal t, Class c, String s) {
- if (t==null) return false;
- if (t.value().equals(s)) return true;
- if (c != null && t.equals("") && c.getSimpleName().equals(s)) return true;
- return false;
- }
- */
- private boolean match(Class c, String s, String nonTerminalName) {
- if (match((bind.as)c.getAnnotation(bind.as.class), c, s)) return true;
- //if (match((nonterminal)c.getAnnotation(bind.as.class), c, nonTerminalName)) return true;
- return false;
- }
- public boolean match(Constructor con, String s, String nonTerminalName) {
- Class c = con.getDeclaringClass();
- if (match((bind.as)con.getAnnotation(bind.as.class), null, s)) return true;
- //if (match((nonterminal)con.getAnnotation(bind.as.class), c, s)) return true;
- return false;
- }
public Object repeatTag() {
return new Tree.ArrayBuildingTreeFunctor<Object>();
}
public Target(Bindable b) { this._bindable = b; }
public String getName() { return _bindable.getSimpleName(); }
- public bind.as getBindAs() { return (bind.as)_bindable.getAnnotation(bind.as.class); }
+ public bind getBind() {
+ return (bind)_bindable.getAnnotation(bind.class); }
+ public bind.as getBindAs() {
+ return (bind.as)_bindable.getAnnotation(bind.as.class); }
//public nonterminal getNonTerminal() { return (nonterminal)_bindable.getAnnotation(bind.as.class); }
public String toString() { return _bindable.getSimpleName(); }
public boolean isRaw() { return _bindable.isAnnotationPresent(bind.raw.class); }
(t.value().equals("") && getName().equals(p.tag))))
return buildSequence(p)!=null;
+ bind b = getBind();
+ if (b != null && getName().equals(p.tag))
+ return buildSequence(p)!=null;
+
bind.as n = getBindAs();
if (n != null &&
(n.value().equals(p.nonTerminal) ||
(n.value().equals("") && getName().equals(p.nonTerminal))))
return buildSequence(p)!=null;
+ if (b != null && getName().equals(p.nonTerminal))
+ return buildSequence(p)!=null;
+
return false;
}
public static class MG {
- public static @bind.as Object grammar(Object[] o) {
- if (o==null) return null;
- if (o[0] != null && o[0] instanceof Grammar) return o[0];
- Grammar g = new Grammar();
- g.nonterminals = (NonTerminal[])Reflection.lub((Object[])o);
- return g;
- }
public static @bind.as class Grammar {
public NonTerminal get(String s) {
for(NonTerminal nt : nonterminals)