Package org.python.pydev.editor.codecompletion.revisited.visitors

Examples of org.python.pydev.editor.codecompletion.revisited.visitors.FindScopeVisitor


            int startLineIndexInASTCoords = startLineIndexIndocCoords + 1; //from doc to ast
            Module module = info.getModuleAdapter().getASTNode();
            SimpleNode currentScope = module;

            try {
                FindScopeVisitor scopeVisitor = new FindScopeVisitor(startLineIndexInASTCoords,
                        selection.getCursorColumn() + 1);
                module.accept(scopeVisitor);
                ILocalScope scope = scopeVisitor.scope;
                FastStack scopeStack = scope.getScopeStack();
                currentScope = (SimpleNode) scopeStack.peek(); //at least the module should be there if we don't have anything.
View Full Code Here


     * @note we don't have to worry about the ast, as it won't change after we create the source module with it.
     */
    @SuppressWarnings("unchecked")
    private FindScopeVisitor getScopeVisitor(int line, int col) throws Exception {
        Tuple key = new Tuple(line, col);
        FindScopeVisitor scopeVisitor = this.scopeVisitorCache.getObj(key);
        if (scopeVisitor == null) {
            scopeVisitor = new FindScopeVisitor(line, col);
            if (ast != null) {
                ast.accept(scopeVisitor);
            }
            this.scopeVisitorCache.add(key, scopeVisitor);
        }
View Full Code Here

        //the line passed in starts at 1 and the lines for the visitor start at 0
        ArrayList<Definition> toRet = new ArrayList<Definition>();

        //first thing is finding its scope
        FindScopeVisitor scopeVisitor = getScopeVisitor(line, col);

        //this visitor checks for assigns for the token
        FindDefinitionModelVisitor visitor = getFindDefinitionsScopeVisitor(actTok, line, col);

        List<Definition> defs = visitor.definitions;
View Full Code Here

                    }

                    if (module instanceof SourceModule) {
                        //this is just to get its scope...
                        SourceModule m = (SourceModule) module;
                        FindScopeVisitor scopeVisitor = m.getScopeVisitor(a.beginLine, a.beginColumn);
                        return new Definition(def.o1, def.o2, rep, a, scopeVisitor.scope, module);
                    } else {
                        //line, col
                        return new Definition(def.o1, def.o2, rep, a, new LocalScope(new FastStack<SimpleNode>(5)),
                                module);
View Full Code Here

     * @param col: at 0
     */
    public IToken[] getLocalTokens(int line, int col, ILocalScope scope) {
        try {
            if (scope == null) {
                FindScopeVisitor scopeVisitor = getScopeVisitor(line, col);
                scope = scopeVisitor.scope;
            }

            return scope.getLocalTokens(line, col, false);
        } catch (Exception e) {
View Full Code Here

     * @param line: at 0
     * @param col: at 0
     */
    public ILocalScope getLocalScope(int line, int col) {
        try {
            FindScopeVisitor scopeVisitor = getScopeVisitor(line, col);

            return scopeVisitor.scope;
        } catch (Exception e) {
            Log.log(e);
            return null;
View Full Code Here

    /**
     * @return the line that ends a given scope (or -1 if not found)
     */
    public int findAstEnd(SimpleNode node) {
        try {
            FindScopeVisitor scopeVisitor = getScopeVisitor(node.beginLine, node.beginColumn);

            return scopeVisitor.scope.getScopeEndLine();
        } catch (Exception e) {
            Log.log(e);
            return -1;
View Full Code Here

    /**
     * @return the main line (or -1 if not found)
     */
    public int findIfMain() {
        try {
            FindScopeVisitor scopeVisitor = getScopeVisitor(-1, -1);

            return scopeVisitor.scope.getIfMainLine();
        } catch (Exception e) {
            Log.log(e);
            return -1;
View Full Code Here

        if (module instanceof SourceModule) {
            SourceModule sourceModule = (SourceModule) module;
            s = sourceModule.getAst();
        }
        if (s != null) {
            FindScopeVisitor visitor = new FindScopeVisitor(state.getLine(), 0);
            try {
                s.accept(visitor);
                if (checkIfInCorrectScope) {
                    boolean scopeCorrect = false;
View Full Code Here

TOP

Related Classes of org.python.pydev.editor.codecompletion.revisited.visitors.FindScopeVisitor

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.