diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 69e5f8c18a..06ff7df471 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,8 @@ +20000515-19:45 GMT-8 Ron Pinkas + + * source/compiler/harbour.l + ! Corrected (again) rules for OPTIONAL to not conflict with DO OPTIONAL WITH ... and FOR Counter := OPTIONAL TO ... + 20000515-20:22 GMT+4 April White * source\rtl\makefile @@ -46,10 +51,10 @@ 20000515-18:00 GMT-8 Ron Pinkas * source/compiler/harbour.c - - Removed: warning of unitialized static variable. + - Removed: warning of uninitialized static variable. * source/compiler/hbpcode.c - - Removed: warning of unitialized static variable. + - Removed: warning of uninitialized static variable. ! Minor correction to hb_compStrongType() 20000515-23:11 GMT+2 Maurilio Longo diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index 539678c0ee..648ec6ba19 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -406,34 +406,85 @@ Separator {SpaceTab} unput( yytext[ yyleng-1 ] ); if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0; - hb_comp_iState = IDENTIFIER; + hb_comp_iState = IDENTIFIER; return IDENTIFIER; } "opti"("onal"|"ona"|"on"|"o")? { BEGIN OPTIONAL_; yylval.string = hb_strupr( hb_strdup( yytext ) ); } +{Separator}+"with"{Separator}+[^ .] { /* DO OPTIONAL WITH ...*/ + /* Push back the last character. */ + unput( yytext[ --yyleng ] ); + + /* Remove possible white space trailing the "with". */ + while( yytext[ yyleng - 1 ] < 48 ) + yyleng--; + + unput( ' ' ); + + /* Push back the "with". */ + unput( 'h' ); + unput( 't' ); + unput( 'i' ); + unput( 'w' ); + + yyleng -= 4; + yytext[ yyleng ] = 0; + + if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0; + + hb_comp_iState = IDENTIFIER; + return IDENTIFIER; + } +{Separator}+"to"{Separator}+[^ .] { /* FOR nVar := OPTIONAL TO ...*/ + /* Push back the last character. */ + unput( yytext[ --yyleng ] ); + + /* Remove possible white space trailing the "to". */ + while( yytext[ yyleng - 1 ] < 48 ) + yyleng--; + + unput( ' ' ); + + /* Push back the "to". */ + unput( 'o' ); + unput( 't' ); + + yyleng -= 2; + yytext[ yyleng ] = 0; + + if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0; + + hb_comp_iState = IDENTIFIER; + return IDENTIFIER; + } + {Separator}+[_a-zA-Z\&] { /* an Identifier after OPTIONAL */ unput( yytext[ yyleng-1 ] ); if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0; + /* OPTIONAL as first item on a line can't be a qualifier. */ if( hb_comp_iState == LOOKUP ) { /* it is first item in the line */ - hb_xfree( (void *) yylval.string ); - hb_comp_iState = OPTIONAL; - return OPTIONAL; - } - else - { /* there is another item in line already */ hb_comp_iState = IDENTIFIER; return IDENTIFIER; } + else + { /* Now it should be a qalifier. */ + hb_xfree( (void *) yylval.string ); + + hb_comp_iState = OPTIONAL; + return OPTIONAL; + } } {Separator}*[^a-zA-Z] { /* any character (not identifier) after OPTIONAL */ unput( yytext[ yyleng-1 ] ); - if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0; - hb_comp_iState = IDENTIFIER; + + if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0; + + hb_comp_iState = IDENTIFIER; return IDENTIFIER; }