@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | const AN = "[\w ]+"; |
| 15 | 15 | const NUM = "-?[\d.e]+"; |
| 16 | 16 | const SIMPLE = "(?P<sv>".self::NULL."|". |
| 17 | - self::FALSE."|". |
|
| 18 | - self::TRUE."|". |
|
| 19 | - self::AN."|". |
|
| 20 | - self::NUM.")"; |
|
| 17 | + self::FALSE."|". |
|
| 18 | + self::TRUE."|". |
|
| 19 | + self::AN."|". |
|
| 20 | + self::NUM.")"; |
|
| 21 | 21 | private const seqForMap = "(?P<seq>\[(?:(?:(?P>sv)|(?P>seq)|(?P>map)),?\s*)+\])"; |
| 22 | 22 | private const mapForSeq = "(?P<map>{\s*(?:".self::AN."\s*:\s*(?:(?P>sv)|(?P>seq)|(?P>map)),?\s*)+})"; |
| 23 | 23 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $matchSpaced = preg_match($spaced, $v); |
| 42 | 42 | $matchIso = preg_match($iso8601, $v); |
| 43 | 43 | if (is_bool($matchDate) || is_bool($matchCanonical) || is_bool($matchSpaced) || is_bool($matchIso)) |
| 44 | - throw new \Exception("Regex date error"); |
|
| 44 | + throw new \Exception("Regex date error"); |
|
| 45 | 45 | |
| 46 | 46 | return $matchDate || $matchCanonical || $matchSpaced || $matchIso; |
| 47 | 47 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | public function getParent($indent = null):Node |
| 32 | 32 | { |
| 33 | 33 | if (is_null($indent)) { |
| 34 | - return $this->_parent ?? $this; |
|
| 34 | + return $this->_parent ?? $this; |
|
| 35 | 35 | } |
| 36 | 36 | $cursor = $this; |
| 37 | 37 | while ($cursor->indent >= $indent) { |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | return $cursor; |
| 77 | 77 | } |
| 78 | 78 | /** |
| 79 | - * CAUTION : the types assumed here are NOT FINAL : they CAN be adjusted according to parent |
|
| 80 | - */ |
|
| 79 | + * CAUTION : the types assumed here are NOT FINAL : they CAN be adjusted according to parent |
|
| 80 | + */ |
|
| 81 | 81 | public function parse(String $nodeString):Node |
| 82 | 82 | { |
| 83 | 83 | $nodeValue = preg_replace("/^\t+/m", " ", $nodeString);//permissive to tabs but replacement |
@@ -209,13 +209,13 @@ discard block |
||
| 209 | 209 | private function getScalar($v) |
| 210 | 210 | { |
| 211 | 211 | $types = ['yes' => true, |
| 212 | - 'no' => false, |
|
| 213 | - 'true' => true, |
|
| 214 | - 'false' => false, |
|
| 215 | - 'null' => null, |
|
| 216 | - '.inf' => INF, |
|
| 217 | - '-.inf' => -INF, |
|
| 218 | - '.nan' => NAN |
|
| 212 | + 'no' => false, |
|
| 213 | + 'true' => true, |
|
| 214 | + 'false' => false, |
|
| 215 | + 'null' => null, |
|
| 216 | + '.inf' => INF, |
|
| 217 | + '-.inf' => -INF, |
|
| 218 | + '.nan' => NAN |
|
| 219 | 219 | ]; |
| 220 | 220 | if (in_array(strtolower($v), array_keys($types))) return $types[strtolower($v)]; |
| 221 | 221 | if (R::isDate($v)) return date_create($v); |