19991013-03:13 GMT+8 Ron Pinkas <Ron@Profit-Master.com>

* harbour.y
          + added TOKEN MACROALIAS and rules to support MemVar aliased macro and non aliased macro variables assignments.
   * harbour.l
          + added rules to support new TOKEN MACROALIAS
   +tests/tstmacro.prg
	  sample program to demonstarte new macro assigments support.
This commit is contained in:
Ron Pinkas
1999-10-13 10:33:26 +00:00
parent 86ad7d606e
commit 0bdf95967e
4 changed files with 45 additions and 3 deletions

View File

@@ -1,3 +1,11 @@
19991013-03:13 GMT+8 Ron Pinkas <Ron@Profit-Master.com>
* harbour.y
+ added TOKEN MACROALIAS and rules to support MemVar aliased macro and non aliased macro variables assignments.
* harbour.l
+ added rules to support new TOKEN MACROALIAS
+tests/tstmacro.prg
sample program to demonstarte new macro assigments support.
19991012-20:41 GMT+1 Victor Szel <info@szelvesz.hu>
* tests/rtl_test.prg
+ Tough FOR/NEXT tests added, many of them will not pass.
@@ -13,9 +21,9 @@
19991012-16:00 GMT+1 Victor Szel <info@szelvesz.hu>
* source/vm/hvm.c
! hb_vmAnd(), hb_vmOr() - Value substitution on error added to .AND.
! hb_vmAnd(), hb_vmOr() - Value substitution on error added to .AND.
and .OR. operators. (mentioned by Jose)
19991012-14:00 GMT+1 Antonio Linares <alinares@fivetech.com>
* source/rtl/dates.c
+ Added support for Windows requirements.

View File

@@ -1136,6 +1136,8 @@ Separator {SpaceTab}
"++" _iState =OPERATOR; return INC;
"--" _iState =OPERATOR; return DEC;
"->" _iState =OPERATOR; return ALIASOP;
"M->&" _iState =OPERATOR; return MACROALIAS;
"MEMVAR->&" _iState =OPERATOR; return MACROALIAS;
"<=" _iState =OPERATOR; return LE;
">=" _iState =OPERATOR; return GE;
"+=" _iState =OPERATOR; return PLUSEQ;

View File

@@ -535,7 +535,7 @@ extern int _iState; /* current parser state (defined in harbour.l */
%token FUNCTION PROCEDURE IDENTIFIER RETURN NIL NUM_DOUBLE INASSIGN NUM_INTEGER NUM_LONG
%token LOCAL STATIC IIF IF ELSE ELSEIF END ENDIF LITERAL TRUEVALUE FALSEVALUE
%token EXTERN INIT EXIT AND OR NOT PUBLIC EQ NE1 NE2
%token INC DEC ALIASOP DOCASE CASE OTHERWISE ENDCASE ENDDO MEMVAR
%token INC DEC ALIASOP MACROALIAS DOCASE CASE OTHERWISE ENDCASE ENDDO MEMVAR
%token WHILE EXIT LOOP END FOR NEXT TO STEP LE GE FIELD IN PARAMETERS
%token PLUSEQ MINUSEQ MULTEQ DIVEQ POWER EXPEQ MODEQ EXITLOOP
%token PRIVATE BEGINSEQ BREAK RECOVER USING DO WITH SELF LINE
@@ -638,6 +638,15 @@ ParamList : IDENTIFIER AsType { AddVar( $1 ); $$ = 1; }
| ParamList ',' IDENTIFIER AsType { AddVar( $3 ); $$++; }
;
MacroAssign: INASSIGN
| '='
VarMacro : ExpMacro
ExpMacro : '&' IDENTIFIER { PushId( $2 ); }
| MACROALIAS IDENTIFIER { PushId( $2 ); }
| Macro
Statement : ExecFlow Crlf {}
| FunCall Crlf { Do( $1 ); }
| AliasFunc Crlf {}
@@ -646,6 +655,8 @@ Statement : ExecFlow Crlf {}
| VarUnary Crlf { GenPopPCode(); }
| VarExpr Crlf { RemoveExtraPush(); }
| { PushSymbol( yy_strdup( "__MVPUT" ), 1); PushNil(); } VarMacro MacroAssign Expression { Do( 2 ); } Crlf
| IDENTIFIER '=' Expression { PopId( $1 ); } Crlf
| AliasVar '=' { $<pVoid>$=( void * )pAliasId; pAliasId = NULL; } Expression { pAliasId=(ALIASID_PTR) $<pVoid>3; PopId( $1 ); AliasRemove(); } Crlf
| AliasFunc '=' Expression { --iLine; GenError( _szCErrors, 'E', ERR_INVALID_LVALUE, NULL, NULL ); } Crlf
@@ -819,6 +830,8 @@ IfInline : IIF PareExpList3 { GenIfInline(); }
Macro : '&' Variable
| '&' '(' Expression ')'
| MACROALIAS Variable
| MACROALIAS '(' Expression ')'
;
AliasVar : NUM_INTEGER ALIASOP { AliasAddInt( $1 ); } IDENTIFIER { $$ = $4; }

View File

@@ -0,0 +1,19 @@
Function nMyFunc( )
LOCAL n := 'cVar1'
PRIVATE cVar1
&n = 'Simple '
? M->cVar1
&( 'cVar' + '1' ) := 'Macro'
?? M->cVar1
M->&n = 'Aliased'
? M->cVar1
MEMVAR->&( 'cVar' + '1' ) := ' Macro'
?? M->cVar1
return NIL