예제 #1
0
 // @ requires iter.hasNext();
 private <T extends IExpr> String rightassoc(String fcnname, Iterator<T> iter)
     throws IVisitor.VisitorException {
   T n = iter.next();
   if (!iter.hasNext()) {
     return n.accept(this);
   } else {
     StringBuilder sb = new StringBuilder();
     sb.append("(");
     sb.append(fcnname);
     sb.append(" ");
     sb.append(n.accept(this));
     sb.append(" ");
     sb.append(rightassoc(fcnname, iter));
     sb.append(")");
     return sb.toString();
   }
 }
예제 #2
0
파일: Lexer.java 프로젝트: mechtaev/angelix
 /** A static helper method that sets the position of an AST node, but returns the same type */
 protected static <T extends IPosable> T setPos(T t, IPos pos) {
   t.setPos(pos);
   return t;
 }