/**
  * Executes this command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input  Input options.
  * @param \Symfony\Component\Console\Output\OutputInterface $output Output stream.
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $filename = $input->getArgument('filename');
     $output->writeln("Parsing input file <comment>{$filename}</comment>.");
     $tokens = $this->tokenizer->tokenizeStream($filename);
     $output->write($this->tokenPrinter->printTokenStream($tokens));
 }
示例#2
0
 /**
  * @param string                                            $filename
  * @param \Helmich\TypoScriptLint\Linter\Report\Report            $report
  * @param \Helmich\TypoScriptLint\Linter\LinterConfiguration      $configuration
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  */
 public function lintFile($filename, Report $report, LinterConfiguration $configuration, OutputInterface $output)
 {
     $file = new File($filename);
     try {
         $tokens = $this->tokenizer->tokenizeStream($filename);
         $statements = $this->parser->parseTokens($tokens);
         $this->lintTokenStream($tokens, $file, $configuration, $output);
         $this->lintSyntaxTree($statements, $file, $configuration, $output);
     } catch (TokenizerException $tokenizerException) {
         $file->addWarning(Warning::createFromTokenizerError($tokenizerException));
     } catch (ParseError $parseError) {
         $file->addWarning(Warning::createFromParseError($parseError));
     }
     if (count($file->getWarnings()) > 0) {
         $report->addFile($file);
     }
 }
 /**
  * Parses a TypoScript string.
  *
  * @param string $content The string to parse.
  * @return \Helmich\TypoScriptParser\Parser\AST\Statement[] The syntax tree.
  */
 public function parseString($content)
 {
     $tokens = $this->tokenizer->tokenizeString($content);
     return $this->parseTokens($tokens);
 }