Update preprocessor submodule with macroprocessor refactoring

By the way, add new tests for the macroprocessor.
time-shift
Sébastien Villemot 2018-07-25 18:51:03 +02:00
parent 1bd74c4704
commit 0da4aefd99
3 changed files with 37 additions and 3 deletions

@ -1 +1 @@
Subproject commit 49e1c43aed1acd80237d7fe911603ac4dd52d67d
Subproject commit 9cf3e034de954f9b221fd72f6cd02334d47bda89

View File

@ -64,7 +64,7 @@ MODFILES = \
example1_with_tags.mod \
example1_irf_shocks.mod \
example1_abs_sign.mod \
example1_macroif.mod \
example1_macro.mod \
example1long.mod \
example2long.mod \
example2long_use_dll.mod \

View File

@ -1,4 +1,5 @@
// Example 1 from Collard's guide to Dynare
// Various tests for the macroprocessor
var y, c, k, a, h, b;
varexo e, u;
@ -21,6 +22,39 @@ theta = 2.95;
phi = 0.1;
@#endif
@#define a = 5
@#define b = 2*(a + 3)/4-1
@#if b != 3
@#error "Arithmetic problem"
@#endif
@#define v = [ "a", 1, 2:3]
@#define empty = []
@#define z = v[2:3]
@#if z != [ 1, [ 2, 3 ]] || length(v) != 3 || 5 in v || !("a" in v) || length(empty) != 0
@#error "Array problem"
@#endif
@#define w = [ 1 ]
@#for elt in v
@#define w = w + [ elt ]
@#endfor
@#if w != [ 1, "a", 1, 2:3]
@#error "For loop problem"
@#endif
@#define s = "abcde"
@#if length(s) != 5 || s[3:4] != "cd"
@#error "String problem"
@#endif
@#define f(y, z) = "@{y}bar@{z}"
@#if f("foo", "baz") != "foobarbaz"
@#error "Function problem"
@#endif
model;
c*theta*h^(1+psi)=(1-alpha)*y;
k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))