2011-05-27 18:20:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
echo '<pre>';
|
|
|
|
|
|
|
|
echo 'Building parser. Output: "',
|
2011-08-04 11:47:29 +02:00
|
|
|
trim(`kmyacc -l -L c -m php.kmyacc -p PHPParser_Parser zend_language_parser.phpy 2>&1`),
|
2011-05-27 18:20:44 +02:00
|
|
|
'"', "\n";
|
|
|
|
|
|
|
|
$source = file_get_contents('y.tab.c');
|
2011-05-29 20:51:15 +02:00
|
|
|
$source = str_replace(
|
2011-06-12 17:12:47 +02:00
|
|
|
array(
|
|
|
|
'"$EOF"',
|
|
|
|
'#',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'\'$EOF\'',
|
|
|
|
'$',
|
|
|
|
),
|
2011-05-29 20:51:15 +02:00
|
|
|
$source
|
|
|
|
);
|
|
|
|
|
2011-06-05 18:40:04 +02:00
|
|
|
echo 'Moving parser to lib/PHPParser/Parser.php.', "\n";
|
|
|
|
file_put_contents(dirname(__DIR__) . '/lib/PHPParser/Parser.php', $source);
|
2011-05-29 20:51:15 +02:00
|
|
|
unlink(__DIR__ . '/y.tab.c');
|
|
|
|
|
|
|
|
echo 'Building debug parser. Output: "',
|
2011-08-04 11:47:29 +02:00
|
|
|
trim(`kmyacc -l -t -L c -m php.kmyacc -p PHPParser_ParserDebug zend_language_parser.phpy 2>&1`),
|
2011-05-29 20:51:15 +02:00
|
|
|
'"', "\n";
|
2011-05-27 18:20:44 +02:00
|
|
|
|
2011-05-29 20:51:15 +02:00
|
|
|
$source = file_get_contents('y.tab.c');
|
2011-05-27 18:20:44 +02:00
|
|
|
$source = str_replace(
|
|
|
|
array(
|
|
|
|
'"$EOF"',
|
2011-06-12 17:12:47 +02:00
|
|
|
'"$start : start"',
|
|
|
|
'#',
|
2011-05-27 18:20:44 +02:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'\'$EOF\'',
|
2011-06-12 17:12:47 +02:00
|
|
|
'\'$start : start\'',
|
|
|
|
'$',
|
2011-05-27 18:20:44 +02:00
|
|
|
),
|
|
|
|
$source
|
|
|
|
);
|
|
|
|
|
2011-06-05 18:40:04 +02:00
|
|
|
echo 'Moving debug parser to lib/PHPParser/ParserDebug.php.', "\n";
|
|
|
|
file_put_contents(dirname(__DIR__) . '/lib/PHPParser/ParserDebug.php', $source);
|
2011-05-27 18:20:44 +02:00
|
|
|
unlink(__DIR__ . '/y.tab.c');
|
|
|
|
|
|
|
|
echo 'Done.';
|
|
|
|
|
|
|
|
echo '</pre>';
|