예제 #1
0
 /**
  * Initialize any static state, can initialize parser for a file
  */
 function __construct($fname = null, $opts = null)
 {
     if (!self::$operatorString) {
         self::$operatorString = '(' . implode('|', array_map(array($this, 'preg_quote'), array_keys(self::$precedence))) . ')';
     }
     if ($fname) {
         if (!is_file($fname)) {
             throw new Exception('load error: failed to find ' . $fname);
         }
         $pi = pathinfo($fname);
         $this->fileName = $fname;
         $this->importDir = $pi['dirname'] . '/';
         $this->buffer = file_get_contents($fname);
         $this->addParsedFile($fname);
     }
 }