mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-26 20:14:46 +01:00
Default to using php-yacc to generate the parsers
This commit is contained in:
parent
3226eb4086
commit
eacc5dbe19
@ -17,7 +17,8 @@
|
|||||||
"ext-tokenizer": "*"
|
"ext-tokenizer": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0"
|
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0",
|
||||||
|
"ircmaxell/php-yacc": "0.0.4"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
|
@ -21,8 +21,10 @@ applied to it:
|
|||||||
Building the parser
|
Building the parser
|
||||||
===================
|
===================
|
||||||
|
|
||||||
In order to rebuild the parser, you need [moriyoshi's fork of kmyacc](https://github.com/moriyoshi/kmyacc-forked).
|
Run `php grammar/rebuildParsers.php` to rebuild the parsers. Additional options:
|
||||||
After you compiled/installed it, run the `rebuildParsers.php` script.
|
|
||||||
|
|
||||||
By default only the `Parser.php` is built. If you want to additionally emit debug symbols and create `y.output`, run the
|
* The `KMYACC` environment variable can be used to specify an alternative `kmyacc` binary.
|
||||||
script with `--debug`. If you want to retain the preprocessed grammar pass `--keep-tmp-grammar`.
|
By default the `phpyacc` dev dependency will be used. To use the original `kmyacc`, you
|
||||||
|
need to compile [moriyoshi's fork](https://github.com/moriyoshi/kmyacc-forked).
|
||||||
|
* The `--debug` option enables emission of debug symbols and creates the `y.output` file.
|
||||||
|
* The `--keep-tmp-grammar` option preserves the preprocessed grammar file.
|
||||||
|
@ -15,14 +15,8 @@ $tokensResultsFile = $resultDir . '/Tokens.php';
|
|||||||
|
|
||||||
$kmyacc = getenv('KMYACC');
|
$kmyacc = getenv('KMYACC');
|
||||||
if (!$kmyacc) {
|
if (!$kmyacc) {
|
||||||
// Check for kmyacc binary in this directory, otherwise fall back to global name
|
// Use phpyacc from dev dependencies by default.
|
||||||
if (file_exists(__DIR__ . '/kmyacc.exe')) {
|
$kmyacc = PHP_BINARY . ' ' . __DIR__ . '/../vendor/bin/phpyacc';
|
||||||
$kmyacc = __DIR__ . '/kmyacc.exe';
|
|
||||||
} else if (file_exists(__DIR__ . '/kmyacc')) {
|
|
||||||
$kmyacc = __DIR__ . '/kmyacc';
|
|
||||||
} else {
|
|
||||||
$kmyacc = 'kmyacc';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array_flip($argv);
|
$options = array_flip($argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user