Add Lexer::parse method to explicit call parser methods #489
Annotations
1 error and 11 warnings
Mutation tests with PHP 8.1
Process completed with exit code 1.
|
Mutation tests with PHP 8.1:
src/Lexer.php#L213
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
$list->tokens[$list->count++] = $token;
// Handling delimiters.
if ($token->type === TokenType::None && $token->value === 'DELIMITER') {
- if ($this->last + 1 >= $this->len) {
+ if ($this->last + 2 >= $this->len) {
$this->error('Expected whitespace(s) before delimiter.', '', $this->last + 1);
continue;
}
|
Mutation tests with PHP 8.1:
src/Lexer.php#L240
Escaped Mutant for Mutator "LessThan":
--- Original
+++ New
@@ @@
// Parsing the delimiter.
$this->delimiter = null;
$delimiterLen = 0;
- while (++$this->last < $this->len && !Context::isWhitespace($this->str[$this->last]) && $delimiterLen < 15) {
+ while (++$this->last <= $this->len && !Context::isWhitespace($this->str[$this->last]) && $delimiterLen < 15) {
$this->delimiter .= $this->str[$this->last];
++$delimiterLen;
}
|
Mutation tests with PHP 8.1:
src/Lexer.php#L367
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
*
* @throws LexerException throws the exception, if strict mode is enabled.
*/
- public function error($msg, $str = '', $pos = 0, $code = 0) : void
+ public function error($msg, $str = '', $pos = -1, $code = 0) : void
{
$error = new LexerException(Translator::gettext($msg), $str, $pos, $code);
parent::error($error);
|
Mutation tests with PHP 8.1:
src/Lexer.php#L367
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
*
* @throws LexerException throws the exception, if strict mode is enabled.
*/
- public function error($msg, $str = '', $pos = 0, $code = 0) : void
+ public function error($msg, $str = '', $pos = 1, $code = 0) : void
{
$error = new LexerException(Translator::gettext($msg), $str, $pos, $code);
parent::error($error);
|
Mutation tests with PHP 8.1:
src/Lexer.php#L409
Escaped Mutant for Mutator "Decrement":
--- Original
+++ New
@@ @@
// keywords.
if (Context::isWhitespace($this->str[$this->last])) {
if ($lastSpace) {
- --$j;
+ ++$j;
// The size of the keyword didn't increase.
continue;
}
|
Mutation tests with PHP 8.1:
src/Lexer.php#L462
Escaped Mutant for Mutator "Break_":
--- Original
+++ New
@@ @@
$token .= $this->str[$this->last];
$ret = new Token($token, TokenType::Label);
$iEnd = $this->last;
- break;
+ continue;
}
if (Context::isWhitespace($this->str[$this->last]) && $j > 1) {
// Whitespace between label and :
|
Mutation tests with PHP 8.1:
src/Lexer.php#L548
Escaped Mutant for Mutator "LessThan":
--- Original
+++ New
@@ @@
$token = $this->str[$this->last];
// Bash style comments. (#comment\n)
if (Context::isComment($token)) {
- while (++$this->last < $this->len && $this->str[$this->last] !== "\n") {
+ while (++$this->last <= $this->len && $this->str[$this->last] !== "\n") {
$token .= $this->str[$this->last];
}
// Include trailing \n as whitespace token
|
Mutation tests with PHP 8.1:
src/Lexer.php#L553
Escaped Mutant for Mutator "LessThan":
--- Original
+++ New
@@ @@
$token .= $this->str[$this->last];
}
// Include trailing \n as whitespace token
- if ($this->last < $this->len) {
+ if ($this->last <= $this->len) {
--$this->last;
}
return new Token($token, TokenType::Comment, Token::FLAG_COMMENT_BASH);
|
Mutation tests with PHP 8.1:
src/Lexer.php#L569
Escaped Mutant for Mutator "LessThan":
--- Original
+++ New
@@ @@
// - "SELECT */* comment */ FROM ..."
// - "SELECT 2*/* comment */3 AS `six`;"
$next = $this->last + 1;
- if ($next < $this->len && $this->str[$next] === '*') {
+ if ($next <= $this->len && $this->str[$next] === '*') {
// Conflict in "*/*": first "*" was not for ending a comment.
// Stop here and let other parsing method define the true behavior of that first star.
$this->last = $iBak;
|
Mutation tests with PHP 8.1:
src/Lexer.php#L586
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
return new Token($token, TokenType::Comment, $flags);
}
// Checking if this is a MySQL-specific command.
- if ($this->last + 1 < $this->len && $this->str[$this->last + 1] === '!') {
+ if ($this->last + 0 < $this->len && $this->str[$this->last + 1] === '!') {
$flags |= Token::FLAG_COMMENT_MYSQL_CMD;
$token .= $this->str[++$this->last];
while (++$this->last < $this->len && $this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') {
|
Mutation tests with PHP 8.1
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|