From bc8ff368268e9c33c8c03d987fcab2321e09bcb2 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 13 Oct 2009 22:16:30 +0000 Subject: [PATCH] 2009-10-14 00:16 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbcomp.h * harbour/src/compiler/hbmain.c * harbour/src/compiler/complex.c * harbour/src/compiler/harbour.y * harbour/src/compiler/harbour.yyc % disable grammar parser when -sm switch is used --- harbour/ChangeLog | 8 ++++ harbour/include/hbcomp.h | 1 + harbour/src/compiler/complex.c | 74 ++++++++++++++++++++++++++++---- harbour/src/compiler/harbour.y | 2 +- harbour/src/compiler/harbour.yyc | 7 +-- harbour/src/compiler/hbmain.c | 5 ++- 6 files changed, 80 insertions(+), 17 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7fa314fff6..63784f04d5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,14 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-14 00:16 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbcomp.h + * harbour/src/compiler/hbmain.c + * harbour/src/compiler/complex.c + * harbour/src/compiler/harbour.y + * harbour/src/compiler/harbour.yyc + % disable grammar parser when -sm switch is used + 2009-10-13 20:02 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/tests/testole.prg + Added SOAP client call example. Based on the one sent to the diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index a35fd07588..695f67bead 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -89,6 +89,7 @@ extern void hb_compCompileEnd( HB_COMP_DECL ); extern int hb_compparse( HB_COMP_DECL ); extern void hb_compParserStop( HB_COMP_DECL ); +extern void hb_compParserRun( HB_COMP_DECL ); #define VS_NONE 0 #define VS_LOCAL 1 diff --git a/harbour/src/compiler/complex.c b/harbour/src/compiler/complex.c index 1324ae520b..5033593689 100644 --- a/harbour/src/compiler/complex.c +++ b/harbour/src/compiler/complex.c @@ -828,7 +828,8 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) pToken->pNext->len >= 4 && pToken->pNext->len <= 8 && hb_strnicmp( "SEQUENCE", pToken->pNext->value, pToken->pNext->len ) == 0 ) { - if( HB_COMP_PARAM->functions.pLast->wSeqCounter == 0 ) + if( HB_COMP_PARAM->functions.pLast->wSeqCounter == 0 && + HB_COMP_PARAM->iTraceInclude == 0 ) hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ENDIF, NULL, NULL ); hb_pp_tokenGet( pLex->pPP ); @@ -869,7 +870,8 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) } } /* Clipper accepts ELSE in one context only */ - if( HB_COMP_PARAM->functions.pLast->wIfCounter == 0 ) + if( HB_COMP_PARAM->functions.pLast->wIfCounter == 0 && + HB_COMP_PARAM->iTraceInclude == 0 ) hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_UNMATCHED_ELSE, NULL, NULL ); pLex->iState = ELSE; @@ -887,7 +889,8 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) } } /* Clipper accepts ELSEIF in one context only */ - if( HB_COMP_PARAM->functions.pLast->wIfCounter == 0 ) + if( HB_COMP_PARAM->functions.pLast->wIfCounter == 0 && + HB_COMP_PARAM->iTraceInclude == 0 ) hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_UNMATCHED_ELSEIF, NULL, NULL ); pLex->iState = ELSEIF; @@ -904,7 +907,8 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) } } /* Clipper accepts ENDIF in one context only */ - if( HB_COMP_PARAM->functions.pLast->wIfCounter == 0 ) + if( HB_COMP_PARAM->functions.pLast->wIfCounter == 0 && + HB_COMP_PARAM->iTraceInclude == 0 ) hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ENDIF, NULL, NULL ); break; @@ -920,7 +924,8 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) } } /* Clipper accepts ENDCASE in one context only */ - if( HB_COMP_PARAM->functions.pLast->wCaseCounter == 0 ) + if( HB_COMP_PARAM->functions.pLast->wCaseCounter == 0 && + HB_COMP_PARAM->iTraceInclude == 0 ) hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ENDCASE, NULL, NULL ); break; @@ -936,7 +941,8 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) } } /* Clipper accepts ENDDO in one context only */ - if( HB_COMP_PARAM->functions.pLast->wWhileCounter == 0 ) + if( HB_COMP_PARAM->functions.pLast->wWhileCounter == 0 && + HB_COMP_PARAM->iTraceInclude == 0 ) hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ENDDO, NULL, NULL ); break; @@ -998,7 +1004,8 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) ( iType == CASE && !HB_PP_LEX_NEEDLEFT( pToken->pNext ) ) ) ) { if( HB_COMP_PARAM->functions.pLast->wCaseCounter == 0 && - HB_COMP_PARAM->functions.pLast->wSwitchCounter == 0 ) + HB_COMP_PARAM->functions.pLast->wSwitchCounter == 0 && + HB_COMP_PARAM->iTraceInclude == 0 ) hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CASE, NULL, NULL ); pLex->iState = iType; @@ -1036,7 +1043,8 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) if( HB_PP_TOKEN_ISEOC( pToken->pNext ) || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_KEYWORD ) { - if( HB_COMP_PARAM->functions.pLast->wForCounter == 0 ) + if( HB_COMP_PARAM->functions.pLast->wForCounter == 0 && + HB_COMP_PARAM->iTraceInclude == 0 ) hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_NEXTFOR, NULL, NULL ); pLex->iState = iType; @@ -1243,7 +1251,7 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) break; case PROCREQ: - if( pToken->pNext && + if( pLex->iState == LOOKUP && !HB_PP_TOKEN_ISEOC( pToken->pNext ) && HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_LEFT_PB ) { hb_pp_tokenGet( pLex->pPP ); @@ -1360,6 +1368,54 @@ int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) } } +void hb_compParserRun( HB_COMP_DECL ) +{ + YYSTYPE yylval; + int iToken; + + while( !HB_COMP_PARAM->fExit && HB_COMP_PARAM->iErrorCount == 0 ) + { + iToken = hb_complex( &yylval, HB_COMP_PARAM ); + if( iToken == 0 ) + break; + if( iToken == DOIDENT ) + hb_compModuleAdd( HB_COMP_PARAM, yylval.string, FALSE ); + else if( iToken == PROCREQ ) + { + iToken = hb_complex( &yylval, HB_COMP_PARAM ); + if( iToken == LITERAL ) + { + const char * szFile, * szExt = NULL; + + if( yylval.valChar.dealloc ) + szFile = hb_compIdentifierNew( HB_COMP_PARAM, yylval.valChar.string, HB_IDENT_FREE ); + else + szFile = yylval.valChar.string; + iToken = hb_complex( &yylval, HB_COMP_PARAM ); + if( iToken == '+' ) + { + iToken = hb_complex( &yylval, HB_COMP_PARAM ); + if( iToken == LITERAL ) + { + if( yylval.valChar.dealloc ) + szExt = hb_compIdentifierNew( HB_COMP_PARAM, yylval.valChar.string, HB_IDENT_FREE ); + else + szExt = yylval.valChar.string; + } + iToken = hb_complex( &yylval, HB_COMP_PARAM ); + } + if( iToken == ')' ) + { + if( szExt && *szExt ) + szFile = hb_compIdentifierNew( HB_COMP_PARAM, + hb_xstrcpy( NULL, szFile, szExt, NULL ), HB_IDENT_FREE ); + hb_compModuleAdd( HB_COMP_PARAM, szFile, FALSE ); + } + } + } + } +} + void hb_compParserStop( HB_COMP_DECL ) { HB_SYMBOL_UNUSED( HB_COMP_PARAM ); diff --git a/harbour/src/compiler/harbour.y b/harbour/src/compiler/harbour.y index e6ccef0811..088ac97c7a 100644 --- a/harbour/src/compiler/harbour.y +++ b/harbour/src/compiler/harbour.y @@ -467,7 +467,7 @@ Statement : ExecFlow CrlfStmnt else hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_DUPL_ANNOUNCE, $2, NULL ); } Crlf - | PROCREQ CompTimeStr ')' Crlf { HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | PROCREQ CompTimeStr ')' Crlf ; CompTimeStr : LITERAL { diff --git a/harbour/src/compiler/harbour.yyc b/harbour/src/compiler/harbour.yyc index f8dce6cf3f..5d454e1d80 100644 --- a/harbour/src/compiler/harbour.yyc +++ b/harbour/src/compiler/harbour.yyc @@ -4644,11 +4644,6 @@ yyreduce: ;} break; - case 93: -#line 470 "harbour.y" - { HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} - break; - case 94: #line 473 "harbour.y" { @@ -6847,7 +6842,7 @@ yyreduce: /* Line 1268 of yacc.c. */ -#line 6851 "harboury.c" +#line 6846 "harboury.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/harbour/src/compiler/hbmain.c b/harbour/src/compiler/hbmain.c index 3c5161279e..6474de318f 100644 --- a/harbour/src/compiler/hbmain.c +++ b/harbour/src/compiler/hbmain.c @@ -4102,7 +4102,10 @@ static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuff if( !HB_COMP_PARAM->fExit ) { int iExitLevel = HB_COMP_PARAM->iExitLevel; - hb_compparse( HB_COMP_PARAM ); + if( HB_COMP_PARAM->iTraceInclude > 0 ) + hb_compParserRun( HB_COMP_PARAM ); + else + hb_compparse( HB_COMP_PARAM ); HB_COMP_PARAM->iExitLevel = HB_MAX( iExitLevel, HB_COMP_PARAM->iExitLevel ); } }