From 81511f14d2e4045f8311d1e135602a08f1135322 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Mon, 26 Jun 2000 19:16:57 +0000 Subject: [PATCH] 2000-06-26 23:05 GMT+3 Alexander Kresin --- harbour/ChangeLog | 5 +++++ harbour/source/pp/ppcore.c | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 61b1b9d8dc..dcd150dbb6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,8 @@ +2000-06-26 23:05 GMT+3 Alexander Kresin + * source/pp/ppcore.c + *fixed some problems, appeared after last fix and + reported by Andi Jahja and Patrick Mast + 2000-06-26 06:22 UTC-0800 Ron Pinkas * source/compiler/harbour.l ! Fixed 3 typos that made strings to be compiled with the closing string delimiter, causing Run-Time error 9004. diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 824dbe5b41..d9610c4941 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -1273,7 +1273,7 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr } switch( *ptrmp ) { case '[': - isWordInside = 0; + if( !s_numBrackets ) isWordInside = 0; s_numBrackets++; s_aIsRepeate[ s_Repeate ] = 0; lastopti[s_Repeate++] = ptrmp; @@ -1321,14 +1321,14 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr } s_numBrackets--; } - else + else { if( !isWordInside ) strtopti = NULL; s_numBrackets--; ptrmp++; } break; case ',': - isWordInside = 1; + if( s_numBrackets == 1 ) isWordInside = 1; if( !s_numBrackets ) strtopti = NULL; if( *ptri == ',' ) { ptrmp++; ptri++; } else @@ -1342,7 +1342,7 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr break; case '\1': /* Match marker */ if( !s_numBrackets ) strtopti = NULL; - if( *(ptrmp+2) == '2' ) isWordInside = 1; /* restricted match marker */ + if( s_numBrackets == 1 && *(ptrmp+2) == '2' ) isWordInside = 1; /* restricted match marker */ if( !WorkMarkers( &ptrmp, &ptri, ptro, lenres, com_or_xcom ) ) { if( s_numBrackets ) @@ -1358,7 +1358,7 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr else endTranslation = TRUE; break; default: /* Key word */ - isWordInside = 1; + if( s_numBrackets == 1 ) isWordInside = 1; if( !s_numBrackets ) strtopti = NULL; ptr = ptri; if( *ptri == ',' || truncmp( &ptri, &ptrmp, !com_or_xcom ) ) @@ -1463,7 +1463,7 @@ static int WorkMarkers( char ** ptrmp, char ** ptri, char * ptro, int * lenres, char exppatt[ MAX_NAME ]; int lenreal = 0, maxlenreal = HB_PP_STR_SIZE, lenpatt; - int rezrestr, ipos; + int rezrestr, ipos, nBra; char * ptr, * ptrtemp; HB_TRACE(HB_TR_DEBUG, ("WorkMarkers(%p, %p, %s, %p)", ptrmp, ptri, ptro, lenres)); @@ -1486,7 +1486,14 @@ static int WorkMarkers( char ** ptrmp, char ** ptri, char * ptro, int * lenres, HB_SKIPTABSPACES( ptrtemp ); while( *ptrtemp == '[' ) { - while( *ptrtemp != ']' ) ptrtemp++; + nBra = 0; + ptrtemp++; + while( ( *ptrtemp != ']' || nBra ) && *ptrtemp != '\0') + { + if( *ptrtemp == '[' ) nBra++; + else if( *ptrtemp == ']' ) nBra --; + ptrtemp++; + } ptrtemp++; HB_SKIPTABSPACES( ptrtemp ); }