Sébastien Villemot
ec779235ea
Macro-processor: move environment out of node classes
...
This completes the separation of parse trees from their evaluation.
Closes : #32
2020-12-07 17:29:05 +01:00
Sébastien Villemot
5d564eed07
Fix the interpretation of @#elseif clauses within an @#ifdef or @#ifndef
2020-11-02 12:47:33 +01:00
Sébastien Villemot
df8d8ef116
Fix logic for @#ifndef
...
Ref. dynare#1747
2020-11-02 12:27:27 +01:00
Houtan Bastani
28b98c7c0e
Rework the function that handles the macro-expansion of the .mod file
2020-02-20 15:30:46 +01:00
Houtan Bastani
abedb47573
macro processor: allow for the definition of a variable without a value
...
- by default, set the value of the variable to `1`, as is done on the command line with the `-D` flag
issue #43
2020-02-19 21:40:40 +01:00
Houtan Bastani
1dbbd87d3d
Remove options `noemptylinemacro` and `nolinemacro`; add option `linemacro`
...
This only concerns the situation when `savemacro` is also passed.
When `linemacro` is passed, the macro expanded .mod file is the same as before
When `linemacro` is not passed, the macro expanded .mod file is equivalent to what it was before when both `noemptylinemacro` and `nolinemacro` were passed.
closes #44
closes #45
2020-02-05 15:19:01 +01:00
Houtan Bastani
12296b620f
macro processor: fix bug in file reported when error encountered after a file has been included
...
closes #42
2020-02-04 11:12:41 +01:00
Houtan Bastani
6284e991fc
macro processor: remove unnecessary type specifiers
2020-02-04 11:12:41 +01:00
Houtan Bastani
148aa9d924
macro processor: simplify handling of `@#define`
2020-01-29 14:52:01 +01:00
Houtan Bastani
c6a52fd778
macro processor: c++ modernization
2020-01-21 15:43:25 +01:00
Houtan Bastani
fa2f6c9206
macro processor: use `map.count()` instead of `map.find()`
2020-01-21 15:41:25 +01:00
Houtan Bastani
3c546ddb20
macro processor: declare function const
2020-01-21 15:41:08 +01:00
Houtan Bastani
e9049aa81f
use prefix notation `R"()"` for quote in quotes
2020-01-16 16:24:21 +01:00
Houtan Bastani
6d1c2ca82b
macro processor: allow colon-separated arrays as command-line defines
...
colon-separated command line arguments such as
```
dynare <<.mod file>> -DA=1:5 -DAA=1:2:5
```
are now translated as:
```
@#define C = [2, 3, 4, 5, 6]
@#define CC = [2, 5]
```
2020-01-16 16:24:21 +01:00
Houtan Bastani
f00d7c4b4c
macro processor: fix bug where command line arguments that began with an integer were being treated as integers even if they weren't (e.g. dates)
2020-01-16 13:09:42 +01:00
Houtan Bastani
f2271eb806
Partial reversion of global indentation of macro processor header files introduced in e2d5a83592
...
The global indentation introduced in e2d5a83592
made the macro processor header files difficult to read. Revert spacing changes that made simple, inline, one-line functions take up 5 lines making headers tougher to read. Similary change for constructors, not to place each brace on an individual line.
2019-12-23 19:39:34 +01:00
Sébastien Villemot
e2d5a83592
Global reindentation
2019-12-20 16:59:30 +01:00
Houtan Bastani
653b2477db
Update for bison 3.5
2019-12-18 15:43:48 +01:00
Sébastien Villemot
031c0cff5f
Various code simplifications and modernizations
2019-12-16 19:42:59 +01:00
Houtan Bastani
8dc70602c8
macro processor: move evaluation of all arguments for unary, binary, and trinary ops into their switch cases
2019-12-10 16:33:32 +01:00
Houtan Bastani
952e899f3a
fix bug in macro processor ensuring short-circuit functionality of `||` and `&&` statements
...
closes dynare#1676
2019-12-10 16:30:11 +01:00
Houtan Bastani
a61565bd01
macro processor: fix bug in cast of string to bool
...
The incorrect `equal` template was being used.
2019-11-26 11:11:34 +01:00
Houtan Bastani
4540bed06c
macro processor: missed if statement with initializer for C++17
2019-11-26 10:40:51 +01:00
Houtan Bastani
4e3bf09495
macro processor: fix typo that caused logical or not to work when one of the arguments is Real == 1 and other arguments are false
2019-11-26 10:39:16 +01:00
Houtan Bastani
8034513578
macro processor: fix bug: allow empty strings
...
previously, `@#define str=""` caused an error
2019-11-26 10:32:43 +01:00
Houtan Bastani
c6beb6c5c6
macro processor: ignore `@#line` directive
2019-11-22 14:14:05 +01:00
Houtan Bastani
ef4710cdb1
macro processor: fix for loops
2019-10-29 11:21:09 +01:00
Houtan Bastani
4866bb5902
macro processor: use C++17 structured bindings in for loops
2019-10-29 11:20:21 +01:00
Houtan Bastani
217dadabbd
Use `if` statements with initializers allowed by C++17
2019-10-29 11:20:13 +01:00
Houtan Bastani
361e99bee5
simplify code
2019-10-28 17:25:40 +01:00
Houtan Bastani
7b13ee1b3a
macro processor: remove unused variable
2019-10-24 17:52:32 +02:00
Houtan Bastani
7b4616e853
fix cross compilation due to bug in MinGW 8.3.0
...
implicit conversion from `filesystem::path` to `string` not supported even though it's in the standard
2019-10-04 14:41:48 +02:00
Houtan Bastani
1291320053
macro processor: handle empty files
2019-10-04 11:18:03 +02:00
Houtan Bastani
125adff59c
macro processor: insert path instead of string as the path has already been created
2019-10-04 11:10:21 +02:00
Houtan Bastani
2ce6e411b4
remove unused headers
2019-10-04 10:57:36 +02:00
Houtan Bastani
031bc62f3a
macro processor: use filesystem after move to C++17, closes #31
...
ancillary to this change is the move of `paths` out of the Driver class into an argument to parsing/evaluation #32
2019-10-03 14:24:47 +02:00
Houtan Bastani
d7e70a4063
macro processor: fix bug: interpret @#include at node level instead of at the Driver level
2019-10-02 17:39:11 +02:00
Houtan Bastani
310f3936fe
macro processor: fix bug: interpret @#includepath at node level instead of at the Driver level
2019-10-02 17:39:05 +02:00
Houtan Bastani
93077bbcdd
macro processor: fix bug in range when start point == end point
2019-10-02 10:22:46 +02:00
Houtan Bastani
0df8dd3bc2
include header needed to compile 3a21eda40e
with g++
...
#26
2019-08-26 18:17:41 +02:00
Houtan Bastani
3a21eda40e
macro processor: support @#echomacrovars with symbol_list
...
closes #26
2019-08-26 18:12:04 +02:00
Houtan Bastani
2b3519e3b0
macro processor: add for syntax for shortcut with filtering comprehension
...
closes #28
2019-08-26 16:08:31 +02:00
Houtan Bastani
def99f9dd3
macro processor: simplify parser code
2019-08-26 15:00:53 +02:00
Houtan Bastani
d4ad2cbb5e
macro processor: Expression class has to_string function as well, so no need for cast
2019-08-23 12:07:31 +02:00
Houtan Bastani
7f96d4a1c9
macro processor: remove unnecessary check in Function evaluation
...
Not necessary because of parser rules for function definition
2019-08-23 11:12:36 +02:00
Houtan Bastani
6ced2aaedb
macro processor: fix bug in array power: disallow reals that are not integers
2019-08-22 15:44:31 +02:00
Houtan Bastani
8da3dc5c6b
macro processor: add noexcept to functions
2019-08-21 18:25:08 +02:00
Houtan Bastani
48466f0e10
macro processor: remove double evaluations of ExpressionPtr
2019-08-21 18:07:40 +02:00
Houtan Bastani
92f18f58f5
macro processor: comment If class
2019-08-21 18:04:09 +02:00
Houtan Bastani
cfc7a1467b
macro processor: fix error message
2019-08-20 15:21:41 +02:00