This is an automated email from the ASF dual-hosted git repository.
henrib pushed a commit to branch JEXL-175
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git
The following commit(s) were added to refs/heads/JEXL-175 by this push:
new b8c4b4e Reuse parsing method; Nitpick on doc
b8c4b4e is described below
commit b8c4b4eb148e9d9397da27b5b4278c4ef0ba55bb
Author: henrib <[email protected]>
AuthorDate: Thu Sep 13 17:12:02 2018 +0200
Reuse parsing method;
Nitpick on doc
---
.../apache/commons/jexl3/parser/StringParser.java | 24 ++--------------------
src/site/xdoc/reference/syntax.xml | 2 +-
2 files changed, 3 insertions(+), 23 deletions(-)
diff --git a/src/main/java/org/apache/commons/jexl3/parser/StringParser.java
b/src/main/java/org/apache/commons/jexl3/parser/StringParser.java
index 6fa6479..6072a3f 100644
--- a/src/main/java/org/apache/commons/jexl3/parser/StringParser.java
+++ b/src/main/java/org/apache/commons/jexl3/parser/StringParser.java
@@ -59,28 +59,7 @@ public class StringParser {
* @return the built string
*/
public static String buildRegex(CharSequence str) {
-
- int length = str.length();
-
- StringBuilder strb = new StringBuilder(length);
-
- int start = 2;
- int end = length - 1;
-
- for (int i = start; i < end; ++i) {
- char c = str.charAt(i);
- if (c == '\\') {
- if (i+1 < end && str.charAt(i+1) == '/') {
- strb.append("/");
- i++;
- } else {
- strb.append(c);
- }
- } else {
- strb.append(c);
- }
- }
- return strb.toString();
+ return buildString(str.subSequence(1, str.length()), true);
}
/**
@@ -178,6 +157,7 @@ public class StringParser {
/**
* Escapes a String representation, expand non-ASCII characters as Unicode
escape sequence.
+ * @param delim the delimiter character
* @param str the string to escape
* @return the escaped representation
*/
diff --git a/src/site/xdoc/reference/syntax.xml
b/src/site/xdoc/reference/syntax.xml
index 1c63bd0..c66147a 100644
--- a/src/site/xdoc/reference/syntax.xml
+++ b/src/site/xdoc/reference/syntax.xml
@@ -346,7 +346,7 @@
</td>
</tr>
<tr>
- <td>Regex literals</td>
+ <td>Regular expression (regex) literals</td>
<td>
Start with <code>~/</code> and ends with
<code>/</code> delimiters, e.g.
<code>~/ABC.*/</code>