* compiler.h
added member iUsed to struct VAR
* hberrors.h
added define of codeblock parameter not used warning
* harbour.y
removed PDECLARED_VAR struct definition
removed code to maintain FunVars list
added code to GetVarPos() to reflect use of declared variable
added logic to FixReturns() and CodeBlockEnd() to generate warnings on non used decalred vaiables
removed previous version of nonused declared variables warnings from FunDedf() and {Main}
* source/compiler/harbour.y
Moved code to check non used declared variable from GenReturn() to FunDef()
Since Clipper function may have multiple RETURN statements
* include/hberrors.h
added WARN_VAR_NOT_USED
* source/compiler/harbour.y
added warning message "Variable \'%s\' declared but not used in function: %s"
added linked list FunVars to record the usage of declared variables
added logic to maintain FunVars
added logic to check usage as per FunVars in GenReturn()
* include/hberrors.h
added define WARN_AMBIGUOUS_VAR 1
added declaration for new function GenWarning()
* source/compiler/harbour.y
added _szWarnings[] to include parse warning messages
added function GenWarning()
added /w compiler switch to enable warnings
added warning message for ambiguous vars
Harbour.y -> modified pcode generation to move the push of the counter variable to the NEXT rather than the FOR
so loop code may manipulate the counter vaiable.
TEST/WORKING/TestFor.prg -> added this file
Harbour.l added support for "[String]" inside ARRAY INDEX expressions
Added "Sysntax error :" message for the macro operator (&)
when followed by a string delimiter.
Harbour.l modified {Array} and added {FunArray} and {ExpArray}.
To fix support of <INDEX> state to be recusive as well as support:
Function()[nIndex].
/TESTS/WORKING/ArrIndex.prg added this file.
/TESTS/BROKEN/FuncArr.prg added this file to show:
// This is NOT working?
QOut( aFunc()[1]
// But this IS working!
a := aFunc()
QOut( a[1] )
corrected problem with "[]" String Delimiters conflict with array names of reserved words (next, while, etc.)
Please note to check i_INDEX_STATE before a "BEGIN 0;" as in the followings:
if( iINDEX_STATE ) BEGIN INDEX; else BEGIN 0;
Please note {String} definition needed to be removed. Seem to only be used in <DEFINE> will probably be resolved by the Pre Processor any way.
Also found and corrected tranctuation of string literals.
In the last 3 weeks someone changed the following to have yytext + 1 and yyleng - 2.
I reverted it back to yytext and yyleng - 1 respectivly.
<STRING1>[^']*' { BEGIN 0; yylval.string = strdup( yytext );
yylval.string[ yyleng - 1 ] = 0; return LITERAL; }
<STRING2>[^\"]*\" { BEGIN 0; yylval.string = strdup( yytext );
yylval.string[ yyleng - 1 ] = 0; return LITERAL; }
<STRING3>[^\]]*\] { BEGIN 0; yylval.string = strdup( yytext );
yylval.string[ yyleng - 1 ] = 0; return LITERAL; }
Removed from bld32exe.bat refrences to -mh and -F (invalid options).
Also removed refrences to HBTOOLS.LIB (non existed).