Re: Re: PHP 5.1 (Or How to break tousands of apps out there)

From: Date: Sun, 27 Nov 2005 01:20:53 +0000
Subject: Re: Re: PHP 5.1 (Or How to break tousands of apps out there)
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-20616@lists.php.net to get a copy of this message
this is not entirely true: token : "[WS]+?[WS]+" == conditional if seperater 1 token : "[WS]+:[WS]+" == conditional if seperater 2 token : ":[WS]+" == case/ if ($a == 5): / else: / endif; token : ":" == namespace stuff... eg. adding whitespace around the " : " and declaring that a token, rather than creating a token for the whitespace it, should work?? Regards Alan On Sat, 2005-11-26 at 13:56 +0100, Marcus Boerger wrote: > Hello Sebastian, > > Saturday, November 26, 2005, 1:46:31 PM, you wrote: > > > On 11/26/05, Marcus Boerger <helly@php.net> wrote: > >> The only thing that matters is whether i can write a correct > >> lexer/parser for this without breaking stuff. > > > Im no parser expert at all, so just to be sure that I understand the > > problem correctly: I guess you can't distinguish at the parser/lexer > > level between cases where it's ambiguos without white spaces and where > > it isn't? > > A lexer splits on tokens while white space is optional. If present it > allows separation of tokens. Forcing this would make whitespace a token > which would be very bad. The parser then works on the tokens and doesn't > see any whitespace. > > > Alternatively, could you provide a configuration switch to turn the > > use of namespace constants in the ternary on or off? (So that people > > who don't use namespace constants but use the ternary without spaces > > wouldn't need to change all their code?) > > That is no option at all becuase it would make it impossible to write > portable php code. > > marcus >

« previous php.internals (#20616) next »