Search in sources :

Example 41 with ParseTree

use of org.antlr.v4.runtime.tree.ParseTree in project checkstyle by checkstyle.

the class JavadocParseTreeTest method docRootInheritDoc.

@Test
public void docRootInheritDoc() throws IOException {
    final String filename = getDocPath("InputDocRootInheritDoc.txt");
    final ParseTree generatedTree = parseJavadoc(getFileContent(new File(filename)));
    final ParseTree expectedTree = ParseTreeBuilder.treeDocRootInheritDoc();
    compareTrees(expectedTree, generatedTree);
}
Also used : File(java.io.File) ParseTree(org.antlr.v4.runtime.tree.ParseTree) Test(org.junit.Test)

Example 42 with ParseTree

use of org.antlr.v4.runtime.tree.ParseTree in project checkstyle by checkstyle.

the class JavadocParseTreeTest method javadocTagDescriptionWithInlineTags.

@Test
public void javadocTagDescriptionWithInlineTags() throws IOException {
    final String filename = getDocPath("InputJavadocTagDescriptionWithInlineTags.txt");
    final ParseTree generatedTree = parseJavadoc(getFileContent(new File(filename)));
    final ParseTree expectedTree = ParseTreeBuilder.treeJavadocTagDescriptionWithInlineTags();
    compareTrees(expectedTree, generatedTree);
}
Also used : File(java.io.File) ParseTree(org.antlr.v4.runtime.tree.ParseTree) Test(org.junit.Test)

Example 43 with ParseTree

use of org.antlr.v4.runtime.tree.ParseTree in project checkstyle by checkstyle.

the class JavadocParseTreeTest method serial.

@Test
public void serial() throws IOException {
    final String filename = getDocPath("InputSerial.txt");
    final ParseTree generatedTree = parseJavadoc(getFileContent(new File(filename)));
    final ParseTree expectedTree = ParseTreeBuilder.treeSerial();
    compareTrees(expectedTree, generatedTree);
}
Also used : File(java.io.File) ParseTree(org.antlr.v4.runtime.tree.ParseTree) Test(org.junit.Test)

Example 44 with ParseTree

use of org.antlr.v4.runtime.tree.ParseTree in project checkstyle by checkstyle.

the class JavadocParseTreeTest method oneSimpleHtmlTag.

@Test
public void oneSimpleHtmlTag() throws IOException {
    final String filename = getHtmlPath("InputOneSimpleHtmlTag.txt");
    final ParseTree generatedTree = parseJavadoc(getFileContent(new File(filename)));
    final ParseTree expectedTree = ParseTreeBuilder.treeOneSimpleHtmlTag();
    compareTrees(expectedTree, generatedTree);
}
Also used : File(java.io.File) ParseTree(org.antlr.v4.runtime.tree.ParseTree) Test(org.junit.Test)

Example 45 with ParseTree

use of org.antlr.v4.runtime.tree.ParseTree in project checkstyle by checkstyle.

the class JavadocParseTreeTest method authorWithMailto.

@Test
public void authorWithMailto() throws IOException {
    final String filename = getDocPath("InputAuthorWithMailto.txt");
    final ParseTree generatedTree = parseJavadoc(getFileContent(new File(filename)));
    final ParseTree expectedTree = ParseTreeBuilder.treeAuthorWithMailto();
    compareTrees(expectedTree, generatedTree);
}
Also used : File(java.io.File) ParseTree(org.antlr.v4.runtime.tree.ParseTree) Test(org.junit.Test)

Aggregations

ParseTree (org.antlr.v4.runtime.tree.ParseTree)102 CommonToken (org.antlr.v4.runtime.CommonToken)32 Test (org.junit.Test)32 JavadocContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.JavadocContext)31 TextContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.TextContext)29 File (java.io.File)24 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)24 ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)20 DescriptionContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.DescriptionContext)15 HtmlElementContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.HtmlElementContext)12 JavadocTagContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.JavadocTagContext)12 JavadocInlineTagContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.JavadocInlineTagContext)10 ReferenceContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.ReferenceContext)10 Grammar (org.antlr.v4.tool.Grammar)10 HtmlElementCloseContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.HtmlElementCloseContext)9 HtmlElementOpenContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.HtmlElementOpenContext)9 HtmlTagContext (com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser.HtmlTagContext)9 ParseTreeWalker (org.antlr.v4.runtime.tree.ParseTreeWalker)8 LexerGrammar (org.antlr.v4.tool.LexerGrammar)8 BailErrorStrategy (org.antlr.v4.runtime.BailErrorStrategy)7