rainerc / cr-data-manager

Automatically exported from code.google.com/p/cr-data-manager
1 stars 0 forks source link

implementation of variables #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
variables could make the rules more flexible. Current ideas:
_directory_ (directory but without the full path)
_year_ (current year)

These variables should be used with the Calc modifier and therefore Calc should 
not be restricted to numerical values.

It could also be useful if the user could define his own variables at the 
beginning of the configuration.

Example:
#@ _myVar_ = 'Gotham books'
<<Series.Contains:Batman>> => {SeriesGroup.Calc:{_myVar_}>>

would be interpreted as:
<<Series.Contains:Batman>> => {SeriesGroup:Gotham books>>

Endless possibilities ...

Original issue reported on code.google.com by rainer.c...@googlemail.com on 25 Mar 2013 at 12:35

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
the variables inside the Calc modifier shouldn't be in {}. Makes it easier to 
use eval(expression) or exec(expression) afterwards.

So: notation should be something like:

#@ _myVar_ = 3
<<Series.Contains:Batman>> => <<Number.Calc:_myVar_ + 5>>
(useless rule only for demonstration)

then the parser can be called with
book.Number = exec(newVal)

Curly brackets ({}) should be restricted to mask book fields.

Original comment by rainer.c...@googlemail.com on 25 Mar 2013 at 4:57

GoogleCodeExporter commented 9 years ago
maybe different notations for pre-defined and user-defined variables is useful.

__directory__ => two underscores: pre-defined

_myVar_ => one underscore: user-defined

Original comment by rainer.c...@googlemail.com on 25 Mar 2013 at 9:18