Passed
Pull Request — master (#3)
by Chris
01:53
created
php/hamle/TextNode/FloatLit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 
16 16
   public function string(): string
17 17
   {
18
-    return (string)$this->float;
18
+    return (string) $this->float;
19 19
   }
20 20
 }
Please login to merge, or discard this patch.
php/hamle/TextNode/RelQuery.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@
 block discarded – undo
23 23
   }
24 24
 
25 25
 
26
-  static function for(string $rel, array $filters) {
27
-    return new self($rel === '>'?Hamle::REL_CHILD:Hamle::REL_PARENT, $filters);
26
+  static function for (string $rel, array $filters) {
27
+    return new self($rel === '>' ?Hamle::REL_CHILD : Hamle::REL_PARENT, $filters);
28 28
   }
29 29
 
30 30
   public function apply(string $s):string {
31 31
 
32
-    $s=  $s."->hamleRel({$this->rel}," . Query::queryParams($this->filters, true) . ')';
33
-    if($this->chain) $s = $this->chain->apply($s);
32
+    $s = $s."->hamleRel({$this->rel},".Query::queryParams($this->filters, true).')';
33
+    if ($this->chain) $s = $this->chain->apply($s);
34 34
     return $s;
35 35
   }
36 36
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@
 block discarded – undo
30 30
   public function apply(string $s):string {
31 31
 
32 32
     $s=  $s."->hamleRel({$this->rel}," . Query::queryParams($this->filters, true) . ')';
33
-    if($this->chain) $s = $this->chain->apply($s);
33
+    if($this->chain) {
34
+      $s = $this->chain->apply($s);
35
+    }
34 36
     return $s;
35 37
   }
36 38
 
Please login to merge, or discard this patch.
php/hamle/TextNode/Query.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
     } elseif ($id !== null) {
39 39
       $o = self::queryId($this->filters);
40 40
     } else {
41
-      $o = 'Hamle\Run::modelTypeTags(' . self::queryParams($this->filters) . ')';
41
+      $o = 'Hamle\Run::modelTypeTags('.self::queryParams($this->filters).')';
42 42
     }
43
-    if($this->immediate) $o = $this->immediate->apply($o);
44
-    if($this->chain) $o = $this->chain->apply($o);
43
+    if ($this->immediate) $o = $this->immediate->apply($o);
44
+    if ($this->chain) $o = $this->chain->apply($o);
45 45
     return $o;
46 46
   }
47 47
 
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
           break;
72 72
         case 'sort':
73 73
           $sd = $q['id'];
74
-          if(!$sd) {
74
+          if (!$sd) {
75 75
             $sort[''] = Hamle::SORT_RANDOM;
76
-          } elseif($sd[0] === '-') {
76
+          } elseif ($sd[0] === '-') {
77 77
             $sort[substr($sd, 1)] = Hamle::SORT_DESCENDING;
78
-          }else {
78
+          } else {
79 79
             $sort[$sd] = Hamle::SORT_ASCENDING;
80 80
           }
81 81
       }
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
       Text::varToCode($limit),
119 119
       Text::varToCode($offset)
120 120
     ];
121
-    if(!$type || $type === '*') {
121
+    if (!$type || $type === '*') {
122 122
       $opt[0] = Text::varToCode($id);
123
-      return 'Hamle\Run::modelId(' . join(',', $opt) . ')';
123
+      return 'Hamle\Run::modelId('.join(',', $opt).')';
124 124
     }
125
-    return 'Hamle\Run::modelTypeId(' . join(',', $opt) . ')';
125
+    return 'Hamle\Run::modelTypeId('.join(',', $opt).')';
126 126
   }
127 127
 
128 128
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,10 +28,12 @@  discard block
 block discarded – undo
28 28
     $id = null;
29 29
     $type = [];
30 30
     foreach ($this->filters ?? [] as $q) {
31
-      if ($q['q'] === 'id')
32
-        $id = $q['id'] ?? null;
33
-      if ($q['q'] === 'type')
34
-        $type = $q['id'];
31
+      if ($q['q'] === 'id') {
32
+              $id = $q['id'] ?? null;
33
+      }
34
+      if ($q['q'] === 'type') {
35
+              $type = $q['id'];
36
+      }
35 37
     }
36 38
     if (!$this->filters) {
37 39
       $o = 'Hamle\Scope::get(0)';
@@ -40,8 +42,12 @@  discard block
 block discarded – undo
40 42
     } else {
41 43
       $o = 'Hamle\Run::modelTypeTags(' . self::queryParams($this->filters) . ')';
42 44
     }
43
-    if($this->immediate) $o = $this->immediate->apply($o);
44
-    if($this->chain) $o = $this->chain->apply($o);
45
+    if($this->immediate) {
46
+      $o = $this->immediate->apply($o);
47
+    }
48
+    if($this->chain) {
49
+      $o = $this->chain->apply($o);
50
+    }
45 51
     return $o;
46 52
   }
47 53
 
@@ -75,7 +81,7 @@  discard block
 block discarded – undo
75 81
             $sort[''] = Hamle::SORT_RANDOM;
76 82
           } elseif($sd[0] === '-') {
77 83
             $sort[substr($sd, 1)] = Hamle::SORT_DESCENDING;
78
-          }else {
84
+          } else {
79 85
             $sort[$sd] = Hamle::SORT_ASCENDING;
80 86
           }
81 87
       }
@@ -86,8 +92,9 @@  discard block
 block discarded – undo
86 92
       Text::varToCode($limit),
87 93
       Text::varToCode($offset)
88 94
     ];
89
-    if ($addGroup)
90
-      $opt[] = Text::varToCode($group);
95
+    if ($addGroup) {
96
+          $opt[] = Text::varToCode($group);
97
+    }
91 98
     return join(',', $opt);
92 99
   }
93 100
 
Please login to merge, or discard this patch.
php/hamle/Tag/Control.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
    */
48 48
   function __construct($tag, $parentTag = null) {
49 49
     parent::__construct();
50
-    $this->o = "\$o" . self::$instCount++;
50
+    $this->o = "\$o".self::$instCount++;
51 51
     $this->type = strtolower($tag);
52 52
     $this->var = "";
53 53
     if ($parentTag && $this->type == "else") {
54
-      if($parentTag instanceof H\Tag) {
54
+      if ($parentTag instanceof H\Tag) {
55 55
         $elseTag = $parentTag->tags[count($parentTag->tags) - 1];
56
-        if($elseTag instanceof H\Tag\Control &&
56
+        if ($elseTag instanceof H\Tag\Control &&
57 57
             in_array($elseTag->type, array('with', 'if'))
58 58
         ) {
59 59
           $elseTag->else = true;
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
   }
68 68
 
69 69
   function renderStTag() {
70
-    $out = "<" . "?php ";
70
+    $out = "<"."?php ";
71 71
     $scopeName = "";
72
-    if($this->type === 'if') {
72
+    if ($this->type === 'if') {
73 73
       $hsvcomp = new H\Text\Comparison($this->var);
74
-      $out .= "if(" . $hsvcomp->toPHP() . ") {";
74
+      $out .= "if(".$hsvcomp->toPHP().") {";
75 75
       return $out."\n?>";
76
-    } elseif($this->type === 'else') {
76
+    } elseif ($this->type === 'else') {
77 77
       $out .= "/* else */";
78 78
       return $out."\n?>";
79 79
     }
80
-    if($this->var) {
80
+    if ($this->var) {
81 81
       if (preg_match('/ as ([a-zA-Z]+)$/', $this->var, $m)) {
82 82
         $scopeName = $m[1];
83 83
         $lookup = substr($this->var, 0, strlen($this->var) - strlen($m[0]));
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
     switch ($this->type) {
89 89
       case "each":
90 90
         if ($this->var)
91
-          $out .= "foreach(" . $hsv->toPHP() . " as {$this->o}) { \n";
91
+          $out .= "foreach(".$hsv->toPHP()." as {$this->o}) { \n";
92 92
         else
93 93
           $out .= "foreach(Hamle\\Scope::get() as {$this->o}) { \n";
94 94
         $out .= "Hamle\\Scope::add({$this->o}); ";
95 95
         break;
96 96
       case "with":
97 97
         if ($scopeName)
98
-          $out .= "Hamle\\Scope::add(" . $hsv->toPHP() . ", \"$scopeName\");\n;";
98
+          $out .= "Hamle\\Scope::add(".$hsv->toPHP().", \"$scopeName\");\n;";
99 99
         else {
100
-          $out .= "if(({$this->o} = " . $hsv->toPHP() . ") && " .
100
+          $out .= "if(({$this->o} = ".$hsv->toPHP().") && ".
101 101
               "{$this->o}->valid()) {\n";
102 102
           $out .= "Hamle\\Scope::add({$this->o});\n;";
103 103
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $fn = $file[0] === '#' ? 'includeFragment' : 'includeFile';
108 108
         $out .= "echo Hamle\\Run::$fn({$hsv->toPHP()});";
109 109
     }
110
-    return $out . "\n?>";
110
+    return $out."\n?>";
111 111
   }
112 112
 
113 113
   /**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
   }
119 119
 
120 120
   function renderEnTag() {
121
-    $out = '<' . '?php ';
121
+    $out = '<'.'?php ';
122 122
     switch ($this->type) {
123 123
       case "each";
124 124
         $out .= 'Hamle\\Scope::done(); ';
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         break;
142 142
     }
143 143
     if ($this->else) $out .= "else{";
144
-    return $out . "\n?>";
144
+    return $out."\n?>";
145 145
   }
146 146
 
147 147
   function render($indent = 0, $minify = false) {
Please login to merge, or discard this patch.
Braces   +23 added lines, -15 removed lines patch added patch discarded remove patch
@@ -82,21 +82,23 @@  discard block
 block discarded – undo
82 82
         $scopeName = $m[1];
83 83
         $lookup = substr($this->var, 0, strlen($this->var) - strlen($m[0]));
84 84
         $hsv = new H\Text(trim($lookup), H\Text::TOKEN_CONTROL);
85
-      } else
86
-        $hsv = new H\Text($this->var, H\Text::TOKEN_CONTROL);
85
+      } else {
86
+              $hsv = new H\Text($this->var, H\Text::TOKEN_CONTROL);
87
+      }
87 88
     }
88 89
     switch ($this->type) {
89 90
       case "each":
90
-        if ($this->var)
91
-          $out .= "foreach(" . $hsv->toPHP() . " as {$this->o}) { \n";
92
-        else
93
-          $out .= "foreach(Hamle\\Scope::get() as {$this->o}) { \n";
91
+        if ($this->var) {
92
+                  $out .= "foreach(" . $hsv->toPHP() . " as {$this->o}) { \n";
93
+        } else {
94
+                  $out .= "foreach(Hamle\\Scope::get() as {$this->o}) { \n";
95
+        }
94 96
         $out .= "Hamle\\Scope::add({$this->o}); ";
95 97
         break;
96 98
       case "with":
97
-        if ($scopeName)
98
-          $out .= "Hamle\\Scope::add(" . $hsv->toPHP() . ", \"$scopeName\");\n;";
99
-        else {
99
+        if ($scopeName) {
100
+                  $out .= "Hamle\\Scope::add(" . $hsv->toPHP() . ", \"$scopeName\");\n;";
101
+        } else {
100 102
           $out .= "if(({$this->o} = " . $hsv->toPHP() . ") && " .
101 103
               "{$this->o}->valid()) {\n";
102 104
           $out .= "Hamle\\Scope::add({$this->o});\n;";
@@ -123,8 +125,9 @@  discard block
 block discarded – undo
123 125
       case "each";
124 126
         $out .= 'Hamle\\Scope::done(); ';
125 127
         $out .= '}';
126
-        if (!$this->var)
127
-          $out .= "Hamle\\Scope::get()->rewind();\n";
128
+        if (!$this->var) {
129
+                  $out .= "Hamle\\Scope::get()->rewind();\n";
130
+        }
128 131
         break;
129 132
       case "if":
130 133
       case "else":
@@ -140,7 +143,9 @@  discard block
 block discarded – undo
140 143
         return "";
141 144
         break;
142 145
     }
143
-    if ($this->else) $out .= "else{";
146
+    if ($this->else) {
147
+      $out .= "else{";
148
+    }
144 149
     return $out . "\n?>";
145 150
   }
146 151
 
@@ -148,9 +153,12 @@  discard block
 block discarded – undo
148 153
     $ind = $minify ? '' : str_pad('', $indent);
149 154
     $oneliner = (!(count($this->content) > 1 || $this->tags));
150 155
     $out = $this->renderStTag();
151
-    if ($this->content) $out .= $this->renderContent($ind, $oneliner || $minify);
152
-    foreach ($this->tags as $tag)
153
-      $out .= $tag->render($indent, $minify);
156
+    if ($this->content) {
157
+      $out .= $this->renderContent($ind, $oneliner || $minify);
158
+    }
159
+    foreach ($this->tags as $tag) {
160
+          $out .= $tag->render($indent, $minify);
161
+    }
154 162
     $out .= $this->renderEnTag();
155 163
     return $out;
156 164
   }
Please login to merge, or discard this patch.
php/hamle/Grammar/Parser.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -301,14 +301,14 @@
 block discarded – undo
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); }
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(
@@ -302,13 +302,13 @@  discard block
 block discarded – undo
302 302
                                                   array_walk_recursive($i, function($a) use (&$return) { $return[] = $a; });
303 303
                                                   return $return;
304 304
                                          }
305
-    private function peg_f2($text) { return new \Seufert\Hamle\TextNode\StringLit(join('',$text)); }
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
-    private function peg_f5($expr, $chain) { if(!$chain) return $expr;
309
+    private function peg_f5($expr, $chain) { if (!$chain) return $expr;
310 310
                            $top = array_pop($chain);
311
-                           while($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); }
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); }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     private function peg_f15($query) { return new \Seufert\Hamle\TextNode\Query($query); }
322 322
     private function peg_f16($id, $query) { return array_merge([['q'=>'type', 'id'=> $id]], $query); }
323 323
     private function peg_f17($query) { return array_merge([['q'=>'type', 'id'=> '*']], $query); }
324
-    private function peg_f18($rel, $sub) { return \Seufert\Hamle\TextNode\RelQuery::for($rel, $sub); }
324
+    private function peg_f18($rel, $sub) { return \Seufert\Hamle\TextNode\RelQuery::for ($rel, $sub); }
325 325
     private function peg_f19($id) { return ['q'=>'id', 'id'=> $id]; }
326 326
     private function peg_f20($id) { return ['q'=>'type', 'id'=> $id]; }
327 327
     private function peg_f21($id) { return ['q'=>'tag', 'id'=> $id]; }
@@ -335,19 +335,19 @@  discard block
 block discarded – undo
335 335
     private function peg_f29($func, $args) { return new \Seufert\Hamle\TextNode\FilterFunc($func, null, $args); }
336 336
     private function peg_f30($func) { return new \Seufert\Hamle\TextNode\FilterFunc($func); }
337 337
     private function peg_f31($arg) { return $arg; }
338
-    private function peg_f32($s, $n, $d) { return \Seufert\Hamle\TextNode\FloatLit((float)"$s$n.$d"); }
338
+    private function peg_f32($s, $n, $d) { return \Seufert\Hamle\TextNode\FloatLit((float) "$s$n.$d"); }
339 339
     private function peg_f33($parts) { return new \Seufert\Hamle\TextNode\StringLit($parts[1]); }
340 340
     private function peg_f34($chars) { return join('', $chars); }
341 341
     private function peg_f35($char_) { return $char_; }
342 342
     private function peg_f36($sequence) { return $sequence; }
343 343
     private function peg_f37($char) { return $char; }
344
-    private function peg_f38($n) { return (int)join('', $n); }
345
-    private function peg_f39($sign, $n) { return new \Seufert\Hamle\TextNode\IntLit((int)($sign.join('', $n))); }
346
-    private function peg_f40($name) { return join('',$name); }
344
+    private function peg_f38($n) { return (int) join('', $n); }
345
+    private function peg_f39($sign, $n) { return new \Seufert\Hamle\TextNode\IntLit((int) ($sign.join('', $n))); }
346
+    private function peg_f40($name) { return join('', $name); }
347 347
     private function peg_f41($p, $s) { return $p.join('', $s); }
348 348
     private function peg_f42($s) { return join('', $s); }
349 349
     private function peg_f43($c) { return $c; }
350
-    private function peg_f44($char_) { return str_replace(['n', 'r', 't'], ['\\n','\\r','\\t'], $char_); }
350
+    private function peg_f44($char_) { return str_replace(['n', 'r', 't'], ['\\n', '\\r', '\\t'], $char_); }
351 351
 
352 352
     private function peg_parseHtmlInput() {
353 353
 
@@ -2715,77 +2715,77 @@  discard block
 block discarded – undo
2715 2715
 
2716 2716
     $this->peg_FAILED = new \stdClass;
2717 2717
     $this->peg_c0 = "{";
2718
-    $this->peg_c1 = array( "type" => "literal", "value" => "{", "description" => "\"{\"" );
2718
+    $this->peg_c1 = array("type" => "literal", "value" => "{", "description" => "\"{\"");
2719 2719
     $this->peg_c2 = "}";
2720
-    $this->peg_c3 = array( "type" => "literal", "value" => "}", "description" => "\"}\"" );
2720
+    $this->peg_c3 = array("type" => "literal", "value" => "}", "description" => "\"}\"");
2721 2721
     $this->peg_c4 = "$";
2722
-    $this->peg_c5 = array( "type" => "literal", "value" => "$", "description" => "\"$\"" );
2722
+    $this->peg_c5 = array("type" => "literal", "value" => "$", "description" => "\"$\"");
2723 2723
     $this->peg_c6 = "|";
2724
-    $this->peg_c7 = array( "type" => "literal", "value" => "|", "description" => "\"|\"" );
2724
+    $this->peg_c7 = array("type" => "literal", "value" => "|", "description" => "\"|\"");
2725 2725
     $this->peg_c8 = "(";
2726
-    $this->peg_c9 = array( "type" => "literal", "value" => "(", "description" => "\"(\"" );
2726
+    $this->peg_c9 = array("type" => "literal", "value" => "(", "description" => "\"(\"");
2727 2727
     $this->peg_c10 = ")";
2728
-    $this->peg_c11 = array( "type" => "literal", "value" => ")", "description" => "\")\"" );
2728
+    $this->peg_c11 = array("type" => "literal", "value" => ")", "description" => "\")\"");
2729 2729
     $this->peg_c12 = "[";
2730
-    $this->peg_c13 = array( "type" => "literal", "value" => "[", "description" => "\"[\"" );
2730
+    $this->peg_c13 = array("type" => "literal", "value" => "[", "description" => "\"[\"");
2731 2731
     $this->peg_c14 = "]";
2732
-    $this->peg_c15 = array( "type" => "literal", "value" => "]", "description" => "\"]\"" );
2732
+    $this->peg_c15 = array("type" => "literal", "value" => "]", "description" => "\"]\"");
2733 2733
     $this->peg_c16 = "*";
2734
-    $this->peg_c17 = array( "type" => "literal", "value" => "*", "description" => "\"*\"" );
2734
+    $this->peg_c17 = array("type" => "literal", "value" => "*", "description" => "\"*\"");
2735 2735
     $this->peg_c18 = " ";
2736
-    $this->peg_c19 = array( "type" => "literal", "value" => " ", "description" => "\" \"" );
2736
+    $this->peg_c19 = array("type" => "literal", "value" => " ", "description" => "\" \"");
2737 2737
     $this->peg_c20 = "/^[><]/";
2738
-    $this->peg_c21 = array( "type" => "class", "value" => "[><]", "description" => "[><]" );
2738
+    $this->peg_c21 = array("type" => "class", "value" => "[><]", "description" => "[><]");
2739 2739
     $this->peg_c22 = "#";
2740
-    $this->peg_c23 = array( "type" => "literal", "value" => "#", "description" => "\"#\"" );
2740
+    $this->peg_c23 = array("type" => "literal", "value" => "#", "description" => "\"#\"");
2741 2741
     $this->peg_c24 = ",";
2742
-    $this->peg_c25 = array( "type" => "literal", "value" => ",", "description" => "\",\"" );
2742
+    $this->peg_c25 = array("type" => "literal", "value" => ",", "description" => "\",\"");
2743 2743
     $this->peg_c26 = ".";
2744
-    $this->peg_c27 = array( "type" => "literal", "value" => ".", "description" => "\".\"" );
2744
+    $this->peg_c27 = array("type" => "literal", "value" => ".", "description" => "\".\"");
2745 2745
     $this->peg_c28 = "^";
2746
-    $this->peg_c29 = array( "type" => "literal", "value" => "^", "description" => "\"^\"" );
2746
+    $this->peg_c29 = array("type" => "literal", "value" => "^", "description" => "\"^\"");
2747 2747
     $this->peg_c30 = "@";
2748
-    $this->peg_c31 = array( "type" => "literal", "value" => "@", "description" => "\"@\"" );
2748
+    $this->peg_c31 = array("type" => "literal", "value" => "@", "description" => "\"@\"");
2749 2749
     $this->peg_c32 = ":";
2750
-    $this->peg_c33 = array( "type" => "literal", "value" => ":", "description" => "\":\"" );
2750
+    $this->peg_c33 = array("type" => "literal", "value" => ":", "description" => "\":\"");
2751 2751
     $this->peg_c34 = "-";
2752
-    $this->peg_c35 = array( "type" => "literal", "value" => "-", "description" => "\"-\"" );
2752
+    $this->peg_c35 = array("type" => "literal", "value" => "-", "description" => "\"-\"");
2753 2753
     $this->peg_c36 = ">";
2754
-    $this->peg_c37 = array( "type" => "literal", "value" => ">", "description" => "\">\"" );
2754
+    $this->peg_c37 = array("type" => "literal", "value" => ">", "description" => "\">\"");
2755 2755
     $this->peg_c38 = "!";
2756
-    $this->peg_c39 = array( "type" => "literal", "value" => "!", "description" => "\"!\"" );
2756
+    $this->peg_c39 = array("type" => "literal", "value" => "!", "description" => "\"!\"");
2757 2757
     $this->peg_c40 = "/^[0-9]/";
2758
-    $this->peg_c41 = array( "type" => "class", "value" => "[0-9]", "description" => "[0-9]" );
2759
-    $this->peg_c42 = array("type" => "other", "description" => "string" );
2758
+    $this->peg_c41 = array("type" => "class", "value" => "[0-9]", "description" => "[0-9]");
2759
+    $this->peg_c42 = array("type" => "other", "description" => "string");
2760 2760
     $this->peg_c43 = "\"";
2761
-    $this->peg_c44 = array( "type" => "literal", "value" => "\"", "description" => "\"\\\"\"" );
2761
+    $this->peg_c44 = array("type" => "literal", "value" => "\"", "description" => "\"\\\"\"");
2762 2762
     $this->peg_c45 = "'";
2763
-    $this->peg_c46 = array( "type" => "literal", "value" => "'", "description" => "\"'\"" );
2763
+    $this->peg_c46 = array("type" => "literal", "value" => "'", "description" => "\"'\"");
2764 2764
     $this->peg_c47 = "\\";
2765
-    $this->peg_c48 = array( "type" => "literal", "value" => "\\", "description" => "\"\\\\\"" );
2766
-    $this->peg_c49 = array("type" => "any", "description" => "any character" );
2765
+    $this->peg_c48 = array("type" => "literal", "value" => "\\", "description" => "\"\\\\\"");
2766
+    $this->peg_c49 = array("type" => "any", "description" => "any character");
2767 2767
     $this->peg_c50 = "/^[a-zA-Z_]/";
2768
-    $this->peg_c51 = array( "type" => "class", "value" => "[a-zA-Z_]", "description" => "[a-zA-Z_]" );
2768
+    $this->peg_c51 = array("type" => "class", "value" => "[a-zA-Z_]", "description" => "[a-zA-Z_]");
2769 2769
     $this->peg_c52 = "/^[a-zA-Z_-]/";
2770
-    $this->peg_c53 = array( "type" => "class", "value" => "[a-zA-Z_-]", "description" => "[a-zA-Z_-]" );
2770
+    $this->peg_c53 = array("type" => "class", "value" => "[a-zA-Z_-]", "description" => "[a-zA-Z_-]");
2771 2771
     $this->peg_c54 = "/^[0-9a-zA-Z_-]/";
2772
-    $this->peg_c55 = array( "type" => "class", "value" => "[0-9a-zA-Z_-]", "description" => "[0-9a-zA-Z_-]" );
2772
+    $this->peg_c55 = array("type" => "class", "value" => "[0-9a-zA-Z_-]", "description" => "[0-9a-zA-Z_-]");
2773 2773
     $this->peg_c56 = "/^[^{\\\$]/";
2774
-    $this->peg_c57 = array( "type" => "class", "value" => "[{\$]", "description" => "[{\$]" );
2774
+    $this->peg_c57 = array("type" => "class", "value" => "[{\$]", "description" => "[{\$]");
2775 2775
     $this->peg_c58 = "/^[a-z]/";
2776
-    $this->peg_c59 = array( "type" => "class", "value" => "[a-z]", "description" => "[a-z]" );
2776
+    $this->peg_c59 = array("type" => "class", "value" => "[a-z]", "description" => "[a-z]");
2777 2777
     $this->peg_c60 = "/^[^{]/";
2778
-    $this->peg_c61 = array( "type" => "class", "value" => "[{]", "description" => "[{]" );
2778
+    $this->peg_c61 = array("type" => "class", "value" => "[{]", "description" => "[{]");
2779 2779
     $this->peg_c62 = "/^[\\n\\r\\x{2028}\\x{2029}]/";
2780
-    $this->peg_c63 = array( "type" => "class", "value" => "[\n\r\x{2028}\x{2029}]", "description" => "[\n\r\x{2028}\x{2029}]" );
2780
+    $this->peg_c63 = array("type" => "class", "value" => "[\n\r\x{2028}\x{2029}]", "description" => "[\n\r\x{2028}\x{2029}]");
2781 2781
     $this->peg_c64 = "/^['\"\\\\bfnrtv]/";
2782
-    $this->peg_c65 = array( "type" => "class", "value" => "['\"\\bfnrtv]", "description" => "['\"\\bfnrtv]" );
2782
+    $this->peg_c65 = array("type" => "class", "value" => "['\"\\bfnrtv]", "description" => "['\"\\bfnrtv]");
2783 2783
 
2784
-    $peg_startRuleFunctions = array( 'HtmlInput' => array($this, "peg_parseHtmlInput"), 'CodeInput' => array($this, "peg_parseCodeInput"), 'ControlInput' => array($this, "peg_parseControlInput") );
2784
+    $peg_startRuleFunctions = array('HtmlInput' => array($this, "peg_parseHtmlInput"), 'CodeInput' => array($this, "peg_parseCodeInput"), 'ControlInput' => array($this, "peg_parseControlInput"));
2785 2785
     $peg_startRuleFunction  = array($this, "peg_parseHtmlInput");
2786 2786
     if (isset($options["startRule"])) {
2787 2787
       if (!(isset($peg_startRuleFunctions[$options["startRule"]]))) {
2788
-        throw new \Exception("Can't start parsing from rule \"" + $options["startRule"] + "\".");
2788
+        throw new \Exception("Can't start parsing from rule \"" +$options["startRule"] + "\".");
2789 2789
       }
2790 2790
 
2791 2791
       $peg_startRuleFunction = $peg_startRuleFunctions[$options["startRule"]];
@@ -2799,7 +2799,7 @@  discard block
 block discarded – undo
2799 2799
       return $peg_result;
2800 2800
     } else {
2801 2801
       if ($peg_result !== $this->peg_FAILED && $this->peg_currPos < $this->input_length) {
2802
-        $this->peg_fail(array("type" => "end", "description" => "end of input" ));
2802
+        $this->peg_fail(array("type" => "end", "description" => "end of input"));
2803 2803
       }
2804 2804
 
2805 2805
       $exception = $this->peg_buildException(null, $this->peg_maxFailExpected, $this->peg_maxFailPos);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -306,7 +306,9 @@
 block discarded – undo
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; }
Please login to merge, or discard this patch.