summaryrefslogtreecommitdiff
path: root/parser.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-12-10 20:07:32 +0000
committerDavid Mitchell <davem@iabyn.com>2016-12-10 20:14:57 +0000
commitdf13534a362db9ee6def13689ce040e48c73a29a (patch)
treede5464824cd77bdbf9809364ab0ad3c9517c9702 /parser.h
parent98d5e3efa825adce1bfa065a5deed791c30162ac (diff)
downloadperl-df13534a362db9ee6def13689ce040e48c73a29a.tar.gz
yyparse(): extend parser stack before every shift.
This reverts v5.25.7-60-gb2c9b6e and adds a test. In that previous commit of mine, for efficiency I changed it so that it checked and extended the parser stack only after every reduce rather than every shift, but when it did check, it extended it by at least 15 slots to allow for all the elements of the longest possible rule to be shifted. Turns out this was bad reasoning. The following type of code can shift indefinitely without ever reducing: [{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/parser.h b/parser.h
index 3c7bb4e97d..ad148c26eb 100644
--- a/parser.h
+++ b/parser.h
@@ -44,9 +44,7 @@ typedef struct yy_parser {
int yylen; /* length of active reduction */
yy_stack_frame *stack; /* base of stack */
- yy_stack_frame *stack_maxbase;/* (stack + alloced size - YY_MAXRULE)
- * it's offset by -YY_MAXRULE to make
- * overflow checks quicker */
+ yy_stack_frame *stack_max1;/* (top-1)th element of allocated stack */
yy_stack_frame *ps; /* current stack frame */
/* lexer state */