function Lexer::lex
Return value
0|1|4|6|8|10|11|14|17|18|21|22|23|24|30|-1
File
-
vendor/
seld/ jsonlint/ src/ Seld/ JsonLint/ Lexer.php, line 94
Class
- Lexer
- Lexer class
Namespace
Seld\JsonLintCode
public function lex() {
while (true) {
$symbol = $this->next();
switch ($symbol) {
case self::T_SKIP_WHITESPACE:
case self::T_BREAK_LINE:
break;
case self::T_COMMENT:
case self::T_OPEN_COMMENT:
if (!($this->flags & JsonParser::ALLOW_COMMENTS)) {
$this->parseError('Lexical error on line ' . ($this->yylineno + 1) . ". Comments are not allowed.\n" . $this->showPosition());
}
$this->skipUntil($symbol === self::T_COMMENT ? self::T_BREAK_LINE : self::T_CLOSE_COMMENT);
if ($this->done) {
// last symbol '/\G$/' before EOF
return 14;
}
break;
case self::T_CLOSE_COMMENT:
$this->parseError('Lexical error on line ' . ($this->yylineno + 1) . ". Unexpected token.\n" . $this->showPosition());
default:
return $symbol;
}
}
}