From dd557a7c8c8fa12b2566f5a147ba48dcd04f8ad4 Mon Sep 17 00:00:00 2001 From: michel Date: Thu, 24 Nov 2005 15:54:00 +0000 Subject: [PATCH] v4: corrected bug in ; after end at end of Dynare blocks git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@518 ac1d8469-bf42-47a9-8791-bf33cf982152 --- parser.src/DynareBison.yy | 22 +++++++++++----------- parser.src/DynareFlex.ll | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/parser.src/DynareBison.yy b/parser.src/DynareBison.yy index fa173940d..4730ca4c7 100644 --- a/parser.src/DynareBison.yy +++ b/parser.src/DynareBison.yy @@ -257,12 +257,12 @@ | comma_expression COMMA expression {$$ = _parser->add_expression_token($1,$3,$2);} initval - : INITVAL ';' {_parser->begin_initval();} initval_list END ';' + : INITVAL ';' {_parser->begin_initval();} initval_list END {_parser->end_initval();} ; endval - : ENDVAL ';' {_parser->begin_endval();} initval_list END ';' + : ENDVAL ';' {_parser->begin_endval();} initval_list END {_parser->end_endval();} ; @@ -277,7 +277,7 @@ ; histval - : HISTVAL ';' {_parser->begin_histval();} histval_list END ';' + : HISTVAL ';' {_parser->begin_histval();} histval_list END histval_list : histval_list histval_elem @@ -290,11 +290,11 @@ ; model - : MODEL ';' equation_list END ';' + : MODEL ';' equation_list END {_parser->check_model();} - | MODEL '(' LINEAR ')' ';' {_parser->option_num("linear","1");} equation_list END ';' + | MODEL '(' LINEAR ')' ';' {_parser->option_num("linear","1");} equation_list END {_parser->check_model();} - | MODEL '(' USE_DLL ')' ';' {_parser->use_dll();} equation_list END ';' + | MODEL '(' USE_DLL ')' ';' {_parser->use_dll();} equation_list END {_parser->check_model();} ; @@ -363,7 +363,7 @@ ; shocks - : SHOCKS ';' {_parser->begin_shocks();} shock_list END ';' + : SHOCKS ';' {_parser->begin_shocks();} shock_list END ; shock_list @@ -567,7 +567,7 @@ ; estimated_params - : ESTIMATED_PARAMS ';' {_parser->estimation_init();} estimated_list END ';' + : ESTIMATED_PARAMS ';' {_parser->estimation_init();} estimated_list END ; estimated_list @@ -639,7 +639,7 @@ } ; - estimated_params_init: ESTIMATED_PARAMS_INIT ';' estimated_init_list END ';' + estimated_params_init: ESTIMATED_PARAMS_INIT ';' estimated_init_list END ; estimated_init_list : estimated_init_list estimated_init_elem @@ -666,7 +666,7 @@ } ; - estimated_params_bounds: ESTIMATED_PARAMS_BOUNDS ';' estimated_bounds_list END ';' + estimated_params_bounds: ESTIMATED_PARAMS_BOUNDS ';' estimated_bounds_list END ; estimated_bounds_list : estimated_bounds_list estimated_bounds_elem @@ -787,7 +787,7 @@ ; observation_trends - : OBSERVATION_TRENDS ';' {_parser->set_trend_init();} trend_list END ';' + : OBSERVATION_TRENDS ';' {_parser->set_trend_init();} trend_list END ; trend_list diff --git a/parser.src/DynareFlex.ll b/parser.src/DynareFlex.ll index 1293784d8..bf0ac7070 100644 --- a/parser.src/DynareFlex.ll +++ b/parser.src/DynareFlex.ll @@ -86,7 +86,7 @@ int sigma_e = 0; optim_weights {BEGIN DYNARE_BLOCK;return OPTIM_WEIGHTS;} /* End of a Dynare block */ -end {BEGIN INITIAL;return END;} +end[ \t\n]*; {BEGIN INITIAL;return END;} /* Inside of a Dynare statement */ datafile {return DATAFILE;} @@ -242,6 +242,7 @@ int sigma_e = 0; _scanner->do_as_is(yytext); } } +. {BEGIN NATIVE; _scanner->do_as_is(yytext);} /* NATIVE Block */ .* {BEGIN INITIAL;_scanner->do_as_is(yytext);_scanner->do_as_is("\n");}