44
55namespace TypeLang \Parser \Exception ;
66
7+ use Phplrt \Contracts \Source \SourceExceptionInterface ;
8+
79class ParseException extends \LogicException implements ParserExceptionInterface
810{
911 final public const ERROR_CODE_UNEXPECTED_TOKEN = 0x01 ;
@@ -28,6 +30,7 @@ final public function __construct(string $message, int $code = 0, ?\Throwable $p
2830 * unexpected source location.
2931 *
3032 * @param int<0, max> $offset
33+ * @throws SourceExceptionInterface
3134 */
3235 public static function fromUnexpectedToken (string $ char , string $ statement , int $ offset ): static
3336 {
@@ -44,6 +47,7 @@ public static function fromUnexpectedToken(string $char, string $statement, int
4447 * This error occurs when unable to recognize tokens in source code.
4548 *
4649 * @param int<0, max> $offset
50+ * @throws SourceExceptionInterface
4751 */
4852 public static function fromUnrecognizedToken (string $ token , string $ statement , int $ offset ): static
4953 {
@@ -58,6 +62,7 @@ public static function fromUnrecognizedToken(string $token, string $statement, i
5862
5963 /**
6064 * @param int<0, max> $offset
65+ * @throws SourceExceptionInterface
6166 */
6267 public static function fromUnrecognizedSyntaxError (string $ statement , int $ offset ): static
6368 {
@@ -71,6 +76,7 @@ public static function fromUnrecognizedSyntaxError(string $statement, int $offse
7176
7277 /**
7378 * @param int<0, max> $offset
79+ * @throws SourceExceptionInterface
7480 */
7581 public static function fromSemanticError (string $ message , string $ statement , int $ offset , int $ code = 0 ): static
7682 {
0 commit comments