2007-05-21 13:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/pp/ppcore.c
! fixed E"..."
! added new hack for strings inside []
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-05-21 13:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/pp/ppcore.c
|
||||
! fixed E"..."
|
||||
! added new hack for strings inside []
|
||||
|
||||
2007-05-21 13:11 UTC+0100 Miguel Angel Marchuet (miguelangel/at/marchuet.net)
|
||||
* contrib/bmdbfcdx/bmdbfcdx1.c
|
||||
* minor warning fix on os/2 compile.
|
||||
|
||||
@@ -688,9 +688,10 @@ static void hb_pp_readLine( PHB_PP_STATE pState )
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL hb_pp_canQuote( BOOL fQuote, char * pBuffer, ULONG ulLen, ULONG * pulAt )
|
||||
static BOOL hb_pp_canQuote( BOOL fQuote, char * pBuffer, ULONG ulLen,
|
||||
ULONG ul, ULONG * pulAt )
|
||||
{
|
||||
ULONG ul = 0;
|
||||
char cQuote = 0;
|
||||
|
||||
/*
|
||||
* TODO: this is Clipper compatible but it breaks valid code so we may
|
||||
@@ -700,9 +701,43 @@ static BOOL hb_pp_canQuote( BOOL fQuote, char * pBuffer, ULONG ulLen, ULONG * pu
|
||||
{
|
||||
if( pBuffer[ ul ] == ']' )
|
||||
{
|
||||
* pulAt = ul;
|
||||
if( cQuote && !fQuote )
|
||||
{
|
||||
ULONG u = ul + 1;
|
||||
cQuote = 0;
|
||||
while( u < ulLen )
|
||||
{
|
||||
if( cQuote )
|
||||
{
|
||||
if( pBuffer[ u ] == cQuote )
|
||||
cQuote = 0;
|
||||
}
|
||||
else if( pBuffer[ u ] == '`' )
|
||||
cQuote = '\'';
|
||||
else if( pBuffer[ u ] == '\'' || pBuffer[ u ] == '"' )
|
||||
cQuote = pBuffer[ u ];
|
||||
else if( pBuffer[ u ] == '[' )
|
||||
hb_pp_canQuote( TRUE, pBuffer, ulLen, u + 1, &u );
|
||||
++u;
|
||||
}
|
||||
fQuote = cQuote == 0;
|
||||
}
|
||||
if( fQuote )
|
||||
* pulAt = ul;
|
||||
return fQuote;
|
||||
}
|
||||
else if( !fQuote )
|
||||
{
|
||||
if( cQuote )
|
||||
{
|
||||
if( pBuffer[ ul ] == cQuote )
|
||||
cQuote = 0;
|
||||
}
|
||||
else if( pBuffer[ ul ] == '`' )
|
||||
cQuote = '\'';
|
||||
else if( pBuffer[ ul ] == '\'' || pBuffer[ ul ] == '"' )
|
||||
cQuote = pBuffer[ ul ];
|
||||
}
|
||||
++ul;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -1020,7 +1055,7 @@ static void hb_pp_getLine( PHB_PP_STATE pState )
|
||||
{
|
||||
ULONG ulStrip, u;
|
||||
|
||||
if( ch == 'e' )
|
||||
if( ch != '"' )
|
||||
++ul;
|
||||
while( ++ul < ulLen && pBuffer[ ul ] != '"' )
|
||||
{
|
||||
@@ -1058,7 +1093,7 @@ static void hb_pp_getLine( PHB_PP_STATE pState )
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
u = ch == 'e' ? 2 : 1;
|
||||
u = ch != '"' ? 2 : 1;
|
||||
ulStrip = ul - u;
|
||||
hb_strRemEscSeq( pBuffer + u, &ulStrip );
|
||||
hb_pp_tokenAddNext( pState, pBuffer + u, ulStrip,
|
||||
@@ -1119,10 +1154,10 @@ static void hb_pp_getLine( PHB_PP_STATE pState )
|
||||
else if( ch == '[' && !pState->fDirective &&
|
||||
hb_pp_canQuote( pState->fCanNextLine ||
|
||||
HB_PP_TOKEN_CANQUOTE( pState->iLastType ),
|
||||
pBuffer + 1, ulLen - 1, &ul ) )
|
||||
pBuffer, ulLen, 1, &ul ) )
|
||||
{
|
||||
hb_pp_tokenAddNext( pState, pBuffer + 1, ul, HB_PP_TOKEN_STRING );
|
||||
ul += 2;
|
||||
hb_pp_tokenAddNext( pState, pBuffer + 1, ul - 1, HB_PP_TOKEN_STRING );
|
||||
++ul;
|
||||
}
|
||||
else if( ( ch == '/' || ch == '&' ) && ulLen > 1 && pBuffer[ 1 ] == ch )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user