Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this repeats #3107, but for 7.4, instead of the kmyacc binary I used https://github.com/ircmaxell/PHP-Yacc here is the rebuildParser that I used: ``` <?php const GRAMMAR_REPO = 'https://raw.githubusercontent.com/nikic/PHP-Parser'; const PARSER_REPO = 'https://raw.githubusercontent.com/niklasvh/php.js'; const GRAMMAR_FILE = GRAMMAR_REPO .'/master/grammar/php7.y'; const TOKENS_FILE = GRAMMAR_REPO .'/master/grammar/tokens.y'; const TMP_FILE = './tmp_parser.jsy'; const RESULT_FILE = './tmp_parser.js'; file_put_contents('kmyacc.js.parser', file_get_contents(PARSER_REPO .'/master/grammar/kmyacc.js.parser')); $tokens = file_get_contents(TOKENS_FILE); $grammarCode = file_get_contents(GRAMMAR_FILE); $grammarCode = str_replace('%tokens', $tokens, $grammarCode); file_put_contents(TMP_FILE, $grammarCode); echo 'Building parser. Output: "', trim(shell_exec('./PHP-Yacc/bin/phpyacc -m kmyacc.js.parser ' . TMP_FILE . ' 2>&1')), '"', "\n"; preg_match_all('/T_\w+/', $tokens, $matches); foreach ($matches[0] as $match) echo '"' . $match . '",'; echo "\n". str_repeat('-', 45). "\n"; foreach ($matches[0] as $match) if (NULL != constant($match)) echo 'PHP.Constants.' . $match . ' = ' . constant($match) . "\n"; ```
- Loading branch information