Repository: flex-falcon Updated Branches: refs/heads/tlf 50f9d4530 -> 9d9cf6c7a
try to generalize escaping of chars in RegEx Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/9d9cf6c7 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/9d9cf6c7 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/9d9cf6c7 Branch: refs/heads/tlf Commit: 9d9cf6c7aea4b0537b6c4119b6ee9a30d6802fc3 Parents: 50f9d45 Author: Alex Harui <[email protected]> Authored: Fri Jun 30 10:32:09 2017 -0700 Committer: Alex Harui <[email protected]> Committed: Fri Jun 30 10:32:09 2017 -0700 ---------------------------------------------------------------------- compiler-jx/.classpath | 1 + compiler-jx/build.xml | 1 + .../internal/codegen/js/jx/LiteralEmitter.java | 13 +++++++------ compiler-jx/src/test/build.xml | 4 ++++ 4 files changed, 13 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9d9cf6c7/compiler-jx/.classpath ---------------------------------------------------------------------- diff --git a/compiler-jx/.classpath b/compiler-jx/.classpath index 79c17cd..35c205d 100644 --- a/compiler-jx/.classpath +++ b/compiler-jx/.classpath @@ -13,5 +13,6 @@ <classpathentry kind="lib" path="lib/flex-tool-api.jar"/> <classpathentry kind="lib" path="lib/junit-4.10.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/COMMONS_COMPRESS"/> + <classpathentry kind="lib" path="/Users/aharui/git/flex/master/flex-falcon/compiler/lib/external/commons-lang-2.6.jar"/> <classpathentry kind="output" path="target/classes"/> </classpath> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9d9cf6c7/compiler-jx/build.xml ---------------------------------------------------------------------- diff --git a/compiler-jx/build.xml b/compiler-jx/build.xml index 86e1917..d2045c7 100644 --- a/compiler-jx/build.xml +++ b/compiler-jx/build.xml @@ -67,6 +67,7 @@ <path id="classpath"> <filelist dir="${falcon.lib.dir}/external"> <file name="antlr.jar" /> + <file name="commons-lang-2.6.jar" /> </filelist> <filelist dir="${lib}"> <file name="commons-io.jar" /> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9d9cf6c7/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java index 5c60baa..af5e2d2 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java @@ -23,6 +23,7 @@ import java.util.Arrays; import java.util.List; import java.util.Stack; +import org.apache.commons.lang.StringEscapeUtils; import org.apache.flex.compiler.codegen.ISubEmitter; import org.apache.flex.compiler.codegen.js.IJSEmitter; import org.apache.flex.compiler.common.IMetaInfo; @@ -175,12 +176,12 @@ public class LiteralEmitter extends JSSubEmitter implements } else { - s = s.replaceAll("\n", "\\\\u000a"); - s = s.replaceAll("\r", "\\\\u000d"); - s = s.replaceAll("\t", "\\\\u0009"); - s = s.replaceAll(" ", "\\\\u0020"); - s = s.replace("\u2028", "\\u2028"); - s = s.replace("\u2029", "\\u2029"); + s = StringEscapeUtils.escapeJava(s); + s = s.replaceAll("\\\\n", "\\\\u000a"); + s = s.replaceAll("\\\\r", "\\\\u000d"); + s = s.replaceAll("\\\\t", "\\\\u0009"); + s = s.replaceAll(" ", "\\\\u0020"); + s = s.replaceAll("\\\\d", "\\d"); } if (!isWritten) http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9d9cf6c7/compiler-jx/src/test/build.xml ---------------------------------------------------------------------- diff --git a/compiler-jx/src/test/build.xml b/compiler-jx/src/test/build.xml index a5d2409..dc115e1 100644 --- a/compiler-jx/src/test/build.xml +++ b/compiler-jx/src/test/build.xml @@ -64,6 +64,7 @@ <pathelement location="${compiler}/target/test-classes"/> <pathelement location="${compiler}/../compiler-test-utils/target/classes"/> <fileset dir="${compiler}/lib" includes="**/*.jar"/> + <fileset dir="${compiler}/../compiler/lib" includes="**/*.jar"/> </classpath> <batchtest todir="${compiler}/target/junit-results"> <fileset dir="${compiler}/target/test-classes"> @@ -103,6 +104,7 @@ <pathelement location="${compiler}/target/test-classes"/> <pathelement location="${compiler}/../compiler-test-utils/target/classes"/> <fileset dir="${compiler}/lib" includes="**/*.jar"/> + <fileset dir="${compiler}/../compiler/lib" includes="**/*.jar"/> </classpath> <batchtest todir="${compiler}/target/junit-results"> <fileset dir="${compiler}/target/test-classes"> @@ -130,6 +132,7 @@ <pathelement location="${compiler}/target/test-classes"/> <pathelement location="${compiler}/../compiler-test-utils/target/classes"/> <fileset dir="${compiler}/lib" includes="**/*.jar"/> + <fileset dir="${compiler}/../compiler/lib" includes="**/*.jar"/> </classpath> <batchtest todir="${compiler}/target/junit-results"> <fileset dir="${compiler}/target/test-classes"> @@ -155,6 +158,7 @@ <pathelement location="${compiler}/target/test-classes"/> <pathelement location="${compiler}/../compiler-test-utils/target/classes"/> <fileset dir="${compiler}/lib" includes="**/*.jar"/> + <fileset dir="${compiler}/../compiler/lib" includes="**/*.jar"/> </classpath> <batchtest todir="${compiler}/target/junit-results"> <fileset dir="${compiler}/target/test-classes">
