From 28ee6341b36fffef2ff38ad5bc3ef9d233429d35 Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Tue, 15 Aug 2000 18:46:56 +0000 Subject: [PATCH] ChangeLog 2000-08-15 20:40 --- harbour/ChangeLog | 11 +++ harbour/include/hbexprc.c | 1 + harbour/source/compiler/exproptc.c | 2 +- harbour/source/compiler/harbour.l | 111 ++++++++++++++++------------- 4 files changed, 75 insertions(+), 50 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9fa6bfe637..a53923f5c1 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +2000-08-15 20:40 UTC+0100 Ryszard Glab + + *include/hbexprc.c + *source/compiler/exproptc.c + *fixed unused variable warning + + source/compiler/harbour.l + *fixed some warnings reported by BCC + *some final optimization + + 2000-08-15 14:40 GMT -3 Luiz Rafael Culik * doc/en/cmdline.txt * Formated text added by Victor diff --git a/harbour/include/hbexprc.c b/harbour/include/hbexprc.c index f7ea60d1fd..752eb811b4 100644 --- a/harbour/include/hbexprc.c +++ b/harbour/include/hbexprc.c @@ -482,6 +482,7 @@ HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight, pLeft->value.asString.dealloc = TRUE; hb_compExprFree( pRight, HB_MACRO_PARAM ); + HB_SYMBOL_UNUSED( HB_MACRO_PARAM ); /* to suppress BCC warning */ return pLeft; } #endif diff --git a/harbour/source/compiler/exproptc.c b/harbour/source/compiler/exproptc.c index c2c531cca0..845515c334 100644 --- a/harbour/source/compiler/exproptc.c +++ b/harbour/source/compiler/exproptc.c @@ -5,6 +5,6 @@ /* hbexprc.c is also included from ../macro/macro.c * However it produces a slighty different code if used in * macro compiler (there is an additional parameter passed to some functions) - * 0 - ignore this magic number - this is used to force compilation + * 1 - ignore this magic number - this is used to force compilation */ #include "hbexprc.c" diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index 78603929c5..34278a0b43 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -169,12 +169,14 @@ Separator {SpaceTab} from direct calls for qout function QOUT([some string]) ; QOUT([some more]) */ - if( 0 /* TODO: hb_ppInsideTextBlock */ ) +/* TODO: implement hb_ppInsideTextBlock it is PP + if( hb_ppInsideTextBlock ) { BEGIN STRING4START; unput( '(' ); } else +*/ yyless( 4 ); /* len of QOUT */ yylval.string = hb_compIdentifierNew( "QOUT", TRUE ); @@ -236,7 +238,7 @@ Separator {SpaceTab} if( (StopChar == '"') || (StopChar == '\'') || (StopChar == '[') ) { - int i = 0; + int i; if( StopChar == '[' ) StopChar = ']'; for( i = 0; i < yyleng-1; ++i ) @@ -353,7 +355,8 @@ Separator {SpaceTab} return IDENTIFIER; } } -{Separator}*[\n;] { /* at the end of line */ +{Separator}* ; +[\n;] { /* at the end of line */ BEGIN 0; unput( yytext[ yyleng-1 ] ); return BREAK; @@ -363,13 +366,13 @@ Separator {SpaceTab} * There are no resons to limit this use in Harbour. */ /* -{Separator}*[\[] { BEGIN 0; +[\[] { BEGIN 0; unput( yytext[ yyleng-1 ] ); hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, yytext, NULL ); } */ %} -{Separator}*(":="|"+="|"-="|"->"|"*="|"/="|"^="|"==") { /* operators */ +(":="|"+="|"-="|"->"|"*="|"/="|"^="|"==") { /* operators */ BEGIN 0; yylval.string = hb_compIdentifierNew( "BREAK", TRUE ); unput( yytext[ yyleng-1 ] ); @@ -377,7 +380,7 @@ Separator {SpaceTab} hb_comp_iState =IDENTIFIER; return IDENTIFIER; } -{Separator}*("++"|"--") { /* operators */ +("++"|"--") { /* operators */ /* NOTE: It is not possible to distinguish between * break++ and break ++i * For this reason we are allowing the BREAK statement only @@ -389,14 +392,14 @@ Separator {SpaceTab} hb_comp_iState =BREAK; return BREAK; } -{Separator}*[\=\(] { /* operators = ( */ +[\=\(] { /* operators = ( */ BEGIN 0; yylval.string = hb_compIdentifierNew( "BREAK", TRUE ); unput( yytext[ yyleng-1 ] ); hb_comp_iState =IDENTIFIER; return IDENTIFIER; } -{Separator}*. { /* all other cases */ +. { /* all other cases */ /* NOTE: This state includes break&var */ BEGIN 0; @@ -408,14 +411,15 @@ Separator {SpaceTab} /* ************************************************************************ */ %} "case" BEGIN CASE_; -{Separator}*[\:\=\|\$\%\*\,\/\]\)\}\^] { /* there is an operator after "case" */ +{Separator}* ; +[\:\=\|\$\%\*\,\/\]\)\}\^] { /* there is an operator after "case" */ BEGIN 0; yylval.string = hb_compIdentifierNew( "CASE", TRUE ); hb_comp_iState =IDENTIFIER; unput( yytext[ yyleng-1 ] ); return IDENTIFIER; } -{Separator}*("+="|"-="|"->") { /* operators */ +("+="|"-="|"->") { /* operators */ BEGIN 0; yylval.string = hb_compIdentifierNew( "CASE", TRUE ); hb_comp_iState =IDENTIFIER; @@ -423,7 +427,7 @@ Separator {SpaceTab} unput( yytext[ yyleng-2 ] ); return IDENTIFIER; } -{Separator}*("::") { /* send operators */ +("::") { /* send operators */ BEGIN 0; unput( yytext[ yyleng-1 ] ); unput( yytext[ yyleng-2 ] ); @@ -432,7 +436,7 @@ Separator {SpaceTab} hb_comp_iState =CASE; return CASE; } -{Separator}*(\n|.) { /* not operator */ +(\n|.) { /* not operator */ BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP ) @@ -605,7 +609,8 @@ Separator {SpaceTab} /* ************************************************************************ */ %} "end" { BEGIN END_; } -{Separator}*[\[\(] { /* array, function call */ +{Separator}* ; +[\[\(] { /* array, function call */ BEGIN 0; if( hb_comp_iState == LOOKUP ) { /* Clipper does not like end[] & end() at the begining of line */ @@ -616,7 +621,7 @@ Separator {SpaceTab} unput( yytext[ yyleng-1 ] ); return IDENTIFIER; } -{Separator}*("->"|"++"|"--") { /* operators */ +("->"|"++"|"--") { /* operators */ BEGIN 0; if( hb_comp_iState == LOOKUP ) { /* Clipper does not like end-> & end++ at the begining of line */ @@ -628,14 +633,14 @@ Separator {SpaceTab} unput( yytext[ yyleng-2 ] ); return IDENTIFIER; } -{Separator}*[\+\-\:\=\|\$\%\*\,\/\[\]\)\}\^] { /* there is an operator after "end" */ +[\+\-\:\=\|\$\%\*\,\/\[\]\)\}\^] { /* there is an operator after "end" */ BEGIN 0; yylval.string = hb_compIdentifierNew( "END", TRUE ); hb_comp_iState =IDENTIFIER; unput( yytext[ yyleng-1 ] ); return IDENTIFIER; } -{Separator}*(.|\n) { /* not operator */ +(.|\n) { /* not operator */ BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP ) @@ -774,13 +779,14 @@ Separator {SpaceTab} IF and IIF */ } -{Separator}*"(" { +{Separator}* ; +"(" { BEGIN 0; unput( yytext[ yyleng-1 ] ); hb_comp_iState=IIF; return IIF; } -{Separator}*[^\(] { +[^\(] { BEGIN 0; hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, ((yytext[ yyleng-1 ]=='\n')?"IIF":yytext), NULL ); } @@ -793,7 +799,8 @@ Separator {SpaceTab} else BEGIN IF_; } -{Separator}*"(" { BEGIN 0; +{Separator}* ; +"(" { BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP ) hb_comp_iState =IF; @@ -801,19 +808,19 @@ Separator {SpaceTab} hb_comp_iState =IIF; return hb_comp_iState; } -{Separator}*[\)\]\/\^\*\%\=\$\@] { BEGIN 0; +[\)\]\/\^\*\%\=\$\@] { BEGIN 0; hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX2, yytext, "IF" ); } -{Separator}*"->" { BEGIN 0; +"->" { BEGIN 0; hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX2, yytext, "IF" ); } -{Separator}*[\n] { BEGIN 0; +\n { BEGIN 0; hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, "IF", NULL ); } -{Separator}*("++"|"--")/[\n] { BEGIN 0; +("++"|"--")/[\n] { BEGIN 0; hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX2, yytext, "IF" ); } -{Separator}*. { BEGIN 0; +. { BEGIN 0; unput( yytext[ yyleng-1 ] ); hb_comp_iState =IF; return IF; @@ -876,7 +883,8 @@ Separator {SpaceTab} /* ************************************************************************ */ %} "next" BEGIN NEXT_; -{Separator}*[\n\;] { /* at the end of line */ +{Separator}* ; +[\n\;] { /* at the end of line */ BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP ) @@ -893,7 +901,7 @@ Separator {SpaceTab} return IDENTIFIER; } } -{Separator}*[\[\(] { /* array, function call */ +[\[\(] { /* array, function call */ BEGIN 0; if( hb_comp_iState == LOOKUP ) { /* Clipper does not like NEXT[] & NEXT() at the begining of line */ @@ -904,7 +912,7 @@ Separator {SpaceTab} unput( yytext[ yyleng-1 ] ); return IDENTIFIER; } -{Separator}*("->"|"++"|"--") { /* operators */ +("->"|"++"|"--") { /* operators */ BEGIN 0; if( hb_comp_iState == LOOKUP ) { /* Clipper does not like next-> & next++ at the begining of line */ @@ -916,13 +924,13 @@ Separator {SpaceTab} unput( yytext[ yyleng-2 ] ); return IDENTIFIER; } -{Separator}*[^_a-zA-Z] { /* there is no identifier after "next" */ +[^_a-zA-Z] { /* there is no identifier after "next" */ BEGIN 0; yylval.string = hb_compIdentifierNew( "NEXT", TRUE ); unput( yytext[ yyleng-1 ] ); return IDENTIFIER; } -{Separator}*. { /* an identifier follows NEXT statement */ +. { /* an identifier follows NEXT statement */ BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP ) @@ -950,7 +958,8 @@ Separator {SpaceTab} yylval.string = hb_compIdentifierNew( hb_strupr( yytext ), TRUE ); BEGIN OTHERWISE_; } -{Separator}*[\n\;] { /* end of line */ +{Separator}* ; +[\n\;] { /* end of line */ BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP ) @@ -966,7 +975,7 @@ Separator {SpaceTab} return IDENTIFIER; } } -{Separator}*. { +. { BEGIN 0; unput( yytext[ yyleng-1 ] ); hb_comp_iState = IDENTIFIER; @@ -1021,7 +1030,8 @@ Separator {SpaceTab} yylval.string = hb_compIdentifierNew( hb_strupr( yytext ), TRUE ); BEGIN RECOVER_; } -{Separator}*[\n] { /* end of line */ +{Separator}* ; +\n { /* end of line */ BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP ) @@ -1035,12 +1045,12 @@ Separator {SpaceTab} return IDENTIFIER; } } -{Separator}+("using"|"usin") { /* USING */ +("using"|"usin") { /* USING */ BEGIN 0; hb_comp_iState = RECOVERUSING; return RECOVERUSING; } -{Separator}*. { /* all other cases */ +. { /* all other cases */ BEGIN 0; unput( yytext[ yyleng-1 ] ); hb_comp_iState =IDENTIFIER; @@ -1053,7 +1063,8 @@ Separator {SpaceTab} yylval.string = hb_compIdentifierNew( hb_strupr( yytext ), TRUE ); BEGIN RETURN_; } -{Separator}+[\&_a-zA-Z0-9] { /* an identifier, numbers or macro */ +{Separator}* +[\&_a-zA-Z0-9] { /* an identifier, numbers or macro */ BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP ) @@ -1067,14 +1078,14 @@ Separator {SpaceTab} return IDENTIFIER; } } -{Separator}*("+="|"-="|"->") { /* operators */ +("+="|"-="|"->") { /* operators */ BEGIN 0; hb_comp_iState =IDENTIFIER; unput( yytext[ yyleng-1 ] ); unput( yytext[ yyleng-2 ] ); return IDENTIFIER; } -{Separator}*("++"|"--") { /* operators */ +("++"|"--") { /* operators */ BEGIN 0; unput( yytext[ yyleng-1 ] ); unput( yytext[ yyleng-2 ] ); @@ -1089,14 +1100,14 @@ Separator {SpaceTab} return IDENTIFIER; } } -{Separator}*("::") { /* SELF operator */ +"::" { /* SELF operator */ BEGIN 0; hb_comp_iState = RETURN; unput( yytext[ yyleng-1 ] ); unput( yytext[ yyleng-2 ] ); return RETURN; } -{Separator}*[\n\;\(\[\{\"\'\.\-\+\!] { +[\n\;\(\[\{\"\'\.\-\+\!] { /* EOL or '()', '[]', '{}', '""', "''" , '.T.', '-', '+', '!' */ BEGIN 0; unput( yytext[ yyleng-1 ] ); @@ -1111,7 +1122,7 @@ Separator {SpaceTab} return IDENTIFIER; } } -{Separator}*. { /* any other character after RETURN */ +. { /* any other character after RETURN */ BEGIN 0; unput( yytext[ yyleng-1 ] ); hb_comp_iState =IDENTIFIER; @@ -1134,7 +1145,8 @@ Separator {SpaceTab} /* ************************************************************************ */ %} "while"|"whil" BEGIN WHILE_; -{Separator}*\n { /* end of line */ +{Separator}* ; +\n { /* end of line */ BEGIN 0; unput( '\n' ); if( hb_comp_iState == DO ) @@ -1144,27 +1156,27 @@ Separator {SpaceTab} yylval.string = hb_compIdentifierNew( "WHILE", TRUE ); return IDENTIFIER; } -{Separator}*[\:\=\|\$\%\*\,\/\]\)\}\^] { /* there is an operator after "case" */ +[\:\=\|\$\%\*\,\/\]\)\}\^] { /* there is an operator after "case" */ BEGIN 0; yylval.string = hb_compIdentifierNew( "WHILE", TRUE ); unput( yytext[ yyleng-1 ] ); return IDENTIFIER; } -{Separator}*("+="|"-="|"->") { /* operators */ +("+="|"-="|"->") { /* operators */ BEGIN 0; yylval.string = hb_compIdentifierNew( "WHILE", TRUE ); unput( yytext[ yyleng-1 ] ); unput( yytext[ yyleng-2 ] ); return IDENTIFIER; } -{Separator}*("::") { /* send operators */ +"::" { /* send operators */ BEGIN 0; unput( yytext[ yyleng-1 ] ); unput( yytext[ yyleng-2 ] ); hb_comp_iState =WHILE; return WHILE; } -{Separator}*. { /* identifiers and literals */ +. { /* identifiers and literals */ BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == LOOKUP || hb_comp_iState == DO ) @@ -1183,13 +1195,14 @@ Separator {SpaceTab} /* ************************************************************************ */ %} "with" BEGIN WITH_; -{Separator}*\n { /* at the end of line */ +{Separator}* ; +\n { /* at the end of line */ BEGIN 0; unput( '\n' ); yylval.string = hb_compIdentifierNew( "WITH", TRUE ); return IDENTIFIER; } -{Separator}*"with" { +"with" { BEGIN 0; yyless( yyleng-4 ); if( hb_comp_iState == DO ) @@ -1204,14 +1217,14 @@ Separator {SpaceTab} return WITH; } } -{Separator}*[\)] { /* ( with ) or with() */ +[\)] { /* ( with ) or with() */ BEGIN 0; unput( yytext[ yyleng-1 ] ); hb_comp_iState =IDENTIFIER; yylval.string = hb_compIdentifierNew( "WITH", TRUE ); return IDENTIFIER; } -{Separator}*. { +. { BEGIN 0; unput( yytext[ yyleng-1 ] ); if( hb_comp_iState == WHILE ||