| @@ 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 | } |
|
| @@ 270-309 (lines=40) @@ | ||
| 267 | '@' => Token::T_AT, |
|
| 268 | ); |
|
| 269 | ||
| 270 | while ($this->scanner->eof() === false) { |
|
| 271 | $next = $this->scanner->peek(); |
|
| 272 | ||
| 273 | if (ctype_space($next)) { |
|
| 274 | $this->scanner->next(); |
|
| 275 | continue; |
|
| 276 | } |
|
| 277 | ||
| 278 | if ($next === '#') { |
|
| 279 | $this->comment(); |
|
| 280 | continue; |
|
| 281 | } |
|
| 282 | ||
| 283 | if ($next === '_' || ctype_alpha($next)) { |
|
| 284 | $this->name(); |
|
| 285 | continue; |
|
| 286 | } |
|
| 287 | ||
| 288 | if ($next === '.') { |
|
| 289 | $this->spread(); |
|
| 290 | continue; |
|
| 291 | } |
|
| 292 | ||
| 293 | if ($next === '"') { |
|
| 294 | $this->str(); |
|
| 295 | continue; |
|
| 296 | } |
|
| 297 | ||
| 298 | if ($next === '-' || ctype_digit($next)) { |
|
| 299 | $this->number(); |
|
| 300 | continue; |
|
| 301 | } |
|
| 302 | ||
| 303 | if (isset($punctuators[$next])) { |
|
| 304 | $this->emit($punctuators[$next], $this->scanner->next(), $this->getLocation()); |
|
| 305 | continue; |
|
| 306 | } |
|
| 307 | ||
| 308 | throw $this->getError("Unknown character: \"{$next}\""); |
|
| 309 | } |
|
| 310 | ||
| 311 | return $this->tokens; |
|
| 312 | } |
|