summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjannick0 <jannick0@users.noreply.github.com>2018-01-07 21:34:32 +0100
committerWill Estes <westes575@gmail.com>2018-03-13 10:45:16 -0400
commit67b3e448727da3093cdc6f0ca7fd151fbf3c10ad (patch)
tree3b313351dfa014815d1900e52b1e32ad1cc031f0
parent6a6e69af761801aedeab0264246772cf60810246 (diff)
downloadflex-git-67b3e448727da3093cdc6f0ca7fd151fbf3c10ad.tar.gz
scanner: fix default of yy_top_state()
For an _empty_ state stack the top of the state stack defaults to the state as if no state stack were present. NB: sanity check for `yy_start_stack_ptr` could be added in `yy_top_state()`.
-rw-r--r--src/flex.skl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/flex.skl b/src/flex.skl
index 1043238..05729df 100644
--- a/src/flex.skl
+++ b/src/flex.skl
@@ -2465,7 +2465,7 @@ m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
%endif
{
M4_YY_DECL_GUTS_VAR();
- return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
+ return yy_start_stack_ptr > 0 ? YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1] : YY_START;
}
]])