2001-05-23 21:15 UTC-0800 Ron Pinkas <ron@profit-master.com>

* include/hbclass.ch
     ! Corrected few minor typos.

   * source/compiler/harbour.slx
   * source/macro/macro.slx
     - Commented few unused lines.

   * contrib/dot/pp.prg
     % Rewrote NextToken() and NextExp().
     + Added NextIdentifier()
     ! Found that Clipper PP is not processing tokens read by NextToken() and NextExp() so removed recursive support,
       and changed logic in ProcessLine() to linear process:
         #defines against all valid Identifiers - Expansion forces a resacn from top.
         #[x]translates against all tokens - Expansion forces a resacn from top of #defines.
         #[x]command agains the first token - Expansion forces a resacn from top of #defines.
     ! Corrected and refined many aspects of Interpreter mode.
     + Added ExecuteMethod() and support for OO syntax.
     + Added support for -I<includepaths...> command line switch.

   * contrib/dot/rp_run.ch
     + Added support for OO syntax.

   * contrib/dot/pp.txt
     * Updated documentation.
This commit is contained in:
Ron Pinkas
2001-05-24 04:52:09 +00:00
parent df0469310e
commit 59346e6bf8
7 changed files with 1936 additions and 1135 deletions

View File

@@ -1,8 +1,58 @@
2001-05-23 21:15 UTC-0800 Ron Pinkas <ron@profit-master.com>
* include/hbclass.ch
! Corrected few minor typos.
* source/compiler/harbour.slx
* source/macro/macro.slx
- Commented few unused lines.
* contrib/dot/pp.prg
% Rewrote NextToken() and NextExp().
+ Added NextIdentifier()
! Found that Clipper PP is not processing tokens read by NextToken() and NextExp() so removed recursive support,
and changed logic in ProcessLine() to linear process:
#defines against all valid Identifiers - Expansion forces a resacn from top.
#[x]translates against all tokens - Expansion forces a resacn from top of #defines.
#[x]command agains the first token - Expansion forces a resacn from top of #defines.
! Corrected and refined many aspects of Interpreter mode.
+ Added ExecuteMethod() and support for OO syntax.
+ Added support for -I<includepaths...> command line switch.
* contrib/dot/rp_run.ch
+ Added support for OO syntax.
* contrib/dot/pp.txt
* Updated documentation.
/* PP Interpreter mode, is now capable of running code like this:
//---------------------------//
Function Main()
LOCAL o := TTest():New()
o:Increment()
Alert( o:nVar )
Return nil
CLASS TTest
VAR nVar
METHOD New CONSTRUCTOR
METHOD Increment()
ENDCLASS
METHOD New //CLASS TTest /* CLASS clause now optional */
::nVar := 0
return Self
METHOD Increment CLASS TTest // () No longer required
Return (++::nVar)
//---------------------------//
*/
2001-05-21 21:35 UTC+1 JFL (mafact) <jfl@mafact.com>
* harbour/source/vm/Proc.c
+ MethodName(nLevel) ==> Same as ProcName(nLevel)
* harbour/include/hbclass.ch
- delete xTranslate 'MethodName'
- delete xTranslate 'MethodName'
2001-05-21 14:30 UTC-0400 David G. Holm <dholm@jsd-llc.com>
@@ -29,7 +79,7 @@
* harbour/source/vm/classes.c
+ hb_objGetRealClsName(object, szmsg )
Return the real class name regarding the Message called
So as an inherited method will return it's real class parent
So as an inherited method will return it's real class parent
* harbour/source/vm/proc.c
* modified PROCNAME() to call the new classes function
* harbour/include/hbapi.h

File diff suppressed because it is too large Load Diff

View File

@@ -16,6 +16,7 @@ PP has 3 personalities which are tied tightly together.
2. DOT prompt, which suppose to allow most of Harbour syntax. Please
report any syntax you expect to work, but is not supported.
It does support IF [ELSE] [ELSEIF] ENDIF in DOT environment.
Executing PP with no source filename will start the DOT prompt mode. In
this mode you can execute a single line at a time, by typing the line
@@ -35,26 +36,42 @@ PP has 3 personalities which are tied tightly together.
- LOCALS have scoping of locals but are implemented as privates
so you can't have a LOCAL and a PRIVATE with the same name.
b. Non declared variable are not auto-created on assignment (yet).
b. Non declared variable are auto-created on assignment in Harbour
but NOT in Clipper (yet).
c. It does support definition and execution of prg defined
FUNCTIONs/PROCEDUREs.
d. It does not (yet) support WHILE and FOR loops.
d. It does support ALL control flow structures *except* BEGIN
SEQUENCE [BREAK] [RECOVER] END SEQUENCE.
e. The executed module is compiled with -n option (for now).
This will create rp_dot.pp$ compilation tace file.
3. Finally, PP is a limited Harbour Interpreter. Subject to those same few
limitations it can execute most of Harbour syntax. Executing PP followed
by a source file name and the -R switch, will "RUN" that source (it will
also create the rp_run.pp$ compilation trace file).
This final syntax is:
This syntax is:
PP filename[.ext] -R
I intend to add support for, LOOPs, and Parameter passing soon, so that the
Interpreter will be as complete as possible.
a. It does support LOCAL/STATIC/PRIVATE/PUBLIC, but:
- STATICs are actually implemented as publics.
- LOCALS have scoping of locals but are implemented as privates
so you can't have a LOCAL and a PRIVATE with the same name.
b. Non declared variable are auto-created on assignment in Harbour
but NOT in Clipper (yet).
c. It does support definition and execution of prg defined
FUNCTIONs/PROCEDUREs as well as parameter passing and return values.
d. It does support ALL control flow structures *except* BEGIN
SEQUENCE [BREAK] [RECOVER] END SEQUENCE.
e. The executed module is compiled with -n option (for now).

View File

@@ -6,16 +6,20 @@
#TRANSLATE AS <type: ANYTYPE, ARRAY, CHARACTER, CODEBLOCK, DATE, LOGICAL, NUMERIC, OBJECT, STRING, USUAL> =>
#TRANSLATE AS ARRAY OF <x> =>
#TRANSLATE AS CLASS <x> =>
#COMMAND _HB_CLASS <*x*> => Alert( "Declaration" )
#TRANSLATE AS CLASS <x> := => :=
#COMMAND _HB_CLASS <*x*> =>
#COMMAND _HB_MEMBER <*x*> =>
#XTRANSLATE QSelf() => PP_Qself()
#XTRANSLATE AddMethod( <MethodName>, @<FunName>(), <n> ) => AddInLine( <MethodName>, {|Self,p1,p2,p3,p4,p5,p6,p7,p8,p9| PP_QSelf(Self), ExecuteMethod( <"FunName">, p1,p2,p3,p4,p5,p6,p7,p8,p9 ) }, <n> )
#TRANSLATE :: => Self:
#COMMAND MEMVAR <*x*> =>
//#COMMAND BROWSE => Browse( 1, 0, MaxRow() - 1, MaxCol() )
#TRANSLATE _GET_( <var>, <varname>, <pic>, <valid>, <when> ) => __GET( MEMVARBLOCK(<varname>), <varname>, <pic>, <valid>, <when> )
//#TRANSLATE __GET( <parlist,...>):Display() => __GET(<parlist>)
#TRANSLATE _GET_( <var>, <varname>, [<pic>], [<valid>], [<when>] ) => __GET( MEMVARBLOCK(<varname>), <varname>, <pic>, <valid>, <when> )
#TRANSLATE __GET( <parlist,...>):Display() => __GET(<parlist>)
//#COMMAND EXTERNAL <file1> [, <fileN> ] => PP_ProcessFile( <file1> ) [; PP_ProcessFile( <fileN> ) ]
#COMMAND EXTERNAL <file1> [, <fileN> ] =>

View File

@@ -148,7 +148,7 @@ DECLARE TClass ;
#ifndef HB_SHORTNAMES
#xtranslate DECLMETH <ClassName> <MethodName> => <ClassName>_<MethodName> ;;
#xtranslate DECLMETH <ClassName> <MethodName> => <ClassName>_<MethodName>
#xcommand CLASS <ClassName> [METACLASS <metaClass>] [ <frm: FROM, INHERIT> <SuperClass1> [,<SuperClassN>] ] [<static: STATIC>] => ;
_HB_CLASS <ClassName> ;;
@@ -386,7 +386,7 @@ DECLARE TClass ;
#xcommand METHOD <MethodName> [([<anyParams,...>])] [DECLCLASS _CLASS_NAME_] _CLASS_IMPLEMENTATION_ => DECLARED METHOD _CLASS_NAME_ <MethodName>([<anyParams>]);;
s_oClass:AddMethod( <(MessageName)>, CLSMETH _CLASS_NAME_ <MethodName>(), HBCLSCHOICE( <.export.>, <.protect.>, <.hidde.> ) + iif( <.ctor.>, HB_OO_CLSTP_CTOR, 0 ) )
#xcommand MESSAGE <MessageName>([MsgParams,...]) [ AS <type> ] METHOD <MethodName> [ <ctor: CONSTRUCTOR> ] [ <export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] => ;
#xcommand MESSAGE <MessageName>([<MsgParams,...>]) [ AS <type> ] METHOD <MethodName> [ <ctor: CONSTRUCTOR> ] [ <export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] => ;
_HB_MEMBER <MessageName>([<MsgParams>]) [<-ctor-> AS CLASS _CLASS_NAME_] [ AS <type> ];;
#xcommand METHOD <MethodName> [([<anyParams,...>])] [DECLCLASS _CLASS_NAME_] _CLASS_IMPLEMENTATION_ => DECLARED METHOD _CLASS_NAME_ <MethodName>([<anyParams>]);;
s_oClass:AddMethod( <(MessageName)>, CLSMETH _CLASS_NAME_ <MethodName>(), HBCLSCHOICE( <.export.>, <.protect.>, <.hidde.> ) + iif( <.ctor.>, HB_OO_CLSTP_CTOR, 0 ) )
@@ -481,7 +481,7 @@ DECLARE TClass ;
#else
#xcommand ACCESS <AccessName> [ AS <type> ] => ;
_HB_MEMBER <AccessName>() [ AS <type> ];;
#xcommand METHOD <AccessName> [([<anyParams,...>])] [DECLCLASS _CLASS_NAME_] _CLASS_IMPLEMENTATION_ => DECLARED METHOD _CLASS_NAME_ <ClassName>([<anyParams>]);;
#xcommand METHOD <AccessName> [([<anyParams,...>])] [DECLCLASS _CLASS_NAME_] _CLASS_IMPLEMENTATION_ => DECLARED METHOD _CLASS_NAME_ <AccessName>([<anyParams>]);;
s_oClass:AddMethod( <(AccessName)>, CLSMETH _CLASS_NAME_ <AccessName>(), HB_OO_CLSTP_EXPORTED + HB_OO_CLSTP_READONLY )
#xcommand ACCESS <AccessName>([<params,...>]) [ AS <type> ] => ;

View File

@@ -130,6 +130,7 @@ DEFINE_STREAM_AS_ONE_OF_THESE {
START_NEW_LINE_IF_ONE_OF_THESE( "\n;" );
#define HB_SELF LEX_CUSTOM_ACTION - 6
SELF_CONTAINED_WORDS_ARE {
@@ -501,7 +502,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 == ']' || 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 )

View File

@@ -80,7 +80,7 @@
hb_macroError( EG_SYNTAX, YYLEX_PARAM );
#undef IF_BELONG_LEFT
#define IF_BELONG_LEFT(chr) if( iLastToken == IDENTIFIER || iLastToken == ']' || iLastToken == MACROVAR || iLastToken == MACROTEXT || iLastToken == ')' || iLastToken == '}' || iLastToken == FIELD || iLastToken == SELF || iLastToken == QSELF || iLastToken == IIF )
#define IF_BELONG_LEFT(chr) if( iLastToken == IDENTIFIER || iLastToken == ']' || iLastToken == MACROVAR || iLastToken == MACROTEXT || iLastToken == ')' || iLastToken == '}' || iLastToken == FIELD || /*iLastToken == SELF ||*/ iLastToken == QSELF || iLastToken == IIF )
static HB_MACRO_PTR pMacro;
static YYSTYPE *pYYLVAL;
@@ -172,7 +172,7 @@ LANGUAGE_WORDS_ARE {
LEX_WORD( "IIF" ) AS_TOKEN( IIF ),
LEX_WORD( "NIL" ) AS_TOKEN( NIL + DONT_REDUCE ),
LEX_WORD( "QSELF" ) AS_TOKEN( QSELF ),
LEX_WORD( "SELF" ) AS_TOKEN( SELF ),
/* LEX_WORD( "SELF" ) AS_TOKEN( SELF ), */
LEX_WORD( "_FIELD" ) AS_TOKEN( FIELD )
};
@@ -185,8 +185,8 @@ LANGUAGE_RULES_ARE {
IF_SEQUENCE_IS( FIELD , ALIASOP , 0 , 0 ) PASS_THROUGH(),
IF_SEQUENCE_IS( FIELD , 0 , 0 , 0 ) REDUCE_TO( HB_IDENTIFIER , 0 ),
IF_SEQUENCE_IS( SELF , ':' , 0 , 0 ) PASS_THROUGH(),
IF_SEQUENCE_IS( SELF , 0 , 0 , 0 ) REDUCE_TO( HB_IDENTIFIER , 0 ),
/* IF_SEQUENCE_IS( SELF , ':' , 0 , 0 ) PASS_THROUGH(),
IF_SEQUENCE_IS( SELF , 0 , 0 , 0 ) REDUCE_TO( HB_IDENTIFIER , 0 ), */
IF_SEQUENCE_IS( QSELF , '(' , ')' , 0 ) REDUCE_TO( SELF + DONT_REDUCE, 0 ),
IF_SEQUENCE_IS( QSELF , 0 , 0 , 0 ) REDUCE_TO( HB_IDENTIFIER , 0 ),