コード例 #1
0
/* Production 35 */
  public void mult_expr() {
 /*@bgen(jjtree) mult_expr */
  ASTmult_expr jjtn000 = new ASTmult_expr(this, IDLParserTreeConstants.JJTMULT_EXPR);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      unary_expr();
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
        case 42:
        case 43:
        case 44:
          ;
          break;
        default:
          jj_la1[41] = jj_gen;
          goto label_16;
          break;
        }
        switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
        case 42:
          jj_consume_token(42);
                         jjtn000.AppendMultOperation(MultOps.Mult);
          break;
        case 43:
          jj_consume_token(43);
                         jjtn000.AppendMultOperation(MultOps.Div);
          break;
        case 44:
          jj_consume_token(44);
                         jjtn000.AppendMultOperation(MultOps.Mod);
          break;
        default:
          jj_la1[42] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
          break;
        }
        unary_expr();
      }
      label_16: ;
      
    } catch (Exception jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
  {if (true) throw ;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }
コード例 #2
0
 /**
  * @see parser.IDLParserVisitor#visit(ASTmult_expr, Object)
  */
 public Object visit(ASTmult_expr node, Object data) {
     Literal result = 
         (Literal)node.jjtGetChild(0).jjtAccept(this, data);
     for(int i=1; i < node.jjtGetNumChildren(); i++) {
         // evaluate the unary-expr and mult/div/mod it to the current result
         switch (node.GetMultOperation(i-1)) {
             case MultOps.Mult:
                 result = result.MultBy((Literal)node.jjtGetChild(i).jjtAccept(this, data));
                 break;
             case MultOps.Div:
                 result = result.DivBy((Literal)node.jjtGetChild(i).jjtAccept(this, data));
                 break;
             case MultOps.Mod:
                 result = result.ModBy((Literal)node.jjtGetChild(i).jjtAccept(this, data));
                 break;                    
         }
     }
     return result;
 }