aboutsummaryrefslogtreecommitdiffstats
path: root/Grammar.pp
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 /Grammar.pp
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 'Grammar.pp')
-rw-r--r--Grammar.pp15
1 files changed, 9 insertions, 6 deletions
diff --git a/Grammar.pp b/Grammar.pp
index eff897a..872f5aa 100644
--- a/Grammar.pp
+++ b/Grammar.pp
@@ -235,7 +235,7 @@ constant:
scalar() | array()
scalar:
- <null> | boolean() | number() | string() | <regex> | range()
+ <null> | boolean() | number() | string() | regex() | range()
boolean:
<true> | <false>
@@ -252,6 +252,14 @@ quoted_string:
( ( <escaped> | <accepted> | <string> | ::concat:: ) #concatenation )*
::_quote::
+#regex:
+ <regex> ( ::colon:: ( range() | number() ) )?
+
+#range:
+ number() ::range:: number()
+ | number() ::range:: #left_range
+ | ::range:: number() #right_range
+
#array:
::bracket_::
( pair() ( ::comma:: pair() )* )?
@@ -261,11 +269,6 @@ pair:
( ::from::? representation() ::to:: representation() #pair )
| ::to::? representation()
-#range:
- number() ::range:: number()
- | number() ::range:: #left_range
- | ::range:: number() #right_range
-
extended_identifier:
( ::count:: #count )? arrayaccess()