Cleanup cpp
This commit is contained in:
@ -6,8 +6,8 @@ package net.sourceforge.pmd.internal.util;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
@ -216,7 +216,7 @@ final class SourceCodePositioner {
|
||||
buf = new int[Math.max(1, bufSize)];
|
||||
}
|
||||
|
||||
public Builder() {
|
||||
Builder() {
|
||||
this(400);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ package net.sourceforge.pmd.cpd;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.sourceforge.pmd.cpd.internal.JavaCCTokenizer;
|
||||
import net.sourceforge.pmd.lang.TokenManager;
|
||||
@ -22,8 +23,8 @@ import net.sourceforge.pmd.util.document.TextDocument;
|
||||
public class CPPTokenizer extends JavaCCTokenizer {
|
||||
|
||||
private boolean skipBlocks;
|
||||
private String skipBlocksStart;
|
||||
private String skipBlocksEnd;
|
||||
private Pattern skipBlocksStart;
|
||||
private Pattern skipBlocksEnd;
|
||||
|
||||
public CPPTokenizer() {
|
||||
setProperties(new Properties()); // set the defaults
|
||||
@ -48,11 +49,11 @@ public class CPPTokenizer extends JavaCCTokenizer {
|
||||
if (skipBlocks) {
|
||||
String skipBlocksPattern = properties.getProperty(OPTION_SKIP_BLOCKS_PATTERN, DEFAULT_SKIP_BLOCKS_PATTERN);
|
||||
String[] split = skipBlocksPattern.split("\\|", 2);
|
||||
skipBlocksStart = split[0];
|
||||
skipBlocksStart = CppBlockSkipper.compileSkipMarker(split[0]);
|
||||
if (split.length == 1) {
|
||||
skipBlocksEnd = split[0];
|
||||
skipBlocksEnd = skipBlocksStart;
|
||||
} else {
|
||||
skipBlocksEnd = split[1];
|
||||
skipBlocksEnd = CppBlockSkipper.compileSkipMarker(split[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,16 +18,16 @@ 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) {
|
||||
static Pattern compileSkipMarker(String marker) {
|
||||
return Pattern.compile("^(?i)" + Pattern.quote(marker), Pattern.MULTILINE);
|
||||
}
|
||||
|
||||
public CppBlockSkipper(TextDocument original, Pattern skipStartMarker, Pattern skipEndMarker) {
|
||||
super(original);
|
||||
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;
|
||||
skipStart = skipStartMarker;
|
||||
skipEnd = skipEndMarker;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,9 +18,7 @@ public class FormalComment extends Comment {
|
||||
|
||||
public FormalComment(JavaccToken t) {
|
||||
super(t);
|
||||
|
||||
// findJavadocs();
|
||||
|
||||
findJavadocs(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@ import net.sourceforge.pmd.lang.java.types.JVariableSig.FieldSig;
|
||||
import net.sourceforge.pmd.lang.java.types.OverloadSelectionResult;
|
||||
import net.sourceforge.pmd.lang.java.types.internal.infer.TypeInferenceLogger;
|
||||
import net.sourceforge.pmd.lang.symboltable.Scope;
|
||||
import net.sourceforge.pmd.util.document.TextDocument;
|
||||
|
||||
/**
|
||||
* Acts as a bridge between outer parts of PMD and the restricted access
|
||||
@ -96,10 +95,6 @@ public final class InternalApiBridge {
|
||||
return methodDeclaration;
|
||||
}
|
||||
|
||||
public static JavaccTokenDocument javaTokenDoc(String fullText) {
|
||||
return new JavaTokenDocument(fullText);
|
||||
}
|
||||
|
||||
public static void setSymbol(SymbolDeclaratorNode node, JElementSymbol symbol) {
|
||||
if (node instanceof ASTMethodDeclaration) {
|
||||
((ASTMethodDeclaration) node).setSymbol((JMethodSymbol) symbol);
|
||||
|
Reference in New Issue
Block a user