Patch level : 10.0
Files correlati : ba8 lv0 Ricompilazione Demo : [ ] Commento : Corretta gestione espressioni annidate. Ora e' possibile scrivere STR(BETWEEN(PREZZO, 338, 883)) git-svn-id: svn://10.65.10.50/trunk@17964 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a8c5a1bed6
commit
60e44f8381
@ -1078,8 +1078,6 @@ TCodesym TExpression::__gettoken()
|
||||
return _invalid;
|
||||
}
|
||||
|
||||
HIDDEN int __parms_found = -1;
|
||||
|
||||
TCodesym TExpression::__factor(TCodesym startsym)
|
||||
{
|
||||
TCodesym sym = _invalid;
|
||||
@ -1129,19 +1127,20 @@ TCodesym TExpression::__factor(TCodesym startsym)
|
||||
case _userfunc:
|
||||
{
|
||||
TValue val (_tok);
|
||||
sym = __function();
|
||||
int parms_found = 0;
|
||||
sym = __function(-1, &parms_found);
|
||||
if (sym != _invalid)
|
||||
{
|
||||
const int index = parse_user_func((const char *) val.string(), __parms_found);
|
||||
|
||||
|
||||
const int index = parse_user_func(val.string(), parms_found);
|
||||
if (index < 0)
|
||||
{
|
||||
strcpy(_tok, (const char *) val.string());
|
||||
strncpy(_tok, val.string(), sizeof(_tok));
|
||||
sym = _invalid;
|
||||
}
|
||||
else
|
||||
{
|
||||
_code.add(_number, real(__parms_found));
|
||||
_code.add(_number, real(parms_found));
|
||||
val = real(index);
|
||||
_code.add(startsym, val);
|
||||
_user_func_defined = TRUE;
|
||||
@ -1219,7 +1218,7 @@ TCodesym TExpression::__term(TCodesym startsym)
|
||||
|
||||
TCodesym TExpression::__expression(TCodesym startsym)
|
||||
{
|
||||
TCodesym sym;
|
||||
TCodesym sym;
|
||||
if ((startsym == _minus) || (startsym == _not) || (startsym == _plus))
|
||||
sym =__gettoken();
|
||||
else
|
||||
@ -1241,27 +1240,34 @@ TCodesym TExpression::__expression(TCodesym startsym)
|
||||
return(sym);
|
||||
}
|
||||
|
||||
TCodesym TExpression::__function(int nparms, bool fixed_num)
|
||||
TCodesym TExpression::__function(int nparms, int* actual_nparams)
|
||||
{
|
||||
TCodesym sym = __gettoken();
|
||||
if (sym != _lpar)
|
||||
return _invalid;
|
||||
__parms_found = 0;
|
||||
int found = 0;
|
||||
sym = __gettoken();
|
||||
if (sym == _rpar)
|
||||
return nparms <= 0 || !fixed_num ? __gettoken() : _invalid;
|
||||
__parms_found++;
|
||||
{
|
||||
if (actual_nparams)
|
||||
*actual_nparams = found;
|
||||
return nparms <= 0 ? __gettoken() : _invalid;
|
||||
}
|
||||
found++;
|
||||
sym = __expression(sym);
|
||||
while (sym == _comma || sym == _semicolon)
|
||||
{
|
||||
sym = __gettoken();
|
||||
__parms_found++;
|
||||
found++;
|
||||
sym = __expression(sym);
|
||||
}
|
||||
|
||||
if (sym == _rpar)
|
||||
return nparms < 0 || __parms_found == nparms || (__parms_found < nparms && !fixed_num) ?
|
||||
__gettoken() :
|
||||
_invalid;
|
||||
{
|
||||
if (actual_nparams)
|
||||
*actual_nparams = found;
|
||||
return nparms < 0 || found == nparms ? __gettoken() : _invalid;
|
||||
}
|
||||
return _invalid;
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ protected:
|
||||
// @cmember Esegue la compilazione di un'espressione
|
||||
TCodesym __expression(TCodesym startsym);
|
||||
// @cmember Esegue la compilazione di un una funzione
|
||||
TCodesym __function(int nparms = -1, bool fixed_num = TRUE);
|
||||
TCodesym __function(int nparms = -1, int* actual_params = NULL);
|
||||
// @cmember Compila l'espressione
|
||||
bool compile(const TString& expression, TTypeexp type);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user