# HG changeset patch # User Jaroslav Tulach # Date 1380324186 -7200 # Node ID a7d89cd0e34c0b5279c92dc20c59e1bf429c9b19 # Parent 5b3ae17babdf34932161c4c4ced29c730dd2889c# Parent 635ee75d82a5aaf5d2b13b3f52a9a84f8e0e5b7a Bringing changes from default branch diff -r 5b3ae17babdf -r a7d89cd0e34c ko/archetype/src/main/resources/archetype-resources/pom.xml --- a/ko/archetype/src/main/resources/archetype-resources/pom.xml Mon Sep 23 00:59:14 2013 +0200 +++ b/ko/archetype/src/main/resources/archetype-resources/pom.xml Sat Sep 28 01:23:06 2013 +0200 @@ -205,21 +205,6 @@ - org.apidesign.bck2brwsr - bck2brwsr-maven-plugin - - - - j2js - - - - - \${project.build.directory}/bck2brwsr.js - \${bck2brwsr.obfuscationlevel} - - - org.apache.maven.plugins maven-compiler-plugin @@ -261,6 +246,14 @@ \${bck2brwsr.version} runtime + + org.apidesign.bck2brwsr + vm4brwsr + js + zip + \${bck2brwsr.version} + provided + diff -r 5b3ae17babdf -r a7d89cd0e34c ko/archetype/src/main/resources/archetype-resources/src/main/assembly/bck2brwsr.xml --- a/ko/archetype/src/main/resources/archetype-resources/src/main/assembly/bck2brwsr.xml Mon Sep 23 00:59:14 2013 +0200 +++ b/ko/archetype/src/main/resources/archetype-resources/src/main/assembly/bck2brwsr.xml Sat Sep 28 01:23:06 2013 +0200 @@ -17,6 +17,15 @@ *:rt + + false + provided + + *:js + + true + / + @@ -40,9 +49,5 @@ ${project.build.directory}/${project.build.finalName}.jar / - - ${project.build.directory}/bck2brwsr.js - / - \ No newline at end of file diff -r 5b3ae17babdf -r a7d89cd0e34c ko/archetype/src/main/resources/archetype-resources/src/main/webapp/pages/index.html --- a/ko/archetype/src/main/resources/archetype-resources/src/main/webapp/pages/index.html Mon Sep 23 00:59:14 2013 +0200 +++ b/ko/archetype/src/main/resources/archetype-resources/src/main/webapp/pages/index.html Sat Sep 28 01:23:06 2013 +0200 @@ -9,12 +9,21 @@ 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } } + @keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } + } .rotate { -webkit-animation-name: spin; -webkit-animation-duration: 3s; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: alternate; + + animation-name: spin; + animation-duration: 3s; + animation-iteration-count: infinite; + animation-direction: alternate; } #scene { diff -r 5b3ae17babdf -r a7d89cd0e34c rt/emul/compact/src/test/java/org/apidesign/bck2brwsr/tck/EnumsTest.java --- a/rt/emul/compact/src/test/java/org/apidesign/bck2brwsr/tck/EnumsTest.java Mon Sep 23 00:59:14 2013 +0200 +++ b/rt/emul/compact/src/test/java/org/apidesign/bck2brwsr/tck/EnumsTest.java Sat Sep 28 01:23:06 2013 +0200 @@ -1,3 +1,20 @@ +/** + * Back 2 Browser Bytecode Translator + * Copyright (C) 2012 Jaroslav Tulach + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. Look for COPYING file in the top folder. + * If not, see http://opensource.org/licenses/GPL-2.0. + */ package org.apidesign.bck2brwsr.tck; import java.util.EnumMap; diff -r 5b3ae17babdf -r a7d89cd0e34c rt/emul/compact/src/test/java/org/apidesign/bck2brwsr/tck/RegExpReplaceAllTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/test/java/org/apidesign/bck2brwsr/tck/RegExpReplaceAllTest.java Sat Sep 28 01:23:06 2013 +0200 @@ -0,0 +1,54 @@ +/** + * Back 2 Browser Bytecode Translator + * Copyright (C) 2012 Jaroslav Tulach + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. Look for COPYING file in the top folder. + * If not, see http://opensource.org/licenses/GPL-2.0. + */ +package org.apidesign.bck2brwsr.tck; + +import org.apidesign.bck2brwsr.vmtest.Compare; +import org.apidesign.bck2brwsr.vmtest.VMTest; +import org.testng.annotations.Factory; + +/** + * + * @author Jaroslav Tulach + */ +public class RegExpReplaceAllTest { + + @Compare public String replaceAll() { + return "JavaScript".replaceAll("Script", "One"); + } + + @Compare public String replaceAllTwice() { + return "Script JavaScript!".replaceAll("Script", "One"); + } + + + @Compare public String replaceAllRegexp() { + return "JavaScript".replaceAll("S....t", "One"); + } + + @Compare public String replaceAllRegexpTwice() { + return "Script JavaScript!".replaceAll("S....t", "One"); + } + + @Compare public String replaceFirstRegexpOnly() { + return "Script JavaScript!".replaceFirst("S....t", "One"); + } + + @Factory public static Object[] create() { + return VMTest.create(RegExpReplaceAllTest.class); + } +} diff -r 5b3ae17babdf -r a7d89cd0e34c rt/emul/mini/src/main/java/java/lang/String.java --- a/rt/emul/mini/src/main/java/java/lang/String.java Mon Sep 23 00:59:14 2013 +0200 +++ b/rt/emul/mini/src/main/java/java/lang/String.java Sat Sep 28 01:23:06 2013 +0200 @@ -2159,6 +2159,14 @@ * @since 1.4 * @spec JSR-51 */ + @JavaScriptBody(args = { "regex", "newText" }, body = + "var self = this.toString();\n" + + "var re = new RegExp(regex.toString());\n" + + "var r = re.exec(self);\n" + + "if (r === null || r.length === 0) return this;\n" + + "var from = self.indexOf(r[0]);\n" + + "return this.substring(0, from) + newText + this.substring(from + r[0].length);\n" + ) public String replaceFirst(String regex, String replacement) { throw new UnsupportedOperationException(); } @@ -2203,7 +2211,14 @@ * @spec JSR-51 */ public String replaceAll(String regex, String replacement) { - throw new UnsupportedOperationException(); + String p = this; + for (;;) { + String n = p.replaceFirst(regex, replacement); + if (n == p) { + return n; + } + p = n; + } } /**