2011-04-18 19:02:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function __autoload($class) {
|
|
|
|
is_file($file = './lib/' . strtr($class, '_', '/') . '.php') && require_once $file;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '<pre>';
|
|
|
|
|
2011-05-30 19:21:25 +02:00
|
|
|
$parser = new Parser;
|
|
|
|
$prettyPrinter = new PrettyPrinter_Zend;
|
|
|
|
$nodeDumper = new NodeDumper;
|
2011-04-18 19:02:30 +02:00
|
|
|
|
|
|
|
// Output Demo
|
2011-05-31 16:33:11 +02:00
|
|
|
$stmts = $parser->parse(new Lexer(
|
2011-04-18 19:02:30 +02:00
|
|
|
'<?php
|
2011-05-27 21:15:38 +02:00
|
|
|
x::$y[z];
|
|
|
|
$x->y[z];
|
|
|
|
$x->y[z][k]->l()->m[t];
|
|
|
|
$x->y[z]();
|
|
|
|
$x->$y[z]();
|
|
|
|
$x->$$y[z]();'
|
2011-04-18 19:02:30 +02:00
|
|
|
),
|
2011-05-27 22:57:55 +02:00
|
|
|
function ($msg) {
|
2011-05-27 21:51:27 +02:00
|
|
|
echo $msg;
|
2011-04-18 19:02:30 +02:00
|
|
|
}
|
|
|
|
);
|
2011-05-29 17:33:03 +02:00
|
|
|
|
2011-04-20 13:40:29 +02:00
|
|
|
if (false !== $stmts) {
|
2011-05-30 19:21:25 +02:00
|
|
|
echo htmlspecialchars($nodeDumper->dump($stmts));
|
2011-04-20 13:40:29 +02:00
|
|
|
}
|
2011-04-18 19:02:30 +02:00
|
|
|
|
|
|
|
echo "\n\n";
|
|
|
|
|
2011-05-30 17:29:10 +02:00
|
|
|
$code = $prettyPrinter->pStmts(
|
2011-05-31 16:33:11 +02:00
|
|
|
$parser->parse(
|
2011-05-30 17:29:10 +02:00
|
|
|
new Lexer(file_get_contents(
|
2011-05-30 18:01:38 +02:00
|
|
|
'../symfonySandbox\src\vendor\symfony\src\Symfony\Components\Console\Input\InputDefinition.php'
|
2011-05-30 17:29:10 +02:00
|
|
|
)),
|
2011-05-29 12:20:47 +02:00
|
|
|
function ($msg) {
|
|
|
|
echo $msg;
|
|
|
|
}
|
|
|
|
)
|
2011-05-30 17:29:10 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
echo htmlspecialchars($code);
|