Package org.python.pydev.parser.jython.ast.factory

Examples of org.python.pydev.parser.jython.ast.factory.AdapterPrefs


                }
            };
        }
        String delimiter = PySelection.getDelimiter(document);

        PyAstFactory factory = new PyAstFactory(new AdapterPrefs(delimiter, versionProvider));
        stmtType overrideBody = factory.createOverrideBody(this.functionDef, parentClassName, currentClassName); //Note that the copy won't have a parent.

        FunctionDef functionDef = this.functionDef.createCopy(false);
        functionDef.body = new stmtType[] { overrideBody != null ? overrideBody : new Pass() };
View Full Code Here


    public String getNewLineDelim() {
        return TextUtilities.getDefaultLineDelimiter(this.doc);
    }

    public AdapterPrefs getAdapterPrefs() {
        return new AdapterPrefs(getNewLineDelim(), versionProvider);
    }
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

        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

                                        t.id = sourceToken.getRepresentation();
                                    }
                                } else {
                                    //unfortunately, for builtins we usually cannot trust the parameters.
                                    String representation = tokenAndBaseClass.o1.getRepresentation();
                                    PyAstFactory factory = new PyAstFactory(new AdapterPrefs(ps.getEndLineDelim(),
                                            request.nature));
                                    functionDef = factory.createFunctionDef(representation);
                                    functionDef.args = factory.createArguments(true);
                                    functionDef.args.vararg = new NameTok("args", NameTok.VarArg);
                                    functionDef.args.kwarg = new NameTok("kwargs", NameTok.KwArg);
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 String getEndLineDelimiter() {
        return TextUtilities.getDefaultLineDelimiter(doc);
    }

    public ModuleAdapter(PythonModuleManager pm, File file, IDocument doc, Module node, IPythonNature nature) {
        super(null, null, node, new AdapterPrefs(TextUtilities.getDefaultLineDelimiter(doc), nature));
        this.file = file;
        this.doc = doc;
        this.aliasToFQIdentifier = null;
        this.importedModules = null;
        this.nature = nature;
View Full Code Here

        if (doc != null) {
            this.doc = doc;
        } else {
            this.doc = PythonModuleManager.getDocFromFile(this.file);
        }
        init(null, null, (Module) module.getAst(), new AdapterPrefs(TextUtilities.getDefaultLineDelimiter(this.doc),
                nature));
        this.sourceModule = module;
        this.aliasToFQIdentifier = null;
        this.importedModules = null;
        this.nature = nature;
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.jython.ast.factory.AdapterPrefs

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.