From 486dc7abebd551973d4ca14a7bcce2c2955ad67e Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Sat, 9 Aug 2014 08:04:25 -0700 Subject: [PATCH] Do a better job with synthesis translate pragmas. --- lexor.lex | 9 +++++++-- parse.y | 9 --------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lexor.lex b/lexor.lex index 6d3304dd4..2dd3ae0c5 100644 --- a/lexor.lex +++ b/lexor.lex @@ -137,8 +137,13 @@ TU [munpf] current line. These are very easy to handle. The meta-comments format is a little more tricky to handle, but do what we can. */ -"//"{W}*"synthesis"{W}*"translate_on"{W}*\n { return K_MC_TRANSLATE_ON; } -"//"{W}*"synthesis"{W}*"translate_off"{W}*\n { return K_MC_TRANSLATE_OFF; } + /* The lexor detects "// synthesis translate_on/off" meta-comments, + we handle them here by turning on/off a flag. The pform uses + that flag to attach implicit attributes to "initial" and + "always" statements. */ + +"//"{W}*"synthesis"{W}*"translate_on"{W}*\n { pform_mc_translate_on(true); } +"//"{W}*"synthesis"{W}*"translate_off"{W}*\n { pform_mc_translate_on(false); } "//" { comment_enter = YY_START; BEGIN(LCOMMENT); } . { yymore(); } \n { yylloc.first_line += 1; BEGIN(comment_enter); } diff --git a/parse.y b/parse.y index 64716c371..07bd8f189 100644 --- a/parse.y +++ b/parse.y @@ -532,8 +532,6 @@ static void current_function_set_statement(const YYLTYPE&loc, vector %token K_resolveto K_sin K_sinh K_slew K_split K_sqrt K_tan K_tanh %token K_timer K_transition K_units K_white_noise K_wreal %token K_zi_nd K_zi_np K_zi_zd K_zi_zp - /* Support some meta-comments as pragmas. */ -%token K_MC_TRANSLATE_ON K_MC_TRANSLATE_OFF %type from_exclude block_item_decls_opt %type number pos_neg_number @@ -4248,13 +4246,6 @@ module_item /* Modules can contain further sub-module definitions. */ : module - /* The lexor detects "// synthesis translate_on/off" meta-comments, - we handle them here by turning on/off a flag. The pform uses - that flag to attach implicit attributes to "initial" and - "always" statements. */ - | K_MC_TRANSLATE_OFF { pform_mc_translate_on(false); } - | K_MC_TRANSLATE_ON { pform_mc_translate_on(true); } - | attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' { data_type_t*data_type = $3;