@@ -12,14 +12,14 @@ |
||
12 | 12 | * @inheritdoc |
13 | 13 | */ |
14 | 14 | public function read( |
15 | - int $code, |
|
16 | - int $pos, |
|
17 | - int $line, |
|
18 | - int $col, |
|
19 | - Token $prev |
|
15 | + int $code, |
|
16 | + int $pos, |
|
17 | + int $line, |
|
18 | + int $col, |
|
19 | + Token $prev |
|
20 | 20 | ): Token { |
21 | 21 | return new Token(TokenKindEnum::EQUALS, $pos, $pos + 1, $line, $col, |
22 | - $prev); |
|
22 | + $prev); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | * @inheritdoc |
25 | 25 | */ |
26 | 26 | public function read( |
27 | - int $code, |
|
28 | - int $pos, |
|
29 | - int $line, |
|
30 | - int $col, |
|
31 | - Token $prev |
|
27 | + int $code, |
|
28 | + int $pos, |
|
29 | + int $line, |
|
30 | + int $col, |
|
31 | + Token $prev |
|
32 | 32 | ): Token { |
33 | 33 | $body = $this->lexer->getBody(); |
34 | 34 | $bodyLength = mb_strlen($body); |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | $value .= sliceString($body, $chunkStart, $pos); |
45 | 45 | |
46 | 46 | return new Token(TokenKindEnum::STRING, $start, $pos + 1, $line, |
47 | - $col, $prev, $value); |
|
47 | + $col, $prev, $value); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | if ($this->isSourceCharacter($code)) { |
51 | 51 | throw new SyntaxErrorException( |
52 | - $this->lexer->getSource(), |
|
53 | - $pos, |
|
54 | - sprintf('Invalid character within String: %s', |
|
52 | + $this->lexer->getSource(), |
|
53 | + $pos, |
|
54 | + sprintf('Invalid character within String: %s', |
|
55 | 55 | printCharCode($code)) |
56 | 56 | ); |
57 | 57 | } |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | case 117: |
92 | 92 | // u |
93 | 93 | $charCode = uniCharCode( |
94 | - charCodeAt($body, $pos + 1), |
|
95 | - charCodeAt($body, $pos + 2), |
|
96 | - charCodeAt($body, $pos + 3), |
|
97 | - charCodeAt($body, $pos + 4) |
|
94 | + charCodeAt($body, $pos + 1), |
|
95 | + charCodeAt($body, $pos + 2), |
|
96 | + charCodeAt($body, $pos + 3), |
|
97 | + charCodeAt($body, $pos + 4) |
|
98 | 98 | ); |
99 | 99 | if ($charCode < 0) { |
100 | 100 | throw new SyntaxErrorException( |
101 | - $this->lexer->getSource(), |
|
102 | - $pos, |
|
103 | - sprintf( |
|
101 | + $this->lexer->getSource(), |
|
102 | + $pos, |
|
103 | + sprintf( |
|
104 | 104 | 'Invalid character escape sequence: \\u%s', |
105 | 105 | sliceString($body, $pos + 1, $pos + 5) |
106 | - ) |
|
106 | + ) |
|
107 | 107 | ); |
108 | 108 | } |
109 | 109 | $value .= chr($charCode); |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | break; |
112 | 112 | default: |
113 | 113 | throw new SyntaxErrorException( |
114 | - $this->lexer->getSource(), |
|
115 | - $pos, |
|
116 | - sprintf('Invalid character escape sequence: \\%s', |
|
114 | + $this->lexer->getSource(), |
|
115 | + $pos, |
|
116 | + sprintf('Invalid character escape sequence: \\%s', |
|
117 | 117 | chr($code)) |
118 | 118 | ); |
119 | 119 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | throw new SyntaxErrorException($this->lexer->getSource(), $pos, |
127 | - 'Unterminated string.'); |
|
127 | + 'Unterminated string.'); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | * @inheritdoc |
15 | 15 | */ |
16 | 16 | public function read( |
17 | - int $code, |
|
18 | - int $pos, |
|
19 | - int $line, |
|
20 | - int $col, |
|
21 | - Token $prev |
|
17 | + int $code, |
|
18 | + int $pos, |
|
19 | + int $line, |
|
20 | + int $col, |
|
21 | + Token $prev |
|
22 | 22 | ): Token { |
23 | 23 | $body = $this->lexer->getBody(); |
24 | 24 | $bodyLength = mb_strlen($body); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | return new Token(TokenKindEnum::NAME, $start, $pos, $line, $col, $prev, |
34 | - sliceString($body, $start, $pos)); |
|
34 | + sliceString($body, $start, $pos)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * @inheritdoc |
27 | 27 | */ |
28 | 28 | public function read( |
29 | - int $code, |
|
30 | - int $pos, |
|
31 | - int $line, |
|
32 | - int $col, |
|
33 | - Token $prev |
|
29 | + int $code, |
|
30 | + int $pos, |
|
31 | + int $line, |
|
32 | + int $col, |
|
33 | + Token $prev |
|
34 | 34 | ): Token { |
35 | 35 | $body = $this->lexer->getBody(); |
36 | 36 | $start = $pos; |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | $code = charCodeAt($body, ++$pos); |
47 | 47 | if (isNumber($code)) { |
48 | 48 | throw new SyntaxErrorException( |
49 | - $this->lexer->getSource(), |
|
50 | - $pos, |
|
51 | - sprintf('Invalid number, unexpected digit after 0: %s.', |
|
49 | + $this->lexer->getSource(), |
|
50 | + $pos, |
|
51 | + sprintf('Invalid number, unexpected digit after 0: %s.', |
|
52 | 52 | printCharCode($code)) |
53 | 53 | ); |
54 | 54 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | return new Token( |
82 | - $isFloat ? TokenKindEnum::FLOAT : TokenKindEnum::INT, |
|
83 | - $start, |
|
84 | - $pos, |
|
85 | - $line, |
|
86 | - $col, |
|
87 | - $prev, |
|
88 | - sliceString($body, $start, $pos) |
|
82 | + $isFloat ? TokenKindEnum::FLOAT : TokenKindEnum::INT, |
|
83 | + $start, |
|
84 | + $pos, |
|
85 | + $line, |
|
86 | + $col, |
|
87 | + $prev, |
|
88 | + sliceString($body, $start, $pos) |
|
89 | 89 | ); |
90 | 90 | } |
91 | 91 | |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | throw new SyntaxErrorException( |
112 | - $this->lexer->getSource(), |
|
113 | - $pos, |
|
114 | - sprintf('Invalid number, expected digit but got: %s', |
|
112 | + $this->lexer->getSource(), |
|
113 | + $pos, |
|
114 | + sprintf('Invalid number, expected digit but got: %s', |
|
115 | 115 | printCharCode($code)) |
116 | 116 | ); |
117 | 117 | } |
@@ -12,11 +12,11 @@ |
||
12 | 12 | * @inheritdoc |
13 | 13 | */ |
14 | 14 | public function read( |
15 | - int $code, |
|
16 | - int $pos, |
|
17 | - int $line, |
|
18 | - int $col, |
|
19 | - Token $prev |
|
15 | + int $code, |
|
16 | + int $pos, |
|
17 | + int $line, |
|
18 | + int $col, |
|
19 | + Token $prev |
|
20 | 20 | ): Token { |
21 | 21 | return new Token(TokenKindEnum::AT, $pos, $pos + 1, $line, $col, $prev); |
22 | 22 | } |
@@ -12,11 +12,11 @@ |
||
12 | 12 | * @inheritdoc |
13 | 13 | */ |
14 | 14 | public function read( |
15 | - int $code, |
|
16 | - int $pos, |
|
17 | - int $line, |
|
18 | - int $col, |
|
19 | - Token $prev |
|
15 | + int $code, |
|
16 | + int $pos, |
|
17 | + int $line, |
|
18 | + int $col, |
|
19 | + Token $prev |
|
20 | 20 | ): Token { |
21 | 21 | return $code === 123 |
22 | 22 | ? new Token(TokenKindEnum::BRACE_L, $pos, $pos + 1, $line, $col, |
@@ -12,14 +12,14 @@ |
||
12 | 12 | * @inheritdoc |
13 | 13 | */ |
14 | 14 | public function read( |
15 | - int $code, |
|
16 | - int $pos, |
|
17 | - int $line, |
|
18 | - int $col, |
|
19 | - Token $prev |
|
15 | + int $code, |
|
16 | + int $pos, |
|
17 | + int $line, |
|
18 | + int $col, |
|
19 | + Token $prev |
|
20 | 20 | ): Token { |
21 | 21 | return new Token(TokenKindEnum::BANG, $pos, $pos + 1, $line, $col, |
22 | - $prev); |
|
22 | + $prev); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -14,22 +14,22 @@ |
||
14 | 14 | * @var array |
15 | 15 | */ |
16 | 16 | private static $supportedReaders = [ |
17 | - AmpReader::class, |
|
18 | - AtReader::class, |
|
19 | - BangReader::class, |
|
20 | - BlockStringReader::class, |
|
21 | - BraceReader::class, |
|
22 | - BracketReader::class, |
|
23 | - ColonReader::class, |
|
24 | - CommentReader::class, |
|
25 | - DollarReader::class, |
|
26 | - EqualsReader::class, |
|
27 | - NameReader::class, |
|
28 | - NumberReader::class, |
|
29 | - ParenthesisReader::class, |
|
30 | - PipeReader::class, |
|
31 | - SpreadReader::class, |
|
32 | - StringReader::class, |
|
17 | + AmpReader::class, |
|
18 | + AtReader::class, |
|
19 | + BangReader::class, |
|
20 | + BlockStringReader::class, |
|
21 | + BraceReader::class, |
|
22 | + BracketReader::class, |
|
23 | + ColonReader::class, |
|
24 | + CommentReader::class, |
|
25 | + DollarReader::class, |
|
26 | + EqualsReader::class, |
|
27 | + NameReader::class, |
|
28 | + NumberReader::class, |
|
29 | + ParenthesisReader::class, |
|
30 | + PipeReader::class, |
|
31 | + SpreadReader::class, |
|
32 | + StringReader::class, |
|
33 | 33 | ]; |
34 | 34 | |
35 | 35 | /** |
@@ -12,11 +12,11 @@ |
||
12 | 12 | * @inheritdoc |
13 | 13 | */ |
14 | 14 | public function read( |
15 | - int $code, |
|
16 | - int $pos, |
|
17 | - int $line, |
|
18 | - int $col, |
|
19 | - Token $prev |
|
15 | + int $code, |
|
16 | + int $pos, |
|
17 | + int $line, |
|
18 | + int $col, |
|
19 | + Token $prev |
|
20 | 20 | ): Token { |
21 | 21 | return $code === 40 |
22 | 22 | ? new Token(TokenKindEnum::PAREN_L, $pos, $pos + 1, $line, $col, |