You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/12/11 15:23:22 UTC

[commons-text] branch master updated: Better local variable names.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new 52f2cc7  Better local variable names.
52f2cc7 is described below

commit 52f2cc73edc993e5e81e0b09a612eb2dedb42b00
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 11 10:23:18 2019 -0500

    Better local variable names.
---
 .../org/apache/commons/text/StringSubstitutor.java     | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/commons/text/StringSubstitutor.java b/src/main/java/org/apache/commons/text/StringSubstitutor.java
index 59a5fc9..ab9be67 100644
--- a/src/main/java/org/apache/commons/text/StringSubstitutor.java
+++ b/src/main/java/org/apache/commons/text/StringSubstitutor.java
@@ -1256,9 +1256,9 @@ public class StringSubstitutor {
      */
     private int substitute(final TextStringBuilder buf, final int offset, final int length,
             List<String> priorVariables) {
-        final StringMatcher pfxMatcher = getVariablePrefixMatcher();
-        final StringMatcher suffMatcher = getVariableSuffixMatcher();
-        final char escape = getEscapeChar();
+        final StringMatcher prefixMatcher = getVariablePrefixMatcher();
+        final StringMatcher suffixMatcher = getVariableSuffixMatcher();
+        final char escapeCh = getEscapeChar();
         final StringMatcher valueDelimMatcher = getValueDelimiterMatcher();
         final boolean substitutionInVariablesEnabled = isEnableSubstitutionInVariables();
         final boolean substitutionInValuesDisabled = isDisableSubstitutionInValues();
@@ -1271,12 +1271,12 @@ public class StringSubstitutor {
         int bufEnd = offset + length;
         int pos = offset;
         while (pos < bufEnd) {
-            final int startMatchLen = pfxMatcher.isMatch(chars, pos, offset, bufEnd);
+            final int startMatchLen = prefixMatcher.isMatch(chars, pos, offset, bufEnd);
             if (startMatchLen == 0) {
                 pos++;
             } else {
                 // found variable start marker
-                if (pos > offset && chars[pos - 1] == escape) {
+                if (pos > offset && chars[pos - 1] == escapeCh) {
                     // escaped
                     if (preserveEscapes) {
                         pos++;
@@ -1294,15 +1294,15 @@ public class StringSubstitutor {
                     int endMatchLen = 0;
                     int nestedVarCount = 0;
                     while (pos < bufEnd) {
-                        if (substitutionInVariablesEnabled && pfxMatcher.isMatch(chars, pos, offset, bufEnd) != 0) {
+                        if (substitutionInVariablesEnabled && prefixMatcher.isMatch(chars, pos, offset, bufEnd) != 0) {
                             // found a nested variable start
-                            endMatchLen = pfxMatcher.isMatch(chars, pos, offset, bufEnd);
+                            endMatchLen = prefixMatcher.isMatch(chars, pos, offset, bufEnd);
                             nestedVarCount++;
                             pos += endMatchLen;
                             continue;
                         }
 
-                        endMatchLen = suffMatcher.isMatch(chars, pos, offset, bufEnd);
+                        endMatchLen = suffixMatcher.isMatch(chars, pos, offset, bufEnd);
                         if (endMatchLen == 0) {
                             pos++;
                         } else {
@@ -1327,7 +1327,7 @@ public class StringSubstitutor {
                                     for (int i = 0; i < varNameExprChars.length; i++) {
                                         // if there's any nested variable when nested variable substitution disabled,
                                         // then stop resolving name and default value.
-                                        if (!substitutionInVariablesEnabled && pfxMatcher.isMatch(varNameExprChars, i,
+                                        if (!substitutionInVariablesEnabled && prefixMatcher.isMatch(varNameExprChars, i,
                                                 i, varNameExprChars.length) != 0) {
                                             break;
                                         }