Example #1
0
 private function createCompiler($filename)
 {
     // Get string to render
     $input = file_get_contents($this->getSourceFilename($filename));
     // Create lexer & parser
     $lexer = new Lexer();
     $parser = new Parser();
     // Create the compiler
     $compiler = new Compiler($parser->parse($lexer->tokenize($input)));
     return $compiler;
 }
Example #2
0
 private function tokenValueTypeShouldMatch($input, $type, $position = 0)
 {
     $lexer = new Lexer();
     $stream = $lexer->tokenize($input);
     $this->assertInternalType($type, $stream->getToken($position)->getValue(), 'Type of value of token does not match ' . $type);
 }