1: <?php
 2: 
 3:  4:  5:  6: 
 7: 
 8: namespace Latte;
 9: 
10: 
11: 12: 13: 14: 15: 
16: class CompileException extends \Exception
17: {
18:     
19:     public $sourceCode;
20: 
21:     
22:     public $sourceName;
23: 
24:     
25:     public $sourceLine;
26: 
27: 
28:     public function setSource($code, $line, $name = NULL)
29:     {
30:         $this->sourceCode = (string) $code;
31:         $this->sourceLine = (int) $line;
32:         $this->sourceName = (string) $name;
33:         if (@is_file($name)) { 
34:             $this->message = rtrim($this->message, '.')
35:                 . ' in ' . str_replace(dirname(dirname($name)), '...', $name) . ($line ? ":$line" : '');
36:         }
37:         return $this;
38:     }
39: 
40: }
41: 
42: 
43: 44: 45: 
46: class RegexpException extends \Exception
47: {
48:     public static $messages = array(
49:         PREG_INTERNAL_ERROR => 'Internal error',
50:         PREG_BACKTRACK_LIMIT_ERROR => 'Backtrack limit was exhausted',
51:         PREG_RECURSION_LIMIT_ERROR => 'Recursion limit was exhausted',
52:         PREG_BAD_UTF8_ERROR => 'Malformed UTF-8 data',
53:         5 => 'Offset didn\'t correspond to the begin of a valid UTF-8 code point', 
54:     );
55: 
56:     public function __construct($message, $code = NULL)
57:     {
58:         parent::__construct($message ?: (isset(self::$messages[$code]) ? self::$messages[$code] : 'Unknown error'), $code);
59:     }
60: 
61: }
62: 
63: 
64: 65: 66: 
67: class RuntimeException extends \Exception
68: {
69: }
70: