Skip to content

Commit

Permalink
Merge 13edd11 into 6105f14
Browse files Browse the repository at this point in the history
  • Loading branch information
techqiang committed Feb 23, 2019
2 parents 6105f14 + 13edd11 commit 820f847
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Util/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ class Util
{
public static function escapeAssertion($s)
{
$s = str_replace('r.', 'r_', $s);
$s = str_replace('p.', 'p_', $s);
if (0 === strpos($s, 'r.')) {
$s = substr_replace($s, 'r_', 0, 2);
}
if (0 === strpos($s, 'p.')) {
$s = substr_replace($s, 'p_', 0, 2);
}

$s = preg_replace_callback("~(\|| |=|\)|\(|&|<|>|,|\+|-|!|\*|\/)(r|p)(\.)~", function ($m) {
return $m[1].$m[2].'_';
}, $s);

return $s;
}
Expand Down

0 comments on commit 820f847

Please sign in to comment.