Search in sources :

Example 21 with ParseTree

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

the class JavadocParseTreeTest method seeReferenceWithFewNestedClasses.

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

Example 22 with ParseTree

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

the class JavadocParseTreeTest method listWithUnclosedItemInUnclosedParagraph.

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

Example 23 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 24 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 25 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)

Aggregations

ParseTree (org.antlr.v4.runtime.tree.ParseTree)89 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 ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)19 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)19 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 LexerGrammar (org.antlr.v4.tool.LexerGrammar)8 BailErrorStrategy (org.antlr.v4.runtime.BailErrorStrategy)7 LexerInterpreter (org.antlr.v4.runtime.LexerInterpreter)7