[pmwiki-users] Conditional extensions

Dominique Faure dominique.faure.1 at free.fr
Sat Apr 23 08:07:52 CDT 2005


At Friday, April 22, 2005 6:00 PM [GMT+1=CET], Patrick R. Michaud wrote:

> On Fri, Apr 22, 2005 at 05:44:11PM +0200, Dominique Faure wrote:
> > I'd like to keep the full php semantics with mandatory spaces required
> > only for non symbolic operators. Here's what I think as my final
> > version:
> >
> > $delims =
> > '/(?:^|\\s*)(\\sand\\s|\\sx?or\\s|&&|\\|\\||[!()])(?:\\s*|$)/i';
>
> I think it's better to require the spaces even for the symbolic
> operators. In particular, without spaces it means that arguments to
> (sub)conditions can never contain parentheses or an exclamation point.
>
> Pm

Good point, but when using 
'/(?:^|\\s+)(and|x?or|&&|\\|\\||[!()])(?:\\s+|$)/i'
to parse 'auth edit && ( auth edit || false )', I got (before the loop):

$terms: Array
(
    [0] => auth edit
    [1] => &&
    [2] => ( auth edit
    [3] => ||
    [4] => false
    [5] => )
)

evaluting to (after the loop):

$terms: Array
(
    [0] => 1
    [1] => &&
    [2] => ( auth edit
    [3] => ||
    [4] => 0
    [5] => )
)

which is a bit annoying...

Cheers,
Dom




More information about the pmwiki-users mailing list