Package webit.script.exceptions

Examples of webit.script.exceptions.ParseException


public class FunctionLoopOverflowTest {

    @Test
    public void test() throws ResourceNotFoundException, IOException {
        Template template;
        ParseException exception;
        //
        exception = null;
        template = EngineManager.getTemplate("/loopTests/loopOverflow1.wit");
        try {
            template.reload();
View Full Code Here


            current = currentCaseStatement = new CaseEntry(body, current);
        } // else use last as current for this key

        if (key == null) {
            if (defaultStatement != null) {
                throw new ParseException("multi default block in one swith", line, column);
            }
            defaultStatement = current;
        } else if (caseMap.containsKey(key)) {
            throw new ParseException("duplicated case value in one swith", line, column);
        }

        caseMap.put(key, current);
        return this;
    }
View Full Code Here

        return this;
    }

    public FunctionDeclarePart appendArg(String name, int line, int column) {
        if (varmgr.assignVariant(name, line, column) != (start + (++this.argsCount))) {
            throw new ParseException("Failed to assign vars!");
        }
        this.args.add(name);
        return this;
    }
View Full Code Here

                    hasReturnLoops = true;
                    it.remove();
                }
            }
            if (!loopInfos.isEmpty()) {
                throw new ParseException("Loops overflow in function body: ".concat(StringUtil.join(loopInfos, ',')));
            }
        }

        return new FunctionDeclare(argsCount,
                varIndexer,
View Full Code Here

        if (to instanceof ResetableValueExpression) {
            this.exportNameList.add(name);
            this.toResetableValueList.add((ResetableValueExpression) to);
            return this;
        } else {
            throw new ParseException("Need a resetable expression.", to);
        }
    }
View Full Code Here

        Statement[] statements = this.toInvertArray();
        List<LoopInfo> loopInfos;
        if ((loopInfos = StatementUtil.collectPossibleLoopsInfo(statements)) == null) {
            return new TemplateAST(varmgr.getIndexers(), statements, varmgr.getVarCount());
        } else {
            throw new ParseException("loop overflow: ".concat(StringUtil.join(loopInfos, ',')));
        }
    }
View Full Code Here

        case 1:
          { pullToString();
          }
        case 130: break;
        case 2:
          { throw new ParseException("Illegal character \""+yytext()+"\" at line "+yyline+", column "+yycolumn, getLine(), getColumn());
          }
        case 131: break;
        case 3:
          { /* ignore */
          }
        case 132: break;
        case 4:
          { return symbol(Tokens.DIV);
          }
        case 133: break;
        case 5:
          { return symbol(Tokens.MULT);
          }
        case 134: break;
        case 6:
          { return symbol(Tokens.IDENTIFIER, yytext().intern());
          }
        case 135: break;
        case 7:
          { return symbol(Tokens.DIRECT_VALUE, yyInt(0, 0, 10));
          }
        case 136: break;
        case 8:
          { return symbol(Tokens.DOT);
          }
        case 137: break;
        case 9:
          { return symbol(Tokens.MINUS);
          }
        case 138: break;
        case 10:
          { yybegin(STRING); resetString();
          }
        case 139: break;
        case 11:
          { yybegin(CHARLITERAL);
          }
        case 140: break;
        case 12:
          { return symbol(Tokens.LT);
          }
        case 141: break;
        case 13:
          { return symbol(Tokens.MOD);
          }
        case 142: break;
        case 14:
          { return symbol(Tokens.GT);
          }
        case 143: break;
        case 15:
          { return symbol(Tokens.LBRACE);
          }
        case 144: break;
        case 16:
          { return symbol(Tokens.FUNCTION);
          }
        case 145: break;
        case 17:
          { return symbol(Tokens.AT);
          }
        case 146: break;
        case 18:
          { return symbol(Tokens.LBRACK);
          }
        case 147: break;
        case 19:
          { return symbol(Tokens.QUESTION);
          }
        case 148: break;
        case 20:
          { return symbol(Tokens.RBRACK);
          }
        case 149: break;
        case 21:
          { return symbol(Tokens.LPAREN);
          }
        case 150: break;
        case 22:
          { return symbol(Tokens.RPAREN);
          }
        case 151: break;
        case 23:
          { if(!interpolationFlag){return symbol(Tokens.RBRACE);}else{yybegin(YYINITIAL); leftInterpolationFlag = true;return symbol(Tokens.INTERPOLATION_END);}
          }
        case 152: break;
        case 24:
          { return symbol(Tokens.SEMICOLON);
          }
        case 153: break;
        case 25:
          { return symbol(Tokens.COMMA);
          }
        case 154: break;
        case 26:
          { return symbol(Tokens.EQ);
          }
        case 155: break;
        case 27:
          { return symbol(Tokens.NOT);
          }
        case 156: break;
        case 28:
          { return symbol(Tokens.COMP);
          }
        case 157: break;
        case 29:
          { return symbol(Tokens.COLON);
          }
        case 158: break;
        case 30:
          { return symbol(Tokens.AND);
          }
        case 159: break;
        case 31:
          { return symbol(Tokens.OR);
          }
        case 160: break;
        case 32:
          { return symbol(Tokens.PLUS);
          }
        case 161: break;
        case 33:
          { return symbol(Tokens.XOR);
          }
        case 162: break;
        case 34:
          { yybegin(YYSTATEMENT); return symbol(Tokens.DIRECT_VALUE, stringLine, stringColumn, popAsString());
          }
        case 163: break;
        case 35:
          { throw new ParseException("Unterminated character literal at end of line", getLine(), getColumn());
          }
        case 164: break;
        case 36:
          { int length = yylength() - TEXT_BLOCK_END_LEN; appendToString('\\',length/2); if((length & 1) == 0){return popTextStatementSymbol(false);} else {appendToString('<', '%');}
          }
        case 165: break;
        case 37:
          { int length = yylength() - INTERPOLATION_START_LEN; appendToString('\\',length/2); if((length & 1) == 0){return popTextStatementSymbol(true);} else {appendToString('$', '{');}
          }
        case 166: break;
        case 38:
          { return symbol(Tokens.SELFEQ, AbstractParser.OP_DIVEQ);
          }
        case 167: break;
        case 39:
          { return symbol(Tokens.SELFEQ, AbstractParser.OP_MULTEQ);
          }
        case 168: break;
        case 40:
          { return symbol(Tokens.DIRECT_VALUE, yyInt(1, 0, 8));
          }
        case 169: break;
        case 41:
          { return symbol(Tokens.DIRECT_VALUE, yyLong(0, -1, 10));
          }
        case 170: break;
        case 42:
          { return symbol(Tokens.DIRECT_VALUE, new Double(yytext()));
          }
        case 171: break;
        case 43:
          { return symbol(Tokens.DIRECT_VALUE, new Float(yytext(0, -1)));
          }
        case 172: break;
        case 44:
          { return symbol(Tokens.DIRECT_VALUE, new Double(yytext(0, -1)));
          }
        case 173: break;
        case 45:
          { return symbol(Tokens.DOTDOT);
          }
        case 174: break;
        case 46:
          { return symbol(Tokens.MINUSMINUS);
          }
        case 175: break;
        case 47:
          { return symbol(Tokens.MINUSGT);
          }
        case 176: break;
        case 48:
          { return symbol(Tokens.SELFEQ, AbstractParser.OP_MINUSEQ);
          }
        case 177: break;
        case 49:
          { return symbol(Tokens.LSHIFT);
          }
        case 178: break;
        case 50:
          { return symbol(Tokens.LTEQ);
          }
        case 179: break;
        case 51:
          { leftInterpolationFlag = false; yybegin(YYINITIAL);
          }
        case 180: break;
        case 52:
          { return symbol(Tokens.SELFEQ, AbstractParser.OP_MODEQ);
          }
        case 181: break;
        case 53:
          { return symbol(Tokens.RSHIFT);
          }
        case 182: break;
        case 54:
          { return symbol(Tokens.GTEQ);
          }
        case 183: break;
        case 55:
          { return symbol(Tokens.IF);
          }
        case 184: break;
        case 56:
          { return symbol(Tokens.DO);
          }
        case 185: break;
        case 57:
          { return symbol(Tokens.LDEBUG);
          }
        case 186: break;
        case 58:
          { return symbol(Tokens.RDEBUG);
          }
        case 187: break;
        case 59:
          { return symbol(Tokens.QUESTION_COLON);
          }
        case 188: break;
        case 60:
          { return symbol(Tokens.EQGT);
          }
        case 189: break;
        case 61:
          { return symbol(Tokens.EQEQ);
          }
        case 190: break;
        case 62:
          { return symbol(Tokens.NOTEQ);
          }
        case 191: break;
        case 63:
          { return symbol(Tokens.SELFEQ, AbstractParser.OP_ANDEQ);
          }
        case 192: break;
        case 64:
          { return symbol(Tokens.ANDAND);
          }
        case 193: break;
        case 65:
          { return symbol(Tokens.SELFEQ, AbstractParser.OP_OREQ);
          }
        case 194: break;
        case 66:
          { return symbol(Tokens.OROR);
          }
        case 195: break;
        case 67:
          { return symbol(Tokens.SELFEQ, AbstractParser.OP_PLUSEQ);
          }
        case 196: break;
        case 68:
          { return symbol(Tokens.PLUSPLUS);
          }
        case 197: break;
        case 69:
          { return symbol(Tokens.SELFEQ, AbstractParser.OP_XOREQ);
          }
        case 198: break;
        case 70:
          { throw new ParseException("Illegal escape sequence \""+yytext()+"\"", getLine(), getColumn());
          }
        case 199: break;
        case 71:
          { /* escape new line */
          }
View Full Code Here

        try {
            return expression instanceof Optimizable
                    ? (Expression) ((Optimizable) expression).optimize()
                    : expression;
        } catch (Exception e) {
            throw new ParseException("Exception occur when do optimization", e, expression);
        }
    }
View Full Code Here

        try {
            return statement instanceof Optimizable
                    ? ((Optimizable) statement).optimize()
                    : statement;
        } catch (Exception e) {
            throw new ParseException("Exception occur when do optimization", e, statement);
        }
    }
View Full Code Here

            case 56: // blockPrepare2 ::= LBRACE
            {
                varmgr.push(); return null;
            }
            default:
                throw new ParseException("Invalid action id.");
        }
    }
View Full Code Here

TOP

Related Classes of webit.script.exceptions.ParseException

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.