aboutsummaryrefslogtreecommitdiffstats
path: root/Visitor/Interpreter.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-06-24 16:43:42 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-06-24 16:43:42 +0200
commit367347debb68da0e4b67c0e7a24b741a3259ae87 (patch)
tree1fa9ed8005fdf2e501a918e90f42d9a763b21181 /Visitor/Interpreter.php
parent68c1f0d5f25f75d052320a8acf07e934fca3fcf1 (diff)
downloadPraspel-367347debb68da0e4b67c0e7a24b741a3259ae87.zip
Praspel-367347debb68da0e4b67c0e7a24b741a3259ae87.tar.gz
Praspel-367347debb68da0e4b67c0e7a24b741a3259ae87.tar.bz2
Add the regex syntactic sugar: /r/m:s.
/r/[m][:s] where r is a regex, m is a modifier and s the maximum size. It is strictly equivalent to regex('/r/[m]', s).
Diffstat (limited to 'Visitor/Interpreter.php')
-rw-r--r--Visitor/Interpreter.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/Visitor/Interpreter.php b/Visitor/Interpreter.php
index d396e04..26c1b50 100644
--- a/Visitor/Interpreter.php
+++ b/Visitor/Interpreter.php
@@ -429,6 +429,16 @@ class Interpreter implements \Hoa\Visitor\Visit {
return $element->getChild(1)->accept($this, $handle, $eldnah);
break;
+ case '#regex':
+ $regex = $element->getChild(0)->accept($this, $handle, $eldnah);
+ $length = 12;
+
+ if(true === $element->childExists(1))
+ $length = $element->getChild(1)->accept($this, $handle, $eldnah);
+
+ return realdom()->regex($regex, $length);
+ break;
+
case 'token':
$tId = $element->getValueToken();
$value = $element->getValueValue();
@@ -522,6 +532,7 @@ class Interpreter implements \Hoa\Visitor\Visit {
case 'accepted':
case 'string':
+ case 'regex';
return $value;
default: