2000-11-02 20:35 UTC+0800 Ron Pinkas <ron@profit-master.com>

* source/compiler/harbour.sly
     + Added rule to accept Get and GetA as FunCall

   * source/compiler/harbour.y
     + Added support for pseudo function _GET_()
   * source/compiler/harbour.l
     + Added _GET_(...) => __GET(...)/__GETA(...) logic from harbour.sly

   * source/macro/macro.slx
     * Corrected YY_DECL #define (Thanks John)

   * source/rtl/tget.prg
   * include/hbextern.ch
     - Removed no longer needed _GET_()
This commit is contained in:
Ron Pinkas
2000-11-03 23:42:27 +00:00
parent 2cb7017058
commit 3a7b8b8893
7 changed files with 104 additions and 14 deletions

View File

@@ -1,3 +1,19 @@
2000-11-02 20:35 UTC+0800 Ron Pinkas <ron@profit-master.com>
* source/compiler/harbour.sly
+ Added rule to accept Get and GetA as FunCall
* source/compiler/harbour.y
+ Added support for pseudo function _GET_()
* source/compiler/harbour.l
+ Added _GET_(...) => __GET(...)/__GETA(...) logic from harbour.sly
* source/macro/macro.slx
* Corrected YY_DECL #define (Thanks John)
* source/rtl/tget.prg
* include/hbextern.ch
- Removed no longer needed _GET_()
2000-11-03 22:30 UTC+0100 (for) Charles,Kwon <jfl@mafact.com>
* source/lang/msgko.c
Charles,Kwon update as requested ...

View File

@@ -694,7 +694,6 @@ EXTERNAL __TEXTRESTORE
//symbols from file: rtl\tget.prg
//
EXTERNAL GETNEW
EXTERNAL _GET_
EXTERNAL __GET
EXTERNAL __GETA
//

View File

@@ -456,6 +456,18 @@ Separator {SpaceTab}
/* ************************************************************************ */
%}
%{
/* ************************************************************************ */
%}
"_get_(" {
yylval.string = hb_compIdentifierNew( "_PROCREQ_", TRUE );
hb_comp_iState =IDENTIFIER;
return GET;
}
%{
/* ************************************************************************ */
%}
"decl"|"decla"|"declar"|"declare" {
yylval.string = hb_compIdentifierNew( hb_strupr( yytext ), TRUE );
if( hb_comp_iState == DO )

View File

@@ -611,6 +611,8 @@ VariableAtAlias : VariableAt ALIASOP { $$ = $1; }
*/
FunCall : IdentName '(' ArgList ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( $1 ), $3 ); }
| MacroVar '(' ArgList ')' { $$ = hb_compExprNewFunCall( $1, $3 ); }
| Get { $$ = $1 }
| GetA { $$ = $1 }
;
ArgList : Argument { $$ = hb_compExprNewArgList( $1 ); }
@@ -645,8 +647,6 @@ ObjectData : NumValue ':' SendId { $$ = hb_compExprNewSend( $1, $3 ); }
| MacroVar ':' SendId { $$ = hb_compExprNewSend( $1, $3 ); }
| MacroExpr ':' SendId { $$ = hb_compExprNewSend( $1, $3 ); }
| FunCall ':' SendId { $$ = hb_compExprNewSend( $1, $3 ); }
| Get ':' SendId { $$ = hb_compExprNewSend( $1, $3 ); }
| GetA ':' SendId { $$ = hb_compExprNewSend( $1, $3 ); }
| IfInline ':' SendId { $$ = hb_compExprNewSend( $1, $3 ); }
| PareExpList ':' SendId { $$ = hb_compExprNewSend( $1, $3 ); }
| VariableAt ':' SendId { $$ = hb_compExprNewSend( $1, $3 ); }

View File

@@ -117,6 +117,9 @@ 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, pGetArgList = NULL, pBaseArrayName = NULL;
static BOOL bTrancuateBaseArray = FALSE;
char * hb_comp_szAnnounce = NULL; /* ANNOUNCEd procedure */
static void hb_compDebugStart( void ) { };
@@ -160,7 +163,7 @@ static void hb_compDebugStart( void ) { };
%token MACROVAR MACROTEXT
%token AS_ARRAY AS_BLOCK AS_CHARACTER AS_CLASS AS_DATE AS_LOGICAL AS_NUMERIC AS_OBJECT AS_VARIANT DECLARE OPTIONAL DECLARE_CLASS DECLARE_MEMBER
%token AS_ARRAY_ARRAY AS_BLOCK_ARRAY AS_CHARACTER_ARRAY AS_CLASS_ARRAY AS_DATE_ARRAY AS_LOGICAL_ARRAY AS_NUMERIC_ARRAY AS_OBJECT_ARRAY
%token PROCREQ
%token PROCREQ GET
/*the lowest precedence*/
/*postincrement and postdecrement*/
@@ -229,6 +232,7 @@ static void hb_compDebugStart( void ) { };
%type <asExpr> DimIndex DimList
%type <asExpr> FieldAlias FieldVarAlias
%type <asExpr> PostOp
%type <asExpr> Get GetA GetArgList
%%
@@ -453,8 +457,17 @@ NilAlias : NilValue ALIASOP { $$ = $1; }
/* Literal string value
*/
LiteralValue : LITERAL { $$ = hb_compExprNewString( $1 ); }
;
LiteralValue : LITERAL { $$ = hb_compExprNewString( $1 );
if( bTrancuateBaseArray )
{ char *pCopy = hb_strdup( $1 ), *pTmp = strchr( pCopy, '[' );
if( pTmp )
{
pCopy[ pTmp - pCopy ] = '\0';
pBaseArrayName = hb_compExprNewString( pCopy );
}
bTrancuateBaseArray = FALSE;
; }
}
LiteralAlias : LiteralValue ALIASOP { $$ = $1; }
;
@@ -613,6 +626,8 @@ VariableAtAlias : VariableAt ALIASOP { $$ = $1; }
*/
FunCall : IdentName '(' ArgList ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( $1 ), $3 ); }
| MacroVar '(' ArgList ')' { $$ = hb_compExprNewFunCall( $1, $3 ); }
| Get { $$ = $1 }
| GetA { $$ = $1 }
;
ArgList : Argument { $$ = hb_compExprNewArgList( $1 ); }
@@ -971,9 +986,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 ); }
| IndexList ',' Expression { $$ = hb_compExprNewArrayAt( $1, $3 ); }
| IndexList ']' '[' Expression { $$ = hb_compExprNewArrayAt( $1, $4 ); }
IndexList : '[' Expression { $$ = hb_compExprNewArrayAt( $<asExpr>0, $2 ); pArrayIndexAsList = hb_compExprNewList( $2 ); }
| IndexList ',' Expression { $$ = hb_compExprNewArrayAt( $1, $3 ) ; pArrayIndexAsList = hb_compExprAddListExpr( pArrayIndexAsList, $3 ); }
| IndexList ']' '[' Expression { $$ = hb_compExprNewArrayAt( $1, $4 ) ; pArrayIndexAsList = hb_compExprAddListExpr( pArrayIndexAsList, $4 ); }
;
ElemList : Argument { $$ = hb_compExprNewList( $1 ); }
@@ -986,6 +1001,58 @@ CodeBlock : '{' '|' { $<asExpr>$ = hb_compExprNewCodeBlock(); } BlockNoVar
'|' BlockExpList '}' { $$ = $<asExpr>3; }
;
Get : GET Variable { pGetArgList = hb_compExprNewArgList( $2 ); } ',' GetArgList ')'
{ $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GET"), pGetArgList ); pGetArgList = NULL; }
| GET AliasVar { pGetArgList = hb_compExprNewArgList( $2 ); } ',' GetArgList ')'
{ $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GET"), pGetArgList ); pGetArgList = NULL; }
| GET ObjectData { pGetArgList = hb_compExprNewArgList( $2 ); } ',' GetArgList ')'
{ $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GET"), pGetArgList ); pGetArgList = NULL; }
| GET ObjectData ArrayIndex { pGetArgList = hb_compExprNewArgList( $3 ); } ',' GetArgList ')'
{ $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GET"), pGetArgList ); pGetArgList = NULL; }
| GET MacroVar { pGetArgList = hb_compExprNewArgList( $2 ); } ',' GetArgList ')'
{ $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GET"), pGetArgList ); pGetArgList = NULL; }
| GET MacroExpr { pGetArgList = hb_compExprNewArgList( $2 ); } ',' GetArgList ')'
{ $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GET"), pGetArgList ); pGetArgList = NULL; }
;
GetArgList : Argument { $$ = hb_compExprAddListExpr( pGetArgList, $1 ); }
| GetArgList ',' Argument { $$ = hb_compExprAddListExpr( pGetArgList, $3 ); }
;
GetA : GET Variable ArrayIndex { pGetArgList = hb_compExprNewArgList( $2 ); bTrancuateBaseArray = TRUE; } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, ( pBaseArrayName ? pBaseArrayName : $6 ) ); pBaseArrayName = NULL; /* Var Name */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $9 ) ; /* Picture */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $12 ); /* ValidBlock */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $15 ); /* WhenBlock */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, hb_compExprNewArray( pArrayIndexAsList ) ); /* Array with Index Expressions as 6th parameter */ }
GetAExt ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GETA"), pGetArgList ); pGetArgList = NULL; }
| GET AliasVar ArrayIndex { pGetArgList = hb_compExprNewArgList( $2 ); bTrancuateBaseArray = TRUE; } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, ( pBaseArrayName ? pBaseArrayName : $6 ) ); pBaseArrayName = NULL; /* Var Name */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $9 ) ; /* Picture */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $12 ); /* ValidBlock */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $15 ); /* WhenBlock */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, hb_compExprNewArray( pArrayIndexAsList ) ); /* Array with Index Expressions as 6th parameter */ }
GetAExt ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GETA"), pGetArgList ); pGetArgList = NULL; }
| GET MacroVar ArrayIndex { pGetArgList = hb_compExprNewArgList( $2 ); bTrancuateBaseArray = TRUE; } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, ( pBaseArrayName ? pBaseArrayName : $6 ) ); pBaseArrayName = NULL; /* Var Name */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $9 ) ; /* Picture */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $12 ); /* ValidBlock */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $15 ); /* WhenBlock */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, hb_compExprNewArray( pArrayIndexAsList ) ); /* Array with Index Expressions as 6th parameter */ }
GetAExt ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GETA"), pGetArgList ); pGetArgList = NULL; }
| GET MacroExpr ArrayIndex { pGetArgList = hb_compExprNewArgList( $2 ); bTrancuateBaseArray = TRUE; } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, ( pBaseArrayName ? pBaseArrayName : $6 ) ); pBaseArrayName = NULL; /* Var Name */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $9 ) ; /* Picture */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $12 ); /* ValidBlock */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, $15 ); /* WhenBlock */ } ','
EmptyExpression { hb_compExprAddListExpr( pGetArgList, hb_compExprNewArray( pArrayIndexAsList ) ); /* Array with Index Expressions as 6th parameter */ }
GetAExt ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( "__GETA"), pGetArgList ); pGetArgList = NULL; }
;
GetAExt : { /* Nothing*/ }
| ',' GetArgList
;
/* NOTE: This uses $-2 then don't use BlockExpList in other context
*/
BlockExpList : Expression { $$ = hb_compExprAddListExpr( $<asExpr>-2, $1 ); }

View File

@@ -50,7 +50,7 @@
* NOTE: yylval_ptr is passed automaticaly by bison if %pure_parser is used
*/
#undef YY_DECL
#define YY_DECL int yylex( YYSTYPE *yylval_ptr )
#define YY_DECL int yylex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
#define YYLEX_PARAM pMacro

View File

@@ -1111,10 +1111,6 @@ return Get():New( nRow, nCol, bVarBlock, cVarName, cPicture, cColor )
//---------------------------------------------------------------------------//
/* Until support of __GET and __GETA() built into harbour.y */
FUNCTION _GET_( uVar, cVarName, cPicture, bValid, bWhen, bSetGet )
RETURN __GET( uVar, cVarName, cPicture, bValid, bWhen, bSetGet )
FUNCTION __GET( uVar, cVarName, cPicture, bValid, bWhen, bSetGet )
LOCAL oGet := Get():New(,, bSetGet, cVarName, cPicture )