* source/compiler/harbour.l
! Corrected definition of _PROCREQ_()
* tests/testdecl.prg
- Removed 1 line of unspported syntax.
* source/macro/macro.slx
* source/compiler/harbour.slx
% Greatly optimized, much simplified, smaller, and faster.
! Converted all "non conventional" macros to functions.
* source/compiler/simplex.c
% Greatly optimized, now as fast as Flex based lexer.
! Converted all "non conventional" macros to functions.
+ Added support for predefind match pattern, {WS} (White Space), in KEYWORDS and WORDS.
+ source/compiler/harbour.sly
* Same as harbour.y, excluding un-needed support for reserved words used as identifiers.
/* Harbour.slx works with either harbour.y or harbour.sly, but harbour.sly creates smaller harbour.exe. */
* hb_slex.bc
* Modified to use harbour.sly
73 lines
1.3 KiB
Plaintext
73 lines
1.3 KiB
Plaintext
// Test for DECLARE statement
|
|
// $Id$
|
|
//
|
|
#include "hbclass.ch"
|
|
|
|
#TRANSLATE AS NEW <ClassName> => AS CLASS <ClassName> := <ClassName>():New()
|
|
|
|
DECLARE nMyFun() AS NUMERIC
|
|
|
|
/*
|
|
DECLARE MyClass ;
|
|
NEW AS CLASS MyClass ;
|
|
While AS String ;
|
|
cVar AS String
|
|
*/
|
|
|
|
DECLARE MyFun( Var1 AS STRING, OPTIONAL Var1 ) AS LOGICAL
|
|
|
|
DECLARE SomeFunc( OPTIONAL SomeVar AS STRING )
|
|
|
|
//DECLARE SomeFunc( OPTIONAL SomeVar AS STRING, OPTIONAL OtherVar )
|
|
|
|
CLASS MyClass
|
|
METHOD New() Constructor
|
|
VAR While AS STRING
|
|
VAR cVar AS STRING
|
|
END CLASS
|
|
|
|
INIT Function Main()
|
|
|
|
MEMVAR Var1, Var2, aVar
|
|
MEMVAR Var3, aVar5, aVar8, Var7
|
|
LOCAL MyObj AS NEW MyClass
|
|
|
|
DECLARE Var1
|
|
DECLARE Var2 := 2
|
|
DECLARE aVar[2]
|
|
DECLARE Var3 := 'Var9', Var4, aVar5[1]
|
|
DECLARE Var6, Var7:=7, aVar8[8]
|
|
DECLARE Var9
|
|
DECLARE &var3
|
|
DECLARE &Var3.
|
|
DECLARE &Var3. ; DECLARE &Var3.&Var3
|
|
DECLARE &Var3.var3
|
|
DECLARE Var3&Var3
|
|
DECLARE Var3&Var3.
|
|
DECLARE Var3&Var3&Var3
|
|
|
|
M->Var1 := nMyFun()
|
|
? M->Var1
|
|
|
|
? M->Var2
|
|
|
|
M->aVar[1] := 'Array Element'
|
|
? M->aVar[1]
|
|
|
|
MyObj:cVar := 'Hello'
|
|
? MyObj:cVar
|
|
|
|
M->Var1 := MyClass():New()
|
|
? M->Var1:While
|
|
|
|
RETURN NIL
|
|
|
|
METHOD New() CLASS MyClass
|
|
|
|
::While := 2 // TODO: Should produce RT Error.
|
|
|
|
RETURN Self
|
|
|
|
Function nMyFun()
|
|
RETURN 1
|