From b1c2957b3fb9081acf58606e669eca0a7aea9377 Mon Sep 17 00:00:00 2001 From: Demi Obenour Date: Wed, 3 May 2017 09:34:34 -0400 Subject: scanner: when bracelevel is negative, treat as zero. This really should never happen, but this at least fixes the breakage on Verilator. --- src/scan.l | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/scan.l b/src/scan.l index 8400cf6..abe47f4 100644 --- a/src/scan.l +++ b/src/scan.l @@ -940,16 +940,16 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */ "'" ACTION_ECHO; BEGIN(CHARACTER_CONSTANT); \" ACTION_ECHO; BEGIN(ACTION_STRING); {NL} { - ++linenum; - ACTION_ECHO; - if (bracelevel == 0) { - if ( doing_rule_action ) - add_action( "\tYY_BREAK]""]\n" ); + ++linenum; + ACTION_ECHO; + if (bracelevel <= 0) { + if ( doing_rule_action ) + add_action( "\tYY_BREAK]""]\n" ); - doing_rule_action = false; - BEGIN(SECT2); - } - } + doing_rule_action = false; + BEGIN(SECT2); + } + } . ACTION_ECHO; } -- cgit v1.2.3