| 1 |
<?php |
| 2 |
/** |
| 3 |
* This file is part of the Peast package |
| 4 |
* |
| 5 |
* (c) Marco Marchiò <[email protected]> |
| 6 |
* |
| 7 |
* For the full copyright and license information refer to the LICENSE file |
| 8 |
* distributed with this source code |
| 9 |
*/ |
| 10 |
namespace Peast\Syntax; |
| 11 |
|
| 12 |
/** |
| 13 |
* Syntax exception class. Syntax errors in the source are thrown using this |
| 14 |
* using this exception class. |
| 15 |
* |
| 16 |
* @author Marco Marchiò <[email protected]> |
| 17 |
* |
| 18 |
* @codeCoverageIgnore |
| 19 |
*/ |
| 20 |
class Exception extends \Exception |
| 21 |
{ |
| 22 |
/** |
| 23 |
* Error position |
| 24 |
* |
| 25 |
* @var Position |
| 26 |
*/ |
| 27 |
protected $position; |
| 28 |
|
| 29 |
/** |
| 30 |
* Class constructor |
| 31 |
* |
| 32 |
* @param string $message Error message |
| 33 |
* @param Position $position Error position |
| 34 |
*/ |
| 35 |
public function __construct($message, Position $position) |
| 36 |
{ |
| 37 |
parent::__construct($message); |
| 38 |
$this->position = $position; |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Returns the error position |
| 43 |
* |
| 44 |
* @return Position |
| 45 |
*/ |
| 46 |
public function getPosition() |
| 47 |
{ |
| 48 |
return $this->position; |
| 49 |
} |
| 50 |
} |