#35 closed defect (later)
PARSER ERROR
Reported by: | César Pérez Álvarez | Owned by: | danirus |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Kernel | Version: | head |
Severity: | major | Keywords: | |
Cc: |
Description
The following sentence
"Serie GetSerie(Text nameInput, Set simulationSet)
{
Set selSim = Select(simulationSet(Set reg)
{
Text nameInputSim = reg->NameInput;
nameInputSim == nameInput
});
If(IsEmpty(selSim), Eval("Serie "+nameInput+";"), selSim[1]->InputSim)
};"
doesn't cause an error when you check it for syntax errors, but it's obviusly that
there is an error in select definition.
Change History (4)
comment:1 Changed 21 years ago by
comment:2 Changed 21 years ago by
Status: | new → assigned |
---|
comment:3 Changed 21 years ago by
Priority: | highest → normal |
---|---|
Resolution: | → later |
Severity: | critical → major |
Status: | assigned → closed |
This is an important improvement that we should treat in next Tol meeting.
The problem is related with the weak parsing of arguments in Tol functions.
The code:
"Serie GetSerie(Text nameInput, Set simulationSet)
{
Set selSim = Select(simulationSet(Set reg)
{
Text nameInputSim = reg->NameInput;
nameInputSim == nameInput
});
If(IsEmpty(selSim), Eval("Serie "+nameInput+";"), selSim[1]->InputSim)
};"
Generates this Syntactical Tree:
----> [BINARY]#F#
> [TYPE]Serie
|> [FUNCTION]GetSerie |> [TYPE]Text | |> [ARGUMENT]nameInput |> [TYPE]Set |> [ARGUMENT]simulationSet
> [SEPARATOR]{;}
|> [TYPE]Set | |> [ARGUMENT]selSim |> [FUNCTION]Select |> [BINARY](#F#) |> [FUNCTION]simulationSet | |> [TYPE](Set) | |> [ARGUMENT]reg |> [SEPARATOR]{;} |> [BINARY]= | |> [TYPE]Text | | |> [ARGUMENT]nameInputSim | |> [BINARY]-> | |> [ARGUMENT]reg | |> [ARGUMENT]NameInput |> [BINARY]== |> [ARGUMENT]nameInputSim |> [ARGUMENT]nameInput
> [FUNCTION]If
|> [ARGUMENT](selSim)
> [FUNCTION]Eval
|> [BINARY](+) |> [BINARY]+ | |> [ARGUMENT]"Serie | |> [ARGUMENT]nameInput |> [ARGUMENT]";
> [BINARY]->
|> [ARGUMENT]selSim |> [ARGUMENT]#(#1#)#
> [ARGUMENT]InputSim
As we can see, [FUNCTION]Select has only one branch, when should be two because
accept two parameters. If we see now [FUNCTION]If, it has three branches, corresponding
each branch with one of its three parameters.
comment:4 Changed 18 years ago by
bug_file_loc: | → http://www.tol-project.org |
---|
If we see the error better, it seems that it is not a syntax error. I think it's related
with de check argumants of the function select.
Following there is a code that we can test:
Struct SimDefinition
(
);
Serie GetSerie(Text nameInput, Set simulationSet)
{
};
Serie Sim0 = CalInd(In(y2003m01d01,y2004m01d01, Mensual), Mensual);
Set SimInfo = SetOfSet
(
);
Serie GetSerie("TSP_PIBLogDelta", SimInfo)