Package org.python.pydev.parser.prettyprinterv2

Examples of org.python.pydev.parser.prettyprinterv2.PrettyPrinterV2


    public static String createSourceFromAST(SimpleNode root, boolean ignoreComments, AdapterPrefs adapterPrefs) {
        IGrammarVersionProvider versionProvider = adapterPrefs.versionProvider;
        IIndentPrefs indentPrefs = DefaultIndentPrefs.get();
        String endLineDelim = adapterPrefs.endLineDelim;

        PrettyPrinterPrefsV2 prettyPrinterPrefs = PrettyPrinterV2.createDefaultPrefs(versionProvider, indentPrefs,
                endLineDelim);

        PrettyPrinterV2 printer = new PrettyPrinterV2(prettyPrinterPrefs);
        try {
            return printer.print(root);
View Full Code Here


            }

            PrettyPrinterPrefsV2 prefsV2 = PrettyPrinterV2.createDefaultPrefs(edit, indentPrefs,
                    PyInformationPresenter.LINE_DELIM);

            PrettyPrinterV2 prettyPrinterV2 = new PrettyPrinterV2(prefsV2);
            try {

                str = prettyPrinterV2.print(astToPrint);
            } catch (IOException e) {
                Log.log(e);
            }
        }
        return str;
View Full Code Here

                indentPrefs = DefaultIndentPrefs.get();
            }

            PrettyPrinterPrefsV2 prefsV2 = PrettyPrinterV2.createDefaultPrefs(edit, indentPrefs, lineDelimiter);

            PrettyPrinterV2 prettyPrinterV2 = new PrettyPrinterV2(prefsV2);
            try {

                str = prettyPrinterV2.print(astToPrint);
            } catch (IOException e) {
                Log.log(e);
            }
        }
        return str;
View Full Code Here

            }

            PrettyPrinterPrefsV2 prefsV2 = PrettyPrinterV2.createDefaultPrefs(edit, indentPrefs,
                    PyInformationPresenter.LINE_DELIM);

            PrettyPrinterV2 prettyPrinterV2 = new PrettyPrinterV2(prefsV2);
            try {

                str = prettyPrinterV2.print(astToPrint);
            } catch (IOException e) {
                Log.log(e);
            }
        }
        return str;
View Full Code Here

        checkExpected(createdFunctionDef, expected);
    }

    private void checkExpected(SimpleNode functionDef, String expected) throws Exception {
        MakeAstValidForPrettyPrintingVisitor.makeValid(functionDef);
        PrettyPrinterV2 printer = new PrettyPrinterV2(new PrettyPrinterPrefsV2("\n", "    ",
                new IGrammarVersionProvider() {

                    public int getGrammarVersion() throws MisconfigurationException {
                        return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_2_7;
                    }
                }));
        String result = printer.print(functionDef);
        System.out.println("Result: >>" + result +
                "<<");
        assertEquals(expected, result);
    }
View Full Code Here

     * @param node
     * @return
     * @throws Exception
     */
    public static String makePrint(IPrettyPrinterPrefs prefs, SimpleNode node) throws Error {
        PrettyPrinterV2 printer = new PrettyPrinterV2(prefs);
        String result = "";
        try {
            result = printer.print(node);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if (DEBUG) {
            System.out.println("\n\nResult:\n");
View Full Code Here

        timer.printDiff();
        assertTrue(!failedComparisson[0]);
    }

    private String printNode(SimpleNode node) {
        PrettyPrinterV2 prettyPrinterV2 = new PrettyPrinterV2(new PrettyPrinterPrefsV2("\n", "    ", versionProvider));
        try {
            return prettyPrinterV2.print(node);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        //      final WriterEraser stringWriter = new WriterEraser();
View Full Code Here

        String endLineDelim = adapterPrefs.endLineDelim;

        PrettyPrinterPrefsV2 prettyPrinterPrefs = PrettyPrinterV2.createDefaultPrefs(versionProvider, indentPrefs,
                endLineDelim);

        PrettyPrinterV2 printer = new PrettyPrinterV2(prettyPrinterPrefs);
        try {
            return printer.print(root);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.prettyprinterv2.PrettyPrinterV2

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.