Re: Re: Bug #838 Updated: Parser error in nested if
| From: | Zeev Suraski | Date: | Fri, 09 Oct 1998 17:35:07 +0000 |
| Subject: | Re: Re: Bug #838 Updated: Parser error in nested if | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-1771@lists.php.net to get a copy of this message | ||
At 18:55 09/10/98 +0200, Antonio Garcia Mari wrote:
> | IF '(' expr ')' { cs_start_if (&$3 _INLINE_TLS); } statement
elseif_list else_single {
>cs_end_if ( _INLINE_TLS_VOID); }
> | IF '(' expr ')' ':' { cs_start_if (&$3 _INLINE_TLS); }
>statement_list
new_elseif_list
>new_else_single { cs_end_if ( _INLINE_TLS_VOID); } ENDIF ';'
>
>So, rules for colon if's and non colon if's are completely different.
except for the
>cs_start_if, cs_end_if. I deduce (correct me if i'm wrong) that theese
functions
>register the nesting if's.
Two different rules for two identical constructs.
>What i'm saying is that a colon if is a different instruction (a different
language construct ) that a non
>colon if. If i'm right, the register functions must be different.
No, you're wrong - they're the same construct, with two flavors for the
syntax. It uses the same tokens.
>Considere the language construct AF like the colon IF:
>
>AF '(' expr ')' ':' { cs_start_af (&$3 _INLINE_TLS); }
>statement_list
new_elseaf_list new_elsea_single {
>cs_end_af ( _INLINE_TLS_VOID); } ENDAF ';'
>
>Then if i've understood the semmantics, this construction is correct:
>AF ($a==1):
> if ($b==2) echo "hello world";
>ELSEAF ($a==2):
> echo "hello world";
>ENDAF;
>
>Can you do that without changing IF by AF or am i completely obfuscated?
No, you can't do it without changing the tokens. That's why I say that the
colon and non-colon if's are two flavors of the very same construct.
Zeev
--
Zeev Suraski <zeev@php.net>
For a PGP public key, finger bourbon@netvision.net.il
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net