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
issue#70
Houtan Bastani 2020-02-19 21:40:40 +01:00
parent 4a68f8a38d
commit abedb47573
No known key found for this signature in database
GPG Key ID: 000094FB955BE169
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
/*
* Copyright © 2019 Dynare Team
* Copyright © 2019-2020 Dynare Team
*
* This file is part of Dynare.
*
@ -129,6 +129,11 @@ directive_one_line : INCLUDE expr
{ $$ = make_shared<Include>($2, driver.env, @$); }
| INCLUDEPATH expr
{ $$ = make_shared<IncludePath>($2, driver.env, @$); }
| DEFINE symbol
{
auto tmp = make_shared<Real>("1", driver.env, @$);
$$ = make_shared<Define>($2, tmp, driver.env, @$);
}
| DEFINE symbol EQUAL expr
{ $$ = make_shared<Define>($2, $4, driver.env, @$); }
| DEFINE function EQUAL expr