Package org.python.pydev.parser.visitors.scope

Examples of org.python.pydev.parser.visitors.scope.OutlineCreatorVisitor


                "#--- comm module\n" +
                "";

        SimpleNode node = parseLegalDocStr(str);

        OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(node);
        ParsedItem item = new ParsedItem(visitor.getAll().toArray(new ASTEntryWithChildren[0]), null);

        //module level: Foo and 1 comment
        assertEquals(2, item.getAstChildrenEntries().length);
        assertNull(item.getAstChildrenEntries()[1].children); //comment has no children
View Full Code Here


                +
                "    pass";

        SimpleNode node = parseLegalDocStr(str);

        OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(node);
        ParsedItem item = new ParsedItem(visitor.getAll().toArray(new ASTEntryWithChildren[0]), null);

        //module level: 2 comments
        assertEquals(2, item.getAstChildrenEntries().length);
        assertNull(item.getAstChildrenEntries()[0].children); //comment has no children
        assertNull(item.getAstChildrenEntries()[1].children); //comment has no children
View Full Code Here

                "        self.foo, self.bar = 1, 2\n" +
                "";

        SimpleNode node = parseLegalDocStr(str);

        OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(node);
        ParsedItem item = new ParsedItem(visitor.getAll().toArray(new ASTEntryWithChildren[0]), null);

        //module level: Test
        assertEquals(1, item.getAstChildrenEntries().length);

        //class level: __init__
View Full Code Here

                "\n" +
                "";

        SimpleNode node = parseLegalDocStr(str);

        OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(node);
        ParsedItem item = new ParsedItem(visitor.getAll().toArray(new ASTEntryWithChildren[0]), null);

        //module level: Foo and main
        assertEquals(2, item.getAstChildrenEntries().length);
        assertNull(item.getAstChildrenEntries()[0].children); //no children
    }
View Full Code Here

                "";

        SimpleNode node = parseLegalDocStr(str);
        SimpleNode node2 = parseLegalDocStr(str2);

        OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(node);
        ParsedItem item = new ParsedItem(visitor.getAll().toArray(new ASTEntryWithChildren[0]), null);

        OutlineCreatorVisitor visitor2 = OutlineCreatorVisitor.create(node2);
        ParsedItem item2 = new ParsedItem(visitor2.getAll().toArray(new ASTEntryWithChildren[0]), null);

        item.updateTo(item2);
    }
View Full Code Here

                                    }
                                }
                                if (module instanceof SourceModule) {
                                    SourceModule sourceModule = (SourceModule) module;

                                    OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(sourceModule.getAst());
                                    ParsedItem root = new ParsedItem(visitor.getAll().toArray(
                                            new ASTEntryWithChildren[0]), null);
                                    childrenToReturn = getChildrenFromParsedItem(wrappedResourceParent, root, file);
                                }
                            }
                        }
View Full Code Here

            public void modelChanged(final SimpleNode ast) {
                Display.getDefault().asyncExec(new Runnable() {
                    public void run() {
                        synchronized (this) {
                            OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(ast);
                            setRoot(new ParsedItem(visitor.getAll().toArray(new ASTEntryWithChildren[0]),
                                    ParsedModel.this.editor.getErrorDescription()));
                        }
                    }
                });
            }

            public void errorChanged(final ErrorDescription errorDesc) {
                Display.getDefault().asyncExec(new Runnable() {
                    public void run() {
                        synchronized (this) {
                            ParsedItem currRoot = getRoot();

                            ParsedItem newRoot;
                            if (currRoot != null) {
                                newRoot = new ParsedItem(currRoot.getAstChildrenEntries(), errorDesc);
                            } else {
                                newRoot = new ParsedItem(new ASTEntryWithChildren[0], errorDesc);
                            }
                            setRoot(newRoot);
                        }
                    }
                });
            }

        };

        OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(editor.getAST());
        root = new ParsedItem(visitor.getAll().toArray(new ASTEntryWithChildren[0]), editor.getErrorDescription());
        editor.addModelListener(modelListener);
    }
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.visitors.scope.OutlineCreatorVisitor

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.