Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (22 sloc) 723 Bytes
<?php
ini_set('display_errors', 1 );
ini_set('memory_limit', -1 );
error_reporting(E_ALL);
require_once __DIR__ . '/Library/PHPParser/bootstrap.php';
require_once __DIR__ . '/Classes/ChocolatSerializer.php';
try {
if ( !isset( $argv[ 1 ] ) ) {
throw new Exception( 'Missing file parameter' );
}
$file = $argv[ 1 ];
if ( !file_exists( $file ) ) {
throw new Exception( 'Cannot open file: ' . $file );
}
$parser = new PHPParser_Parser( new PHPParser_Lexer );
$statements = $parser->parse( file_get_contents( $file ) );
$serializer = new ChocolatSerializer( file( $file ) );
print $serializer->serialize( $statements );
} catch( Exception $exception ) {
print $exception;
die( $exception->getCode() );
}