Homec4science

Add a test case for `YYINITDEPTH`

Authored by Joshua Spence <josh@freelancer.com> on Dec 2 2015, 21:51.

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

Committed
Joshua Spence <josh@freelancer.com>Dec 2 2015, 21:51
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU65b877383e0e: Add case-insensitive array
Branches
Unknown
Tags
Unknown

Event Timeline

Joshua Spence <josh@freelancer.com> committed rPHUcde5e8a0fbb2: Add a test case for `YYINITDEPTH` (authored by Joshua Spence <josh@freelancer.com>).Dec 2 2015, 21:51