From 937659747ab504d6220d89fd492752c31ad1d0c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 24 Jul 2018 12:49:08 +0200
Subject: [PATCH] Macroprocessor: error out when length() operator called on a
 string or an int

Closes DynareTeam/Dynare#1547
---
 src/macro/MacroBison.yy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/macro/MacroBison.yy b/src/macro/MacroBison.yy
index c650b947..43f8354a 100644
--- a/src/macro/MacroBison.yy
+++ b/src/macro/MacroBison.yy
@@ -159,7 +159,7 @@ expr : INTEGER
        }
      | NAME LPAREN array_expr RPAREN
        { TYPERR_CATCH($$ = driver.eval_string_function(*$1, $3), @$); delete $1; }
-     | LENGTH LPAREN array_expr RPAREN
+     | LENGTH LPAREN expr RPAREN
        { TYPERR_CATCH($$ = $3->length(), @$); }
      | LPAREN expr RPAREN
        { $$ = $2; }
-- 
GitLab