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

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


        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


                }
            }

            if (functionFound != null) {
                int lastReturnedLine = it.getLastReturnedLine();
                NameTok nameTok = createNameTok(functionFound, lastReturnedLine, NameTok.FunctionName, ps);

                if (nameTok != null) {
                    FunctionDef functionDef = createFunctionDef(lastReturnedLine, nameTok,
                            PySelection.getFirstCharPosition(line));

                    if (!addStatement(body, functionDef)) {
                        return body;
                    }

                    if (stopOnFirstMatch) {
                        return body;
                    }
                }
                continue;
            }

            classMatcher.reset(line);

            if (classMatcher.find()) {
                int lastReturnedLine = it.getLastReturnedLine();

                NameTok nameTok = createNameTok(classMatcher, lastReturnedLine, NameTok.ClassName, ps);

                if (nameTok != null) {
                    ClassDef classDef = createClassDef(lastReturnedLine, nameTok,
                            PySelection.getFirstCharPosition(line));
View Full Code Here

        int absoluteCursorOffset = ps.getAbsoluteCursorOffset(lastReturnedLine, col);
        if (ParsingUtils.getContentType(ps.getDoc(), absoluteCursorOffset) != IPythonPartitions.PY_DEFAULT) {
            return null;
        }

        NameTok nameTok = new NameTok(matcher.group(NAME_GROUP), type);
        nameTok.beginLine = lastReturnedLine + 1;
        nameTok.beginColumn = col + 1;
        return nameTok;
    }
View Full Code Here

                //and clear them for the next call (they always must be before a function def)
                Suite suite = (Suite) stack.popNode();
                body = suite.body;

                argumentsType arguments = makeArguments(stack.nodeArity() - 2);
                NameTok nameTok = makeName(NameTok.FunctionName);
                Decorators decs = (Decorators) stack.popNode();
                decoratorsType[] decsexp = decs.exp;
                FunctionDef funcDef = new FunctionDef(nameTok, arguments, body, decsexp, null);
                if (decs.exp.length == 0) {
                    addSpecialsBefore(decs, 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

        } else {
            startLine -= 1;
        }
        stmtType goHere = FastParser.firstClassOrFunction(doc, startLine, searchForward, pyEdit.isCythonFile());

        NameTok node = getNameNode(goHere);
        if (node != null) {
            //ok, somewhere to go
            pyEdit.revealModelNode(node);

        } else {
View Full Code Here

    /**
     * @param defNode the ClassDef or FunctionDef from where we want to get the name
     * @return the name of the given statement
     */
    protected NameTok getNameNode(stmtType defNode) {
        NameTok node = null;
        if (defNode != null) {
            if (defNode instanceof ClassDef) {
                ClassDef def = (ClassDef) defNode;
                node = (NameTok) def.name;
            }
View Full Code Here

                        name = NodeUtils.getNameFromNameTok((NameTok) (attributeToken).attr);
                    } else if (token instanceof Name) {
                        Name nameToken = (Name) token;
                        name = nameToken.id;
                    } else if (token instanceof NameTok) {
                        NameTok nameTokToken = (NameTok) token;
                        name = NodeUtils.getNameFromNameTok(nameTokToken);
                    }

                    if (name != null) {
                        return !(name.startsWith("__") && (name.endsWith("__")));
View Full Code Here

        return null;
    }

    private void visitImportModules(aliasType[] names) {
        for (aliasType alias : names) {
            NameTok name = (NameTok) alias.name;
            NameTok asName = (NameTok) alias.asname;

            String realName = name.id;
            String aliasName = name.id;
            if (asName != null) {
                aliasName = asName.id;
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.