Changeset View
Changeset View
Standalone View
Standalone View
externals/jsonlint/src/Seld/JsonLint/Lexer.php
Context not available. | |||||
public function showPosition() | public function showPosition() | ||||
{ | { | ||||
$pre = str_replace("\n", '', $this->getPastInput()); | $pre = str_replace("\n", '', $this->getPastInput()); | ||||
$c = str_repeat('-', max(0, strlen($pre) - 1)); // new Array(pre.length + 1).join("-"); | $c = str_repeat('-', max(0, @strlen($pre) - 1)); // new Array(pre.length + 1).join("-"); | ||||
return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^"; | return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^"; | ||||
} | } | ||||
public function getPastInput() | public function getPastInput() | ||||
{ | { | ||||
$past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match)); | $past = @substr($this->matched, 0, @strlen($this->matched) - @strlen($this->match)); | ||||
return (strlen($past) > 20 ? '...' : '') . substr($past, -20); | return (@strlen($past) > 20 ? '...' : '') . @substr($past, -20); | ||||
} | } | ||||
public function getUpcomingInput() | public function getUpcomingInput() | ||||
{ | { | ||||
$next = $this->match; | $next = $this->match; | ||||
if (strlen($next) < 20) { | if (@strlen($next) < 20) { | ||||
$next .= substr($this->input, 0, 20 - strlen($next)); | $next .= @substr($this->input, 0, 20 - @strlen($next)); | ||||
} | } | ||||
return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : ''); | return @substr($next, 0, 20) . (@strlen($next) > 20 ? '...' : ''); | ||||
} | } | ||||
protected function parseError($str, $hash) | protected function parseError($str, $hash) | ||||
Context not available. | |||||
$rulesLen = count($rules); | $rulesLen = count($rules); | ||||
for ($i=0; $i < $rulesLen; $i++) { | for ($i=0; $i < $rulesLen; $i++) { | ||||
if (preg_match($this->rules[$rules[$i]], $this->input, $match)) { | if (@preg_match($this->rules[$rules[$i]], $this->input, $match)) { | ||||
preg_match_all('/\n.*/', $match[0], $lines); | preg_match_all('/\n.*/', $match[0], $lines); | ||||
$lines = $lines[0]; | $lines = $lines[0]; | ||||
if ($lines) { | if ($lines) { | ||||
Context not available. | |||||
'first_line' => $this->yylloc['last_line'], | 'first_line' => $this->yylloc['last_line'], | ||||
'last_line' => $this->yylineno+1, | 'last_line' => $this->yylineno+1, | ||||
'first_column' => $this->yylloc['last_column'], | 'first_column' => $this->yylloc['last_column'], | ||||
'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]), | 'last_column' => $lines ? @strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + @strlen($match[0]), | ||||
); | ); | ||||
$this->yytext .= $match[0]; | $this->yytext .= $match[0]; | ||||
$this->match .= $match[0]; | $this->match .= $match[0]; | ||||
$this->yyleng = strlen($this->yytext); | $this->yyleng = @strlen($this->yytext); | ||||
$this->more = false; | $this->more = false; | ||||
$this->input = substr($this->input, strlen($match[0])); | $this->input = @substr($this->input, @strlen($match[0])); | ||||
$this->matched .= $match[0]; | $this->matched .= $match[0]; | ||||
$token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]); | $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]); | ||||
if ($token) { | if ($token) { | ||||
Context not available. | |||||
return 6; | return 6; | ||||
break; | break; | ||||
case 2: | case 2: | ||||
$this->yytext = substr($this->yytext, 1, $this->yyleng-2); | $this->yytext = @substr($this->yytext, 1, $this->yyleng-2); | ||||
return 4; | return 4; | ||||
case 3: | case 3: | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0