Aha! fix tests of c++
This commit is contained in:
@ -18,19 +18,23 @@ import net.sourceforge.pmd.util.document.TextDocument;
|
||||
class CppBlockSkipper extends EscapeTranslator {
|
||||
|
||||
private final Pattern skipStart;
|
||||
private final String skipStartMarker;
|
||||
private final Pattern skipEnd;
|
||||
private final String skipEndMarker;
|
||||
|
||||
public CppBlockSkipper(TextDocument original, String skipStartMarker, String skipEndMarker) {
|
||||
super(original);
|
||||
skipStart = Pattern.compile("^" + Pattern.quote(skipStartMarker));
|
||||
skipEnd = Pattern.compile("^" + Pattern.quote(skipEndMarker));
|
||||
skipStart = Pattern.compile("^(?i)" + Pattern.quote(skipStartMarker), Pattern.MULTILINE);
|
||||
this.skipStartMarker = "\n" + skipStartMarker;
|
||||
skipEnd = Pattern.compile("^(?i)" + Pattern.quote(skipEndMarker), Pattern.MULTILINE);
|
||||
this.skipEndMarker = "\n" + skipEndMarker;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int gobbleMaxWithoutEscape(int maxOff) throws MalformedSourceException {
|
||||
Matcher start = skipStart.matcher(input).region(this.bufpos, maxOff);
|
||||
if (start.find()) {
|
||||
Matcher end = skipStart.matcher(input).region(start.end(), maxOff);
|
||||
Matcher end = skipEnd.matcher(input).region(start.end(), maxOff);
|
||||
if (end.find()) {
|
||||
return recordEscape(start.start(), end.end(), Chars.EMPTY);
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
[Image] or [Truncated image[ Bcol Ecol
|
||||
L1
|
||||
[void] 1 1
|
||||
[void] 1 2
|
||||
L5
|
||||
[main] 2 1
|
||||
[main] 2 2
|
||||
L9
|
||||
[(] 2 2
|
||||
L10
|
||||
[(] 1 2
|
||||
[)] 2 2
|
||||
L12
|
||||
[{] 2 2
|
||||
|
Reference in New Issue
Block a user