1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-12 09:29:47 +01:00
PHP-Parser/grammar/rebuildParser.php
nikic eeb63065be a) changes node structure (Stmt_, Expr_, ...) b) fixes parsing of x::$y[z]
Sorry for that one large commit. Won't happen again.
2011-05-27 18:42:36 +02:00

33 lines
715 B
PHP

<?php
echo '<pre>';
echo 'Building parser. Output: "',
`kmyacc -l -v -t -m kmyacc.class.php.parser -L c zend_language_parser.phpy`,
'"', "\n";
echo 'Reading parser.', "\n";
$source = file_get_contents('y.tab.c');
echo 'Replacing "YYParser" -> "Parser", "$EOF" -> \'$EOF\', "$start : start" -> \'$start : start\'.', "\n";
$source = str_replace(
array(
'YYParser',
'"$EOF"',
'"$start : start"'
),
array(
'Parser',
'\'$EOF\'',
'\'$start : start\''
),
$source
);
echo 'Moving parser to lib/Parser.php.', "\n";
file_put_contents(dirname(__DIR__) . '/lib/Parser.php', $source);
unlink(__DIR__ . '/y.tab.c');
echo 'Done.';
echo '</pre>';