diff options
author | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-11-26 19:52:50 +0100 |
---|---|---|
committer | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-11-26 19:52:50 +0100 |
commit | 5454abd4ec36bb36f14a0729b76dc7a4d62280f2 (patch) | |
tree | 4900accd46e8a7471540007bc6e2978818105a7d | |
parent | bc5d0286963579248073849ff6706f8d7903fd94 (diff) | |
download | gwtquery-5454abd4ec36bb36f14a0729b76dc7a4d62280f2.tar.gz gwtquery-5454abd4ec36bb36f14a0729b76dc7a4d62280f2.zip |
Fix handling of inlined regexp since we have to double escape reverse-slashes, and consider more cases where inlined regex could be
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java index 7d44411d..7c9ab708 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java @@ -162,7 +162,7 @@ public class JsniBundleGenerator extends Generator { /** * Adapt a java-script block which could produce a syntax error when - * embedding it a a JSNI block. + * embedding it in a JSNI block. * * The objective is to replace any 'c' comment-ending occurrence to avoid closing * JSNI comment blocks prematurely. @@ -216,7 +216,7 @@ public class JsniBundleGenerator extends Generator { if (!isCPPComment && !isCComment && !isRegex && !isOper) { isCPPComment = c == '/'; isCComment = c == '*'; - isOper = !isCPPComment && !isCComment && !"=(&|".contains(""+prev); + isOper = !isCPPComment && !isCComment && !"=()&|\n;,\\}".contains(""+prev); isRegex = !isCPPComment && !isCComment && !isOper; } if (isOper) { @@ -263,7 +263,7 @@ public class JsniBundleGenerator extends Generator { private String escapeInlineRegex(String s, String mod) { if (s.endsWith("*")) { - return "new RegExp('" + s + "', '" + mod + "')"; + return "new RegExp('" + s.replaceAll("\\", "\\\\") + "','" + mod + "')"; } else { return '/' + s + '/' + mod; } |