Implement bison parser stack re(al)location.
The elements on the parser stack are of a complex type, which bison
generated parsers don't know how to reallocate when they need to grow
the stack. This patch implements yyoverflow, which is called whenever
the parser runs out of stack space.
The size of the elements is quite large (152 bytes on x86_64), so the
initial stack (which is allocated on the C stack) is set to 1 element.
Any subsequent reallocations are done by using QVector for reallocation,
copying the elements, and handling the deallocation. Because of the size
of the elements, the stack (vectors) are grown linearly.
The upper limit of the stack size if left at 10000 elements, which
should really be enough for an lalr(1) grammar.
Task-number: QTBUG-4470
Change-Id: Ic1ef08655b388c38ef452d03a425cbd31b91825b
Reviewed-by:
Simon Hausmann <simon.hausmann@theqtcompany.com>
Showing
Please register or sign in to comment