Merge branch 'master' into pmd/7.0.x

This commit is contained in:
Andreas Dangel
2022-04-29 13:40:05 +02:00
74 changed files with 6574 additions and 6510 deletions

View File

@@ -2,23 +2,17 @@
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.html.ast;
import java.util.Set;
import org.junit.Test;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.test.BaseNodeAttributePrinter;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper;
import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest;
import net.sourceforge.pmd.lang.rule.xpath.Attribute;
import net.sourceforge.pmd.util.CollectionUtil;
import net.sourceforge.pmd.lang.ast.test.CoordinatesPrinter;
public class PositionTest extends BaseTreeDumpTest {
public PositionTest() {
super(new PositionRenderer(), ".html");
super(CoordinatesPrinter.INSTANCE, ".html");
}
@Override
@@ -30,13 +24,4 @@ public class PositionTest extends BaseTreeDumpTest {
public void testPositions() {
doTest("SimpleHtmlFile2");
}
private static class PositionRenderer extends BaseNodeAttributePrinter {
private final Set<String> pos = CollectionUtil.setOf("BeginLine", "BeginColumn", "EndLine", "EndColumn");
@Override
protected boolean ignoreAttribute(Node node, Attribute attribute) {
return !pos.contains(attribute.getName());
}
}
}

View File

@@ -1,15 +1,15 @@
+- #document[@BeginColumn = "1", @BeginLine = "1", @EndColumn = "8", @EndLine = "7"]
+- #doctype[@BeginColumn = "1", @BeginLine = "1", @EndColumn = "15", @EndLine = "1"]
+- #text[@BeginColumn = "16", @BeginLine = "1", @EndColumn = "16", @EndLine = "1"]
+- html[@BeginColumn = "1", @BeginLine = "2", @EndColumn = "7", @EndLine = "7"]
| +- #text[@BeginColumn = "7", @BeginLine = "2", @EndColumn = "4", @EndLine = "3"]
| +- head[@BeginColumn = "5", @BeginLine = "3", @EndColumn = "22", @EndLine = "3"]
| | +- #text[@BeginColumn = "11", @BeginLine = "3", @EndColumn = "15", @EndLine = "3"]
| +- #text[@BeginColumn = "23", @BeginLine = "3", @EndColumn = "4", @EndLine = "4"]
| +- body[@BeginColumn = "5", @BeginLine = "4", @EndColumn = "11", @EndLine = "6"]
| | +- #text[@BeginColumn = "11", @BeginLine = "4", @EndColumn = "8", @EndLine = "5"]
| | +- h1[@BeginColumn = "9", @BeginLine = "5", @EndColumn = "22", @EndLine = "5"]
| | | +- #text[@BeginColumn = "13", @BeginLine = "5", @EndColumn = "17", @EndLine = "5"]
| | +- #text[@BeginColumn = "23", @BeginLine = "5", @EndColumn = "4", @EndLine = "6"]
| +- #text[@BeginColumn = "12", @BeginLine = "6", @EndColumn = "12", @EndLine = "6"]
+- #text[@BeginColumn = "8", @BeginLine = "7", @EndColumn = "8", @EndLine = "7"]
+- #document[@BeginColumn = 1, @BeginLine = 1, @EndColumn = 8, @EndLine = 7]
+- #doctype[@BeginColumn = 1, @BeginLine = 1, @EndColumn = 15, @EndLine = 1]
+- #text[@BeginColumn = 16, @BeginLine = 1, @EndColumn = 16, @EndLine = 1]
+- html[@BeginColumn = 1, @BeginLine = 2, @EndColumn = 7, @EndLine = 7]
| +- #text[@BeginColumn = 7, @BeginLine = 2, @EndColumn = 4, @EndLine = 3]
| +- head[@BeginColumn = 5, @BeginLine = 3, @EndColumn = 22, @EndLine = 3]
| | +- #text[@BeginColumn = 11, @BeginLine = 3, @EndColumn = 15, @EndLine = 3]
| +- #text[@BeginColumn = 23, @BeginLine = 3, @EndColumn = 4, @EndLine = 4]
| +- body[@BeginColumn = 5, @BeginLine = 4, @EndColumn = 11, @EndLine = 6]
| | +- #text[@BeginColumn = 11, @BeginLine = 4, @EndColumn = 8, @EndLine = 5]
| | +- h1[@BeginColumn = 9, @BeginLine = 5, @EndColumn = 22, @EndLine = 5]
| | | +- #text[@BeginColumn = 13, @BeginLine = 5, @EndColumn = 17, @EndLine = 5]
| | +- #text[@BeginColumn = 23, @BeginLine = 5, @EndColumn = 4, @EndLine = 6]
| +- #text[@BeginColumn = 12, @BeginLine = 6, @EndColumn = 12, @EndLine = 6]
+- #text[@BeginColumn = 8, @BeginLine = 7, @EndColumn = 8, @EndLine = 7]