macro-processor: allow for nested variables
We should allow
@#define J=10
@#define K=1:@{J}
but currently the lexer gives an error when encountering the @{J}
in the second line.
-
Related to this, according to the manual, we have at the command line
-DMACRO_VARIABLE=MACRO_EXPRESSION
But we do not really macro expressions asdynare macro.mod -D=[1,2]
fails. -
I tried to get around this by using
n_countries=2;
fid=fopen('n_countries_def.txt','w+');
fprintf(fid,'@#for co in 1:%u\n',n_countries)
fclose(fid)
to write a text file creating the first statement and then using
@#include "n_countries_def.txt"
var C_@{co};
@#endfor
But this is also not allowed:
ERROR in macro-processor: n_countries_def.txt:1.15: @#for loop not matched by an @#endfor or file does not end with a new line (unexpected end of file)
because apparently the macro processor checks for completeness of the macro in each included file instead of the whole created file.