Commit 25ad8b7a authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

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: default avatarSimon Hausmann <simon.hausmann@theqtcompany.com>
parent ec9ab0ba
Showing with 916 additions and 814 deletions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment