Skip to content

Commit

Permalink
Issue checkstyle#3810: Replaced singletonTag in nested html rules in …
Browse files Browse the repository at this point in the history
…javadoc grammar with singletonElement
  • Loading branch information
voidfist committed Jul 26, 2017
1 parent a978ce5 commit a3daea0
Show file tree
Hide file tree
Showing 6 changed files with 580 additions and 99 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Expand Up @@ -1515,8 +1515,8 @@
<haltOnFailure>true</haltOnFailure>
<branchRate>100</branchRate>
<lineRate>100</lineRate>
<totalBranchRate>81</totalBranchRate>
<totalLineRate>84</totalLineRate>
<totalBranchRate>83</totalBranchRate>
<totalLineRate>88</totalLineRate>
<regexes>
<regex>
<pattern>com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer</pattern>
Expand All @@ -1530,13 +1530,13 @@
</regex>
<regex>
<pattern>com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocParser</pattern>
<branchRate>23</branchRate>
<lineRate>27</lineRate>
<branchRate>34</branchRate>
<lineRate>45</lineRate>
</regex>
<regex>
<pattern>com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocLexer</pattern>
<branchRate>41</branchRate>
<lineRate>55</lineRate>
<branchRate>57</branchRate>
<lineRate>75</lineRate>
</regex>
</regexes>
</check>
Expand Down
Expand Up @@ -133,7 +133,7 @@ pTagOpen: OPEN P_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | WS)* CL
pTagClose: OPEN SLASH P_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
paragraph: pTagOpen
(htmlTag
| singletonTag
| singletonElement
| li
| tr
| td
Expand Down Expand Up @@ -175,7 +175,7 @@ liTagOpen: OPEN LI_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | WS)*
liTagClose: OPEN SLASH LI_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
li: liTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| tr
| td
Expand Down Expand Up @@ -217,7 +217,7 @@ trTagOpen: OPEN TR_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | WS)*
trTagClose: OPEN SLASH TR_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
tr: trTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| td
Expand Down Expand Up @@ -259,7 +259,7 @@ tdTagOpen: OPEN TD_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | WS)*
tdTagClose: OPEN SLASH TD_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
td: tdTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -301,7 +301,7 @@ thTagOpen: OPEN TH_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | WS)*
thTagClose: OPEN SLASH TH_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
th: thTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -343,7 +343,7 @@ bodyTagOpen: OPEN BODY_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | W
bodyTagClose: OPEN SLASH BODY_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
body: bodyTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -385,7 +385,7 @@ colgroupTagOpen: OPEN COLGROUP_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTE
colgroupTagClose: OPEN SLASH COLGROUP_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
colgroup: colgroupTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -427,7 +427,7 @@ ddTagOpen: OPEN DD_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | WS)*
ddTagClose: OPEN SLASH DD_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
dd: ddTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -469,7 +469,7 @@ dtTagOpen: OPEN DT_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | WS)*
dtTagClose: OPEN SLASH DT_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
dt: dtTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -511,7 +511,7 @@ headTagOpen: OPEN HEAD_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | W
headTagClose: OPEN SLASH HEAD_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
head: headTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -553,7 +553,7 @@ htmlTagOpen: OPEN HTML_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK | W
htmlTagClose: OPEN SLASH HTML_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
html: htmlTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -595,7 +595,7 @@ optionTagOpen: OPEN OPTION_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK
optionTagClose: OPEN SLASH OPTION_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
option: optionTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -637,7 +637,7 @@ tbodyTagOpen: OPEN TBODY_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK |
tbodyTagClose: OPEN SLASH TBODY_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
tbody: tbodyTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -679,7 +679,7 @@ tfootTagOpen: OPEN TFOOT_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK |
tfootTagClose: OPEN SLASH TFOOT_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
tfoot: tfootTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down Expand Up @@ -721,7 +721,7 @@ theadTagOpen: OPEN THEAD_HTML_TAG_NAME (attribute | NEWLINE | LEADING_ASTERISK |
theadTagClose: OPEN SLASH THEAD_HTML_TAG_NAME (NEWLINE | LEADING_ASTERISK | WS)* CLOSE;
thead: theadTagOpen
(htmlTag
| singletonTag
| singletonElement
| paragraph
| li
| tr
Expand Down
Expand Up @@ -251,4 +251,10 @@ public void testJavadocWithCrAsNewline() throws Exception {
verifyJavadocTree(getPath("expectedJavadocWithCrAsNewlineAst.txt"),
getPath("InputJavadocWithCrAsNewline.javadoc"));
}

@Test
public void testNestingWithSingletonElement() throws Exception {
verifyJavadocTree(getHtmlPath("expectedNestingWithSingletonElementAst.txt"),
getHtmlPath("InputNestingWithSingletonElement.javadoc"));
}
}
@@ -0,0 +1,19 @@
* <p> paragraph with a <br>singletonElement. <hr> And it contains another one. </p>
* <li> List with singletonElement
* <param name=movie value="~/imitation game.mp4"> <param name=allowfullscreen value=true> </li>
*
* <tr> tr with <base href="www.something.com"> singletonElement </tr>
* <td> td with singletonElement <br/> </td>
* <th> th with <base/> singletonElement </th>
* <body> body with <br/> singletonElement </body>
* <colgroup><col><col><col></colgroup>
* <dd> dd with <hr> singletonElement </dd>
* <dt> dt with <img src="~/singletonElement.jpg" alt="" width="100" height="150"/> singletonElement </dt>
* <head> head with <img src="~/singletonElement.jpg" alt="" width="100" height="150">
* singletonElement </head>
*
* <html> <bR> <Br> <BR> <Br/> <BR/> <bR/> </html>
* <option> <INPut/> </option>
* <tbody> <input/> <br> </tbody>
* <thead> <br> </thead>
* <tfoot> <AREA ALT="alt" COORDS="100,0,200,50" HREF="/href/"> </tfoot>
@@ -1,81 +1,76 @@
JAVADOC -> JAVADOC [0:0]
|--HTML_ELEMENT -> HTML_ELEMENT [0:0]
| `--P_TAG_OPEN -> P_TAG_OPEN [0:0]
| |--OPEN -> < [0:0]
| |--P_HTML_TAG_NAME -> P [0:1]
| `--CLOSE -> > [0:2]
|--NEWLINE -> \r\n [0:3]
|--HTML_ELEMENT -> HTML_ELEMENT [1:0]
| `--SINGLETON_ELEMENT -> SINGLETON_ELEMENT [1:0]
| `--BR_TAG -> BR_TAG [1:0]
| |--OPEN -> < [1:0]
| |--BR_HTML_TAG_NAME -> br [1:1]
| `--CLOSE -> > [1:3]
|--NEWLINE -> \r\n [1:4]
|--HTML_ELEMENT -> HTML_ELEMENT [2:0]
| `--SINGLETON_ELEMENT -> SINGLETON_ELEMENT [2:0]
| `--BR_TAG -> BR_TAG [2:0]
| |--OPEN -> < [2:0]
| |--BR_HTML_TAG_NAME -> br [2:1]
| `--SLASH_CLOSE -> /> [2:3]
|--NEWLINE -> \r\n [2:5]
|--HTML_ELEMENT -> HTML_ELEMENT [3:0]
| `--SINGLETON_ELEMENT -> SINGLETON_ELEMENT [3:0]
| `--BR_TAG -> BR_TAG [3:0]
| |--OPEN -> < [3:0]
| |--BR_HTML_TAG_NAME -> BR [3:1]
| `--CLOSE -> > [3:3]
|--NEWLINE -> \r\n [3:4]
|--HTML_ELEMENT -> HTML_ELEMENT [4:0]
| `--SINGLETON_ELEMENT -> SINGLETON_ELEMENT [4:0]
| `--BR_TAG -> BR_TAG [4:0]
| |--OPEN -> < [4:0]
| |--BR_HTML_TAG_NAME -> BR [4:1]
| `--SLASH_CLOSE -> /> [4:3]
|--NEWLINE -> \r\n [4:5]
|--HTML_ELEMENT -> HTML_ELEMENT [5:0]
| `--HTML_TAG -> HTML_TAG [5:0]
| |--HTML_ELEMENT_OPEN -> HTML_ELEMENT_OPEN [5:0]
| | |--OPEN -> < [5:0]
| | |--HTML_TAG_NAME -> TABLE [5:1]
| | `--CLOSE -> > [5:6]
| |--NEWLINE -> \r\n [5:7]
| |--TEXT -> \t [6:0]
| |--HTML_ELEMENT -> HTML_ELEMENT [6:1]
| | `--TR -> TR [6:1]
| | |--TR_TAG_OPEN -> TR_TAG_OPEN [6:1]
| | | |--OPEN -> < [6:1]
| | | |--TR_HTML_TAG_NAME -> tr [6:2]
| | | `--CLOSE -> > [6:4]
| | `--TR_TAG_CLOSE -> TR_TAG_CLOSE [6:5]
| | |--OPEN -> < [6:5]
| | |--SLASH -> / [6:6]
| | |--TR_HTML_TAG_NAME -> TR [6:7]
| | `--CLOSE -> > [6:9]
| |--NEWLINE -> \r\n [6:10]
| |--TEXT -> \t [7:0]
| |--HTML_ELEMENT -> HTML_ELEMENT [7:1]
| | `--TR -> TR [7:1]
| | |--TR_TAG_OPEN -> TR_TAG_OPEN [7:1]
| | | |--OPEN -> < [7:1]
| | | |--TR_HTML_TAG_NAME -> TR [7:2]
| | | `--CLOSE -> > [7:4]
| | `--TR_TAG_CLOSE -> TR_TAG_CLOSE [7:5]
| | |--OPEN -> < [7:5]
| | |--SLASH -> / [7:6]
| | |--TR_HTML_TAG_NAME -> tr [7:7]
| | `--CLOSE -> > [7:9]
| |--NEWLINE -> \r\n [7:10]
| `--HTML_ELEMENT_CLOSE -> HTML_ELEMENT_CLOSE [8:0]
| |--OPEN -> < [8:0]
| |--SLASH -> / [8:1]
| |--HTML_TAG_NAME -> table [8:2]
| `--CLOSE -> > [8:7]
|--NEWLINE -> \r\n [8:8]
|--HTML_ELEMENT -> HTML_ELEMENT [9:0]
| `--P_TAG_CLOSE -> P_TAG_CLOSE [9:0]
| |--OPEN -> < [9:0]
| |--SLASH -> / [9:1]
| |--P_HTML_TAG_NAME -> p [9:2]
| `--CLOSE -> > [9:3]
| `--PARAGRAPH -> PARAGRAPH [0:0]
| |--P_TAG_OPEN -> P_TAG_OPEN [0:0]
| | |--OPEN -> < [0:0]
| | |--P_HTML_TAG_NAME -> P [0:1]
| | `--CLOSE -> > [0:2]
| |--NEWLINE -> \r\n [0:3]
| |--SINGLETON_ELEMENT -> SINGLETON_ELEMENT [1:0]
| | `--BR_TAG -> BR_TAG [1:0]
| | |--OPEN -> < [1:0]
| | |--BR_HTML_TAG_NAME -> br [1:1]
| | `--CLOSE -> > [1:3]
| |--NEWLINE -> \r\n [1:4]
| |--SINGLETON_ELEMENT -> SINGLETON_ELEMENT [2:0]
| | `--BR_TAG -> BR_TAG [2:0]
| | |--OPEN -> < [2:0]
| | |--BR_HTML_TAG_NAME -> br [2:1]
| | `--SLASH_CLOSE -> /> [2:3]
| |--NEWLINE -> \r\n [2:5]
| |--SINGLETON_ELEMENT -> SINGLETON_ELEMENT [3:0]
| | `--BR_TAG -> BR_TAG [3:0]
| | |--OPEN -> < [3:0]
| | |--BR_HTML_TAG_NAME -> BR [3:1]
| | `--CLOSE -> > [3:3]
| |--NEWLINE -> \r\n [3:4]
| |--SINGLETON_ELEMENT -> SINGLETON_ELEMENT [4:0]
| | `--BR_TAG -> BR_TAG [4:0]
| | |--OPEN -> < [4:0]
| | |--BR_HTML_TAG_NAME -> BR [4:1]
| | `--SLASH_CLOSE -> /> [4:3]
| |--NEWLINE -> \r\n [4:5]
| |--HTML_TAG -> HTML_TAG [5:0]
| | |--HTML_ELEMENT_OPEN -> HTML_ELEMENT_OPEN [5:0]
| | | |--OPEN -> < [5:0]
| | | |--HTML_TAG_NAME -> TABLE [5:1]
| | | `--CLOSE -> > [5:6]
| | |--NEWLINE -> \r\n [5:7]
| | |--TEXT -> \t [6:0]
| | |--HTML_ELEMENT -> HTML_ELEMENT [6:1]
| | | `--TR -> TR [6:1]
| | | |--TR_TAG_OPEN -> TR_TAG_OPEN [6:1]
| | | | |--OPEN -> < [6:1]
| | | | |--TR_HTML_TAG_NAME -> tr [6:2]
| | | | `--CLOSE -> > [6:4]
| | | `--TR_TAG_CLOSE -> TR_TAG_CLOSE [6:5]
| | | |--OPEN -> < [6:5]
| | | |--SLASH -> / [6:6]
| | | |--TR_HTML_TAG_NAME -> TR [6:7]
| | | `--CLOSE -> > [6:9]
| | |--NEWLINE -> \r\n [6:10]
| | |--TEXT -> \t [7:0]
| | |--HTML_ELEMENT -> HTML_ELEMENT [7:1]
| | | `--TR -> TR [7:1]
| | | |--TR_TAG_OPEN -> TR_TAG_OPEN [7:1]
| | | | |--OPEN -> < [7:1]
| | | | |--TR_HTML_TAG_NAME -> TR [7:2]
| | | | `--CLOSE -> > [7:4]
| | | `--TR_TAG_CLOSE -> TR_TAG_CLOSE [7:5]
| | | |--OPEN -> < [7:5]
| | | |--SLASH -> / [7:6]
| | | |--TR_HTML_TAG_NAME -> tr [7:7]
| | | `--CLOSE -> > [7:9]
| | |--NEWLINE -> \r\n [7:10]
| | `--HTML_ELEMENT_CLOSE -> HTML_ELEMENT_CLOSE [8:0]
| | |--OPEN -> < [8:0]
| | |--SLASH -> / [8:1]
| | |--HTML_TAG_NAME -> table [8:2]
| | `--CLOSE -> > [8:7]
| |--NEWLINE -> \r\n [8:8]
| `--P_TAG_CLOSE -> P_TAG_CLOSE [9:0]
| |--OPEN -> < [9:0]
| |--SLASH -> / [9:1]
| |--P_HTML_TAG_NAME -> p [9:2]
| `--CLOSE -> > [9:3]
`--EOF -> <EOF> [9:4]

0 comments on commit a3daea0

Please sign in to comment.