Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • dynare dynare
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 118
    • Issues 118
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 5
    • Merge requests 5
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynareDynare
  • dynaredynare
  • Issues
  • #1578
Closed
Open
Issue created Jan 12, 2018 by Johannes Pfeifer@JohannesPfeiferDeveloper

macro-processor: allow for nested variables

  1. Related to https://forum.dynare.org/t/total-number-of-periods-given-by-variable/11200/3

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.

  1. Related to this, according to the manual, we have at the command line -DMACRO_VARIABLE=MACRO_EXPRESSION But we do not really macro expressions as dynare macro.mod -D=[1,2] fails.

  2. 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.

Assignee
Assign to
Time tracking