@@ -245,12 +245,12 @@ discard block |
||
| 245 | 245 | * @var Token $lastToken |
| 246 | 246 | */ |
| 247 | 247 | $lastToken = null; |
| 248 | - $isColonFound = false; |
|
| 248 | + $isColonFound = false; |
|
| 249 | 249 | |
| 250 | 250 | |
| 251 | 251 | // To check the presence of a colon |
| 252 | - $count = 0; |
|
| 253 | - $indexOfColon; |
|
| 252 | + $count = 0; |
|
| 253 | + $indexOfColon; |
|
| 254 | 254 | |
| 255 | 255 | for ($this->last = 0, $lastIdx = 0; $this->last < $this->len; $lastIdx = ++$this->last) { |
| 256 | 256 | /** |
@@ -261,46 +261,46 @@ discard block |
||
| 261 | 261 | $token = null; |
| 262 | 262 | |
| 263 | 263 | |
| 264 | - // To check :loop is found |
|
| 265 | - if($isColonFound === true && preg_match('/^\s/', $this->str[$this->last])) { |
|
| 266 | - $count++; |
|
| 267 | - } |
|
| 264 | + // To check :loop is found |
|
| 265 | + if($isColonFound === true && preg_match('/^\s/', $this->str[$this->last])) { |
|
| 266 | + $count++; |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | 269 | foreach (static::$PARSER_METHODS as $method) { |
| 270 | - if (($token = $this->$method())) { |
|
| 270 | + if (($token = $this->$method())) { |
|
| 271 | 271 | break; |
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if($isColonFound === true && $count === 5) { |
|
| 276 | - $count = 0; |
|
| 277 | - $isColonFound = false; |
|
| 278 | - $string = strtolower($this->str); |
|
| 279 | - $loopKeyWord = preg_match('/:\s+loop\s+/', $string, $matches) ? $matches[1] : ''; |
|
| 280 | - if($loopKeyWord === '') { |
|
| 281 | - $this->error( |
|
| 282 | - __('Unexpected character.'), |
|
| 283 | - $this->str[$indexOfColon], |
|
| 284 | - $indexOfColon |
|
| 285 | - ); |
|
| 286 | - } |
|
| 287 | - } |
|
| 275 | + if($isColonFound === true && $count === 5) { |
|
| 276 | + $count = 0; |
|
| 277 | + $isColonFound = false; |
|
| 278 | + $string = strtolower($this->str); |
|
| 279 | + $loopKeyWord = preg_match('/:\s+loop\s+/', $string, $matches) ? $matches[1] : ''; |
|
| 280 | + if($loopKeyWord === '') { |
|
| 281 | + $this->error( |
|
| 282 | + __('Unexpected character.'), |
|
| 283 | + $this->str[$indexOfColon], |
|
| 284 | + $indexOfColon |
|
| 285 | + ); |
|
| 286 | + } |
|
| 287 | + } |
|
| 288 | 288 | |
| 289 | 289 | if ($token === null) { |
| 290 | 290 | // @assert($this->last === $lastIdx); |
| 291 | 291 | $token = new Token($this->str[$this->last]); |
| 292 | - if($this->str[$this->last] === ':') { |
|
| 293 | - $isColonFound = true; |
|
| 294 | - $indexOfColon = $this->last; |
|
| 295 | - } |
|
| 296 | - // For other unexpected characters except ':' |
|
| 297 | - else { |
|
| 298 | - $this->error( |
|
| 299 | - __('Unexpected character.'), |
|
| 300 | - $this->str[$this->last], |
|
| 301 | - $this->last |
|
| 302 | - ); |
|
| 303 | - } |
|
| 292 | + if($this->str[$this->last] === ':') { |
|
| 293 | + $isColonFound = true; |
|
| 294 | + $indexOfColon = $this->last; |
|
| 295 | + } |
|
| 296 | + // For other unexpected characters except ':' |
|
| 297 | + else { |
|
| 298 | + $this->error( |
|
| 299 | + __('Unexpected character.'), |
|
| 300 | + $this->str[$this->last], |
|
| 301 | + $this->last |
|
| 302 | + ); |
|
| 303 | + } |
|
| 304 | 304 | } elseif (($lastToken !== null) |
| 305 | 305 | && ($token->type === Token::TYPE_SYMBOL) |
| 306 | 306 | && ($token->flags & Token::FLAG_SYMBOL_VARIABLE) |