Package com.icona.tree.nodes.Expression

Examples of com.icona.tree.nodes.Expression.ListExpression


    Expression expression;
    Statement statement;
   
    @Override
    public String toString(){
      ListExpression le=null;
      if(expression.getClass()==ListExpression.class)
        le=(ListExpression)expression;
      boolean insertParenthesis=statement.hasMultipleExpressions() || le!=null && le.isMultipleExpression() ;
      CodeStringBuilder sb=new CodeStringBuilder();

      if(le!=null) sb.appendWithNewLine(le.getAllExceptLastExpressionString());
      sb.appendWithTab("while(");
      sb.append((le!=null)?le.getLastExpressionString():expression.toString());
      sb.appendWithNewLine(")");
     
      if(insertParenthesis) sb.appendWithTabNewLine("{");
     
      sb.appendWithNewLine(statement.toString());
      //sb.append("\n");
      if(le.isMultipleExpression()) sb.appendWithNewLine(le.getAllExceptLastExpressionString());
     
     
      if(insertParenthesis) sb.appendWithTabNewLine("}");
      return sb.toString();
    }
View Full Code Here


        retval.start = input.LT(1);


        ObjectiveCParser.declarator_return d =null;

        ListExpression exp1 =null;



        retval.initializations =null;
        ListExpression listExpression=null;
        //ListExpression listExpression=new ListExpression(null,-1);

        try {
            // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:482:3: (d= declarator ( '=' exp1= initializer )? )
            // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:482:3: d= declarator ( '=' exp1= initializer )?
            {
            pushFollow(FOLLOW_declarator_in_init_declarator1315);
            d=declarator();

            state._fsp--;
            if (state.failed) return retval;

            if ( state.backtracking==0 ) {
                 retval.identifier =(d!=null?d.identifier:null);
                 retval.arrayType =(d!=null?d.arrayType:null);
              }

            // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:487:2: ( '=' exp1= initializer )?
            int alt43=2;
            int LA43_0 = input.LA(1);

            if ( (LA43_0==47) ) {
                alt43=1;
            }
            switch (alt43) {
                case 1 :
                    // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:487:3: '=' exp1= initializer
                    {
                    match(input,47,FOLLOW_47_in_init_declarator1323); if (state.failed) return retval;

                    pushFollow(FOLLOW_initializer_in_init_declarator1331);
                    exp1=initializer();

                    state._fsp--;
                    if (state.failed) return retval;

                    if ( state.backtracking==0 ) {
                        listExpression=new ListExpression(null,-1);
                        listExpression=exp1;
                      }

                    }
                    break;
View Full Code Here


    // $ANTLR start "initializer"
    // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:497:1: initializer returns [ListExpression expression ] : (exp1= assignment_expression | '{' exp2= initializer ( ',' exp3= initializer )* '}' );
    public final ListExpression initializer() throws RecognitionException {
        ListExpression expression = null;


        AssignmentExpression exp1 =null;

        ListExpression exp2 =null;

        ListExpression exp3 =null;



        expression =null;
        ListExpression listExpression=new ListExpression(null,-1);

        try {
            // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:507:5: (exp1= assignment_expression | '{' exp2= initializer ( ',' exp3= initializer )* '}' )
            int alt45=2;
            int LA45_0 = input.LA(1);

            if ( ((LA45_0 >= CHARACTER_LITERAL && LA45_0 <= DECIMAL_LITERAL)||LA45_0==FLOATING_POINT_LITERAL||LA45_0==HEX_LITERAL||LA45_0==IDENTIFIER||LA45_0==OCTAL_LITERAL||LA45_0==STRING_LITERAL||LA45_0==20||LA45_0==25||LA45_0==27||LA45_0==29||LA45_0==32||(LA45_0 >= 35 && LA45_0 <= 36)||LA45_0==98) ) {
                alt45=1;
            }
            else if ( (LA45_0==93) ) {
                alt45=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return expression;}
                NoViableAltException nvae =
                    new NoViableAltException("", 45, 0, input);

                throw nvae;

            }
            switch (alt45) {
                case 1 :
                    // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:507:5: exp1= assignment_expression
                    {
                    pushFollow(FOLLOW_assignment_expression_in_initializer1367);
                    exp1=assignment_expression();

                    state._fsp--;
                    if (state.failed) return expression;

                    if ( state.backtracking==0 ) {
                          listExpression.addExpression(exp1);
                        }

                    }
                    break;
                case 2 :
                    // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:511:4: '{' exp2= initializer ( ',' exp3= initializer )* '}'
                    {
                    match(input,93,FOLLOW_93_in_initializer1374); if (state.failed) return expression;

                    pushFollow(FOLLOW_initializer_in_initializer1378);
                    exp2=initializer();

                    state._fsp--;
                    if (state.failed) return expression;

                    if ( state.backtracking==0 ) {
                          listExpression.addExpression(exp2);

                       
                        }

                    // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:517:3: ( ',' exp3= initializer )*
                    loop44:
                    do {
                        int alt44=2;
                        int LA44_0 = input.LA(1);

                        if ( (LA44_0==34) ) {
                            alt44=1;
                        }


                        switch (alt44) {
                      case 1 :
                          // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:517:4: ',' exp3= initializer
                          {
                          match(input,34,FOLLOW_34_in_initializer1387); if (state.failed) return expression;

                          pushFollow(FOLLOW_initializer_in_initializer1391);
                          exp3=initializer();

                          state._fsp--;
                          if (state.failed) return expression;

                          if ( state.backtracking==0 ) {
                                listExpression.addExpression(exp3);
                                }

                          }
                          break;

View Full Code Here

        AssignmentExpression expx =null;



        expression =null;
        ListExpression listExpression=new ListExpression(null,-1);

        try {
            // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:788:2: (exp1= assignment_expression ( ',' expx= assignment_expression )* )
            // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:789:2: exp1= assignment_expression ( ',' expx= assignment_expression )*
            {
            pushFollow(FOLLOW_assignment_expression_in_expression2604);
            exp1=assignment_expression();

            state._fsp--;
            if (state.failed) return expression;

            if ( state.backtracking==0 ) {
                listExpression.addExpression(exp1);
                //src.addChild((Statement) exp1);//TODO the src.addChild here should be removed, only for testing purpose
              }

            // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:794:2: ( ',' expx= assignment_expression )*
            loop63:
            do {
                int alt63=2;
                int LA63_0 = input.LA(1);

                if ( (LA63_0==34) ) {
                    alt63=1;
                }


                switch (alt63) {
              case 1 :
                  // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:795:3: ',' expx= assignment_expression
                  {
                  match(input,34,FOLLOW_34_in_expression2615); if (state.failed) return expression;

                  pushFollow(FOLLOW_assignment_expression_in_expression2619);
                  expx=assignment_expression();

                  state._fsp--;
                  if (state.failed) return expression;

                  if ( state.backtracking==0 ) {
                        listExpression.addExpression(expx);
                        //src.addChild((Statement) expx);//TODO the src.addChild here should be removed, only for testing purpose
                      }

                  }
                  break;
View Full Code Here

    }
   
    @Override
    public String toString()
    {
      ListExpression le=null;
      if(expression.getClass()==ListExpression.class)
        le=(ListExpression)expression;
     
      CodeStringBuilder sb=new CodeStringBuilder();
     
     
      if(le!=null) sb.appendWithNewLine(le.getAllExceptLastExpressionString());
      sb.appendWithTab("if (");
      sb.append((le!=null)?le.getLastExpressionString():expression.toString());
      sb.appendWithNewLine(")");
     
      //CodeStringBuilder.addTab();
     
      if(ifStatement.hasMultipleExpressions()){
View Full Code Here

    Statement statement;
   
    public String toString(){
      CodeStringBuilder sb=new CodeStringBuilder();
     
      ListExpression le=null;
      if(exprCondition!=null && exprCondition.getClass()==ListExpression.class)
        le=(ListExpression)exprCondition;
     
     
      if(declInit!=null){
        sb.appendWithTabNewLine("{");
        CodeStringBuilder.addTab();
        sb.appendWithNewLine(declInit.toString());
      }
      if(le!=null)
        sb.appendWithNewLine(le.getAllExceptLastExpressionString());
      sb.appendWithTab("for (");

      if(exprInit!=null)
        sb.append(((ListExpression)exprInit).getAllExpressionStringCommaSeperated());
      sb.append(";");

      if(le!=null)
        sb.append(le.getLastExpressionString());
      sb.append(";");

      if(exprLast!=null)
        sb.append(((ListExpression)exprLast).getAllExpressionStringCommaSeperated());
      sb.appendWithNewLine(")");
      if(le!=null && le.isMultipleExpression()){
        sb.appendWithTabNewLine("{");
        CodeStringBuilder.addTab();
      }

      if(statement.hasMultipleExpressions()){
        sb.appendWithTabNewLine("{");
        CodeStringBuilder.addTab();
      }
      if(statement!=null)
        sb.appendWithNewLine(statement);
      if(statement.hasMultipleExpressions()){
        CodeStringBuilder.removeTab();
        sb.appendWithTabNewLine("}");
      }
      sb.append("\n");
      if(le!=null)
        sb.appendWithNewLine(le.getAllExceptLastExpressionString());
      if(le!=null && le.isMultipleExpression()){
        CodeStringBuilder.removeTab();
        sb.appendWithTabNewLine("}");
      }

      if(declInit!=null){
View Full Code Here

   
    @Override
    public String toString(){
     
     
      ListExpression le=null;
      if(expression.getClass()==ListExpression.class)
        le=(ListExpression)expression;
     
      CodeStringBuilder sb=new CodeStringBuilder();
      sb.appendWithTabNewLine("do");
      boolean insertParenthesis=statement.hasMultipleExpressions() || le!=null && le.isMultipleExpression();
     
      if(insertParenthesis) sb.appendWithTabNewLine("{");
     
      //CodeStringBuilder.addTab();
      sb.appendWithNewLine(statement.toString());
      //sb.append("\n");
      if(le!=null) sb.appendWithNewLine(le.getAllExceptLastExpressionString());
      if(insertParenthesis) sb.appendWithTabNewLine("}");
      //sb.append("\n");
     
      //CodeStringBuilder.removeTab();
     
      sb.appendWithTab("while (");
      sb.append((le!=null)?le.getLastExpressionString():expression.toString());
      sb.appendWithNewLine(");");
     
     
     
      return sb.toString();
View Full Code Here

TOP

Related Classes of com.icona.tree.nodes.Expression.ListExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.