diff options
author | Dan Ungureanu <udan1107@gmail.com> | 2015-05-26 01:02:55 +0300 |
---|---|---|
committer | Dan Ungureanu <udan1107@gmail.com> | 2015-06-08 19:37:46 +0300 |
commit | 0a52978705d59c50f785f0f9cf537161046beb21 (patch) | |
tree | 00051de2f829f6b1f5c95c54da89be1f298b77a8 /src/Exceptions | |
download | sql-parser-0a52978705d59c50f785f0f9cf537161046beb21.zip sql-parser-0a52978705d59c50f785f0f9cf537161046beb21.tar.gz sql-parser-0a52978705d59c50f785f0f9cf537161046beb21.tar.bz2 |
Initial commit.
Diffstat (limited to 'src/Exceptions')
-rw-r--r-- | src/Exceptions/LexerException.php | 41 | ||||
-rw-r--r-- | src/Exceptions/ParserException.php | 32 |
2 files changed, 73 insertions, 0 deletions
diff --git a/src/Exceptions/LexerException.php b/src/Exceptions/LexerException.php new file mode 100644 index 0000000..f346d83 --- /dev/null +++ b/src/Exceptions/LexerException.php @@ -0,0 +1,41 @@ +<?php + +namespace SqlParser\Exceptions; + +use SqlParser\Token; + +/** + * Exception thrown by the lexer. + */ +class LexerException extends \Exception +{ + + /** + * The character that produced this error. + * + * @var string + */ + public $ch; + + /** + * The index of the character that produced this error. + * + * @var int + */ + public $pos; + + /** + * Constructor. + * + * @param string $message + * @param string $ch + * @param int $positiion + * @param int $code + */ + public function __construct($message = '', $ch = '', $pos = 0, $code = 0) + { + parent::__construct($message, $code); + $this->ch = $ch; + $this->pos = $pos; + } +} diff --git a/src/Exceptions/ParserException.php b/src/Exceptions/ParserException.php new file mode 100644 index 0000000..e23d03d --- /dev/null +++ b/src/Exceptions/ParserException.php @@ -0,0 +1,32 @@ +<?php + +namespace SqlParser\Exceptions; + +use SqlParser\Token; + +/** + * Exception thrown by the parser. + */ +class ParserException extends \Exception +{ + + /** + * The token that produced this error. + * + * @var Token + */ + public $token; + + /** + * Constructor. + * + * @param string $message + * @param Token $token + * @param int $code + */ + public function __construct($message = '', Token $token = null, $code = 0) + { + parent::__construct($message, $code); + $this->token = $token; + } +} |