Package org.python.pydev.core

Examples of org.python.pydev.core.IGrammarVersionProvider


    /**
     * Should only be called for testing. Does not register as a thread.
     */
    public PyParser(IGrammarVersionProvider grammarVersionProvider) {
        if (grammarVersionProvider == null) {
            grammarVersionProvider = new IGrammarVersionProvider() {
                public int getGrammarVersion() {
                    return IPythonNature.LATEST_GRAMMAR_VERSION;
                }
            };
        }
View Full Code Here


        }
    }

    public int applyOnDocument(ITextViewer viewer, IDocument document, char trigger, int stateMask, int offset) {
        IGrammarVersionProvider versionProvider = null;
        PyEdit edit = null;
        if (viewer instanceof PySourceViewer) {
            PySourceViewer pySourceViewer = (PySourceViewer) viewer;
            versionProvider = edit = pySourceViewer.getEdit();
        } else {
            versionProvider = new IGrammarVersionProvider() {

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

    private final int LEVEL_BRACES = 2; //{}

    public static PrettyPrinterPrefsV2 createDefaultPrefs(IGrammarVersionProvider versionProvider,
            IIndentPrefs indentPrefs, String endLineDelim) {
        if (versionProvider == null) {
            versionProvider = new IGrammarVersionProvider() {

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

            if (tryToParse) {
                IDocument doc;
                try {
                    doc = FileUtilsFileBuffer.getDocFromFile(predefinedModule);
                    IGrammarVersionProvider provider = new IGrammarVersionProvider() {

                        public int getGrammarVersion() throws MisconfigurationException {
                            return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_3_0; // Always Python 3.0 here
                        }
                    };
View Full Code Here

    public AbstractRewriterTestCase(String name, boolean ignoreEmptyLines) {
        super(name, ignoreEmptyLines);
    }

    protected void runRewriter() throws Throwable {
        setTestGenerated(Rewriter.reparsed(data.source, new AdapterPrefs("\n", new IGrammarVersionProvider() {

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

                data.source), CodeCompletionTestsBase.nature, CodeCompletionTestsBase.nature);
        return module;
    }

    protected IGrammarVersionProvider createVersionProvider() {
        IGrammarVersionProvider versionProvider = new IGrammarVersionProvider() {

            public int getGrammarVersion() throws MisconfigurationException {
                if (data.file.toString().contains("_grammar3")) {
                    return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_3_0;
                }
View Full Code Here

        List<GeneratePropertiesRequest> requests = new ArrayList<GeneratePropertiesRequest>();
        GeneratePropertiesRequest req;
        for (INodeAdapter elem : attributes) {
            req = new GeneratePropertiesRequest(clazz, elem, properties, methodOffsetStrategy, propertyOffsetStrategy,
                    accessModifier, new AdapterPrefs("\n", new IGrammarVersionProvider() {

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

        for (int index : attributeSelection) {
            attributes.add(clazz.getAttributes().get(index));
        }
        ConstructorFieldRequest req = new ConstructorFieldRequest(clazz, attributes, this.offsetStrategy,
                new AdapterPrefs("\n", new IGrammarVersionProvider() {

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

    public List<ExtractMethodRequest> getRefactoringRequests() {
        List<ExtractMethodRequest> requests = new ArrayList<ExtractMethodRequest>();
        ExtractMethodRequest req = new ExtractMethodRequest("extracted_method", this.selection, this.scopeAdapter,
                this.parsedSelection, deducer.getParameters(), deducer.getReturns(), this.renameMap,
                this.offsetStrategy, new AdapterPrefs("\n", new IGrammarVersionProvider() {

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

        Tuple<IPythonNature, String> infoForFile = PydevPlugin.getInfoForFile(getEditorFile());
        return infoForFile.o1.getGrammarVersion();
    }

    public IGrammarVersionProvider getGrammarVersionProvider() {
        return new IGrammarVersionProvider() {

            public int getGrammarVersion() throws MisconfigurationException {
                //Always calculate at the present time based on the editor configuration.
                return PyEdit.this.getGrammarVersion();
            }
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.