Skip to content

Commit

Permalink
Renamed variables
Browse files Browse the repository at this point in the history
  • Loading branch information
wener-tiobe committed Apr 13, 2023
1 parent f0518f1 commit 3196469
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pmd-cpp/src/main/java/net/sourceforge/pmd/cpd/CPPTokenizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class CPPTokenizer extends JavaCCTokenizer {
private boolean skipBlocks = true;
private String skipBlocksStart;
private String skipBlocksEnd;
private boolean ignoreIdentifiersAndLiteralsInSeqence = false;
private boolean ignoreIdentifierAndLiteralSeqences = false;
private boolean ignoreLiteralSequences = false;

/**
Expand All @@ -51,7 +51,7 @@ public void setProperties(Properties properties) {
}
}
ignoreLiteralSequences = Boolean.parseBoolean(properties.getProperty(OPTION_IGNORE_LITERAL_SEQUENCES, Boolean.FALSE.toString()));
ignoreIdentifiersAndLiteralsInSeqence =
ignoreIdentifierAndLiteralSeqences =
Boolean.parseBoolean(properties.getProperty(OPTION_IGNORE_IDENTIFIER_AND_LITERAL_SEQUENCES, Boolean.FALSE.toString()));
}

Expand Down Expand Up @@ -92,18 +92,18 @@ protected TokenManager getLexerForSource(SourceCode sourceCode) {

@Override
protected TokenFilter getTokenFilter(final TokenManager tokenManager) {
return new CppTokenFilter(tokenManager, ignoreLiteralSequences, ignoreIdentifiersAndLiteralsInSeqence);
return new CppTokenFilter(tokenManager, ignoreLiteralSequences, ignoreIdentifierAndLiteralSeqences);
}

private static class CppTokenFilter extends JavaCCTokenFilter {
private final boolean ignoreLiteralSequences;
private final boolean ignoreIdentifiersAndLiteralsInSeqence;
private final boolean ignoreIdentifierAndLiteralSeqences;
private GenericToken discardingTokensUntil = null;
private boolean discardCurrent = false;

CppTokenFilter(final TokenManager tokenManager, final boolean ignoreLiteralSequences, final boolean ignoreIdentifiersInSeqence) {
CppTokenFilter(final TokenManager tokenManager, final boolean ignoreLiteralSequences, final boolean ignoreIdentifierAndLiteralSeqences) {
super(tokenManager);
this.ignoreIdentifiersAndLiteralsInSeqence = ignoreIdentifiersInSeqence;
this.ignoreIdentifierAndLiteralSeqences = ignoreIdentifierAndLiteralSeqences;
this.ignoreLiteralSequences = ignoreLiteralSequences;
}

Expand All @@ -114,21 +114,21 @@ protected void analyzeTokens(final GenericToken currentToken, final Iterable<Gen
}

private void skipSequences(final GenericToken currentToken, final Iterable<GenericToken> remainingTokens) {
if (ignoreLiteralSequences || ignoreIdentifiersAndLiteralsInSeqence) {
if (ignoreLiteralSequences || ignoreIdentifierAndLiteralSeqences) {
final int kind = currentToken.getKind();
if (isDiscardingToken()) {
if (currentToken == discardingTokensUntil) { // NOPMD - intentional check for reference equality
discardingTokensUntil = null;
discardCurrent = true;
}
} else if (kind == CppParserConstants.LCURLYBRACE) {
final GenericToken finalToken = findEndOfSequenceToDiscard(remainingTokens, ignoreIdentifiersAndLiteralsInSeqence);
final GenericToken finalToken = findEndOfSequenceToDiscard(remainingTokens, ignoreIdentifierAndLiteralSeqences);
discardingTokensUntil = finalToken;
}
}
}

private static GenericToken findEndOfSequenceToDiscard(final Iterable<GenericToken> remainingTokens, boolean ignoreIdentifiersAndLiteralsInSeqence) {
private static GenericToken findEndOfSequenceToDiscard(final Iterable<GenericToken> remainingTokens, boolean ignoreIdentifierAndLiteralSeqences) {
boolean seenAllowedToken = false;
int braceCount = 0;
for (final GenericToken token : remainingTokens) {
Expand All @@ -144,7 +144,7 @@ private static GenericToken findEndOfSequenceToDiscard(final Iterable<GenericTok
break; // can be skipped; continue to the next token
case CppParserConstants.ID:
// Ignore identifiers if instructed
if (ignoreIdentifiersAndLiteralsInSeqence) {
if (ignoreIdentifierAndLiteralSeqences) {
seenAllowedToken = true;
break; // can be skipped; continue to the next token
} else {
Expand Down

0 comments on commit 3196469

Please sign in to comment.