From abedb47573317dd16089b72cb95d0abca3893f6a Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Wed, 19 Feb 2020 21:40:40 +0100
Subject: [PATCH] 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
---
 src/macro/Parser.yy | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/macro/Parser.yy b/src/macro/Parser.yy
index 800a6554..2c72ea84 100644
--- a/src/macro/Parser.yy
+++ b/src/macro/Parser.yy
@@ -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
-- 
GitLab