From 1b828ec874199e382adf654b33e39254b34d175d Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 22 Sep 2005 17:43:56 +0200 Subject: lexer fix: will now support ">" in look ahead/behind patterns & (?u) inline flag darcs-hash:20050922154356-9b6ab-0e881a2f3fc6f3f8acd2f16df8a9dde68f6085e3.gz --- inc/parser/lexer.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'inc/parser') diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php index 394eae3f6..e0492d7c9 100644 --- a/inc/parser/lexer.php +++ b/inc/parser/lexer.php @@ -139,10 +139,11 @@ class Doku_LexerParallelRegex { for ($i = 0; $i < $cnt; $i++) { // Replace lookaheads / lookbehinds with marker + $m = "\1\1"; $pattern = preg_replace( array ( - '/\(\?(i|m|s|x|U)\)/U', - '/\(\?(\-[i|m|s|x|U])\)/U', + '/\(\?(i|m|s|x|u|U)\)/U', + '/\(\?(\-[i|m|s|x|u|U])\)/U', '/\(\?\=(.*)\)/sU', '/\(\?\!(.*)\)/sU', '/\(\?\<\=(.*)\)/sU', @@ -150,13 +151,13 @@ class Doku_LexerParallelRegex { '/\(\?\:(.*)\)/sU', ), array ( - '<<<>>>', - '<<<>>>', - '<<<>>>', - '<<<>>>', - '<<<>>>', - '<<<>>>', - '<<<>>>', + $m.'SO:\\1'.$m, + $m.'SOR:\\1'.$m, + $m.'LA:IS:\\1'.$m, + $m.'LA:NOT:\\1'.$m, + $m.'LB:IS:\\1'.$m, + $m.'LB:NOT:\\1'.$m, + $m.'GRP:\\1'.$m, ), $this->_patterns[$i] ); @@ -170,13 +171,13 @@ class Doku_LexerParallelRegex { // Restore lookaheads / lookbehinds $pattern = preg_replace( array ( - '<<<<>>>>', - '<<<<>>>>', - '/<<<>>>/sU', - '/<<<>>>/sU', - '/<<<>>>/sU', - '/<<<>>>/sU', - '/<<<>>>/sU', + '/'.$m.'SO:(.{1})'.$m.'/', + '/'.$m.'SOR:(.{2})'.$m.'/', + '/'.$m.'LA:IS:(.*)'.$m.'/sU', + '/'.$m.'LA:NOT:(.*)'.$m.'/sU', + '/'.$m.'LB:IS:(.*)'.$m.'/sU', + '/'.$m.'LB:NOT:(.*)'.$m.'/sU', + '/'.$m.'GRP:(.*)'.$m.'/sU', ), array ( '(?\\1)', -- cgit v1.2.3