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

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


                if (scopeVar.id.equals(var)) {
                    isStored = true; //NameTok are always store contexts.
                }

            } else if (astNode instanceof Import) {
                Import importNode = (Import) astNode;
                isStored = checkNames(var, importNode.names);

            } else if (astNode instanceof ImportFrom) {
                ImportFrom importFrom = (ImportFrom) astNode;
                isStored = checkNames(var, importFrom.names);
View Full Code Here


            case JJTNOT_1OP:
                ret = new UnaryOp(UnaryOp.Not, null);
                break;

            case JJTIMPORT:
                ret = new Import(null);
                break;
            case JJTDOT_OP:
                ret = new Attribute(null, null, Attribute.Load);
                break;
            case JJTSTAR_EXPR:
View Full Code Here

        }
    }

    //import_stmt: 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*)
    final public void import_stmt() throws ParseException {
        Import imp;
        Object spStr;
        try {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case IMPORT:
                    spStr = jj_consume_token(IMPORT);
                    imp = Import();
                    if (imp != null) {
                        imp.addSpecial(spStr, false);
                    }
                    break;
                case FROM:
                    temporaryToken = grammarActions.createSpecialStr("from");
                    jj_consume_token(FROM);
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

        }
    }

    //import_stmt: 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*)
    final public void import_stmt() throws ParseException {
        Import imp;
        Object spStr;
        try {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case IMPORT:
                    spStr = jj_consume_token(IMPORT);
                    imp = Import();
                    if (imp != null) {
                        imp.addSpecial(spStr, false);
                    }
                    break;
                case FROM:
                    temporaryToken = grammarActions.createSpecialStr("from");
                    jj_consume_token(FROM);
View Full Code Here

        }
    }

    //import_stmt: 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*)
    final public void import_stmt() throws ParseException {
        Import imp;
        Object spStr;
        try {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case IMPORT:
                    spStr = jj_consume_token(IMPORT);
                    imp = Import();
                    if (imp != null) {
                        imp.addSpecial(spStr, false);
                    }
                    break;
                case FROM:
                    temporaryToken = grammarActions.createSpecialStr("from");
                    jj_consume_token(FROM);
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

            } catch (Exception e) {
                Log.log(e);
            }
        }
        if (v instanceof Import) {
            Import f = (Import) v;
            FindLastLineVisitor findLastLineVisitor = new FindLastLineVisitor();
            try {
                f.accept(findLastLineVisitor);
                SimpleNode lastNode = findLastLineVisitor.getLastNode();
                return lastNode.beginLine;
            } catch (Exception e) {
                Log.log(e);
            }
View Full Code Here

        }
    }

    //import_stmt: 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*)
    final public void import_stmt() throws ParseException {
        Import imp;
        Object spStr;
        try {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case IMPORT:
                    spStr = jj_consume_token(IMPORT);
                    imp = Import();
                    if (imp != null) {
                        imp.addSpecial(spStr, false);
                    }
                    break;
                case FROM:
                    temporaryToken = grammarActions.createSpecialStr("from");
                    jj_consume_token(FROM);
View Full Code Here

                FunctionDef def = (FunctionDef) node;
                node = def.name;

            } 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) {
View Full Code Here

TOP

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

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.