2002-05-23 12:46 UTC-0800 Ron Pinkas <ron@ronpinkas.com>
* source/compiler/harbour.slx
! Fixed SELF[...] // Self as Array in IF_BELONG_LEFT() ( borrowed from from xHarbour )
* source/compiler/harbour.sly
! Corrected typo in GetVar - included item belonging to GetVarArray ( borrowed from from xHarbour )
! Fixed logic of GetA ( borrowed from from xHarbour )
This commit is contained in:
@@ -8,6 +8,14 @@
|
||||
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2002-05-23 12:46 UTC-0800 Ron Pinkas <ron@ronpinkas.com>
|
||||
* source/compiler/harbour.slx
|
||||
! Fixed SELF[...] // Self as Array in IF_BELONG_LEFT() ( borrowed from from xHarbour )
|
||||
|
||||
* source/compiler/harbour.sly
|
||||
! Corrected typo in GetVar - included item belonging to GetVarArray ( borrowed from from xHarbour )
|
||||
! Fixed logic of GetA ( borrowed from from xHarbour )
|
||||
|
||||
2002-05-23 14:59 UTC-0300 Horacio Roldan <harbour_ar@yahoo.com.ar>
|
||||
* contrib/mysql/tmysql.prg
|
||||
! Change in CreateTable's mapping of the xBase N(dig,0) field
|
||||
|
||||
@@ -50,8 +50,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define NUMERALS_PER_LINE 3000
|
||||
|
||||
//#define SHOW_LEX_TOKENS
|
||||
//#define DEBUG_LEX
|
||||
|
||||
@@ -68,11 +66,6 @@
|
||||
|
||||
static int iCloseSquare = 0, iWantsEOL, iWantsEXP, iWantsID, iWantsVAR;
|
||||
|
||||
/* Commented 2001-08-29 - Not really needed!
|
||||
static char *aTexts[ NUMERALS_PER_LINE ];
|
||||
int iTexts = 0;
|
||||
*/
|
||||
|
||||
static unsigned char iIdentifier = 0;
|
||||
static char *sIdOnHold, *s_sLastBlock = NULL;
|
||||
|
||||
@@ -503,7 +496,7 @@ LANGUAGE_RULES_ARE {
|
||||
if( bTmp )
|
||||
|
||||
#undef IF_BELONG_LEFT
|
||||
#define IF_BELONG_LEFT(chr) if( iLastToken == IDENTIFIER || iLastToken == ']' || iLastToken == MACROVAR || iLastToken == MACROTEXT || iLastToken == ')' || iLastToken == '}' || iLastToken == WANTS_EOL || iLastToken == WANTS_ID || iLastToken == WANTS_VAR || iLastToken == DECLARE || iLastToken == FIELD || /*iLastToken == SELF ||*/ iLastToken == QSELF || iLastToken == IIF || iLastToken == PROCREQ )
|
||||
#define IF_BELONG_LEFT(chr) if( iLastToken == IDENTIFIER || iLastToken == SELF || iLastToken == ']' || iLastToken == MACROVAR || iLastToken == MACROTEXT || iLastToken == ')' || iLastToken == '}' || iLastToken == WANTS_EOL || iLastToken == WANTS_ID || iLastToken == WANTS_VAR || iLastToken == DECLARE || iLastToken == FIELD || /*iLastToken == SELF ||*/ iLastToken == QSELF || iLastToken == IIF || iLastToken == PROCREQ )
|
||||
|
||||
/* Support Functions. */
|
||||
int hb_comp_SLX_InterceptAction( int iRet, char *sToken )
|
||||
@@ -678,18 +671,6 @@ static int hb_comp_SLX_ElementToken( char* szToken, unsigned int iTokenLen )
|
||||
yylval.string = (char*) hb_xgrab( TOKEN_SIZE );
|
||||
yylval.string[0] = 0;
|
||||
|
||||
/* Commented 2001-08-29 - Not really needed!
|
||||
if( iTexts < NUMERALS_PER_LINE )
|
||||
{
|
||||
aTexts[iTexts++] = yylval.string;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "Error SLX0002 Too many numerals in line: %i\n", hb_comp_iLine - 1 );
|
||||
hb_comp_iErrorCount++;
|
||||
iTexts = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Hex Number */
|
||||
if( yytext[0] == '0' && yytext[1] == 'X' )
|
||||
@@ -803,6 +784,8 @@ long hb_comp_SLX_Hex2L( char* sHex )
|
||||
|
||||
int hb_comp_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, BOOL *ptr_bIgnoreWords, int iLastToken, char *sToken, char *s_szBuffer )
|
||||
{
|
||||
extern BOOL hb_pp_bInline;
|
||||
|
||||
DEBUG_INFO( printf( "Custom Action for %i\n", x ) );
|
||||
|
||||
if( x < HB_WANTS_EXP )
|
||||
@@ -1061,7 +1044,6 @@ int hb_comp_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, BOOL *ptr_bIg
|
||||
|
||||
char sBuffer[ YY_BUF_SIZE ], *pBuffer, sInlineSym[] = "HB_INLINE_0", cMode = INLINE_NORMAL;
|
||||
int iSize, iBraces = 0;
|
||||
extern BOOL hb_pp_bInline;
|
||||
PINLINE pInline;
|
||||
|
||||
hb_comp_iLineINLINE = hb_comp_iLine;
|
||||
|
||||
@@ -117,10 +117,10 @@ char * hb_comp_buffer; /* yacc input buffer */
|
||||
static PTR_LOOPEXIT hb_comp_pLoops = NULL;
|
||||
static HB_RTVAR_PTR hb_comp_rtvars = NULL;
|
||||
|
||||
static HB_EXPR_PTR pArrayIndexAsList = NULL;
|
||||
static HB_EXPR_PTR pGetArgList = NULL, pBaseArrayName = NULL;
|
||||
static BOOL bTrancuateBaseArray = FALSE;
|
||||
static HB_EXPR_PTR pGetArgList = NULL, pBaseArrayName = NULL, pGetVarArray;
|
||||
|
||||
static BOOL bTrancuateBaseArray = FALSE, s_bBlock = FALSE, s_bBlockMacro = FALSE, s_bBlockDeclared = FALSE, s_bSetGet;
|
||||
static s_bBlock = FALSE, s_bBlockMacro = FALSE, s_bBlockDeclared = FALSE, s_bSetGet;
|
||||
static HB_EXPR_PTR pBlockSimple;
|
||||
|
||||
extern int hb_compLocalGetPos( char * szVarName ); /* returns the order + 1 of a local variable */
|
||||
@@ -1014,9 +1014,9 @@ ArrayIndex : IndexList ']' { $$ = $1; }
|
||||
/* NOTE: $0 represents the expression before ArrayIndex
|
||||
* Don't use ArrayIndex in other context than as an array index!
|
||||
*/
|
||||
IndexList : '[' Expression { $$ = hb_compExprNewArrayAt( $<asExpr>0, $2 ); if( pArrayIndexAsList == NULL ){ pArrayIndexAsList = hb_compExprNewList( $2 ); } }
|
||||
| IndexList ',' Expression { $$ = hb_compExprNewArrayAt( $1, $3 ) ; if( pArrayIndexAsList == NULL ){ pArrayIndexAsList = hb_compExprAddListExpr( pArrayIndexAsList, $3 ); } }
|
||||
| IndexList ']' '[' Expression { $$ = hb_compExprNewArrayAt( $1, $4 ) ; if( pArrayIndexAsList == NULL ){ pArrayIndexAsList = hb_compExprAddListExpr( pArrayIndexAsList, $4 ); } }
|
||||
IndexList : '[' Expression { $$ = hb_compExprNewArrayAt( $<asExpr>0, $2 ); }
|
||||
| IndexList ',' Expression { $$ = hb_compExprNewArrayAt( $1, $3 ); }
|
||||
| IndexList ']' '[' Expression { $$ = hb_compExprNewArrayAt( $1, $4 ); }
|
||||
;
|
||||
|
||||
ElemList : Argument { $$ = hb_compExprNewList( $1 ); }
|
||||
@@ -1096,42 +1096,62 @@ GetVar : Variable
|
||||
}
|
||||
| AliasVar { s_bSetGet = TRUE; $$ = $1; }
|
||||
| ObjectData { s_bSetGet = TRUE; $$ = $1; }
|
||||
| ObjectData ArrayIndex { s_bSetGet = TRUE; $$ = $2; }
|
||||
;
|
||||
|
||||
GetArgList : Argument { $$ = hb_compExprAddListExpr( pGetArgList, $1 ); }
|
||||
| GetArgList ',' Argument { $$ = hb_compExprAddListExpr( pGetArgList, $3 ); }
|
||||
;
|
||||
|
||||
_Get_ : GET { pArrayIndexAsList = NULL; }
|
||||
_Get_ : GET { pBaseArrayName = NULL; }
|
||||
;
|
||||
|
||||
GetA : _Get_ GetVarArray { pGetArgList = hb_compExprNewArgList( $2 ); bTrancuateBaseArray = TRUE; } ','
|
||||
EmptyExpression { hb_compExprAddListExpr( pGetArgList, ( pBaseArrayName ? pBaseArrayName : $5 ) ); bTrancuateBaseArray = FALSE; pBaseArrayName = NULL; /* Var Name */ } ','
|
||||
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $8 ) ; /* Picture */ } ','
|
||||
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $11 ); /* ValidBlock */ } ','
|
||||
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $14 ); /* WhenBlock */
|
||||
hb_compExprAddListExpr( pGetArgList, hb_compExprNewArray( pArrayIndexAsList ) ); /* Array with Index Expressions as 6th parameter */
|
||||
EmptyExpression {
|
||||
HB_EXPR_PTR pArrayVar, pIndex;
|
||||
|
||||
hb_compExprAddListExpr( pGetArgList, $14 ); /* WhenBlock */
|
||||
|
||||
// We need to scan the pGetVarArray backwards and build a list of the Index Expressions.
|
||||
pArrayVar = HB_EXPR_USE( pGetVarArray->value.asList.pExprList, HB_EA_REDUCE );
|
||||
pIndex = HB_EXPR_USE( pGetVarArray->value.asList.pIndex, HB_EA_REDUCE );
|
||||
pIndex->pNext = NULL;
|
||||
|
||||
while( pArrayVar->ExprType == HB_ET_ARRAYAT )
|
||||
{
|
||||
pArrayVar->value.asList.pIndex->pNext = pIndex;
|
||||
pIndex = pArrayVar->value.asList.pIndex;
|
||||
pArrayVar = pArrayVar->value.asList.pExprList;
|
||||
}
|
||||
|
||||
pIndex = hb_compExprNewList( pIndex );
|
||||
|
||||
hb_compExprAddListExpr( pGetArgList, hb_compExprNewArray( pIndex ) ); /* Array with Index Expressions as 6th parameter */
|
||||
}
|
||||
GetAExt ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GETA"), pGetArgList ); pGetArgList = NULL; }
|
||||
;
|
||||
|
||||
GetVarArray : Variable ArrayIndex { $$ = hb_compExprAddListExpr( hb_compExprNewCodeBlock(), $1 ); }
|
||||
| AliasVar ArrayIndex { $$ = hb_compExprAddListExpr( hb_compExprNewCodeBlock(), $1 ); }
|
||||
| MacroVar ArrayIndex { $$ = hb_compExprNewNil();
|
||||
if( $1->value.asMacro.cMacroOp )
|
||||
{
|
||||
GetVarArray : Variable ArrayIndex { pGetVarArray = $2; $$ = hb_compExprAddListExpr( hb_compExprNewCodeBlock(), $1 ); }
|
||||
| ObjectData ArrayIndex { pGetVarArray = $2; $$ = hb_compExprAddListExpr( hb_compExprNewCodeBlock(), $1 ); }
|
||||
| AliasVar ArrayIndex { pGetVarArray = $2; $$ = hb_compExprAddListExpr( hb_compExprNewCodeBlock(), $1 ); }
|
||||
| MacroVar ArrayIndex {
|
||||
pGetVarArray = $2; $$ = hb_compExprNewNil();
|
||||
|
||||
if( $1->value.asMacro.cMacroOp )
|
||||
{
|
||||
pBaseArrayName = hb_compExprNewVar( $1->value.asMacro.szMacro );
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
pBaseArrayName = hb_compExprNewString( $1->value.asMacro.szMacro );
|
||||
}
|
||||
}
|
||||
| MacroExpr ArrayIndex { $$ = hb_compExprNewNil();
|
||||
/* TODO: Clipper allways error, but we can handle simple macros or macros with no declared symbols!!! */
|
||||
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_GET_COMPLEX_MACRO, NULL, NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
| MacroExpr ArrayIndex { $$ = hb_compExprNewNil();
|
||||
/* TODO: Clipper allways error, but we can handle simple macros or macros with no declared symbols!!! */
|
||||
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_GET_COMPLEX_MACRO, NULL, NULL );
|
||||
}
|
||||
;
|
||||
|
||||
GetAExt : { /* Nothing*/ }
|
||||
|
||||
Reference in New Issue
Block a user