diff options
author | David Mitchell <davem@iabyn.com> | 2016-12-10 20:07:32 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-12-10 20:14:57 +0000 |
commit | df13534a362db9ee6def13689ce040e48c73a29a (patch) | |
tree | de5464824cd77bdbf9809364ab0ad3c9517c9702 /parser.h | |
parent | 98d5e3efa825adce1bfa065a5deed791c30162ac (diff) | |
download | perl-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.h | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -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 */ |