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
This commit is contained in:
Przemyslaw Czerpak
2009-10-13 22:16:30 +00:00
parent f2932c93b2
commit bc8ff36826
6 changed files with 80 additions and 17 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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 );

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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 );
}
}