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

Examples of org.python.pydev.parser.jython.ast.NameTok


    private Expr extractConstructorInit(IClassDefAdapter base) {
        FunctionDefAdapter init = base.getFirstInit();
        if (init != null) {
            if (!init.getArguments().hasOnlySelf()) {
                Attribute classInit = new Attribute(new Name(moduleAdapter.getBaseContextName(this.classAdapter,
                        base.getName()), Name.Load, false), new NameTok(NodeHelper.KEYWORD_INIT, NameTok.Attrib),
                        Attribute.Load);
                List<exprType> constructorParameters = init.getArguments().getSelfFilteredArgs();

                Name selfArg = new Name(NodeHelper.KEYWORD_SELF, Name.Load, false);
                constructorParameters.add(0, selfArg);
View Full Code Here


        //check on actual file
        requestCompl(new File(TestDependent.TEST_PYSRC_LOC + "/testlib/unittest/guitestcase.py"), "guite", -1, 0,
                new String[] {});

        Import importTok = new Import(new aliasType[] { new aliasType(new NameTok("unittest", NameTok.ImportModule),
                null) });
        this.imports = new ArrayList<IToken>();
        this.imports.add(new SourceToken(importTok, "unittest", "", "", ""));

        requestCompl("import unittest\nunittest", new String[] {}); //none because the import for unittest is already there
View Full Code Here

        Name name = (Name) stack.popNode();
        return makeName(ctx, name);
    }

    protected final NameTok makeName(int ctx, Name name) {
        NameTok n = new NameTok(name.id, ctx);
        n.beginColumn = name.beginColumn;
        n.beginLine = name.beginLine;
        addSpecials(name, n);
        //we have to create it because it could be that specials are added later
        //(so, the instance must be already created even if not used)
        name.specialsBefore = n.getSpecialsBefore();
        name.specialsAfter = n.getSpecialsAfter();
        return n;
    }
View Full Code Here

            case JJTFUNCDEF:
                suite = (Suite) stack.popNode();
                body = suite.body;

                argumentsType arguments = makeArguments(stack.nodeArity() - 1);
                NameTok nameTok = makeName(NameTok.FunctionName);
                //decorator is always null at this point... it's decorated later on
                FunctionDef funcDef = new FunctionDef(nameTok, arguments, body, null, null);
                addSpecialsAndClearOriginal(suite, funcDef);
                setParentForFuncOrClass(body, funcDef);
                return funcDef;
View Full Code Here

                return null;
        }
    }

    NameTok[] getVargAndKwarg(java.util.List<SimpleNode> args) throws Exception {
        NameTok varg = null;
        NameTok kwarg = null;
        for (Iterator<SimpleNode> iter = args.iterator(); iter.hasNext();) {
            SimpleNode node = iter.next();
            if (node.getId() == JJTEXTRAKEYWORDLIST) {
                ExtraArg a = (ExtraArg) node;
                kwarg = a.tok;
View Full Code Here

        return new argumentsType(fpargs, varg, kwarg, newdefs, null, null, null, null, null, null);

    }

    private argumentsType makeArguments(int l) throws Exception {
        NameTok kwarg = null;
        NameTok stararg = null;
        if (l > 0 && stack.peekNode().getId() == JJTEXTRAKEYWORDLIST) {
            ExtraArg node = (ExtraArg) stack.popNode();
            kwarg = node.tok;
            l--;
            addSpecialsAndClearOriginal(node, kwarg);
View Full Code Here

        this.offsetStrategy = req.offsetMethodStrategy;
    }

    @Override
    protected SimpleNode getEditNode() {
        NameTok functionName = new NameTok(accessorName, NameTok.FunctionName);
        argumentsType args = createArguments();
        stmtType[] body = createBody();

        return new FunctionDef(functionName, args, body, null, null);
    }
View Full Code Here

        return new argumentsType(params, null, null, null, null, null, null, null, null, null);
    }

    private stmtType[] createBody() {
        Name self = new Name(NodeHelper.KEYWORD_SELF, Name.Load, false);
        NameTok name = new NameTok(nodeHelper.getPrivateAttr(attributeName), NameTok.Attrib);
        Attribute returnAttribute = new Attribute(self, name, Attribute.Load);
        Return returnStmt = new Return(returnAttribute);

        return new stmtType[] { returnStmt };
    }
View Full Code Here

        this.offsetStrategy = req.offsetMethodStrategy;
    }

    @Override
    protected SimpleNode getEditNode() {
        NameTok functionName = new NameTok(accessorName, NameTok.FunctionName);
        argumentsType args = createArguments();
        stmtType[] body = createBody();

        return new FunctionDef(functionName, args, body, null, null);
    }
View Full Code Here

        return new argumentsType(params, null, null, null, null, null, null, null, null, null);
    }

    private stmtType[] createBody() {
        Name self = new Name(NodeHelper.KEYWORD_SELF, Name.Load, false);
        NameTok name = new NameTok(nodeHelper.getPrivateAttr(attributeName), NameTok.Attrib);
        Attribute attribute = new Attribute(self, name, Attribute.Del);
        Delete delete = new Delete(new exprType[] { attribute });

        return new stmtType[] { delete };
    }
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.jython.ast.NameTok

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.