From 0d0b2892e265efde66ea4d61b26a33b2c125392c Mon Sep 17 00:00:00 2001 From: Eric Oden Date: Sun, 17 Nov 2013 01:46:31 -0600 Subject: [PATCH] Allow comparing of string literals in IF, WHEN.. THEN and UNTIL. --- CommandFlowControl.cs | 4 ++-- CommandTemporal.cs | 2 +- Utils.cs | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CommandFlowControl.cs b/CommandFlowControl.cs index 2f23942..7b7c542 100644 --- a/CommandFlowControl.cs +++ b/CommandFlowControl.cs @@ -75,7 +75,7 @@ public override void Update(float time) } } - [CommandAttribute("IF ~_{}")] + [CommandAttribute("IF /_{}")] public class CommandIf : Command { List commands = new List(); @@ -115,7 +115,7 @@ public override void Update(float time) } } - [CommandAttribute("UNTIL ~_{}")] + [CommandAttribute("UNTIL /_{}")] public class CommandUntilLoop : Command { List commands = new List(); diff --git a/CommandTemporal.cs b/CommandTemporal.cs index 9f15fb0..18fbdb7 100644 --- a/CommandTemporal.cs +++ b/CommandTemporal.cs @@ -173,7 +173,7 @@ public override void Evaluate() } } - [CommandAttribute("WHEN ~ THEN *")] + [CommandAttribute("WHEN / THEN *")] public class CommandWhen : Command { private Command targetCommand; diff --git a/Utils.cs b/Utils.cs index 9efd5dc..7da4d8c 100644 --- a/Utils.cs +++ b/Utils.cs @@ -275,6 +275,11 @@ public static String BuildInnerRegex(String kegex) output += "([^{}\"]+)"; break; + case "/": + // Anything but braces + output += "([^{}]+)"; + break; + case "[": int choiceEnd = kegex.IndexOf(']', i); var choices = kegex.Substring(i + 1, choiceEnd - i - 1).Split(',');