// L-System Rule Parser
function RuleParser(str) {
  this.str = str;
  this.rules = {};

  this.parse = function() {
    var c, d;
    var env = 0;
    var rule_str;
    var variable;

    for (var i = 0; i < this.str.length; i++) {
      c = this.str[i];
      if (i > 0) {
	d = this.str[i-1];
      } else {
	d = null;
      }

      if (c == '(') {
	env = 1;
	rule_str = "";
      } else if (c.search(/[A-Z]/) == 0 && env == 1) {
	variable = c;
      } else if (c == '>' && d == '-') {
	env = 2;
      } else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+-\[\]]/) == 0)
                 && env == 2) {
	rule_str += c;
      } else if (c == ')') {
	this.rules[variable] = rule_str;
	env = 0;
      }
    }

    return this.rules;
  }
}

module.exports = RuleParser;

@@ -387,16 +387,17 @@
 else if 
+(
 (c.searc
@@ -412,16 +412,65 @@
 /) == 0 
+%7C%7C c.search(/%5B%5C+%5C-%5C%5B%5C%5D%5D/) == 0)%0A                 
 && env =

Allow control char as rule "variable"