diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 64720fa520..ac5ae970a3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,12 @@ +2001-06-22 07:30 UTC-0800 Ron Pinkas + * source/pp/ppcore.c + + Added logic for new Idenitifier Match Marker which will only match Identifiers. + + Added static BOOL IsIdentifier( char *szProspect ) + + * include/hbclass.ch + ! Changed to in 3 VO OO compatibility rules, where regular match marker was TOO generic. + ! Reinstated default #define HB_CLS_VO + 2001-06-22 06:10 UTC-0800 Ron Pinkas * include/hbclass.ch ! Un-Commented out 3 rules used for VO OO and #undefed HB_CLS_VO instead. diff --git a/harbour/include/hbclass.ch b/harbour/include/hbclass.ch index 4f69716e10..39fa4142e5 100644 --- a/harbour/include/hbclass.ch +++ b/harbour/include/hbclass.ch @@ -131,7 +131,7 @@ DECLARE TClass ; /* IF NOTHING DECIDED BY THE PROGRAMER USE ALL */ #define HB_CLS_FWO #define HB_CLS_CSY -//#define HB_CLS_VO +#define HB_CLS_VO #define HB_CLS_TOP #endif @@ -251,10 +251,9 @@ DECLARE TClass ; /* VO SYNTAX */ #ifdef HB_CLS_VO -// *** These rules are TOO generic and have undesired side effects!!! -#xtranslate ( { [] } => ( ():New(

) -#xtranslate = { [] } => = ():New(

) -#xtranslate , { [] } => , ():New(

) +#xtranslate ( { [] } => ( ():New(

) +#xtranslate = { [] } => = ():New(

) +#xtranslate , { [] } => , ():New(

) #xcommand EXPORT [ AS ] [ INIT ] [] => ; _HB_MEMBER {[AS ] } ;; diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index d53967bedc..21092f3ae4 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -131,6 +131,7 @@ static int NextWord( char **, char *, BOOL ); static int NextName( char **, char * ); static int NextParm( char **, char * ); static BOOL OpenInclude( char *, PATHNAMES *, PHB_FNAME, BOOL bStandardOnly, char * ); +static BOOL IsIdentifier( char *szProspect ); #define ISNAME( c ) ( isalnum( ( int ) c ) || ( c ) == '_' || ( c ) > 0x7E ) #define MAX_NAME 255 @@ -897,6 +898,8 @@ static void ConvertPatterns( char * mpatt, int mlen, char * rpatt, int rlen ) { exptype = '3'; i++; } else if( *(mpatt+i) == '(' ) /* Extended expression match marker */ { exptype = '4'; i++; } + else if( *(mpatt+i) == '!' ) /* Extended expression match marker */ + { exptype = '5'; i++; } ptr = mpatt + i; while( *ptr != '>' ) { @@ -937,6 +940,12 @@ static void ConvertPatterns( char * mpatt, int mlen, char * rpatt, int rlen ) else hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); } + else if( exptype == '5' ) + { + if( *(exppatt+explen-1) == '!' ) explen--; + else + hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); + } rmlen = i - ipos + 1; /* Convert match marker into inner format */ @@ -1784,12 +1793,25 @@ static int WorkMarkers( char ** ptrmp, char ** ptri, char * ptro, int * lenres, printf( "\nExpr: '%s' ptrtemp: '%s' exppat: '%s'\n", expreal, ptrtemp, exppatt ); #endif - if( ipos > 1 && isExpres( expreal ) ) + if( ipos > 1 ) { - /* - printf( "Accepted: >%s<\n", expreal ); - */ - *ptri += lenreal; + if( *(exppatt+2) == '5' ) /* ---- Minimal match marker */ + { + if( IsIdentifier( expreal ) ) + { + /* + printf( "Accepted ID: >%s<\n", expreal ); + */ + *ptri += lenreal; + } + } + else if( isExpres( expreal ) ) + { + /* + printf( "Accepted: >%s<\n", expreal ); + */ + *ptri += lenreal; + } } else { @@ -3778,6 +3800,27 @@ static int NextParm( char ** sSource, char * sDest ) return lenName; } +static BOOL IsIdentifier( char *szProspect ) +{ + if( isalpha( szProspect[0] ) || szProspect[0] == '_' ) + { + int i = 1; + + while( ISNAME( szProspect[i] ) ) + { + i++; + } + while( szProspect[i] == ' ' ) + { + i++; + } + + return ( szProspect[i] == '\0' ) ; + } + + return FALSE; +} + static BOOL OpenInclude( char * szFileName, PATHNAMES * pSearch, PHB_FNAME pMainFileName, BOOL bStandardOnly, char * szInclude ) { FILE * fptr;