diff --git a/parser.inc.php b/parser.inc.php index c356acf..307c8cf 100644 --- a/parser.inc.php +++ b/parser.inc.php @@ -594,11 +594,15 @@ class mtgMetaInfoParser private function _validatePropToken($name, $value) { - if(!isset($this->config['valid_tokens']) || !$this->config['valid_tokens']) + if(!isset($this->config['valid_tokens']) || + !is_array($this->config['valid_tokens'])) return; if(!in_array($name, $this->config['valid_tokens'])) + { + --$this->line; //hack for more precise reporting throw new Exception("Unknown token '$name'"); + } } private function _symbol() @@ -779,7 +783,7 @@ class mtgMetaInfoParser $t = ord($t); if($t !== $this->token) { - $this->_error("Expecting '" . $this->_toStr($t) . "' instead got '" . $this->_toStr($this->token) . "'"); + $this->_error("expecting '" . $this->_toStr($t) . "' instead got '" . $this->_toStr($this->token) . "'"); } $attr = $this->attribute; @@ -796,7 +800,7 @@ class mtgMetaInfoParser private function _error($msg) { - throw new Exception($msg . "(token: {$this->token}, attr: {$this->attribute}})"); + throw new Exception($msg . "(token: {$this->token}, attr: {$this->attribute})"); } }