@@ -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) |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | |
| 264 | 264 | // To check :loop is found |
| 265 | - if($isColonFound === true && preg_match('/^\s/', $this->str[$this->last])) { |
|
| 265 | + if ($isColonFound === true && preg_match('/^\s/', $this->str[$this->last])) { |
|
| 266 | 266 | $count++; |
| 267 | 267 | } |
| 268 | 268 | |
@@ -272,12 +272,12 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if($isColonFound === true && $count === 5) { |
|
| 275 | + if ($isColonFound === true && $count === 5) { |
|
| 276 | 276 | $count = 0; |
| 277 | 277 | $isColonFound = false; |
| 278 | 278 | $string = strtolower($this->str); |
| 279 | 279 | $loopKeyWord = preg_match('/:\s+loop\s+/', $string, $matches) ? $matches[1] : ''; |
| 280 | - if($loopKeyWord === '') { |
|
| 280 | + if ($loopKeyWord === '') { |
|
| 281 | 281 | $this->error( |
| 282 | 282 | __('Unexpected character.'), |
| 283 | 283 | $this->str[$indexOfColon], |
@@ -289,7 +289,7 @@ discard block |
||
| 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] === ':') { |
|
| 292 | + if ($this->str[$this->last] === ':') { |
|
| 293 | 293 | $isColonFound = true; |
| 294 | 294 | $indexOfColon = $this->last; |
| 295 | 295 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $lastToken->token .= $token->token; |
| 313 | 313 | $lastToken->type = Token::TYPE_SYMBOL; |
| 314 | 314 | $lastToken->flags = Token::FLAG_SYMBOL_USER; |
| 315 | - $lastToken->value .= '@' . $token->value; |
|
| 315 | + $lastToken->value .= '@'.$token->value; |
|
| 316 | 316 | continue; |
| 317 | 317 | } elseif (($lastToken !== null) |
| 318 | 318 | && ($token->type === Token::TYPE_KEYWORD) |
@@ -628,8 +628,8 @@ discard block |
||
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | $iBak = $this->last; |
| 631 | - $token = $this->str[$this->last] . $this->str[++$this->last] |
|
| 632 | - . $this->str[++$this->last] . $this->str[++$this->last]; // _TRUE_ or _FALS_e |
|
| 631 | + $token = $this->str[$this->last].$this->str[++$this->last] |
|
| 632 | + . $this->str[++$this->last].$this->str[++$this->last]; // _TRUE_ or _FALS_e |
|
| 633 | 633 | |
| 634 | 634 | if (Context::isBool($token)) { |
| 635 | 635 | return new Token($token, Token::TYPE_BOOL); |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | && ((($this->str[$this->last] === $quote) && ($this->str[$this->last + 1] === $quote)) |
| 803 | 803 | || (($this->str[$this->last] === '\\') && ($quote !== '`'))) |
| 804 | 804 | ) { |
| 805 | - $token .= $this->str[$this->last] . $this->str[++$this->last]; |
|
| 805 | + $token .= $this->str[$this->last].$this->str[++$this->last]; |
|
| 806 | 806 | } else { |
| 807 | 807 | if ($this->str[$this->last] === $quote) { |
| 808 | 808 | break; |