Package org.python.pydev.parser.fastparser.ScopesParser

Examples of org.python.pydev.parser.fastparser.ScopesParser.Scopes


                            return new TextSelection(currDottedToken.o2, currDottedToken.o1.length());
                        }
                    }
                }
            }
            Scopes scopes = ScopesParser.createScopes(doc);
            //            System.out.println(scopes.debugString(doc));
            IRegion scope = scopes.getScopeForSelection(selection.getOffset(), selection.getLength());
            if (scope != null) {
                return new TextSelection(scope.getOffset(), scope.getLength());
            }

        } catch (BadLocationException e) {
View Full Code Here


                "    def method(self, a=(10,20)):\n"
                +
                "        '''\n" +
                "    multi string\n" +
                "        '''\n");
        Scopes scopes = ScopesParser.createScopes(doc);
        assertEquals("" +
                "[1 [2 #comment 2]\n" +
                "[4 class Foo([3 object 3]):\n"
                +
                "    [5 [8 def method([6 self, a=([7 10,20 7]) 6]):\n" +
                "        [9 [10 '''\n"
                +
                "    multi string\n" +
                "        ''' 10]\n" +
                " 4] 5] 8] 9] 1]" +
                "", scopes.debugString(doc)
                .toString());
    }
View Full Code Here

                .toString());
    }

    public void testScopes2() throws Exception {
        Document doc = new Document("a().o");
        Scopes scopes = ScopesParser.createScopes(doc);
        assertEquals(new Region(0, 5), scopes.getScopeForSelection(2, 0));
    }
View Full Code Here

        Document doc = new Document("(1\n" +
                "\n" +
                "class Bar(object):\n" +
                "    call" +
                "");
        Scopes scopes = ScopesParser.createScopes(doc);
        assertEquals("" +
                "[1 (1\n" +
                "\n" +
                "[3 class Bar([2 object 2]):\n" +
                "    [4 call 3] 4] 1]" +
                "", scopes
                .debugString(doc).toString());
    }
View Full Code Here

                .debugString(doc).toString());
    }

    public void testScopes3() throws Exception {
        Document doc = new Document("a(.o");
        Scopes scopes = ScopesParser.createScopes(doc);
        assertEquals(new Region(0, 4), scopes.getScopeForSelection(2, 0));
    }
View Full Code Here

                "    if True:\n" +
                "        a = \\\n" +
                "xx\n" +
                "    else:\n" +
                "        pass");
        Scopes scopes = ScopesParser.createScopes(doc);
        assertEquals("" +
                "[1 [2 #comment 2]\n" +
                "[4 class Foo([3 object 3]):\n"
                +
                "    [5 [9 def method([6 self, a=([7 bb,([8 cc,dd 8]) 7]) 6]):\n" +
                "        [10 [11 '''\n"
                +
                "    multi string\n" +
                "        ''' 4] 5] 9] 10] 11]\n" +
                "[12 class Class2:\n"
                +
                "    [13 [14 if True:\n" +
                "        [15 a = \\\n" +
                "xx 14] 15]\n" +
                "    [16 else:\n"
                +
                "        [17 pass 12] 13] 16] 17] 1]" +
                "", scopes.debugString(doc).toString());

        assertEquals(new Region(0, 8), scopes.getScopeForSelection(0, 2));
        assertEquals(new Region(19, 6), scopes.getScopeForSelection(20, 0));
    }
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.fastparser.ScopesParser.Scopes

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.