| @@ 266-305 (lines=40) @@ | ||
| 263 | '@' => Token::T_AT, |
|
| 264 | ); |
|
| 265 | ||
| 266 | while ($this->scanner->eof() === false) { |
|
| 267 | $next = $this->scanner->peek(); |
|
| 268 | ||
| 269 | if (ctype_space($next)) { |
|
| 270 | $this->scanner->next(); |
|
| 271 | continue; |
|
| 272 | } |
|
| 273 | ||
| 274 | if ($next === '#') { |
|
| 275 | $this->comment(); |
|
| 276 | continue; |
|
| 277 | } |
|
| 278 | ||
| 279 | if ($next === '_' || ctype_alpha($next)) { |
|
| 280 | $this->name(); |
|
| 281 | continue; |
|
| 282 | } |
|
| 283 | ||
| 284 | if ($next === '.') { |
|
| 285 | $this->spread(); |
|
| 286 | continue; |
|
| 287 | } |
|
| 288 | ||
| 289 | if ($next === '"') { |
|
| 290 | $this->str(); |
|
| 291 | continue; |
|
| 292 | } |
|
| 293 | ||
| 294 | if ($next === '-' || ctype_digit($next)) { |
|
| 295 | $this->number(); |
|
| 296 | continue; |
|
| 297 | } |
|
| 298 | ||
| 299 | if (isset($punctuators[$next])) { |
|
| 300 | $this->emit($punctuators[$next], $this->scanner->next(), $this->getLocation()); |
|
| 301 | continue; |
|
| 302 | } |
|
| 303 | ||
| 304 | throw $this->getError("Unknown character: \"{$next}\""); |
|
| 305 | } |
|
| 306 | ||
| 307 | return $this->tokens; |
|
| 308 | } |
|
| @@ 236-270 (lines=35) @@ | ||
| 233 | '|' => Token::T_PIPE, |
|
| 234 | ); |
|
| 235 | ||
| 236 | while ($this->scanner->eof() === false) { |
|
| 237 | $next = $this->scanner->peek(); |
|
| 238 | ||
| 239 | if (ctype_space($next)) { |
|
| 240 | $this->scanner->next(); |
|
| 241 | continue; |
|
| 242 | } |
|
| 243 | ||
| 244 | if ($next === '#') { |
|
| 245 | $this->comment(); |
|
| 246 | continue; |
|
| 247 | } |
|
| 248 | ||
| 249 | if ($next === '_' || ctype_alpha($next)) { |
|
| 250 | $this->name(); |
|
| 251 | continue; |
|
| 252 | } |
|
| 253 | ||
| 254 | if ($next === '"') { |
|
| 255 | $this->str(); |
|
| 256 | continue; |
|
| 257 | } |
|
| 258 | ||
| 259 | if ($next === '-' || ctype_digit($next)) { |
|
| 260 | $this->number(); |
|
| 261 | continue; |
|
| 262 | } |
|
| 263 | ||
| 264 | if (isset($punctuators[$next])) { |
|
| 265 | $this->emit($punctuators[$next], $this->scanner->next(), $this->getLocation()); |
|
| 266 | continue; |
|
| 267 | } |
|
| 268 | ||
| 269 | throw $this->getError("Unknown character: \"{$next}\""); |
|
| 270 | } |
|
| 271 | ||
| 272 | return $this->tokens; |
|
| 273 | } |
|