scanner: when bracelevel is negative, treat as zero.
This really should never happen, but this at least fixes the
breakage on Verilator.
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 @@
"'" 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;
}