From c665d0e39809ea6df2c80403525b7fef4dc25f88 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Wed, 19 Jan 2000 18:24:23 +0000 Subject: [PATCH] Updating hbpp.c --- harbour/ChangeLog | 12 ++++++++---- harbour/source/pp/hbpp.c | 24 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 382bc12eab..2eb481457a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,7 @@ +20000119-21:21 GMT+3 Alexander Kresin + * source/pp/hbpp.c + * Few bugs fixed, reported by Matteo Baccan and Dave Pearson + 20000119-13:05 GMT+1 Ryszard Glab *source/macro/macro.y @@ -28,9 +32,9 @@ *include/ctoharb.h *source/vm/hvm.c - * added HB_ENDPROC_REQUEST and hb_vmRequestEndProc() which are used - to request immediately return from currently evaluated pcode buffer. - This is used to stop processing of macro compiled code. + * added HB_ENDPROC_REQUEST and hb_vmRequestEndProc() which are used + to request immediately return from currently evaluated pcode buffer. + This is used to stop processing of macro compiled code. *source/rtl/itemapi.c * if parameter passed to hb_itemNew is not NULL then it is used to @@ -43,7 +47,7 @@ was used. *doc/funclist.txt - * marked TYPE() as Ready :) + * marked TYPE() as Ready :) 2000-01-19 08:28 GMT+1 Antonio Linares * source/debug/debugger.prg diff --git a/harbour/source/pp/hbpp.c b/harbour/source/pp/hbpp.c index 6e09bec1b8..120917ceee 100644 --- a/harbour/source/pp/hbpp.c +++ b/harbour/source/pp/hbpp.c @@ -121,11 +121,12 @@ static BOOL s_bTracePragma = FALSE; #define STATE_COMMENT 2 #define STATE_QUOTE1 3 #define STATE_QUOTE2 4 -#define STATE_ID_END 5 -#define STATE_ID 6 -#define STATE_EXPRES 7 -#define STATE_EXPRES_ID 8 -#define STATE_BRACKET 9 +#define STATE_QUOTE3 5 +#define STATE_ID_END 6 +#define STATE_ID 7 +#define STATE_EXPRES 8 +#define STATE_EXPRES_ID 9 +#define STATE_BRACKET 10 #define IT_EXPR 1 #define IT_ID 2 @@ -140,6 +141,7 @@ static int s_Repeate; static BOOL s_bReplacePat = TRUE; static int s_numBrackets; static char s_groupchar; +static char s_prevchar = 'A'; int hb_pp_lInclude = 0; int * hb_pp_aCondCompile; @@ -1799,7 +1801,7 @@ static int ReplacePattern( char patttype, char * expreal, int lenreal, char * pt else if( lenreal && *expreal == '{' ) { hb_pp_Stuff( expreal, ptro, lenreal, 4, lenres ); - } + } else { hb_pp_Stuff( "{||}", ptro, 4, 4, lenres ); @@ -1886,10 +1888,15 @@ int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lDropSpaces, ch break; case STATE_QUOTE1: if(cha=='\'') s_ParseState = STATE_NORMAL; break; case STATE_QUOTE2: if(cha=='\"') s_ParseState = STATE_NORMAL; break; - case STATE_BRACKET: if(cha==']') s_ParseState = STATE_NORMAL; break; + case STATE_QUOTE3: if(cha==']') s_ParseState = STATE_NORMAL; break; default: switch( cha ) { - case '[': s_ParseState = STATE_BRACKET; break; + case '[': + if( ISNAME(s_prevchar) || s_prevchar == ']' ) + s_ParseState = STATE_BRACKET; + else s_ParseState = STATE_QUOTE3; + break; + case ']': s_ParseState = STATE_NORMAL; break; case '\"': if( s_ParseState != STATE_BRACKET ) s_ParseState = STATE_QUOTE2; break; @@ -1911,6 +1918,7 @@ int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lDropSpaces, ch else if( !State ) maxlen = readed = 0; break; } + if( cha != ' ' && cha != ';' ) s_prevchar = cha; } if( cha != ' ' && cha != '\t' ) State = 1; if( lDropSpaces && State ) lDropSpaces = 0;