Redesign VarReference
The current VarReference
object contains as only attribute ref
that is a reference to a Variable
. A Variable
object is uniquely initialized with a parameter
attribute that can be various objects. It is better to have a direct reference to the actual parameter
object rather that to the Variable
object containing that object.
Currently this is:
GeneralVariable:
ObjectImport | Dummy | Variable
;
VarReference:
!Keyword
ref = [GeneralVariable|FQN|^args, statements, ~statements.names,
~statements.variables, ~statements.false_,
~statements.true_]
;
The VarReference
should be reduced to the cases where we really cannot further resolve the variable, for example for Dummy
identifiers. In addition, ~statements.names, ~statements.variables
is for tuple imports and tuple variables for which we should always have "normal" imports and variables. It should be checked whether and why we need ~statements.false_, ~statements.true_
This rule will match either a Dummy
from the local scope, or FunctionDefinition
, ObjectImport
defined in the global scope:
GeneralIdentifier:
FunctionDefinition | ObjectImport | Dummy
;
GlobalScopeReference:
ref = [GeneralIdentifier|FQN|^args, statements]
;
In the following code all three identifier rules, defined above, will match:
import sqrt from math
func3_2(x) = x*sqrt(x)
print(func3_2(4)) // result is 8
And the following rule will match a Series object
that is either an element in columns
attribute of a Table
object that is in turn a parameter
in a top-level Variable
object or a parameter
attribute in Variable
object from the global scope:
SeriesReference:
ref = [Series|FQN|statements.~parameter.~columns, statements.~parameter]
;
Example for the latter:
ser = (letters: 'a', 'b')
c = ser
Here, the variable c
will contain as parameter
a SeriesReference
object with a reference to the Series
object (letters: 'a', 'b')
and contain no information about the variable ser
.