Package org.pegdown.ast

Examples of org.pegdown.ast.RootNode.accept()


        assertThat("rootNode", rootNode, notNullValue());

        final int totalLength = source.length();
        MarkdownTokenListBuilder builder = new MarkdownTokenListBuilder(totalLength);
        MarkdownLexerVisitor visitor = new MarkdownLexerVisitor(builder);
        rootNode.accept(visitor);
        List<MarkdownToken> tokens = builder.build();
       
        assertThat(tokens, everyItem(nonZeroLength()));
        assertThat(totalLengthOf(tokens), equalTo(totalLength));
    }
View Full Code Here


        try {
            RootNode rootNode = markdownProcessor.parseMarkdown(markdownSource);

            MarkdownTokenListBuilder builder = new MarkdownTokenListBuilder(inputLength);
            MarkdownLexerVisitor visitor = new MarkdownLexerVisitor(builder);
            rootNode.accept(visitor);
            tokens = builder.build();
        }
        catch (ParsingTimeoutException ex) {
            LOG.log(Level.WARNING, "Time out while parsing Markdown source, falling back to no highlighting");
            tokens = Collections.singletonList(new MarkdownToken(MarkdownTokenId.PLAIN, 0, inputLength));
View Full Code Here

                RootNode rootNode = result.getRootNode();
                int extensions = result.getExtensions();
                if (rootNode != null) {
                    FileObject file = pr.getSnapshot().getSource().getFileObject();
                    MarkdownTOCVisitor visitor = new MarkdownTOCVisitor(file);
                    rootNode.accept(visitor);
                    MarkdownTOCRootItem tocRootItem
                            = new MarkdownTOCRootItem(file, rootNode, visitor.getTOCEntryItems());
                    MarkdownReferencesRootItem refsRootItem
                            = new MarkdownReferencesRootItem(file, rootNode);
View Full Code Here

                RootNode rootNode = result.getRootNode();
                if (rootNode != null) {
                    List<OffsetRange> sectionFolds = new ArrayList<OffsetRange>();
                    for (Node node : rootNode.getChildren()) {
                        MarkdownTOCVisitor visitor = new MarkdownTOCVisitor(pr.getSnapshot().getSource().getFileObject());
                        rootNode.accept(visitor);
                        sectionFolds = visitor.getOffsetRanges();
                    }
                    foldsByType = Collections.singletonMap("comments", sectionFolds);
                }
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.