2000-06-15 20:56 UTC-0800 Ron Pinkas <Ron@Profit-Master.com>

* source/compiler/harbour.l
   * source/compiler/harbour.y
     + Added support for _ProcReq_() - compile time function used to implement SET FORMAT TO and
       SET PROCEDURE TO. Clipper implementation doesn't allow a run time function with this name, Harbour
       will only intercept it as compile time function, if used at BOL.
       As compile time function it only accepts a single "Literal", or "Literal + Literal".

   * source/compiler/hbgenerr.c
   * source/pp/ppcomp.c
     ! Fixed line numbering. Warnnings and Errors, should now report correct line numbers.
This commit is contained in:
Ron Pinkas
2000-06-16 04:07:14 +00:00
parent 56af97ae3d
commit 99ca708ef6
5 changed files with 36 additions and 8 deletions

View File

@@ -1,3 +1,15 @@
2000-06-15 20:56 UTC-0800 Ron Pinkas <Ron@Profit-Master.com>
* source/compiler/harbour.l
* source/compiler/harbour.y
+ Added support for _ProcReq_() - compile time function used to implement SET FORMAT TO and
SET PROCEDURE TO. Clipper implementation doesn't allow a run time function with this name, Harbour
will only intercept it as compile time function, if used at BOL.
As compile time function it only accepts a single "Literal", or "Literal + Literal".
* source/compiler/hbgenerr.c
* source/pp/ppcomp.c
! Fixed line numbering. Warnnings and Errors, should now report correct line numbers.
2000-06-15 15:30 UTC-0400 David G. Holm <dholm@jsd-llc.com>
+ tests/mousetst.prg

View File

@@ -355,6 +355,8 @@ Separator {SpaceTab}
/* ************************************************************************ */
%}
^{Separator}*"_procreq_"{Separator}*"(" { return PROCREQ; }
"decl"("are"|"ar"|"a")? { BEGIN DECLARE_;
yylval.string = hb_strupr( hb_strdup( yytext ) );
}

View File

@@ -162,6 +162,7 @@ char * hb_comp_szAnnounce = NULL; /* ANNOUNCEd procedure */
%token MACROVAR MACROTEXT
%token AS_ARRAY AS_BLOCK AS_CHARACTER AS_CLASS AS_DATE AS_LOGICAL AS_NUMERIC AS_OBJECT AS_VARIANT DECLARE OPTIONAL
%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
/*the lowest precedence*/
/*postincrement and postdecrement*/
@@ -189,7 +190,7 @@ char * hb_comp_szAnnounce = NULL; /* ANNOUNCEd procedure */
%right '\n' ';' ','
/*the highest precedence*/
%type <string> IdentName IDENTIFIER LITERAL SendId MACROVAR MACROTEXT
%type <string> IdentName IDENTIFIER LITERAL SendId MACROVAR MACROTEXT CompTimeStr
%type <valDouble> NUM_DOUBLE
%type <valInteger> NUM_INTEGER
%type <valLong> NUM_LONG
@@ -245,6 +246,7 @@ Source : Crlf { hb_comp_EOL = FALSE; }
| Function { hb_comp_EOL = FALSE; }
| Statement { hb_comp_EOL = FALSE; }
| Line { hb_comp_EOL = FALSE; }
| ProcReq { hb_comp_EOL = FALSE; }
| Source Crlf { hb_comp_EOL = FALSE; }
| Source Function { hb_comp_EOL = FALSE; }
| Source Statement { hb_comp_EOL = FALSE; }
@@ -253,6 +255,7 @@ Source : Crlf { hb_comp_EOL = FALSE; }
| Source MemvarDef { hb_comp_EOL = FALSE; }
| Source Declaration { hb_comp_EOL = FALSE; }
| Source Line { hb_comp_EOL = FALSE; }
| Source ProcReq { hb_comp_EOL = FALSE; }
| Source error Crlf { hb_comp_EOL = FALSE; yyclearin; }
;
@@ -260,6 +263,13 @@ Line : LINE NUM_INTEGER LITERAL Crlf
| LINE NUM_INTEGER LITERAL '@' LITERAL Crlf /* Xbase++ style */
;
ProcReq : PROCREQ CompTimeStr ')' Crlf { hb_compAutoOpenAdd( $2 ); }
;
CompTimeStr: LITERAL
| LITERAL '+' LITERAL { char szFileName[ _POSIX_PATH_MAX ]; sprintf( szFileName, "%s%s", $1, $3 ); $$ = szFileName; }
;
Function : FunScope FUNCTION IdentName { hb_comp_cVarType = ' '; hb_compFunctionAdd( $3, ( HB_SYMBOLSCOPE ) $1, 0 ); } Params Crlf {}
| FunScope PROCEDURE IdentName { hb_comp_cVarType = ' '; hb_compFunctionAdd( $3, ( HB_SYMBOLSCOPE ) $1, FUN_PROCEDURE ); } Params Crlf {}
;

View File

@@ -127,7 +127,7 @@ void hb_compGenError( char * szErrors[], char cPrefix, int iError, char * szErro
if( hb_comp_EOL )
--iLine;
if( hb_comp_files.pLast != NULL && hb_comp_files.pLast->szFileName != NULL )
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, iLine + hb_pp_nEmptyStrings );
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, hb_comp_files.pLast->iLine - 1 );
printf( "Error %c%04i ", cPrefix, iError );
printf( szErrors[ iError - 1 ], szError1, szError2 );
printf( "\n" );
@@ -150,7 +150,7 @@ void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, char *
if( ( szText[ 0 ] - '0' ) <= hb_comp_iWarnings )
{
if( hb_comp_files.pLast != NULL && hb_comp_files.pLast->szFileName != NULL )
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, iLine + hb_pp_nEmptyStrings );
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, hb_comp_files.pLast->iLine - 1 );
printf( "Warning %c%04i ", cPrefix, iWarning );
printf( szText + 1, szWarning1, szWarning2 );
printf( "\n" );

View File

@@ -93,7 +93,11 @@ int hb_pp_Internal( FILE * handl_o, char * sOut )
if( !lContinue )
{
if( *s_szLine != '\0' )
if( *s_szLine == '\0' )
{
hb_pp_nEmptyStrings++;
}
else
{
ptr = s_szLine;
@@ -120,9 +124,8 @@ int hb_pp_Internal( FILE * handl_o, char * sOut )
}
else
{
hb_pp_nEmptyStrings++;
*s_szLine = '\0';
/*hb_pp_nEmptyStrings++;*/
hb_comp_files.pLast->iLine++;
}
}
else
@@ -155,8 +158,6 @@ int hb_pp_Internal( FILE * handl_o, char * sOut )
}
}
}
else
hb_pp_nEmptyStrings++;
break;
}
@@ -221,6 +222,9 @@ int hb_pp_Internal( FILE * handl_o, char * sOut )
*( sOut + lens++ ) = '\n';
*( sOut + lens ) = '\0';
hb_comp_files.pLast->iLine += hb_pp_nEmptyStrings;
hb_pp_nEmptyStrings = 0;
if( handl_o )
hb_pp_WrStr( handl_o, sOut );