QuackCompiler\Parser\TokenReader::parse PHP Method

parse() public method

public parse ( )
    public function parse()
    {
        $this->ast = $this->grammar->start();
    }

Usage Example

Esempio n. 1
0
 public function read()
 {
     $files = $this->getFileNames();
     $this->inArguments('-v', '--version') && (print $this->getVersionContent());
     $this->inArguments('-h', '--help') && (print $this->getHelpContent());
     array_walk($files, function ($file) {
         if (!file_exists($file)) {
             echo "File [{$file}] not found";
             exit(1);
         }
         try {
             $lexer = new Tokenizer(file_get_contents($file));
             $parser = new TokenReader($lexer);
             $parser->parse();
             echo $parser->format();
         } catch (SyntaxError $e) {
             echo $e;
             exit(1);
         }
     });
 }
All Usage Examples Of QuackCompiler\Parser\TokenReader::parse