Package org.python.pydev.core

Examples of org.python.pydev.core.IGrammarVersionProvider


                ast = NodeUtils.getClassDefInit((ClassDef) ast);
            }
            if (ast instanceof FunctionDef) {
                FunctionDef functionDef = (FunctionDef) ast;
                if (functionDef.args != null) {
                    String printed = PrettyPrinterV2.printArguments(new IGrammarVersionProvider() {

                        public int getGrammarVersion() throws MisconfigurationException {
                            return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_3_0;
                        }
                    }, functionDef.args);
View Full Code Here


    private void runSelectionExtension(RefactoringInfo info) {
        StringBuilder buffer = new StringBuilder();
        try {
            String source = Rewriter.createSourceFromAST(info.getParsedExtendedSelection().getASTParent(), "\n",
                    new IGrammarVersionProvider() {

                        public int getGrammarVersion() throws MisconfigurationException {
                            return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_2_7;
                        }
                    });
View Full Code Here

    private RefactoringInfo setupInfo(MockupSelectionConfig config) throws Throwable {
        IDocument doc = new Document(data.source);

        ITextSelection selection = new TextSelection(doc, data.sourceSelection.getOffset(),
                data.sourceSelection.getLength());
        RefactoringInfo info = new RefactoringInfo(doc, selection, new IGrammarVersionProvider() {

            public int getGrammarVersion() throws MisconfigurationException {
                return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_2_7;
            }
        });
View Full Code Here

            System.out.println("here");
        }
        ITextSelection selection = new TextSelection(doc, data.sourceSelection.getOffset(),
                data.sourceSelection.getLength());

        RefactoringInfo info = new RefactoringInfo(doc, selection, new IGrammarVersionProvider() {

            public int getGrammarVersion() throws MisconfigurationException {
                return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_2_7;
            }
        });
View Full Code Here

        FileUtilsFileBuffer.IN_TESTS = true;

        IDocument document = new Document(data.source);
        ITextSelection selection = new TextSelection(document, data.sourceSelection.getOffset(),
                data.sourceSelection.getLength());
        RefactoringInfo info = new RefactoringInfo(document, selection, new IGrammarVersionProvider() {

            public int getGrammarVersion() throws MisconfigurationException {
                return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_2_7;
            }
        });
View Full Code Here

        List<OverrideMethodsRequest> requests = new ArrayList<OverrideMethodsRequest>();

        for (FunctionDefAdapter method : methods) {
            OverrideMethodsRequest req = new OverrideMethodsRequest(clazz, this.offsetStrategy, method, false,
                    baseClassName, new AdapterPrefs("\n", new IGrammarVersionProvider() {

                        public int getGrammarVersion() throws MisconfigurationException {
                            return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_2_7;
                        }
                    }));
View Full Code Here

    public static ModuleAdapter createModuleAdapter(PythonModuleManager pythonModuleManager, File file, IDocument doc,
            IPythonNature nature, IGrammarVersionProvider versionProvider) throws Throwable {
        if (file != null && file.exists()) {
            if (FileTypesPreferencesPage.isCythonFile(file.getName())) {
                versionProvider = new IGrammarVersionProvider() {

                    public int getGrammarVersion() throws MisconfigurationException {
                        return IPythonNature.GRAMMAR_PYTHON_VERSION_CYTHON;
                    }
                };
View Full Code Here

        FileUtilsFileBuffer.IN_TESTS = true;

        IDocument document = new Document(data.source);
        ITextSelection selection = new TextSelection(document, data.sourceSelection.getOffset(),
                data.sourceSelection.getLength());
        IGrammarVersionProvider versionProvider = createVersionProvider();
        RefactoringInfo info = new RefactoringInfo(document, selection, versionProvider);
        ExtractLocalRefactoring refactoring = new ExtractLocalRefactoring(info);

        ExtractLocalRequestProcessor requestProcessor = refactoring.getRequestProcessor();
        requestProcessor.setVariableName("extracted_variable");
View Full Code Here

    PyAstFactory astFactory;

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        astFactory = new PyAstFactory(new AdapterPrefs("\n", new IGrammarVersionProvider() {

            public int getGrammarVersion() throws MisconfigurationException {
                return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_2_7;
            }
        }));
View Full Code Here

    }

    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;
                    }
                }));
View Full Code Here

TOP

Related Classes of org.python.pydev.core.IGrammarVersionProvider

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.