From 41d05c5804aad669608bb4e30935c1b970045512 Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Thu, 1 Oct 2015 16:59:13 +0200 Subject: [PATCH] fix tokenizer to parse regexp modifier as part of the regular expression This - allows to use modifiers like 'u' (for unicode support) to be used. - makes the Rfc822UTF8.peg.inc example working again. This change might break regexp rules not followd by a whitespace or a line-end. --- lib/hafriedlander/Peg/Compiler/Rule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hafriedlander/Peg/Compiler/Rule.php b/lib/hafriedlander/Peg/Compiler/Rule.php index b7adbad..58aab1f 100644 --- a/lib/hafriedlander/Peg/Compiler/Rule.php +++ b/lib/hafriedlander/Peg/Compiler/Rule.php @@ -135,7 +135,7 @@ function parse_rule() { ((\\\\\\\\)*\\\\/) # Escaped \/, making sure to catch all the \\ first, so that we dont think \\/ is an escaped / | [^/] # Anything except / - )*/@xu' ; + )*/\S*(?=\s|$)@xu' ; function tokenize( $str, &$tokens, $o = 0 ) { $length = strlen($str);