function chooseFile($fname = 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); } }