@@ -301,14 +301,14 @@ discard block |
||
| 301 | 301 | private function peg_f1($i) { $return = array(); |
| 302 | 302 | array_walk_recursive($i, function($a) use (&$return) { $return[] = $a; }); |
| 303 | 303 | return $return; |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | private function peg_f2($text) { return new \Seufert\Hamle\TextNode\StringLit(join('',$text)); } |
| 306 | 306 | private function peg_f3($body) { return $body; } |
| 307 | 307 | private function peg_f4($name) { |
| 308 | 308 | return new \Seufert\Hamle\TextNode\ScopeId(null, null, new \Seufert\Hamle\TextNode\ModelParam($name)); } |
| 309 | 309 | private function peg_f5($expr, $chain) { if(!$chain) return $expr; |
| 310 | - $top = array_pop($chain); |
|
| 311 | - while($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); } |
|
| 310 | + $top = array_pop($chain); |
|
| 311 | + while($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); } |
|
| 312 | 312 | private function peg_f6($sub) { return $sub; } |
| 313 | 313 | private function peg_f7($filter) { return $filter; } |
| 314 | 314 | private function peg_f8($name) { return new \Seufert\Hamle\TextNode\ModelParam($name, null); } |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | private function peg_f35($s) { return new \Seufert\Hamle\TextNode\StringLit(join('',$s)); } |
| 349 | 349 | private function peg_f36($s, $e, $post) { |
| 350 | - $o = []; |
|
| 351 | - if($s) $o[] = new \Seufert\Hamle\TextNode\StringLit(join('',$s)); |
|
| 352 | - if($e) $o[] = $e; |
|
| 353 | - if($post) foreach($post as $p) $o[] = $p; |
|
| 354 | - if(!$o) return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 355 | - return \Seufert\Hamle\TextNode\StringConcat::fromList($o); |
|
| 356 | - } |
|
| 350 | + $o = []; |
|
| 351 | + if($s) $o[] = new \Seufert\Hamle\TextNode\StringLit(join('',$s)); |
|
| 352 | + if($e) $o[] = $e; |
|
| 353 | + if($post) foreach($post as $p) $o[] = $p; |
|
| 354 | + if(!$o) return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 355 | + return \Seufert\Hamle\TextNode\StringConcat::fromList($o); |
|
| 356 | + } |
|
| 357 | 357 | private function peg_f37($parts) { return new \Seufert\Hamle\TextNode\StringLit($parts[1]); } |
| 358 | 358 | private function peg_f38($chars) { return join('', $chars); } |
| 359 | 359 | private function peg_f39($c) { return $c; } |
@@ -306,7 +306,9 @@ discard block |
||
| 306 | 306 | private function peg_f3($body) { return $body; } |
| 307 | 307 | private function peg_f4($name) { |
| 308 | 308 | return new \Seufert\Hamle\TextNode\ScopeId(null, null, new \Seufert\Hamle\TextNode\ModelParam($name)); } |
| 309 | - private function peg_f5($expr, $chain) { if(!$chain) return $expr; |
|
| 309 | + private function peg_f5($expr, $chain) { if(!$chain) { |
|
| 310 | + return $expr; |
|
| 311 | + } |
|
| 310 | 312 | $top = array_pop($chain); |
| 311 | 313 | while($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); } |
| 312 | 314 | private function peg_f6($sub) { return $sub; } |
@@ -339,19 +341,35 @@ discard block |
||
| 339 | 341 | private function peg_f33($parts) { return $parts[1]; } |
| 340 | 342 | private function peg_f34($s, $e, $post) { |
| 341 | 343 | $o = []; |
| 342 | - if($s) $o[] = new \Seufert\Hamle\TextNode\StringLit(join('',$s)); |
|
| 343 | - if($e) $o[] = $e; |
|
| 344 | - if($post) foreach($post as $p) $o[] = $p; |
|
| 345 | - if(!$o) return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 344 | + if($s) { |
|
| 345 | + $o[] = new \Seufert\Hamle\TextNode\StringLit(join('',$s)); |
|
| 346 | + } |
|
| 347 | + if($e) { |
|
| 348 | + $o[] = $e; |
|
| 349 | + } |
|
| 350 | + if($post) { |
|
| 351 | + foreach($post as $p) $o[] = $p; |
|
| 352 | + } |
|
| 353 | + if(!$o) { |
|
| 354 | + return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 355 | + } |
|
| 346 | 356 | return \Seufert\Hamle\TextNode\StringConcat::fromList($o); |
| 347 | 357 | } |
| 348 | 358 | private function peg_f35($s) { return new \Seufert\Hamle\TextNode\StringLit(join('',$s)); } |
| 349 | 359 | private function peg_f36($s, $e, $post) { |
| 350 | 360 | $o = []; |
| 351 | - if($s) $o[] = new \Seufert\Hamle\TextNode\StringLit(join('',$s)); |
|
| 352 | - if($e) $o[] = $e; |
|
| 353 | - if($post) foreach($post as $p) $o[] = $p; |
|
| 354 | - if(!$o) return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 361 | + if($s) { |
|
| 362 | + $o[] = new \Seufert\Hamle\TextNode\StringLit(join('',$s)); |
|
| 363 | + } |
|
| 364 | + if($e) { |
|
| 365 | + $o[] = $e; |
|
| 366 | + } |
|
| 367 | + if($post) { |
|
| 368 | + foreach($post as $p) $o[] = $p; |
|
| 369 | + } |
|
| 370 | + if(!$o) { |
|
| 371 | + return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 372 | + } |
|
| 355 | 373 | return \Seufert\Hamle\TextNode\StringConcat::fromList($o); |
| 356 | 374 | } |
| 357 | 375 | private function peg_f37($parts) { return new \Seufert\Hamle\TextNode\StringLit($parts[1]); } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | private $peg_currPos = 0; |
| 68 | 68 | private $peg_reportedPos = 0; |
| 69 | 69 | private $peg_cachedPos = 0; |
| 70 | - private $peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false ); |
|
| 70 | + private $peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false); |
|
| 71 | 71 | private $peg_maxFailPos = 0; |
| 72 | 72 | private $peg_maxFailExpected = array(); |
| 73 | 73 | private $peg_silentFails = 0; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $this->peg_currPos = 0; |
| 79 | 79 | $this->peg_reportedPos = 0; |
| 80 | 80 | $this->peg_cachedPos = 0; |
| 81 | - $this->peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false ); |
|
| 81 | + $this->peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false); |
|
| 82 | 82 | $this->peg_maxFailPos = 0; |
| 83 | 83 | $this->peg_maxFailExpected = array(); |
| 84 | 84 | $this->peg_silentFails = 0; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | private function expected($description) { |
| 122 | 122 | throw $this->peg_buildException( |
| 123 | 123 | null, |
| 124 | - array(array("type" => "other", "description" => $description )), |
|
| 124 | + array(array("type" => "other", "description" => $description)), |
|
| 125 | 125 | $this->peg_reportedPos |
| 126 | 126 | ); |
| 127 | 127 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | if ($this->peg_cachedPos !== $pos) { |
| 153 | 153 | if ($this->peg_cachedPos > $pos) { |
| 154 | 154 | $this->peg_cachedPos = 0; |
| 155 | - $this->peg_cachedPosDetails = array( "line" => 1, "column" => 1, "seenCR" => false ); |
|
| 155 | + $this->peg_cachedPosDetails = array("line" => 1, "column" => 1, "seenCR" => false); |
|
| 156 | 156 | } |
| 157 | 157 | $this->peg_advancePos($this->peg_cachedPosDetails, $this->peg_cachedPos, $pos); |
| 158 | 158 | $this->peg_cachedPos = $pos; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $foundDesc = $found ? json_encode($found) : "end of input"; |
| 215 | 215 | |
| 216 | - $message = "Expected " . $expectedDesc . " but " . $foundDesc . " found."; |
|
| 216 | + $message = "Expected ".$expectedDesc." but ".$foundDesc." found."; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | return new SyntaxError( |
@@ -304,13 +304,13 @@ discard block |
||
| 304 | 304 | array_walk_recursive($i, function($a) use (&$return) { $return[] = $a; }); |
| 305 | 305 | return $return; |
| 306 | 306 | } |
| 307 | - private function peg_f2($text) { return new \Seufert\Hamle\TextNode\StringLit(join('',$text)); } |
|
| 307 | + private function peg_f2($text) { return new \Seufert\Hamle\TextNode\StringLit(join('', $text)); } |
|
| 308 | 308 | private function peg_f3($body) { return $body; } |
| 309 | 309 | private function peg_f4($name) { |
| 310 | 310 | return new \Seufert\Hamle\TextNode\ScopeId(null, null, new \Seufert\Hamle\TextNode\ModelParam($name)); } |
| 311 | - private function peg_f5($expr, $chain) { if(!$chain) return $expr; |
|
| 311 | + private function peg_f5($expr, $chain) { if (!$chain) return $expr; |
|
| 312 | 312 | $top = array_pop($chain); |
| 313 | - while($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); } |
|
| 313 | + while ($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); } |
|
| 314 | 314 | private function peg_f6($sub) { return $sub; } |
| 315 | 315 | private function peg_f7($filter) { return $filter; } |
| 316 | 316 | private function peg_f8($name) { return new \Seufert\Hamle\TextNode\ModelParam($name, null); } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | private function peg_f15($query) { return new \Seufert\Hamle\TextNode\Query($query); } |
| 324 | 324 | private function peg_f16($id, $query) { return array_merge([['q'=>'type', 'id'=> $id]], $query); } |
| 325 | 325 | private function peg_f17($query) { return array_merge([['q'=>'type', 'id'=> '*']], $query); } |
| 326 | - private function peg_f18($rel, $sub) { return \Seufert\Hamle\TextNode\RelQuery::for($rel, $sub); } |
|
| 326 | + private function peg_f18($rel, $sub) { return \Seufert\Hamle\TextNode\RelQuery::for ($rel, $sub); } |
|
| 327 | 327 | private function peg_f19($id) { return ['q'=>'id', 'id'=> $id]; } |
| 328 | 328 | private function peg_f20($id) { return ['q'=>'type', 'id'=> $id]; } |
| 329 | 329 | private function peg_f21($id) { return ['q'=>'tag', 'id'=> $id]; } |
@@ -337,23 +337,23 @@ discard block |
||
| 337 | 337 | private function peg_f29($func, $args) { return new \Seufert\Hamle\TextNode\FilterFunc($func, null, $args); } |
| 338 | 338 | private function peg_f30($func) { return new \Seufert\Hamle\TextNode\FilterFunc($func); } |
| 339 | 339 | private function peg_f31($arg) { return $arg; } |
| 340 | - private function peg_f32($s, $n, $d) { return \Seufert\Hamle\TextNode\FloatLit((float)"$s$n.$d"); } |
|
| 340 | + private function peg_f32($s, $n, $d) { return \Seufert\Hamle\TextNode\FloatLit((float) "$s$n.$d"); } |
|
| 341 | 341 | private function peg_f33($parts) { return $parts[1]; } |
| 342 | 342 | private function peg_f34($s, $e, $post) { |
| 343 | 343 | $o = []; |
| 344 | - if($s) $o[] = new \Seufert\Hamle\TextNode\StringLit(join('',$s)); |
|
| 345 | - if($e) $o[] = $e; |
|
| 346 | - if($post) foreach($post as $p) $o[] = $p; |
|
| 347 | - if(!$o) return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 344 | + if ($s) $o[] = new \Seufert\Hamle\TextNode\StringLit(join('', $s)); |
|
| 345 | + if ($e) $o[] = $e; |
|
| 346 | + if ($post) foreach ($post as $p) $o[] = $p; |
|
| 347 | + if (!$o) return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 348 | 348 | return \Seufert\Hamle\TextNode\StringConcat::fromList($o); |
| 349 | 349 | } |
| 350 | - private function peg_f35($s) { return new \Seufert\Hamle\TextNode\StringLit(join('',$s)); } |
|
| 350 | + private function peg_f35($s) { return new \Seufert\Hamle\TextNode\StringLit(join('', $s)); } |
|
| 351 | 351 | private function peg_f36($s, $e, $post) { |
| 352 | 352 | $o = []; |
| 353 | - if($s) $o[] = new \Seufert\Hamle\TextNode\StringLit(join('',$s)); |
|
| 354 | - if($e) $o[] = $e; |
|
| 355 | - if($post) foreach($post as $p) $o[] = $p; |
|
| 356 | - if(!$o) return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 353 | + if ($s) $o[] = new \Seufert\Hamle\TextNode\StringLit(join('', $s)); |
|
| 354 | + if ($e) $o[] = $e; |
|
| 355 | + if ($post) foreach ($post as $p) $o[] = $p; |
|
| 356 | + if (!$o) return new \Seufert\Hamle\TextNode\StringLit(''); |
|
| 357 | 357 | return \Seufert\Hamle\TextNode\StringConcat::fromList($o); |
| 358 | 358 | } |
| 359 | 359 | private function peg_f37($parts) { return new \Seufert\Hamle\TextNode\StringLit($parts[1]); } |
@@ -362,13 +362,13 @@ discard block |
||
| 362 | 362 | private function peg_f40($s) { return $s; } |
| 363 | 363 | private function peg_f41($char) { return $char; } |
| 364 | 364 | private function peg_f42($sequence) { return $sequence; } |
| 365 | - private function peg_f43($n) { return (int)join('', $n); } |
|
| 366 | - private function peg_f44($sign, $n) { return new \Seufert\Hamle\TextNode\IntLit((int)($sign.join('', $n))); } |
|
| 367 | - private function peg_f45($p, $ex) { return $p.join('',$ex); } |
|
| 365 | + private function peg_f43($n) { return (int) join('', $n); } |
|
| 366 | + private function peg_f44($sign, $n) { return new \Seufert\Hamle\TextNode\IntLit((int) ($sign.join('', $n))); } |
|
| 367 | + private function peg_f45($p, $ex) { return $p.join('', $ex); } |
|
| 368 | 368 | private function peg_f46($p, $s) { return $p.join('', $s); } |
| 369 | 369 | private function peg_f47($s) { return join('', $s); } |
| 370 | - private function peg_f48($name) { return join('',$name); } |
|
| 371 | - private function peg_f49($char_) { return str_replace(['n', 'r', 't'], ['\\n','\\r','\\t'], $char_); } |
|
| 370 | + private function peg_f48($name) { return join('', $name); } |
|
| 371 | + private function peg_f49($char_) { return str_replace(['n', 'r', 't'], ['\\n', '\\r', '\\t'], $char_); } |
|
| 372 | 372 | |
| 373 | 373 | private function peg_parseHtmlInput() { |
| 374 | 374 | |
@@ -3329,79 +3329,79 @@ discard block |
||
| 3329 | 3329 | |
| 3330 | 3330 | $this->peg_FAILED = new \stdClass; |
| 3331 | 3331 | $this->peg_c0 = "{"; |
| 3332 | - $this->peg_c1 = array( "type" => "literal", "value" => "{", "description" => "\"{\"" ); |
|
| 3332 | + $this->peg_c1 = array("type" => "literal", "value" => "{", "description" => "\"{\""); |
|
| 3333 | 3333 | $this->peg_c2 = "}"; |
| 3334 | - $this->peg_c3 = array( "type" => "literal", "value" => "}", "description" => "\"}\"" ); |
|
| 3334 | + $this->peg_c3 = array("type" => "literal", "value" => "}", "description" => "\"}\""); |
|
| 3335 | 3335 | $this->peg_c4 = "$"; |
| 3336 | - $this->peg_c5 = array( "type" => "literal", "value" => "$", "description" => "\"$\"" ); |
|
| 3336 | + $this->peg_c5 = array("type" => "literal", "value" => "$", "description" => "\"$\""); |
|
| 3337 | 3337 | $this->peg_c6 = "|"; |
| 3338 | - $this->peg_c7 = array( "type" => "literal", "value" => "|", "description" => "\"|\"" ); |
|
| 3338 | + $this->peg_c7 = array("type" => "literal", "value" => "|", "description" => "\"|\""); |
|
| 3339 | 3339 | $this->peg_c8 = "("; |
| 3340 | - $this->peg_c9 = array( "type" => "literal", "value" => "(", "description" => "\"(\"" ); |
|
| 3340 | + $this->peg_c9 = array("type" => "literal", "value" => "(", "description" => "\"(\""); |
|
| 3341 | 3341 | $this->peg_c10 = ")"; |
| 3342 | - $this->peg_c11 = array( "type" => "literal", "value" => ")", "description" => "\")\"" ); |
|
| 3342 | + $this->peg_c11 = array("type" => "literal", "value" => ")", "description" => "\")\""); |
|
| 3343 | 3343 | $this->peg_c12 = "["; |
| 3344 | - $this->peg_c13 = array( "type" => "literal", "value" => "[", "description" => "\"[\"" ); |
|
| 3344 | + $this->peg_c13 = array("type" => "literal", "value" => "[", "description" => "\"[\""); |
|
| 3345 | 3345 | $this->peg_c14 = "]"; |
| 3346 | - $this->peg_c15 = array( "type" => "literal", "value" => "]", "description" => "\"]\"" ); |
|
| 3346 | + $this->peg_c15 = array("type" => "literal", "value" => "]", "description" => "\"]\""); |
|
| 3347 | 3347 | $this->peg_c16 = "*"; |
| 3348 | - $this->peg_c17 = array( "type" => "literal", "value" => "*", "description" => "\"*\"" ); |
|
| 3348 | + $this->peg_c17 = array("type" => "literal", "value" => "*", "description" => "\"*\""); |
|
| 3349 | 3349 | $this->peg_c18 = " "; |
| 3350 | - $this->peg_c19 = array( "type" => "literal", "value" => " ", "description" => "\" \"" ); |
|
| 3350 | + $this->peg_c19 = array("type" => "literal", "value" => " ", "description" => "\" \""); |
|
| 3351 | 3351 | $this->peg_c20 = "/^[><]/"; |
| 3352 | - $this->peg_c21 = array( "type" => "class", "value" => "[><]", "description" => "[><]" ); |
|
| 3352 | + $this->peg_c21 = array("type" => "class", "value" => "[><]", "description" => "[><]"); |
|
| 3353 | 3353 | $this->peg_c22 = "#"; |
| 3354 | - $this->peg_c23 = array( "type" => "literal", "value" => "#", "description" => "\"#\"" ); |
|
| 3354 | + $this->peg_c23 = array("type" => "literal", "value" => "#", "description" => "\"#\""); |
|
| 3355 | 3355 | $this->peg_c24 = ","; |
| 3356 | - $this->peg_c25 = array( "type" => "literal", "value" => ",", "description" => "\",\"" ); |
|
| 3356 | + $this->peg_c25 = array("type" => "literal", "value" => ",", "description" => "\",\""); |
|
| 3357 | 3357 | $this->peg_c26 = "."; |
| 3358 | - $this->peg_c27 = array( "type" => "literal", "value" => ".", "description" => "\".\"" ); |
|
| 3358 | + $this->peg_c27 = array("type" => "literal", "value" => ".", "description" => "\".\""); |
|
| 3359 | 3359 | $this->peg_c28 = "^"; |
| 3360 | - $this->peg_c29 = array( "type" => "literal", "value" => "^", "description" => "\"^\"" ); |
|
| 3360 | + $this->peg_c29 = array("type" => "literal", "value" => "^", "description" => "\"^\""); |
|
| 3361 | 3361 | $this->peg_c30 = "@"; |
| 3362 | - $this->peg_c31 = array( "type" => "literal", "value" => "@", "description" => "\"@\"" ); |
|
| 3362 | + $this->peg_c31 = array("type" => "literal", "value" => "@", "description" => "\"@\""); |
|
| 3363 | 3363 | $this->peg_c32 = ":"; |
| 3364 | - $this->peg_c33 = array( "type" => "literal", "value" => ":", "description" => "\":\"" ); |
|
| 3364 | + $this->peg_c33 = array("type" => "literal", "value" => ":", "description" => "\":\""); |
|
| 3365 | 3365 | $this->peg_c34 = "-"; |
| 3366 | - $this->peg_c35 = array( "type" => "literal", "value" => "-", "description" => "\"-\"" ); |
|
| 3366 | + $this->peg_c35 = array("type" => "literal", "value" => "-", "description" => "\"-\""); |
|
| 3367 | 3367 | $this->peg_c36 = ">"; |
| 3368 | - $this->peg_c37 = array( "type" => "literal", "value" => ">", "description" => "\">\"" ); |
|
| 3368 | + $this->peg_c37 = array("type" => "literal", "value" => ">", "description" => "\">\""); |
|
| 3369 | 3369 | $this->peg_c38 = "!"; |
| 3370 | - $this->peg_c39 = array( "type" => "literal", "value" => "!", "description" => "\"!\"" ); |
|
| 3370 | + $this->peg_c39 = array("type" => "literal", "value" => "!", "description" => "\"!\""); |
|
| 3371 | 3371 | $this->peg_c40 = "/^[0-9]/"; |
| 3372 | - $this->peg_c41 = array( "type" => "class", "value" => "[0-9]", "description" => "[0-9]" ); |
|
| 3372 | + $this->peg_c41 = array("type" => "class", "value" => "[0-9]", "description" => "[0-9]"); |
|
| 3373 | 3373 | $this->peg_c42 = "\""; |
| 3374 | - $this->peg_c43 = array( "type" => "literal", "value" => "\"", "description" => "\"\\\"\"" ); |
|
| 3374 | + $this->peg_c43 = array("type" => "literal", "value" => "\"", "description" => "\"\\\"\""); |
|
| 3375 | 3375 | $this->peg_c44 = "'"; |
| 3376 | - $this->peg_c45 = array( "type" => "literal", "value" => "'", "description" => "\"'\"" ); |
|
| 3377 | - $this->peg_c46 = array("type" => "other", "description" => "string" ); |
|
| 3376 | + $this->peg_c45 = array("type" => "literal", "value" => "'", "description" => "\"'\""); |
|
| 3377 | + $this->peg_c46 = array("type" => "other", "description" => "string"); |
|
| 3378 | 3378 | $this->peg_c47 = "\\"; |
| 3379 | - $this->peg_c48 = array( "type" => "literal", "value" => "\\", "description" => "\"\\\\\"" ); |
|
| 3380 | - $this->peg_c49 = array("type" => "any", "description" => "any character" ); |
|
| 3379 | + $this->peg_c48 = array("type" => "literal", "value" => "\\", "description" => "\"\\\\\""); |
|
| 3380 | + $this->peg_c49 = array("type" => "any", "description" => "any character"); |
|
| 3381 | 3381 | $this->peg_c50 = "/^[a-zA-Z_]/"; |
| 3382 | - $this->peg_c51 = array( "type" => "class", "value" => "[a-zA-Z_]", "description" => "[a-zA-Z_]" ); |
|
| 3382 | + $this->peg_c51 = array("type" => "class", "value" => "[a-zA-Z_]", "description" => "[a-zA-Z_]"); |
|
| 3383 | 3383 | $this->peg_c52 = "/^[a-zA-Z0-9_]/"; |
| 3384 | - $this->peg_c53 = array( "type" => "class", "value" => "[a-zA-Z0-9_]", "description" => "[a-zA-Z0-9_]" ); |
|
| 3384 | + $this->peg_c53 = array("type" => "class", "value" => "[a-zA-Z0-9_]", "description" => "[a-zA-Z0-9_]"); |
|
| 3385 | 3385 | $this->peg_c54 = "/^[a-zA-Z_-]/"; |
| 3386 | - $this->peg_c55 = array( "type" => "class", "value" => "[a-zA-Z_-]", "description" => "[a-zA-Z_-]" ); |
|
| 3386 | + $this->peg_c55 = array("type" => "class", "value" => "[a-zA-Z_-]", "description" => "[a-zA-Z_-]"); |
|
| 3387 | 3387 | $this->peg_c56 = "/^[0-9a-zA-Z_-]/"; |
| 3388 | - $this->peg_c57 = array( "type" => "class", "value" => "[0-9a-zA-Z_-]", "description" => "[0-9a-zA-Z_-]" ); |
|
| 3388 | + $this->peg_c57 = array("type" => "class", "value" => "[0-9a-zA-Z_-]", "description" => "[0-9a-zA-Z_-]"); |
|
| 3389 | 3389 | $this->peg_c58 = "/^[^{\\\$]/"; |
| 3390 | - $this->peg_c59 = array( "type" => "class", "value" => "[{\$]", "description" => "[{\$]" ); |
|
| 3390 | + $this->peg_c59 = array("type" => "class", "value" => "[{\$]", "description" => "[{\$]"); |
|
| 3391 | 3391 | $this->peg_c60 = "/^[a-z]/"; |
| 3392 | - $this->peg_c61 = array( "type" => "class", "value" => "[a-z]", "description" => "[a-z]" ); |
|
| 3392 | + $this->peg_c61 = array("type" => "class", "value" => "[a-z]", "description" => "[a-z]"); |
|
| 3393 | 3393 | $this->peg_c62 = "/^[^{]/"; |
| 3394 | - $this->peg_c63 = array( "type" => "class", "value" => "[{]", "description" => "[{]" ); |
|
| 3394 | + $this->peg_c63 = array("type" => "class", "value" => "[{]", "description" => "[{]"); |
|
| 3395 | 3395 | $this->peg_c64 = "/^[\\n\\r\\x{2028}\\x{2029}]/"; |
| 3396 | - $this->peg_c65 = array( "type" => "class", "value" => "[\n\r\x{2028}\x{2029}]", "description" => "[\n\r\x{2028}\x{2029}]" ); |
|
| 3396 | + $this->peg_c65 = array("type" => "class", "value" => "[\n\r\x{2028}\x{2029}]", "description" => "[\n\r\x{2028}\x{2029}]"); |
|
| 3397 | 3397 | $this->peg_c66 = "/^['\"\\\\bfnrtv]/"; |
| 3398 | - $this->peg_c67 = array( "type" => "class", "value" => "['\"\\bfnrtv]", "description" => "['\"\\bfnrtv]" ); |
|
| 3398 | + $this->peg_c67 = array("type" => "class", "value" => "['\"\\bfnrtv]", "description" => "['\"\\bfnrtv]"); |
|
| 3399 | 3399 | |
| 3400 | - $peg_startRuleFunctions = array( 'HtmlInput' => array($this, "peg_parseHtmlInput"), 'CodeInput' => array($this, "peg_parseCodeInput"), 'ControlInput' => array($this, "peg_parseControlInput") ); |
|
| 3400 | + $peg_startRuleFunctions = array('HtmlInput' => array($this, "peg_parseHtmlInput"), 'CodeInput' => array($this, "peg_parseCodeInput"), 'ControlInput' => array($this, "peg_parseControlInput")); |
|
| 3401 | 3401 | $peg_startRuleFunction = array($this, "peg_parseHtmlInput"); |
| 3402 | 3402 | if (isset($options["startRule"])) { |
| 3403 | 3403 | if (!(isset($peg_startRuleFunctions[$options["startRule"]]))) { |
| 3404 | - throw new \Exception("Can't start parsing from rule \"" + $options["startRule"] + "\"."); |
|
| 3404 | + throw new \Exception("Can't start parsing from rule \"" +$options["startRule"] + "\"."); |
|
| 3405 | 3405 | } |
| 3406 | 3406 | |
| 3407 | 3407 | $peg_startRuleFunction = $peg_startRuleFunctions[$options["startRule"]]; |
@@ -3415,7 +3415,7 @@ discard block |
||
| 3415 | 3415 | return $peg_result; |
| 3416 | 3416 | } else { |
| 3417 | 3417 | if ($peg_result !== $this->peg_FAILED && $this->peg_currPos < $this->input_length) { |
| 3418 | - $this->peg_fail(array("type" => "end", "description" => "end of input" )); |
|
| 3418 | + $this->peg_fail(array("type" => "end", "description" => "end of input")); |
|
| 3419 | 3419 | } |
| 3420 | 3420 | |
| 3421 | 3421 | $exception = $this->peg_buildException(null, $this->peg_maxFailExpected, $this->peg_maxFailPos); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | ]); |
| 73 | 73 | } catch (SyntaxError $e) { |
| 74 | 74 | throw new ParseError( |
| 75 | - 'Unable to parse:' . $s . "\n\n" . $e->getMessage(), |
|
| 75 | + 'Unable to parse:'.$s."\n\n".$e->getMessage(), |
|
| 76 | 76 | 0, |
| 77 | 77 | $e, |
| 78 | 78 | ); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $func = $filter['func']; |
| 134 | 134 | if (method_exists(Filter::class, $func)) { |
| 135 | - $func = Filter::class . '::' . $func; |
|
| 135 | + $func = Filter::class.'::'.$func; |
|
| 136 | 136 | } elseif ( |
| 137 | 137 | in_array($func, ['round', 'strtoupper', 'strtolower', 'ucfirst']) |
| 138 | 138 | ) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | $args = join( |
| 150 | 150 | ',', |
| 151 | - array_map(function ($v) { |
|
| 151 | + array_map(function($v) { |
|
| 152 | 152 | if (is_array($v) && $v['type'] ?? false === 'expr') { |
| 153 | 153 | return self::renderExpr($v); |
| 154 | 154 | } else { |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | }, $filter['args']), |
| 158 | 158 | ); |
| 159 | 159 | if (strlen($args)) { |
| 160 | - $args = ',' . $args; |
|
| 160 | + $args = ','.$args; |
|
| 161 | 161 | } |
| 162 | - $o = "$func($o" . $args . ')'; |
|
| 162 | + $o = "$func($o".$args.')'; |
|
| 163 | 163 | if ($filter['chain'] ?? false) { |
| 164 | 164 | $o = self::addFilter($o, $filter['chain']); |
| 165 | 165 | } |
@@ -168,21 +168,21 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | static function renderScopeThis($n) |
| 170 | 170 | { |
| 171 | - $o = 'Hamle\Scope::get()->hamleGet(' . self::varToCode($n['name']) . ')'; |
|
| 171 | + $o = 'Hamle\Scope::get()->hamleGet('.self::varToCode($n['name']).')'; |
|
| 172 | 172 | $o = self::addParams($o, $n['param'] ?? []); |
| 173 | 173 | return $o; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | static function renderScopeId($n) |
| 177 | 177 | { |
| 178 | - $o = 'Hamle\Scope::get(' . $n['id'] . ')'; |
|
| 178 | + $o = 'Hamle\Scope::get('.$n['id'].')'; |
|
| 179 | 179 | $o = self::addParams($o, $n['param'] ?? []); |
| 180 | 180 | return $o; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | static function renderScopeName($n) |
| 184 | 184 | { |
| 185 | - $o = 'Hamle\Scope::getName(' . self::varToCode($n['name']) . ')'; |
|
| 185 | + $o = 'Hamle\Scope::getName('.self::varToCode($n['name']).')'; |
|
| 186 | 186 | $o = self::addParams($o, $n['param'] ?? []); |
| 187 | 187 | return $o; |
| 188 | 188 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | static function addParams(string $o, array $params) |
| 191 | 191 | { |
| 192 | 192 | while ($params['type'] ?? null === 'sub') { |
| 193 | - $o .= '->hamleGet(' . self::varToCode($params['name']) . ')'; |
|
| 193 | + $o .= '->hamleGet('.self::varToCode($params['name']).')'; |
|
| 194 | 194 | $params = $params['params'] ?? []; |
| 195 | 195 | } |
| 196 | 196 | return $o; |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | { |
| 201 | 201 | $r = $rel === 'child' ? Hamle::REL_CHILD : Hamle::REL_PARENT; |
| 202 | 202 | $o = |
| 203 | - $o . |
|
| 204 | - '->hamleRel(' . |
|
| 205 | - self::varToCode($r) . |
|
| 206 | - ',' . |
|
| 207 | - self::queryParams($query, true) . |
|
| 203 | + $o. |
|
| 204 | + '->hamleRel('. |
|
| 205 | + self::varToCode($r). |
|
| 206 | + ','. |
|
| 207 | + self::queryParams($query, true). |
|
| 208 | 208 | ')'; |
| 209 | 209 | return $o; |
| 210 | 210 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | self::varToCode($limit), |
| 267 | 267 | self::varToCode($offset), |
| 268 | 268 | ]; |
| 269 | - return 'Hamle\Run::modelTypeId(' . join(',', $opt) . ')'; |
|
| 269 | + return 'Hamle\Run::modelTypeId('.join(',', $opt).')'; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | static function renderQuery($n) |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } elseif ($id !== null) { |
| 288 | 288 | $o = self::queryId($n['query']); |
| 289 | 289 | } else { |
| 290 | - $o = 'Hamle\Run::modelTypeTags(' . self::queryParams($n['query']) . ')'; |
|
| 290 | + $o = 'Hamle\Run::modelTypeTags('.self::queryParams($n['query']).')'; |
|
| 291 | 291 | } |
| 292 | 292 | if ($n['sub'] ?? []) { |
| 293 | 293 | $o = self::addRel($o, $n['sub'], $n['rel']); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $o = self::renderQuery($expr['body']); |
| 315 | 315 | break; |
| 316 | 316 | default: |
| 317 | - throw new \RuntimeException('Invalid Node: ' . $expr['body']['type']); |
|
| 317 | + throw new \RuntimeException('Invalid Node: '.$expr['body']['type']); |
|
| 318 | 318 | } |
| 319 | 319 | if ($expr['body']['filter'] ?? false) { |
| 320 | 320 | $o = self::addFilter($o, $expr['body']['filter']); |
@@ -334,16 +334,16 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | break; |
| 336 | 336 | case 'scopeName': |
| 337 | - $out .= '<?=' . self::renderScopeName($node) . '?>'; |
|
| 337 | + $out .= '<?='.self::renderScopeName($node).'?>'; |
|
| 338 | 338 | break; |
| 339 | 339 | case 'scopeThis': |
| 340 | - $out .= '<?=' . self::renderScopeThis($node) . '?>'; |
|
| 340 | + $out .= '<?='.self::renderScopeThis($node).'?>'; |
|
| 341 | 341 | break; |
| 342 | 342 | case 'expr': |
| 343 | - $out .= '<?=' . self::renderExpr($node) . '?>'; |
|
| 343 | + $out .= '<?='.self::renderExpr($node).'?>'; |
|
| 344 | 344 | break; |
| 345 | 345 | default: |
| 346 | - throw new \RuntimeException('Invalid Node:' . $node['type']); |
|
| 346 | + throw new \RuntimeException('Invalid Node:'.$node['type']); |
|
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | return $out; |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $out[] = self::renderExpr($node); |
| 373 | 373 | break; |
| 374 | 374 | default: |
| 375 | - throw new \RuntimeException('Invalid Node:' . $node['type']); |
|
| 375 | + throw new \RuntimeException('Invalid Node:'.$node['type']); |
|
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | return join('.', $out); |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | function doEval() |
| 382 | 382 | { |
| 383 | - return eval('use Seufert\Hamle; return ' . $this->toPHP() . ';'); |
|
| 383 | + return eval('use Seufert\Hamle; return '.$this->toPHP().';'); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | static function varToCode($var) |
@@ -388,9 +388,9 @@ discard block |
||
| 388 | 388 | if (is_array($var)) { |
| 389 | 389 | $code = []; |
| 390 | 390 | foreach ($var as $key => $value) { |
| 391 | - $code[] = self::varToCode($key) . '=>' . self::varToCode($value); |
|
| 391 | + $code[] = self::varToCode($key).'=>'.self::varToCode($value); |
|
| 392 | 392 | } |
| 393 | - return 'array(' . implode(',', $code) . ')'; //remove unnecessary coma |
|
| 393 | + return 'array('.implode(',', $code).')'; //remove unnecessary coma |
|
| 394 | 394 | } |
| 395 | 395 | if (is_bool($var)) { |
| 396 | 396 | return $var ? 'TRUE' : 'FALSE'; |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | if ($var instanceof Text) { |
| 402 | 402 | return $var->toPHP(); |
| 403 | 403 | } |
| 404 | - return "'" . str_replace(['$', "'"], ['$', "\\'"], $var) . "'"; |
|
| 404 | + return "'".str_replace(['$', "'"], ['$', "\\'"], $var)."'"; |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | /** |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $this->filters = $filters; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - static function for(string $rel, array $filters): self |
|
| 23 | + static function for (string $rel, array $filters): self |
|
| 24 | 24 | { |
| 25 | 25 | return new self( |
| 26 | 26 | $rel === '>' ? Hamle::REL_CHILD : Hamle::REL_PARENT, |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | public function apply(string $s): string |
| 32 | 32 | { |
| 33 | 33 | $s = |
| 34 | - $s . |
|
| 35 | - "->hamleRel({$this->rel}," . |
|
| 36 | - Query::queryParams($this->filters, true) . |
|
| 34 | + $s. |
|
| 35 | + "->hamleRel({$this->rel},". |
|
| 36 | + Query::queryParams($this->filters, true). |
|
| 37 | 37 | ')'; |
| 38 | 38 | if ($this->chain) { |
| 39 | 39 | $s = $this->chain->apply($s); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | Throwable $previous = null |
| 38 | 38 | ) { |
| 39 | 39 | ///@todo Include Line number & file name within parse error exceptions |
| 40 | - $message .= ', on line ' . Hamle\Hamle::getLineNo() . ' in file ?.hamle'; |
|
| 40 | + $message .= ', on line '.Hamle\Hamle::getLineNo().' in file ?.hamle'; |
|
| 41 | 41 | parent::__construct($message, $code, $previous); |
| 42 | 42 | } |
| 43 | 43 | } |