Re: [PHP-DEV] Re: [Zend Engine 2] Heredoc-Syntax

2002-01-31 Thread Markus Fischer

On Thu, Jan 31, 2002 at 06:48:42PM +0900, Yasuo Ohgaki wrote : 
> BTW, Zend does not complain for following line.
> (with or without this patch)
> 
> SOME_LABEL_NOT_DEFINED;
> 
> Is this intended behavior?

Good questions. I've observed this too. It's an undefined
constant, therefore evalutes to the string
'SOME_LABEL_NOT_DEFINED' which evalutes to true and there
likely not an error. Sounds reasonable?

-- 
Please always Cc to me when replying to me on the lists.

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: [Zend Engine 2] Heredoc-Syntax

2002-01-31 Thread Yasuo Ohgaki

Derick Rethans wrote:
> On Wed, 30 Jan 2002, Yasuo Ohgaki wrote:
> 
> 
>>Zak Greant wrote:
>>
>>>  I talked to [EMAIL PROTECTED] about this quite some time ago. IIRC, we
>>>  agreed that <<- heredoc syntax was an acceptable way to handle this.
>>>  The <<- syntax would work like the same way as <<- in bash.
>>>
>>>
>>Hi Zak,
>>I worked for you :)
>>
> 
> Did you actually test this?
> 

In fact, I didn't.
This one is much better and supposed to be valid one.
(I spend more than 30 min this time. But it may not be
enough. If it's bad, please fix or create new one :)

Question is:
Do we really need/want this?

Even if I made this patch, I'm somewhere between
0 and -1 for this change.

BTW, Zend does not complain for following line.
(with or without this patch)

SOME_LABEL_NOT_DEFINED;

Is this intended behavior?

-- 
Yasuo Ohgaki


Index: Zend/zend_language_scanner.l
===
RCS file: /repository/Zend/zend_language_scanner.l,v
retrieving revision 1.43
diff -u -r1.43 zend_language_scanner.l
--- Zend/zend_language_scanner.l2002/01/06 15:21:09 1.43
+++ Zend/zend_language_scanner.l2002/01/31 09:09:30
@@ -1256,9 +1256,11 @@
 }
 
 
-^{LABEL}(";")?{NEWLINE} {
+^{TABS_AND_SPACES}{LABEL}(";")?{NEWLINE} {
int label_len;
unsigned char unput_semicolon;
+   int tabs_and_spaces = 0;
+   void *tmp;
 
CG(zend_lineno)++;
if (yytext[yyleng-2]=='\r') {
@@ -1273,8 +1275,12 @@
} else{
unput_semicolon=0;
}
+   
+   if (yytext[tabs_and_spaces] == ' ' || yytext[tabs_and_spaces] == '\t')
+  for (; yytext[tabs_and_spaces] == ' ' || yytext[tabs_and_spaces] == '\t'; 
+tabs_and_spaces++);
 
-   if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) {
+   tmp =(char *)yytext+tabs_and_spaces;
+   if (label_len - tabs_and_spaces ==CG(heredoc_len) && !memcmp(tmp, CG(heredoc), 
+label_len - tabs_and_spaces)) {
zendlval->value.str.val = estrndup(yytext, yyleng); /* unput destroys 
yytext */
zendlval->value.str.len = yyleng;
if (unput_semicolon) {



-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP-DEV] Re: [Zend Engine 2] Heredoc-Syntax

2002-01-30 Thread Yasuo Ohgaki

Yasuo Ohgaki wrote:
> Zak Greant wrote:
> 
>>   I talked to [EMAIL PROTECTED] about this quite some time ago. IIRC, we
>>   agreed that <<- heredoc syntax was an acceptable way to handle this.
>>   The <<- syntax would work like the same way as <<- in bash.
>>
> Hi Zak,
> I worked for you :)
> 
> 

Should never send patch just before leaving :)
I forgot to think about non-sapce chars before LABEL.

-- 
Yasuo Ohgaki
Please CC me when you reply to news/list messages.
Do not reply only to me :)


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: [Zend Engine 2] Heredoc-Syntax

2002-01-30 Thread Derick Rethans

On Wed, 30 Jan 2002, Yasuo Ohgaki wrote:

> Zak Greant wrote:
> >   I talked to [EMAIL PROTECTED] about this quite some time ago. IIRC, we
> >   agreed that <<- heredoc syntax was an acceptable way to handle this.
> >   The <<- syntax would work like the same way as <<- in bash.
> >
> Hi Zak,
> I worked for you :)

Did you actually test this?

Derick



-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: [Zend Engine 2] Heredoc-Syntax

2002-01-30 Thread Yasuo Ohgaki

Zak Greant wrote:
>   I talked to [EMAIL PROTECTED] about this quite some time ago. IIRC, we
>   agreed that <<- heredoc syntax was an acceptable way to handle this.
>   The <<- syntax would work like the same way as <<- in bash.
> 
Hi Zak,
I worked for you :)

-- 
Yasuo Ohgaki


Index: Zend/zend_language_scanner.l
===
RCS file: /repository/Zend/zend_language_scanner.l,v
retrieving revision 1.43
diff -u -r1.43 zend_language_scanner.l
--- Zend/zend_language_scanner.l2002/01/06 15:21:09 1.43
+++ Zend/zend_language_scanner.l2002/01/30 12:20:35
@@ -1256,7 +1256,7 @@
 }
 
 
-^{LABEL}(";")?{NEWLINE} {
+{LABEL}(";")?{NEWLINE} {
int label_len;
unsigned char unput_semicolon;
 



-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP-DEV] Re: [Zend Engine 2] Heredoc-Syntax

2002-01-30 Thread Zak Greant

On Wed, 2002-01-30 at 04:04, [EMAIL PROTECTED] wrote:
> On Wed, 30 Jan 2002, Yasuo Ohgaki wrote:
> 
> > > therefore i wrote 'on its own line'. i suppose heredoc is handled by
> > > the scanner, so this should not be a problem.
> 
> It's handled by the scanner indeed
> 
> > >
> > > yohgaki: you were talking about reasons and mentioned only one that
> > > isn't a reason for me. any other reasons ?
> >
> > As I mentioned, feel free to write and submit patch :)
> >
> > PS: You are better to search archive, there were discussion
> > regarding heredoc patch. It's not directly related to
> > this change, but it may help. The last patch was rejected,
> > IIRC.
> 
> It's fairly easy to patch, the question is if we want it. Andi, what's
> your statement on this? I don't see why the heredoc label should be on the
> first column anyways.

  I talked to [EMAIL PROTECTED] about this quite some time ago. IIRC, we
  agreed that <<- heredoc syntax was an acceptable way to handle this.
  The <<- syntax would work like the same way as <<- in bash.

  Of course, I never got around to implementing it... :)


-- 
For technical support contracts, goto https://order.mysql.com/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Zak Greant <[EMAIL PROTECTED]>   
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB
/_/  /_/\_, /___/\___\_\___/   Calgary, Canada 
   <___/   www.mysql.com


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]