@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function __construct(StringStream $stream, string $type) |
| 89 | 89 | { |
| 90 | - if (! self::isKnownType($type)) { |
|
| 90 | + if (!self::isKnownType($type)) { |
|
| 91 | 91 | throw new SyntaxErrorException($stream); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | protected function defaultExtractor(string $tokenName) |
| 125 | 125 | { |
| 126 | - if($this->multiLineOpened) { |
|
| 126 | + if ($this->multiLineOpened) { |
|
| 127 | 127 | $this->stream->ignoreWhitespace(); |
| 128 | 128 | } else { |
| 129 | 129 | $this->stream->ignoreHorizontalSpace(); |
@@ -139,27 +139,27 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | $ord = $this->stream->ord(); |
| 141 | 141 | |
| 142 | - if($ord == AsciiChar::NULL) { |
|
| 142 | + if ($ord == AsciiChar::NULL) { |
|
| 143 | 143 | return; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if($ord === AsciiChar::OPEN_BRACKET && !$this->commentOpen) { |
|
| 146 | + if ($ord === AsciiChar::OPEN_BRACKET && !$this->commentOpen) { |
|
| 147 | 147 | $this->multiLineOpened = true; |
| 148 | 148 | $this->stream->next(); |
| 149 | 149 | goto start; |
| 150 | - } elseif($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::CLOSE_BRACKET) { |
|
| 150 | + } elseif ($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::CLOSE_BRACKET) { |
|
| 151 | 151 | $this->multiLineOpened = false; |
| 152 | 152 | $this->stream->next(); |
| 153 | 153 | goto start; |
| 154 | - } elseif($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::LINE_FEED) { |
|
| 154 | + } elseif ($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::LINE_FEED) { |
|
| 155 | 155 | $this->stream->next(); |
| 156 | 156 | goto start; |
| 157 | - } elseif($ord === AsciiChar::LINE_FEED && !$this->commentOpen) { |
|
| 157 | + } elseif ($ord === AsciiChar::LINE_FEED && !$this->commentOpen) { |
|
| 158 | 158 | return; |
| 159 | 159 | } else { |
| 160 | - if($ord === AsciiChar::SEMICOLON) { |
|
| 160 | + if ($ord === AsciiChar::SEMICOLON) { |
|
| 161 | 161 | $this->stream->previous(); |
| 162 | - if($this->stream->currentAscii()->isHorizontalSpace()) { |
|
| 162 | + if ($this->stream->currentAscii()->isHorizontalSpace()) { |
|
| 163 | 163 | |
| 164 | 164 | $this->commentOpen = true; |
| 165 | 165 | $this->stream->next(); |
@@ -170,20 +170,20 @@ discard block |
||
| 170 | 170 | $this->stream->next(); |
| 171 | 171 | } |
| 172 | 172 | goto start; |
| 173 | - } elseif(($this->stream->currentAscii()->isVerticalSpace() || $ord === AsciiChar::NULL) && $this->commentOpen) { |
|
| 173 | + } elseif (($this->stream->currentAscii()->isVerticalSpace() || $ord === AsciiChar::NULL) && $this->commentOpen) { |
|
| 174 | 174 | $this->stream->next(); |
| 175 | 175 | $this->stream->ignoreHorizontalSpace(); |
| 176 | 176 | $this->commentOpen = false; |
| 177 | 177 | goto start; |
| 178 | - } elseif($this->commentOpen) { |
|
| 178 | + } elseif ($this->commentOpen) { |
|
| 179 | 179 | $this->commentOpen = true; |
| 180 | 180 | $this->ignoreComment(); |
| 181 | 181 | goto start; |
| 182 | - } elseif(!$this->commentOpen) { |
|
| 183 | - if($ord === AsciiChar::SPACE && $this->tokens[$tokenName] === "") { |
|
| 182 | + } elseif (!$this->commentOpen) { |
|
| 183 | + if ($ord === AsciiChar::SPACE && $this->tokens[$tokenName] === "") { |
|
| 184 | 184 | $this->stream->next(); |
| 185 | 185 | goto start; |
| 186 | - } elseif($this->stream->currentAscii()->isHorizontalSpace()) { |
|
| 186 | + } elseif ($this->stream->currentAscii()->isHorizontalSpace()) { |
|
| 187 | 187 | return; |
| 188 | 188 | } else { |
| 189 | 189 | $this->tokens[$tokenName] .= $this->stream->current(); |
@@ -207,15 +207,15 @@ discard block |
||
| 207 | 207 | { |
| 208 | 208 | start: |
| 209 | 209 | $ord = $this->stream->ord(); |
| 210 | - if($ord == AsciiChar::NULL) { |
|
| 210 | + if ($ord == AsciiChar::NULL) { |
|
| 211 | 211 | return; |
| 212 | 212 | } |
| 213 | - if($ord === AsciiChar::SEMICOLON) { |
|
| 213 | + if ($ord === AsciiChar::SEMICOLON) { |
|
| 214 | 214 | $this->stream->next(); |
| 215 | 215 | $this->commentOpen = true; |
| 216 | 216 | goto start; |
| 217 | - } elseif($this->commentOpen) { |
|
| 218 | - if($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
| 217 | + } elseif ($this->commentOpen) { |
|
| 218 | + if ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
| 219 | 219 | $this->commentOpen = false; |
| 220 | 220 | goto start; |
| 221 | 221 | } else { |
@@ -223,14 +223,14 @@ discard block |
||
| 223 | 223 | $this->commentOpen = true; |
| 224 | 224 | goto start; |
| 225 | 225 | } |
| 226 | - } elseif(!$this->commentOpen) { |
|
| 227 | - if($this->multiLineOpened) { |
|
| 228 | - if($ord === AsciiChar::CLOSE_BRACKET) { |
|
| 226 | + } elseif (!$this->commentOpen) { |
|
| 227 | + if ($this->multiLineOpened) { |
|
| 228 | + if ($ord === AsciiChar::CLOSE_BRACKET) { |
|
| 229 | 229 | $this->multiLineOpened = false; |
| 230 | 230 | } |
| 231 | 231 | $this->stream->next(); |
| 232 | 232 | goto start; |
| 233 | - } elseif($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
| 233 | + } elseif ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
| 234 | 234 | return; |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -249,53 +249,53 @@ discard block |
||
| 249 | 249 | $ord = $this->stream->ord(); |
| 250 | 250 | $this->stream->next(); |
| 251 | 251 | |
| 252 | - if($ord == 0) { // if end of record |
|
| 252 | + if ($ord == 0) { // if end of record |
|
| 253 | 253 | return; |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // comment starts |
| 257 | - if($ord === 59) { |
|
| 257 | + if ($ord === 59) { |
|
| 258 | 258 | $this->commentOpen = true; |
| 259 | 259 | goto start; |
| 260 | - } elseif($this->commentOpen == true && $ord !== 10) { |
|
| 260 | + } elseif ($this->commentOpen == true && $ord !== 10) { |
|
| 261 | 261 | $this->commentOpen = true; |
| 262 | 262 | goto start; |
| 263 | - } elseif($this->commentOpen == true && ($ord === 10 || $ord === 0)) { |
|
| 263 | + } elseif ($this->commentOpen == true && ($ord === 10 || $ord === 0)) { |
|
| 264 | 264 | $this->stream->previous(); |
| 265 | 265 | $this->commentOpen = false; |
| 266 | 266 | goto start; |
| 267 | 267 | } else { |
| 268 | 268 | // ignore blanck line |
| 269 | - if($ord === 32) { |
|
| 269 | + if ($ord === 32) { |
|
| 270 | 270 | goto start; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // Find starts of char set |
| 274 | - if($ord === 34 && !$this->commentOpen) { // " |
|
| 274 | + if ($ord === 34 && !$this->commentOpen) { // " |
|
| 275 | 275 | $this->extractCharSet($tokenName); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | // multi line opened |
| 279 | - if($ord === 40 && !$this->commentOpen) { |
|
| 279 | + if ($ord === 40 && !$this->commentOpen) { |
|
| 280 | 280 | $this->multiLineOpened = true; |
| 281 | 281 | goto start; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // multi line closed |
| 285 | - if($this->multiLineOpened && !$this->commentOpen && $ord === 41) { |
|
| 285 | + if ($this->multiLineOpened && !$this->commentOpen && $ord === 41) { |
|
| 286 | 286 | $this->multiLineOpened = false; |
| 287 | 287 | goto start; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // comment end in multi line TXT record |
| 291 | - if($ord === 10 && $this->commentOpen && $this->multiLineOpened) { |
|
| 291 | + if ($ord === 10 && $this->commentOpen && $this->multiLineOpened) { |
|
| 292 | 292 | goto start; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | // is record ends? |
| 296 | - if(!$this->multiLineOpened && ($ord === 10 || $ord === 0)) { |
|
| 296 | + if (!$this->multiLineOpened && ($ord === 10 || $ord === 0)) { |
|
| 297 | 297 | return; |
| 298 | - } elseif($this->multiLineOpened && $ord === 10) { |
|
| 298 | + } elseif ($this->multiLineOpened && $ord === 10) { |
|
| 299 | 299 | goto start; |
| 300 | 300 | } |
| 301 | 301 | } |
@@ -311,11 +311,11 @@ discard block |
||
| 311 | 311 | $ord = $this->stream->ord(); |
| 312 | 312 | $this->stream->next(); |
| 313 | 313 | |
| 314 | - if($ord == 0) { // if end of record |
|
| 314 | + if ($ord == 0) { // if end of record |
|
| 315 | 315 | return; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if(!$escaping_open && $ord === 34) { |
|
| 318 | + if (!$escaping_open && $ord === 34) { |
|
| 319 | 319 | $this->txtExtractor($tokenName); |
| 320 | 320 | } else { |
| 321 | 321 | $this->tokens[$tokenName] .= chr($ord); |