summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDemi Obenour <demiobenour@gmail.com>2017-05-03 09:34:34 -0400
committerWill Estes <westes575@gmail.com>2017-05-03 16:13:02 -0400
commitb1c2957b3fb9081acf58606e669eca0a7aea9377 (patch)
tree3874980aed58dcf241e5da33989ea3911840c0d1
parent8b746fa02556b7b99430f5e136c2a3684b5642ae (diff)
scanner: when bracelevel is negative, treat as zero.
This really should never happen, but this at least fixes the breakage on Verilator.
-rw-r--r--src/scan.l18
1 files 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;
}