From 412e8a7da0f1ceed51a5c8d88c27a9733b4daccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Mon, 21 Feb 2011 11:20:18 +0100 Subject: [PATCH] Preprocessor: fix problem with "%" sign inside string in native statements --- preprocessor/DynareFlex.ll | 4 +++- tests/comments.mod | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index 254739e21..2ed5b6f79 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -580,7 +580,9 @@ string eofbuff; /* Add the native statement */ { - [^/%*\n\.]* | + [^/%*\n\.\'\"]* | + \'[^\'\n]*\' | + \"[^\"\n]*\" | \.{1,2} | "*" | "/" { yymore(); eofbuff = string(yytext); } diff --git a/tests/comments.mod b/tests/comments.mod index f2a668995..dd8f9b73c 100644 --- a/tests/comments.mod +++ b/tests/comments.mod @@ -28,6 +28,8 @@ fff = [ 1 delta 4 ; ... /* COMMENT 1 0 4 ; ... // comment */ phi 9 4 ] % comment +disp(' %% This is not a comment %% ') + model; c*theta*h^(1+psi)=(1-alpha)*y; k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))