Commit Graph

96 Commits (e7aeec229e9627d5091658569876c51c037738de)

Author SHA1 Message Date
Houtan Bastani ad1ef0d856 macroprocessor: fix unhandled case of nested ifdef/ifndef statements. closes #1587 2018-01-29 10:58:07 +01:00
Houtan Bastani 46fbd8107c Fix commit reverted in 4d89452e1bb6cc55f0800d6cbf976f2519f822c1. 2018-01-25 00:47:50 +01:00
Stéphane Adjemian (Charybdis) 8bae11e85a Revert "macroprocessor: interpret arrays passed on the command line as arrays instead of strings. closes #1578"
Commit 204d9cd05fef9ac6fda8530536578c05fab66366 fails with gcc 4.9 (I checked that it works flawlessly
with 6.x). The error message is:

MacroDriver.cc:63:24: error: 'class std::basic_string<char>' has no member named 'front'
         if (it->second.front() == '[' && it->second.back() == ']')
                        ^
MacroDriver.cc:63:53: error: 'class std::basic_string<char>' has no member named 'back'
         if (it->second.front() == '[' && it->second.back() == ']')

Ideally we should bump the version of gcc used in the build system, but I will not do that before the
next bug fix release. I suppose it is easier to replace the front() and back() methods.
2018-01-24 22:15:57 +01:00
Houtan Bastani 17dd443341 macroprocessor: allow inline comments. closes #1550 2018-01-23 17:13:46 +01:00
Houtan Bastani 7ffbe32445 macroprocessor: interpret arrays passed on the command line as arrays instead of strings. closes #1578 2018-01-23 16:33:20 +01:00
Houtan 9f8edf87dd preprocessor: add line number to field in structure that macro variables are saved to. #1564 2017-12-07 18:11:00 +01:00
Houtan Bastani f57fb54a45 preprocessor: support echomacrovars(save). closes #1564 2017-12-04 16:56:43 +01:00
Houtan Bastani f836aa92c5 macroprocessor: add @#echomacrovars command. #1564 2017-12-01 16:55:36 +01:00
Houtan Bastani dff540df4e preprocessor: allow passing mod file as string. Closes #1509
Usage: ./dynare_m $'<<mod file text>>'

The $’’ expands special characters. This is necessary because our setup for native matlab statements require that they end with a newline. In other words, the rest of the mod file can be sent on one line, but if there is a native matlab statement you must enter a `\n` after it.

NB: In this case, apostrophes must be escaped: ' becomes \'

e.g., to run tests/example1.mod:
./dynare_m  $'//Example 1 from Collard\'s guide to Dynare\nvar y, c, k, a, h, b;varexo e, u;verbatim;% I want these comments included in\n% example1.m 1999q1 1999y\n%\nvar = 1;\nend;parameters beta, rho, alpha, delta, theta, psi, tau;alpha = 0.36;rho   = 0.95;tau   = 0.025;beta  = 0.99;delta = 0.025;psi   = 0;theta = 2.95;phi   = 0.1;\nmodel;c*theta*h^(1+psi)=(1-alpha)*y;k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))*(exp(b(+1))*alpha*y(+1)+(1-delta)*k));y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));k = exp(b)*(y-c)+(1-delta)*k(-1);a = rho*a(-1)+tau*b(-1) + e;b = tau*a(-1)+rho*b(-1) + u;end;initval;y = 1.08068253095672;c = 0.80359242014163;h = 0.29175631001732;k = 11.08360443260358;a = 0;b = 0;e = 0;u = 0;end;shocks;var e; stderr 0.009;var u; stderr 0.009;var e, u = phi*0.009*0.009;end; stoch_simul;'
2017-09-08 17:40:04 +02:00
Stéphane Adjemian (Charybdis) 67482f4b7b Fixed copyright notices. 2017-05-18 18:36:38 +02:00
Stéphane Adjemian (Charybdis) d2b7503e1c Fixed indentation of c/h/cc/hh files. 2017-05-16 16:30:27 +02:00
Stéphane Adjemian (Charybdis) 031a798a96 Fixed copyright notices. 2017-05-16 14:11:15 +02:00
Houtan Bastani 69abc08d85 macroprocessor: stop with error when division by zero is encountered. closes #1278 2016-09-05 17:36:40 +02:00
Houtan Bastani cd66cf7bbf fix copyright dates 2016-03-15 12:45:57 +01:00
Sébastien Villemot 42d166e272 Fix compatibility with Flex 2.6.
In Flex 2.6, the C++ scanner changed. yyout is now a reference (and no
longer a pointer).
2016-03-14 16:28:24 +01:00
Houtan Bastani fde8adc240 build system: cosmetic typo fix 2016-03-09 16:53:57 +01:00
Houtan Bastani 035b6ea463 Revert "preprocessor: add utf-8 tokenizing"
This reverts commit f2cc9d389954f16dbb88c3401e90c7981e3599d6.

This commit causes warnings in Flex
2015-10-30 18:27:41 +01:00
Houtan Bastani 7cc90013cd Merge branch 'julia' 2015-09-01 11:35:16 +02:00
Houtan Bastani ee6880bfdb preprocessor: macroprocessor: add @#includepath macro. #1039 2015-08-28 14:43:26 +02:00
Houtan Bastani 38443b0775 preprocessor: fix bug introduced in 1ba04976aac043deca38edb03e0dfc866dfadd67. #1039 2015-08-28 11:13:19 +02:00
Houtan Bastani 9f90d6ae8c preprocessor: macroprocessor: add -I switch. closes #1039 2015-08-27 16:49:12 +02:00
Houtan Bastani 33f2e2077c preprocessor: add utf-8 tokenizing 2015-08-17 17:09:40 +02:00
Houtan Bastani 3cdbc65607 macroprocessor: fix memory leak 2015-02-25 09:03:48 +01:00
Houtan Bastani 5498783e4c macroprocessor: add support for passing macro values to @#include statement, closes #848 2015-02-24 14:43:19 +01:00
Houtan Bastani dd36a7c255 fix copyright date 2015-02-18 04:00:11 +01:00
Houtan Bastani 1a08cd1ffc modify error message when @#endfor and @#endif not followed by newline at EOF. closes #706 2015-02-18 03:54:31 +01:00
Sébastien Villemot 6d22ae06cb Fix substring operator in macro-processor.
The characters of the substring could be mixed with random characters from the
memory space. Thanks to Tom Holden for reporting the bug.

Closes #708
2014-08-12 19:30:09 +02:00
Sébastien Villemot 314f9ccb0d It's bison 2.5 that's actually required now. 2014-01-13 14:56:56 +01:00
Houtan Bastani e0f662129a preprocessor: namespace fixes to remove clang warnings 2013-12-30 14:54:00 +01:00
Sébastien Villemot 1afd46b880 Refactor bison files using new prologue syntax. 2013-12-28 21:16:47 +01:00
Sébastien Villemot 10c4b8a080 Fix compatibility issue with Bison 3.
Closes #570
2013-12-28 21:02:15 +01:00
Houtan Bastani 9d5d6b713d Revert "macroprocessor: substitute dates, don't substitute dates preceded by $ or dates('"
This reverts commit 9be1d084fd2b510e7d229c7b0e02bde500e34ce1.
2013-11-18 12:53:55 +01:00
Houtan Bastani 71cd4c1a52 Revert macro/MacroFlex.ll of 858159a4f53e23a4654d5cb447e7a937faf30168 2013-11-18 12:53:42 +01:00
Houtan Bastani 0e6c4735ff Revert "macroprocessor: if you encounter dates(date), insert quotes"
This reverts commit 9eb34cee4a68d54a0943f41a7977899a36a60a80.
2013-11-18 12:42:48 +01:00
Houtan Bastani 9a28f4103d Revert "macroprocessor: copy anything within "dates()" straight to preprocessing stage"
This reverts commit 4f93207a30478d28f026cc1c9ac51640bd134f88.
2013-11-18 12:42:25 +01:00
Houtan Bastani 2acb921e99 Revert "simplify flex code"
This reverts commit 3d57c1e5e95de4fc36e2dee095aa8a9c187ddfc4.
2013-11-18 12:42:01 +01:00
Houtan Bastani 447177d771 simplify flex code 2013-10-23 15:28:16 +02:00
Houtan Bastani 72effd0156 macroprocessor: copy anything within "dates()" straight to preprocessing stage 2013-10-22 16:32:53 +02:00
Houtan Bastani 5b0bde1b8d macroprocessor: if you encounter dates(date), insert quotes 2013-10-22 14:06:57 +02:00
Houtan Bastani f3ef1f583f disallow -0 year 2013-10-22 14:06:57 +02:00
Houtan Bastani 9ecd0f2b41 macroprocessor: substitute dates, don't substitute dates preceded by $ or dates(' 2013-10-22 14:06:57 +02:00
Houtan Bastani 792b1b5924 macroprocessor: add length command. closes #436 2013-08-12 17:24:47 -04:00
Houtan Bastani 02e886c744 preprocessor: add @#ifndef directive 2012-06-26 15:12:31 +02:00
Houtan Bastani 2b901fef80 fix bug with @#ifdef in macroprocessor 2012-06-26 14:50:16 +02:00
Sébastien Villemot 979500a391 Macroprocessor: mention @#ifdef in error messages 2012-06-13 18:40:12 +02:00
Sébastien Villemot c19f62b2e3 Bison/Flex files: do not load C++ mode under Emacs
It is better to use bison-mode and flex-mode (see the wiki)
2012-06-04 11:59:35 +02:00
Houtan Bastani bdb3ceeb64 update copyright dates for files already modified in 2012 2012-01-04 14:42:06 +01:00
Houtan Bastani 2d15137289 macroprocessor: add @#ifdef 2012-01-02 18:27:04 +01:00
Sébastien Villemot 989e1917ec Build system: add boost includes for macroprocessor 2011-06-13 10:23:55 +02:00
Houtan Bastani 3023aa2c13 Allow commandline defines with string values 2011-06-10 13:25:16 +02:00