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

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


            case JJTDOTTED_AS_NAME:
                NameTok asname = null;
                if (arity > 1) {
                    asname = makeName(NameTok.ImportName);
                }
                return new aliasType(makeName(NameTok.ImportName), asname);

            case JJTIMPORT_AS_NAME:
                asname = null;
                if (arity > 1) {
                    asname = makeName(NameTok.ImportName);
                }
                return new aliasType(makeName(NameTok.ImportName), asname);

            case JJTSTAR_EXPR:
                Starred s = (Starred) n;
                s.value = (exprType) this.stack.popNode();
                ctx.setStore(s);
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

        for (int i = 0; i < node.names.length; i++) {
            if (i > 0) {
                this.doc.addRequire(",", lastNode);
            }
            aliasType alias = node.names[i];
            handleAlias(alias);
        }

        afterNode(node);
View Full Code Here

        this.doc.addRequire(" import ", lastNode);
        if (node.names.length == 0) {
            this.doc.addRequire("*", lastNode);
        } else {
            for (int i = 0; i < node.names.length; i++) {
                aliasType alias = node.names[i];
                if (i > 0) {
                    doc.addRequire(",", lastNode);
                }
                handleAlias(alias);
            }
View Full Code Here

    }

    public Tuple<IModule, String> findModule(String moduleToFind, String currentModule, ICompletionState state,
            IModule current) throws CompletionRecursionException, MisconfigurationException {
        NameTok name = new NameTok(moduleToFind, NameTok.ImportModule);
        Import impTok = new Import(new aliasType[] { new aliasType(name, null) });

        List<IToken> tokens = new ArrayList<IToken>();
        List<IToken> imp = AbstractVisitor.makeImportToken(impTok, tokens, currentModule, true);
        IToken importedModule = imp.get(imp.size() - 1); //get the last one (it's the one with the 'longest' representation).
        return this.findOnImportedMods(importedModule, "", state, "", currentModule, current);
View Full Code Here

            Name name = (Name) node;
            return name.id;
        }

        if (node instanceof aliasType) {
            aliasType type = (aliasType) node;
            return ((NameTok) type.name).id;
        }
        if (node instanceof Attribute) {
            Attribute attribute = (Attribute) node;
            return discoverRep(attribute.attr);
View Full Code Here

        for (int i = 0; i < node.names.length; i++) {
            if (i > 0) {

            }
            aliasType alias = node.names[i];
            handleAlias(alias);

        }

        fixAfterNode(node);
View Full Code Here

        if (node.module != null) {
            node.module.accept(this);
        }

        for (int i = 0; i < node.names.length; i++) {
            aliasType alias = node.names[i];
            handleAlias(alias);
        }
        fixAfterNode(node);

        return null;
View Full Code Here

        } else if (astThis.node instanceof Import) {
            aliasType[] imports = ((Import) astThis.node).names;
            FastStringBuffer retVal = new FastStringBuffer();
            for (int i = 0; i < imports.length; i++) {
                aliasType aliasType = imports[i];

                //as ...
                if (aliasType.asname != null) {
                    retVal.append(((NameTok) aliasType.asname).id);
                    retVal.append(" = ");
                }

                retVal.append(((NameTok) aliasType.name).id);
                retVal.append(", ");
            }
            //delete the last 2 chars
            retVal.deleteLast();
            retVal.deleteLast();
            return retVal.toString();

        } else if (astThis.node instanceof ImportFrom) {
            // from wxPython.wx import *
            ImportFrom importToken = (ImportFrom) astThis.node;
            StringBuffer modules = new StringBuffer();
            for (int i = 0; i < importToken.names.length; i++) {
                aliasType aliasType = importToken.names[i];

                //as ...
                if (aliasType.asname != null) {
                    modules.append(((NameTok) aliasType.asname).id);
                    modules.append(" = ");
View Full Code Here

            } else if (node instanceof Import) {
                ArrayList<SimpleNode> ret = new ArrayList<SimpleNode>();
                Import importToken = (Import) node;
                for (int i = 0; i < importToken.names.length; i++) {
                    aliasType aliasType = importToken.names[i];

                    //as ...
                    if (aliasType.asname != null) {
                        ret.add(aliasType.asname);
                    }

                    ret.add(aliasType.name);
                }
                return ret.toArray(new SimpleNode[0]);

            } else if (node instanceof ImportFrom) {
                ArrayList<SimpleNode> ret = new ArrayList<SimpleNode>();
                ImportFrom importToken = (ImportFrom) node;
                boolean found = false;
                for (int i = 0; i < importToken.names.length; i++) {
                    found = true;
                    aliasType aliasType = importToken.names[i];

                    //as ...
                    if (aliasType.asname != null) {
                        ret.add(aliasType.asname);
                    }
View Full Code Here

TOP

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

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.