Commit Graph

38 Commits (74ef3457b4805099ee9885b34173a0d0fd6aca61)

Author SHA1 Message Date
Sébastien Villemot 74ef3457b4
Use secure URL for link to GNU licenses 2021-06-09 17:21:00 +02:00
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
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 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
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 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 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 6e523aaf28
macro processor: add immutable Range class, making Array immutable 2019-08-20 15:21:41 +02:00
Houtan Bastani 16080f2bb8
macro processor: make Variable class immutable 2019-08-20 11:16:33 +02:00
Houtan Bastani b77f6ecd94
macro processor: add `defined` operator 2019-08-19 15:14:51 +02:00
Sébastien Villemot 75b000a0b5
Macro processor: ensure that all read-accessors return a const reference
Useless copies are thus avoided in some situations.
2019-08-14 17:36:10 +02:00
Sébastien Villemot c4f331c74c
Macro processor: make more node classes immutable
Since the node classes are stored and copied as std::shared_ptr, a given class
instance can actually be shared by two different expressions. Hence, in order
to prevent weird bugs, it’s necessary to make these classes immutable.

This commit deals with the easy cases.

The remaining (and more complex) ones are:
— Variable
— Array
— Include
— IncludePath
2019-08-14 17:14:42 +02:00
Sébastien Villemot 46a7cf5db7
Macro processor: fix the use of move semantics in constructor
In particular, remove the const keyword before arguments passed-by-value,
because otherwise they can't be moved (since they are immutable).

Also add a few missing calls to std::move(), and remove some calls to
std::move() when they are useless (on class enums, which are fundamental
types.)
2019-08-14 16:43:45 +02:00
Houtan Bastani 273c54f7fb
macro processor: introduce functions to test types of variables and literals 2019-08-07 14:16:15 -04:00
Houtan Bastani d35f2609fe
macro processor: implement `isempty` 2019-08-07 11:59:14 -04:00
Houtan Bastani 00172ec10b
change missed in `309326c372b140d4e6e459b2139d957c246c6512` 2019-08-07 10:44:11 -04:00
Houtan Bastani 309326c372
macro processor: change name of Double type to Real 2019-08-07 10:37:35 -04:00
Houtan Bastani 618bf7c987
macro processor: remove cast to int 2019-08-06 14:10:11 -04:00
Houtan Bastani b3798a0baa
macro processor: introduce bool casts 2019-08-05 16:30:29 -04:00
Houtan Bastani eaa8b8fa84
macro processor: introduce array casts 2019-08-02 17:00:23 -04:00
Houtan Bastani 2b1eedd132
macro processor: introduce tuple casts 2019-08-02 16:56:01 -04:00
Houtan Bastani 7e085855b3
macro processor: introduce string casts 2019-08-02 15:19:00 -04:00
Houtan Bastani 5442512904
macro processor: introduce double casts 2019-08-02 15:03:05 -04:00
Houtan Bastani 5fc83fad29
macro processor: introduce integer casts 2019-08-02 14:53:24 -04:00
Houtan Bastani 06b835c2e0 aesthetic changes 2019-06-27 14:27:59 +02:00
Houtan Bastani 63b2117587 macro processor: remove unnecessary includes 2019-06-27 13:57:19 +02:00
Houtan Bastani bde7c47117 macro processor: combine comprehension classes 2019-06-27 11:44:51 +02:00
Houtan Bastani d5f728c0a3
macro processor: support array comprehension 2019-06-25 16:50:26 +02:00
Houtan Bastani 2bd6282aef
Revert "macro processor: support array comprehension" (should not have been pushed yet)
This reverts commit f2c93d377f.
2019-06-25 12:14:03 +02:00
Houtan Bastani b041cb4fba
macro processor: remove unnecessary function 2019-06-25 12:12:34 +02:00
Houtan Bastani f2c93d377f
macro processor: support array comprehension 2019-06-25 11:15:15 +02:00
Houtan Bastani cd9dfa64cb
macro processor: inline function 2019-06-25 11:14:00 +02:00
Houtan Bastani 4c6032895d
macro processor: fix bug in indexing of strings/arrays 2019-06-24 15:57:00 +02:00
Houtan Bastani a3e63101f4
support `save` option of @#echomacrovars 2019-06-24 11:06:31 +02:00
Houtan Bastani 17e040f3f6
macro processor 2.0 2019-06-21 16:45:17 +02:00