HomePhabricator

Add a test case for `YYINITDEPTH`

Description

Add a test case for YYINITDEPTH

Summary:
D14529 removed some questionable code from XHPAST:

// PHP's if/else rules use right reduction rather than left reduction which
// means while parsing nested if/else's the stack grows until it the last
// statement is read. This is annoying, particularly because of a quirk in
// bison.
// http://www.gnu.org/software/bison/manual/html_node/Memory-Management.html
// Apparently if you compile a bison parser with g++ it can no longer grow
// the stack. The work around is to just make your initial stack ridiculously
// large. Unfortunately that increases memory usage while parsing which is
// dumb. Anyway, putting a TODO here to fix PHP's if/else grammar.
#define YYINITDEPTH 500

It wasn't really clear why this code was needed and, hence, it was removed. The removal of this #define, however, caused a regression (see rPHU33b1620656f76aa1fdb303557afac5fd32ba0e91). This diff adds a test case in an attempt to prevent future regressions.

Test Plan: arc unit

Reviewers: epriestley, Blessed Reviewers

Reviewed By: epriestley, Blessed Reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14627

Details

Provenance
joshuaspenceAuthored on
joshuaspencePushed on Dec 2 2015, 8:52 PM
Reviewer
Blessed Reviewers
Differential Revision
D14627: Add a test case for `YYINITDEPTH`
Parents
rPHU65b877383e0e: Add case-insensitive array
Branches
Unknown
Tags
Unknown
Build Status
Buildable 9227
Build 10925: Run Core Tests