close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 21 years ago

Closed 21 years ago

Last modified 13 years ago

#57 closed defect (fixed)

Check syntax errors blocks TOLBase

Reported by: César Pérez Álvarez Owned by: danirus
Priority: high Milestone:
Component: Kernel Version: head
Severity: minor Keywords:
Cc:

Description

When you check syntax errors in this piece of code:



FILE : funmultdist.tol
PURPOSE: Funciones de distribucion multivariante y variables aleatorias
escalares y multivariantes


Real ScalarNormalConditional(Real nu, Real sigma, Real limInf, Real limSup)

{

If(GT(limInf, limSup), ?,
{

Real min =

If(LE(limInf, -TheMaxAbsValue), 0, DistNormal(limInf, nu, sigma));

Real max =

If(GE(limSup, TheMaxAbsValue), 1, DistNormal(limSup, nu, sigma));

Real u = Rand(min, max);

Real Msg("ScalarNormalConditional", "min -> "<<min);
Real Msg("ScalarNormalConditional", "max -> "<<max);

Real var = DistNormalInv(u, nu, sigma);
Case
(

GT(var, TheMaxAbsValue), TheMaxAbsValue,
LT(var, -TheMaxAbsValue), -TheMaxAbsValue,
1, var

)

})

};

PutDescription("Generacion de una variable alaeatoria normal truncada con
media nu y varianza sigma y limites (limInf, limSup)",
ScalarNormalConditional);


Matrix MultNormalConditionalMode
(

Matrix Nu,
Matrix Cov,
Matrix LimInf,
Matrix LimSup,
Real mode 0 Sin limite, 1 LimInf, 2 LimSup, 3 LimInf y LimSup

)

{
Real Msg("MultNormalConditionalMode", "mode ->"<<mode);

Case
(

EQ(mode, 0), MultNormal(Nu, Cov),
EQ(mode, 1), MultNormalConditionalInf(Nu, Cov, LimInf),
EQ(mode, 2), MultNormalConditionalSup(Nu, Cov, LimSup),
EQ(mode, 3), MultNormalConditional(Nu, Cov, LimInf, LimSup),
And(NE(mode, 0),NE(mode, 1),NE(mode, 2),NE(mode, 3)),MultNormal(Nu, Cov))

)

};


the application is blocked.
However , if we put // between the first function declaration the syntax error
appears like:


"Símbolo de cierre ) fuera de lugar en el carácter 3, línea 56:

Línea de código

47 : {
48 : Real Msg("MultNormalConditionalMode", "mode ->"<<mode);
49 : Case
50 : (
51 : EQ(mode, 0), MultNormal(Nu, Cov),
52 : EQ(mode, 1), MultNormalConditionalInf(Nu, Cov, LimInf),
53 : EQ(mode, 2), MultNormalConditionalSup(Nu, Cov, LimSup),
54 : EQ(mode, 3), MultNormalConditional(Nu, Cov, LimInf, LimSup),
55 : And(NE(mode, 0),NE(mode, 1),NE(mode, 2),NE(mode, 3)),MultNormal(Nu,

Cov))

56 > )


57 : };
58 :
59 :

"


I think that the problem is in the first case declaration, but I don't know why.

Change History (4)

comment:1 Changed 21 years ago by danirus

Status: newassigned

comment:2 Changed 21 years ago by danirus

Resolution: fixed
Status: assignedclosed

A solution for this problem has just been deployed in Tol CVS:

InAComment BParser method need an increment operation for "curIndex" argument.
When it was into "then" branch of the first "if" statement of InAComment method, curIndex
must be incremented. Without this increment operation, the parser never skip curIndex
position in the Text given as first argument.

comment:3 Changed 18 years ago by Víctor de Buen Remiro

bug_file_loc: http://cvs.tol-project.org/viewcvs.cgi/tol_tests/tol/Bugzilla/bug_000057

comment:4 Changed 13 years ago by Víctor de Buen Remiro

(In [4343]) Refs #57
Refs #1448
When there are errors Include returns nothing instead of Empty

Note: See TracTickets for help on using tickets.