minor fix: using yield and wait_until macro to implement yield_wait_until
This commit is contained in:
parent
f296df8bca
commit
54b7875295
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ScriptParser.java,v 1.1 2009/01/08 16:27:48 fros4943 Exp $
|
||||
* $Id: ScriptParser.java,v 1.2 2009/01/08 17:47:37 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.plugins;
|
||||
|
@ -59,12 +59,12 @@ public class ScriptParser {
|
|||
|
||||
code = parseTimeoutWithAction(code);
|
||||
|
||||
code = replaceYieldThenWaitUntils(code);
|
||||
|
||||
code = replaceYields(code);
|
||||
|
||||
code = replaceWaitUntils(code);
|
||||
|
||||
code = replaceYieldThenWaitsUntils(code);
|
||||
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ public class ScriptParser {
|
|||
return pattern.matcher(code).replaceAll("SCRIPT_SWITCH()");
|
||||
}
|
||||
|
||||
private String replaceYieldThenWaitsUntils(String code) throws ScriptSyntaxErrorException {
|
||||
private String replaceYieldThenWaitUntils(String code) throws ScriptSyntaxErrorException {
|
||||
Pattern pattern = Pattern.compile(
|
||||
"YIELD_THEN_WAIT_UNTIL\\(" +
|
||||
"(.*)" /* expression */ +
|
||||
|
@ -189,9 +189,7 @@ public class ScriptParser {
|
|||
|
||||
while (matcher.find()) {
|
||||
code = matcher.replaceFirst(
|
||||
"do { " +
|
||||
" SCRIPT_SWITCH();" +
|
||||
"} while (!(" + matcher.group(1) + "))");
|
||||
"YIELD(); WAIT_UNTIL(" + matcher.group(1) + ")");
|
||||
matcher.reset(code);
|
||||
}
|
||||
|
||||
|
@ -209,7 +207,7 @@ public class ScriptParser {
|
|||
while (matcher.find()) {
|
||||
code = matcher.replaceFirst(
|
||||
"while (!(" + matcher.group(1) + ")) { " +
|
||||
" SCRIPT_SWITCH()" +
|
||||
" SCRIPT_SWITCH(); " +
|
||||
"}");
|
||||
matcher.reset(code);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue