diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 36e6415f93..aad96249df 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +20000514-10:07 GMT-8 Ron Pinkas + + * source/compiler/harbour.l + ! Fixed parse error when DO OPTIONAL WITH 1 or " or other non alpha charcaters + ! Fixed parse error when FOR Var := OPTIONAL TO ... + 20000514-09:45 GMT-8 Ron Pinkas * source/compiler/harbour.y diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index 9ce7396acd..ae2c1c4d68 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -360,7 +360,7 @@ Separator {SpaceTab} "optional" { BEGIN OPTIONAL_; } -{Separator}+"with"{Separator}+[_a-zA-Z\&] { unput( yytext[ yyleng-1 ] ); +{Separator}+"with"{Separator}+[^ .] { unput( yytext[ yyleng-1 ] ); unput( ' ' ); unput( 'h' ); unput( 't' ); @@ -372,6 +372,16 @@ Separator {SpaceTab} return IDENTIFIER; } +{Separator}+"to"{Separator}+[^ .] { unput( yytext[ yyleng-1 ] ); + unput( ' ' ); + unput( 'o' ); + unput( 't' ); + if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0; + yylval.string = hb_strdup( "OPTIONAL" ); + hb_comp_iState = IDENTIFIER; + return IDENTIFIER; + } + {Separator}+[_a-zA-Z\&] { unput( yytext[ yyleng-1 ] ); BEGIN 0; return OPTIONAL; } {Separator}*(.|\n) { /* end of line or any operator */ diff --git a/harbour/tests/testwarn.prg b/harbour/tests/testwarn.prg index f0be028278..33a2ca6b26 100644 --- a/harbour/tests/testwarn.prg +++ b/harbour/tests/testwarn.prg @@ -89,9 +89,11 @@ PROCEDURE THEMAIN( optional ) PRIVATE TEST AS CHAR - DO Optional WITH cVar + DO Proc WITH - FOR Conter := 1 TO 10 + DO Optional WITH + + FOR Conter := Optional TO 10 ? "For with End" End