From 12cb3fb99065f6eb0f610317190523dfdecc221c Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Thu, 10 Aug 2000 09:49:35 +0000 Subject: [PATCH] ChangeLog 2000-09-10 11:50 UTC+0100 --- harbour/ChangeLog | 5 +++++ harbour/source/compiler/harbour.l | 23 +++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index aed47abfb3..0614a7bdb1 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,8 @@ +2000-08-10 11:50 UTC+0100 Ryszard Glab + + *source/compiler/harbour.l + * fixed handling of while[] and case[] + 2000-08-09 20:00 UTC+0800 Ron Pinkas * source/compiler/simplex.c * Corrected support for BREAK ( ). diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index cc8c262e5b..a9645af3bf 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -70,10 +70,14 @@ extern FILE * yyin; /* currently yacc parsed file */ int yy_lex_input( char *, int ); #define YY_INPUT( buf, result, max_size ) result = yy_lex_input( buf, max_size ); +/* NOTE: Uncomment this YY_USER_ACTION definition if you want to use + '^' match marker (beginning of line) +*/ +/* #define YY_USER_ACTION \ if ( yyleng > 0 ) \ yy_current_buffer->yy_at_bol = ( yytext[yyleng - 1] == '\n' || yytext[0] == '\n' ); - +*/ #define LOOKUP 0 /* scan from the begining of line */ #define OPERATOR -1 @@ -308,14 +312,6 @@ Separator {SpaceTab} unput( yytext[ yyleng-1 ] ); return IDENTIFIER; } -{Separator}*[\[] { /* Clipper assumes a [String] here */ - if( hb_comp_wCaseCounter == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CASE, NULL, NULL ); - BEGIN 0; - unput( yytext[ yyleng-1 ] ); - hb_comp_iState =CASE; - return CASE; - } {Separator}*("+="|"-="|"->") { /* operators */ BEGIN 0; yylval.string = hb_compIdentifierNew( "CASE", TRUE ); @@ -328,6 +324,8 @@ Separator {SpaceTab} BEGIN 0; unput( yytext[ yyleng-1 ] ); unput( yytext[ yyleng-2 ] ); + if( hb_comp_wCaseCounter == 0 ) + hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CASE, NULL, NULL ); hb_comp_iState =CASE; return CASE; } @@ -336,6 +334,8 @@ Separator {SpaceTab} unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP ) { /* it is first item in the line */ + if( hb_comp_wCaseCounter == 0 ) + hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CASE, NULL, NULL ); hb_comp_iState =CASE; return CASE; } @@ -1031,11 +1031,6 @@ Separator {SpaceTab} yylval.string = hb_compIdentifierNew( "WHILE", TRUE ); return IDENTIFIER; } -{Separator}*[\[] { /* array */ - /* Clipper does not like while[] at all */ - BEGIN 0; - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, yytext, NULL ); - } {Separator}*[\:\=\|\$\%\*\,\/\]\)\}\^] { /* there is an operator after "case" */ BEGIN 0; yylval.string = hb_compIdentifierNew( "WHILE", TRUE );