public function analyse($strLogic)
 {
     // Remove CRs
     $strLogic = $this->removeReturns($strLogic);
     // Parse out strings as #1 priority
     $this->strings = array();
     QuotedStringParser::extractStrings($strLogic, $this->strings);
     // Check brackets are ok first
     if (!$this->checkBracketSensibility($strLogic)) {
         throw new BadBracketNesting('Brackets are incorrectly nested');
     }
     // Preprocessing (eg switch IN () to IN [] to avoid splitting in the wrong places)
     $strLogic = $this->preProcess($strLogic);
     // Split the string on brackets first, needs to be recursive
     $group = $this->deBracket($strLogic);
     return $group;
 }
$t->diag('QuotedStringParser::replace');
$subject = 'person.age = 18';
$result = QuotedStringParser::replace($subject, 'Hello', 'Goodbye');
$t->ok($subject === $result, "Search for something that doesn't exist in a non-quoted string");
$result = QuotedStringParser::replace($subject, '=', '!=');
$ok = $result === 'person.age != 18';
$t->ok($ok, "Search for something that exists in a non-quoted string");
$subject = "rule.cond = 'LIKE'";
$result = QuotedStringParser::replace($subject, 'LIKE', 'HATE');
$t->ok($subject === $result, "Search for something that exists only within a quoted string");
$result = QuotedStringParser::replace($subject, 'WIBBLE', 'BLAH');
$t->ok($subject === $result, "Search for something that does not exist at all in a quoted string");
$result = QuotedStringParser::replace($subject, '=', '<>');
$ok = $result === "rule.cond <> 'LIKE'";
$t->ok($ok, "Search for something that exists outside of a quoted string");
$subject = "(person.name > 21 AND name='(not sure)')";
$result = QuotedStringParser::replace($subject, '\\(', '');
$result = QuotedStringParser::replace($result, '\\)', '');
$ok = $result === "person.name > 21 AND name='(not sure)'";
$t->ok($ok, "Remove brackets, but not in string");
$t = new lime_test(3, new lime_output_color());
$t->diag('QuotedStringParser::extractStrings');
$subject = "person.location IN ('Brum','Coventry')";
$strs = array();
QuotedStringParser::extractStrings($subject, $strs);
$t->ok($subject == "person.location IN (%%0,%%1)", 'Extract strings from an IN clause');
$subject = "person.name = '%%0'";
$strs = array();
QuotedStringParser::extractStrings($subject, $strs);
$t->ok($subject == "person.name = %%0", "Check that tokens don't confuse string extraction");
$t->ok($strs[0] == "'%%0'", "Check that strings are correctly saved");