Package org.python.pydev.parser.jython

Examples of org.python.pydev.parser.jython.ParseException


        }

        exprType[] exprs;
        switch (n.getId()) {
            case -1:
                throw new ParseException("Illegal node found: " + n, n);

            case JJTFILE_INPUT:
                Module m = (Module) n;
                m.body = makeStmts(arity);
                return m;

            case JJTFALSE:
            case JJTTRUE:
            case JJTNONE:
            case JJTNAME:
            case JJTNUM:
            case JJTPASS_STMT:
            case JJTBREAK_STMT:
            case JJTCONTINUE_STMT:
            case JJTSTRING:
            case JJTUNICODE:
            case JJTBINARY:
            case JJTBEGIN_DECORATOR:
            case JJTCOMMA:
            case JJTCOLON:
                return n; //it's already the correct node (and it's value is already properly set)

            case JJTSUITE:
                stmtType[] stmts = new stmtType[arity];
                for (int i = arity - 1; i >= 0; i--) {
                    SimpleNode yield_or_stmt = stack.popNode();
                    if (yield_or_stmt instanceof Yield) {
                        stmts[i] = new Expr((Yield) yield_or_stmt);

                    } else {
                        try {
                            stmts[i] = (stmtType) yield_or_stmt;
                        } catch (ClassCastException e) {
                            recoverFromClassCastException(yield_or_stmt, e);
                            stmts[i] = new Pass(); //recover from it with a valid node!
                        }
                    }
                }
                return new Suite(stmts);

            case JJTFOR_STMT:
                orelseSuite = null;
                if (stack.nodeArity() == 5) {
                    orelseSuite = popSuiteAndSuiteType();
                }

                body = popSuite();
                iter = (exprType) stack.popNode();
                target = (exprType) stack.popNode();
                ctx.setStore(target);

                For forStmt = (For) n;
                forStmt.target = target;
                forStmt.iter = iter;
                forStmt.body = body;
                forStmt.orelse = orelseSuite;
                return forStmt;

            case JJTBEGIN_ELIF_STMT:
                return new If(null, null, null);

            case JJTIF_STMT:
                return handleIfConstruct(n, arity);

            case JJTEXEC_STMT:
                exprType locals = arity >= 3 ? ((exprType) stack.popNode()) : null;
                exprType globals = arity >= 2 ? ((exprType) stack.popNode()) : null;
                value = (exprType) stack.popNode();
                Exec exec = (Exec) n;
                exec.body = value;
                exec.locals = locals;
                exec.globals = globals;
                return exec;

            case JJTDECORATORS:
                ArrayList<SimpleNode> list2 = new ArrayList<SimpleNode>();
                ArrayList<SimpleNode> listArgs = new ArrayList<SimpleNode>();
                while (stack.nodeArity() > 0) {
                    SimpleNode node = stack.popNode();
                    while (!(node instanceof decoratorsType)) {
                        if (node instanceof comprehensionType) {
                            listArgs.add(node);
                            listArgs.add(stack.popNode()); //target
                        } else if (node instanceof ComprehensionCollection) {
                            listArgs.add(((ComprehensionCollection) node).getGenerators()[0]);
                            listArgs.add(stack.popNode()); //target

                        } else {
                            listArgs.add(node);
                        }
                        node = stack.popNode();
                    }
                    listArgs.add(node);//the decoratorsType
                    list2.add(0, makeDecorator(listArgs));
                    listArgs.clear();
                }
                return new Decorators((decoratorsType[]) list2.toArray(new decoratorsType[0]), JJTDECORATORS);

            case JJTSUBSCRIPTLIST:
                sliceType[] dims = new sliceType[arity];
                for (int i = arity - 1; i >= 0; i--) {
                    SimpleNode sliceNode = stack.popNode();
                    if (sliceNode instanceof sliceType) {
                        dims[i] = (sliceType) sliceNode;

                    } else if (sliceNode instanceof IdentityNode) {
                        //this should be ignored...
                        //this happens when parsing something like a[1,], whereas a[1,2] would not have this.

                    } else {
                        throw new RuntimeException("Expected a sliceType or an IdentityNode. Received :"
                                + sliceNode.getClass());
                    }
                }
                return new ExtSlice(dims);

            case JJTAUG_PLUS:
            case JJTAUG_MINUS:
            case JJTAUG_MULTIPLY:
            case JJTAUG_DIVIDE:
            case JJTAUG_MODULO:
            case JJTAUG_AND:
            case JJTAUG_OR:
            case JJTAUG_XOR:
            case JJTAUG_LSHIFT:
            case JJTAUG_RSHIFT:
            case JJTAUG_POWER:
            case JJTAUG_FLOORDIVIDE:
                AugAssign augAssign = (AugAssign) n;
                exprType value1 = (exprType) stack.popNode();
                exprType target1 = (exprType) stack.popNode();
                ctx.setAugStore(target1);
                augAssign.target = target1;
                augAssign.value = value1;
                return n;

            case JJTOR_BOOLEAN:
                return new BoolOp(BoolOp.Or, makeExprs());
            case JJTAND_BOOLEAN:
                return new BoolOp(BoolOp.And, makeExprs());
            case JJTCOMPARISION:
                if (arity <= 2) {
                    throw new ParseException("Internal error: To make a compare, at least 3 nodes are needed.", n);
                }
                int l = arity / 2;
                exprType[] comparators = new exprType[l];
                int[] ops = new int[l];
                for (int i = l - 1; i >= 0; i--) {
View Full Code Here


                lambdef_nocond();
                break;
            default:
                jj_la1[85] = jj_gen;
                jj_consume_token(-1);
                throw new ParseException();
        }
    }
View Full Code Here

                comparison();
                break;
            default:
                jj_la1[88] = jj_gen;
                jj_consume_token(-1);
                throw new ParseException();
        }
    }
View Full Code Here

                            }
                            break;
                        default:
                            jj_la1[91] = jj_gen;
                            jj_consume_token(-1);
                            throw new ParseException();
                    }
                }
        }
    }
View Full Code Here

                    }
                    break;
                default:
                    jj_la1[96] = jj_gen;
                    jj_consume_token(-1);
                    throw new ParseException();
            }
        }
    }
View Full Code Here

                    }
                    break;
                default:
                    jj_la1[98] = jj_gen;
                    jj_consume_token(-1);
                    throw new ParseException();
            }
        }
    }
View Full Code Here

                    }
                    break;
                default:
                    jj_la1[100] = jj_gen;
                    jj_consume_token(-1);
                    throw new ParseException();
            }
        }
    }
View Full Code Here

                power();
                break;
            default:
                jj_la1[101] = jj_gen;
                jj_consume_token(-1);
                throw new ParseException();
        }
    }
View Full Code Here

                }
                break;
            default:
                jj_la1[104] = jj_gen;
                jj_consume_token(-1);
                throw new ParseException();
        }
    }
View Full Code Here

                        testlist_comp();
                        break;
                    default:
                        jj_la1[105] = jj_gen;
                        jj_consume_token(-1);
                        throw new ParseException();
                }
                spStr2 = grammarActions.createSpecialStr(")", false);
                jj_consume_token(RPAREN);
            } catch (Throwable jjte002) {
                if (jjtc002) {
                    jjtree.clearNodeScope(jjtn002);
                    jjtc002 = false;
                } else {
                    jjtree.popNode();
                }
                if (jjte002 instanceof RuntimeException) {
                    {
                        if (true)
                            throw (RuntimeException) jjte002;
                    }
                }
                if (jjte002 instanceof ParseException) {
                    {
                        if (true)
                            throw (ParseException) jjte002;
                    }
                }
                {
                    if (true)
                        throw (Error) jjte002;
                }
            } finally {
                if (jjtc002) {
                    jjtree.closeNodeScope(jjtn002, true);
                    jjtreeCloseNodeScope(jjtn002);
                }
            }
            grammarActions.addToPeek(spStr, false);
            grammarActions.addToPeek(spStr2, true);
        } else {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case LBRACKET:
                    SimpleNode jjtn003 = builder.openNode(JJTLIST);
                    boolean jjtc003 = true;
                    jjtree.openNodeScope(jjtn003);
                    jjtreeOpenNodeScope(jjtn003);
                    try {
                        spStr = grammarActions.createSpecialStr("[", false);
                        jj_consume_token(LBRACKET);
                        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                            case LPAREN:
                            case LBRACE:
                            case LBRACKET:
                            case DOT:
                            case PLUS:
                            case MINUS:
                            case NOT:
                            case NOT_BOOL:
                            case LAMBDA:
                            case FALSE:
                            case TRUE:
                            case NONE:
                            case NAME:
                            case DECNUMBER:
                            case HEXNUMBER:
                            case OCTNUMBER:
                            case BINNUMBER:
                            case FLOAT:
                            case COMPLEX:
                            case SINGLE_STRING:
                            case SINGLE_STRING2:
                            case TRIPLE_STRING:
                            case TRIPLE_STRING2:
                            case SINGLE_BSTRING:
                            case SINGLE_BSTRING2:
                            case TRIPLE_BSTRING:
                            case TRIPLE_BSTRING2:
                                testlist_comp();
                                break;
                            default:
                                jj_la1[106] = jj_gen;
                                ;
                        }
                        spStr2 = grammarActions.createSpecialStr("]", false);
                        jj_consume_token(RBRACKET);
                    } catch (Throwable jjte003) {
                        if (jjtc003) {
                            jjtree.clearNodeScope(jjtn003);
                            jjtc003 = false;
                        } else {
                            jjtree.popNode();
                        }
                        if (jjte003 instanceof RuntimeException) {
                            {
                                if (true)
                                    throw (RuntimeException) jjte003;
                            }
                        }
                        if (jjte003 instanceof ParseException) {
                            {
                                if (true)
                                    throw (ParseException) jjte003;
                            }
                        }
                        {
                            if (true)
                                throw (Error) jjte003;
                        }
                    } finally {
                        if (jjtc003) {
                            jjtree.closeNodeScope(jjtn003, true);
                            jjtreeCloseNodeScope(jjtn003);
                        }
                    }
                    grammarActions.addToPeek(spStr, false);
                    grammarActions.addToPeek(spStr2, true);
                    break;
                case LBRACE:
                    SimpleNode jjtn004 = builder.openNode(JJTDICTIONARY);
                    boolean jjtc004 = true;
                    jjtree.openNodeScope(jjtn004);
                    jjtreeOpenNodeScope(jjtn004);
                    try {
                        spStr = grammarActions.createSpecialStr("{", false);
                        jj_consume_token(LBRACE);
                        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                            case LPAREN:
                            case LBRACE:
                            case LBRACKET:
                            case DOT:
                            case PLUS:
                            case MINUS:
                            case NOT:
                            case NOT_BOOL:
                            case LAMBDA:
                            case FALSE:
                            case TRUE:
                            case NONE:
                            case NAME:
                            case DECNUMBER:
                            case HEXNUMBER:
                            case OCTNUMBER:
                            case BINNUMBER:
                            case FLOAT:
                            case COMPLEX:
                            case SINGLE_STRING:
                            case SINGLE_STRING2:
                            case TRIPLE_STRING:
                            case TRIPLE_STRING2:
                            case SINGLE_BSTRING:
                            case SINGLE_BSTRING2:
                            case TRIPLE_BSTRING:
                            case TRIPLE_BSTRING2:
                                dictorsetmaker();
                                break;
                            default:
                                jj_la1[107] = jj_gen;
                                ;
                        }
                        spStr2 = grammarActions.createSpecialStr("}", false);
                        jj_consume_token(RBRACE);
                    } catch (Throwable jjte004) {
                        if (jjtc004) {
                            jjtree.clearNodeScope(jjtn004);
                            jjtc004 = false;
                        } else {
                            jjtree.popNode();
                        }
                        if (jjte004 instanceof RuntimeException) {
                            {
                                if (true)
                                    throw (RuntimeException) jjte004;
                            }
                        }
                        if (jjte004 instanceof ParseException) {
                            {
                                if (true)
                                    throw (ParseException) jjte004;
                            }
                        }
                        {
                            if (true)
                                throw (Error) jjte004;
                        }
                    } finally {
                        if (jjtc004) {
                            jjtree.closeNodeScope(jjtn004, true);
                            jjtreeCloseNodeScope(jjtn004);
                        }
                    }
                    grammarActions.addToPeek(spStr, false);
                    grammarActions.addToPeek(spStr2, true);
                    break;
                case FALSE:
                    SimpleNode jjtn005 = builder.openNode(JJTFALSE);
                    boolean jjtc005 = true;
                    jjtree.openNodeScope(jjtn005);
                    jjtreeOpenNodeScope(jjtn005);
                    try {
                        jj_consume_token(FALSE);
                    } finally {
                        if (jjtc005) {
                            jjtree.closeNodeScope(jjtn005, true);
                            jjtreeCloseNodeScope(jjtn005);
                        }
                    }
                    break;
                case TRUE:
                    SimpleNode jjtn006 = builder.openNode(JJTTRUE);
                    boolean jjtc006 = true;
                    jjtree.openNodeScope(jjtn006);
                    jjtreeOpenNodeScope(jjtn006);
                    try {
                        jj_consume_token(TRUE);
                    } finally {
                        if (jjtc006) {
                            jjtree.closeNodeScope(jjtn006, true);
                            jjtreeCloseNodeScope(jjtn006);
                        }
                    }
                    break;
                case NONE:
                    SimpleNode jjtn007 = builder.openNode(JJTNONE);
                    boolean jjtc007 = true;
                    jjtree.openNodeScope(jjtn007);
                    jjtreeOpenNodeScope(jjtn007);
                    try {
                        jj_consume_token(NONE);
                    } finally {
                        if (jjtc007) {
                            jjtree.closeNodeScope(jjtn007, true);
                            jjtreeCloseNodeScope(jjtn007);
                        }
                    }
                    break;
                case DOT:
                    SimpleNode jjtn008 = builder.openNode(JJTELLIPSIS_AS_NAME);
                    boolean jjtc008 = true;
                    jjtree.openNodeScope(jjtn008);
                    jjtreeOpenNodeScope(jjtn008);
                    try {
                        jj_consume_token(DOT);
                        jj_consume_token(DOT);
                        jj_consume_token(DOT);
                    } finally {
                        if (jjtc008) {
                            jjtree.closeNodeScope(jjtn008, true);
                            jjtreeCloseNodeScope(jjtn008);
                        }
                    }
                    break;
                case NAME:
                    Name();
                    break;
                case DECNUMBER:
                case HEXNUMBER:
                case OCTNUMBER:
                case BINNUMBER:
                case FLOAT:
                case COMPLEX:
                    Number();
                    break;
                case SINGLE_STRING:
                case SINGLE_STRING2:
                case TRIPLE_STRING:
                case TRIPLE_STRING2:
                case SINGLE_BSTRING:
                case SINGLE_BSTRING2:
                case TRIPLE_BSTRING:
                case TRIPLE_BSTRING2:
                    String();
                    label_35: while (true) {
                        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                            case SINGLE_STRING:
                            case SINGLE_STRING2:
                            case TRIPLE_STRING:
                            case TRIPLE_STRING2:
                            case SINGLE_BSTRING:
                            case SINGLE_BSTRING2:
                            case TRIPLE_BSTRING:
                            case TRIPLE_BSTRING2:
                                ;
                                break;
                            default:
                                jj_la1[108] = jj_gen;
                                break label_35;
                        }
                        SimpleNode jjtn009 = builder.openNode(JJTSTRJOIN);
                        boolean jjtc009 = true;
                        jjtree.openNodeScope(jjtn009);
                        jjtreeOpenNodeScope(jjtn009);
                        try {
                            String();
                        } catch (Throwable jjte009) {
                            if (jjtc009) {
                                jjtree.clearNodeScope(jjtn009);
                                jjtc009 = false;
                            } else {
                                jjtree.popNode();
                            }
                            if (jjte009 instanceof RuntimeException) {
                                {
                                    if (true)
                                        throw (RuntimeException) jjte009;
                                }
                            }
                            if (jjte009 instanceof ParseException) {
                                {
                                    if (true)
                                        throw (ParseException) jjte009;
                                }
                            }
                            {
                                if (true)
                                    throw (Error) jjte009;
                            }
                        } finally {
                            if (jjtc009) {
                                jjtree.closeNodeScope(jjtn009, 2);
                                jjtreeCloseNodeScope(jjtn009);
                            }
                        }
                    }
                    break;
                default:
                    jj_la1[109] = jj_gen;
                    jj_consume_token(-1);
                    throw new ParseException();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.jython.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.