Esempio n. 1
0
/* Production 33 */
  public void shift_expr() {
 /*@bgen(jjtree) shift_expr */
  ASTshift_expr jjtn000 = new ASTshift_expr(this, IDLParserTreeConstants.JJTSHIFT_EXPR);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      add_expr();
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
        case 38:
        case 39:
          ;
          break;
        default:
          jj_la1[37] = jj_gen;
          goto label_14;
          break;
        }
        switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
        case 38:
          jj_consume_token(38);
                        jjtn000.AppendShiftOperation(ShiftOps.Right);
          break;
        case 39:
          jj_consume_token(39);
                        jjtn000.AppendShiftOperation(ShiftOps.Left);
          break;
        default:
          jj_la1[38] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
          break;
        }
        add_expr();
      }
      label_14: ;
      
    } catch (Exception jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
  {if (true) throw ;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }
 /**
  * @see parser.IDLParserVisitor#visit(ASTshift_expr, Object)
  */
 public Object visit(ASTshift_expr node, Object data) {        
     Literal result = 
         (Literal)node.jjtGetChild(0).jjtAccept(this, data);
     for(int i=1; i < node.jjtGetNumChildren(); i++) {
         // evaluate the add-expr and lshift/rshift the current result with it
         switch (node.GetShiftOperation(i-1)) {
             case ShiftOps.Right:
                 result = result.ShiftRightBy((Literal)node.jjtGetChild(i).jjtAccept(this, data));
                 break;
             case ShiftOps.Left:
                 result = result.ShiftLeftBy((Literal)node.jjtGetChild(i).jjtAccept(this, data));
                 break;
         }
     }
     return result;
 }