Package org.python.parser.ast

Examples of org.python.parser.ast.modType


    public Object visitLambda(Lambda node) throws Exception {
        String name = "<lambda>";

        //Add a return node onto the outside of suite;
        modType retSuite = new Suite(new stmtType[] { new Return(node.body, node) }, node);

        setline(node);

        code.new_(code.pool.Class("org/python/core/PyFunction"));
        code.dup();
View Full Code Here


        char[] bufreader = prepBufreader(istream, cflags);

        ReaderCharStream charStream = new ReaderCharStream(bufreader);
        PythonGrammar g = new PythonGrammar(charStream, literalMkrForParser);

        modType node = null;
        try {
            node = doparse(kind, cflags, g);
        } catch (Throwable t) {
            throw fixParseError(charStream, t, filename);
        }
View Full Code Here

        return node;
    }

    public static modType partialParse(String string, String kind, String filename, CompilerFlags cflags,
            boolean stdprompt) {
        modType node = null;
        //System.err.println(new PyString(string).__repr__().toString());

        char[] bufreader = prepBufreader(PyString.to_bytes(string), cflags);

        ReaderCharStream charStream = new ReaderCharStream(bufreader);
View Full Code Here

        //        }
        //        return node;
    }

    private static modType doparse(String kind, CompilerFlags cflags, PythonGrammar g) throws ParseException {
        modType node = null;

        if (cflags != null)
            g.token_source.generator_allowed = cflags.generator_allowed;

        if (kind.equals("eval")) {
View Full Code Here

            throw parser.fixParseError(null, t, filename);
        }
    }

    public static PyCode compile_flags(byte[] istream, String filename, String type, CompilerFlags cflags) {
        modType node = parser.parse(istream, type, filename, cflags);
        boolean printResults = false;
        if (type.equals("single"))
            printResults = true;
        return Py.compile_flags(node, getName(), filename, true, printResults, cflags);
    }
View Full Code Here

        return Py.compile_flags(PyString.to_bytes(data + "\n\n"), filename, type, cflags);
    }

    public static PyObject compile_command_flags(String string, String filename, String kind, CompilerFlags cflags,
            boolean stdprompt) {
        modType node = parser.partialParse(string + "\n", kind, filename, cflags, stdprompt);

        if (node == null)
            return Py.None;
        return Py.compile_flags(node, Py.getName(), filename, true, true, cflags);
    }
View Full Code Here

TOP

Related Classes of org.python.parser.ast.modType

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.