public function testComments() { $recorder = new LexerOutputRecorder(); $testResult = $recorder->process('file', 'data/Comments.plex'); $expected = unserialize(file_get_contents(dirname(__FILE__) . '/data/Comments.expect.dat')); $this->assertEquals($testResult, $expected); }
/** * Interpret arguments and invoke the recorder. * * @version @package_version@ * @param array Command line arguments after stripping of PHP script, etc. */ function main($args) { if (count($args)) { $plexFile = array_shift($args); } else { echo 'Usage: infile [outfile]'; return 1; } $gen = new LexerOutputRecorder(); $states = $gen->process('file', $plexFile); if (count($args)) { file_put_contents(array_shift($args), serialize($states)); } else { echo serialize($states); } return 0; }