1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-11-05 00:44:21 +03:00

Fix failing tests.

Updated sql-parser library.

Signed-off-by: Dan Ungureanu <udan1107@gmail.com>
This commit is contained in:
Dan Ungureanu
2015-06-30 01:06:44 +03:00
parent 46e44ed0d5
commit d2b5498565
36 changed files with 566 additions and 248 deletions

View File

@@ -26,6 +26,20 @@ use SqlParser\Fragments\OptionsFragment;
abstract class Statement
{
/**
* The clauses of this statement, in order.
*
* The value attributed to each clause is used by the builder and it may
* have one of the following values:
*
* - 1 = 01 - add the clause only
* - 2 = 10 - add the keyword
* - 3 = 11 - add both the keyword and the clause
*
* @var array
*/
public static $CLAUSES;
/**
* The options of this query.
*
@@ -59,8 +73,6 @@ abstract class Statement
*/
public function parse(Parser $parser, TokensList $list)
{
$this->first = $list->idx;
/**
* Whether options were parsed or not.
* For statements that do not have any options this is set to `true` by
@@ -70,7 +82,6 @@ abstract class Statement
$parsedOptions = isset(static::$OPTIONS) ? false : true;
for (; $list->idx < $list->count; ++$list->idx) {
/**
* Token parsed at this moment.
* @var Token
@@ -88,6 +99,12 @@ abstract class Statement
continue;
}
// Unions are parsed by the parser because they represent more than
// one statement.
if ($token->value === 'UNION') {
break;
}
/**
* The name of the class that is used for parsing.
* @var string
@@ -124,7 +141,7 @@ abstract class Statement
);
$parsedOptions = true;
}
} else if ($class === null) {
} elseif ($class === null) {
// There is no parser for this keyword and isn't the beggining
// of a statement (so no options) either.
$parser->error(
@@ -145,11 +162,11 @@ abstract class Statement
$this->after($parser, $list, $token);
}
$this->last = $list->idx--; // Go back to last used token.
--$list->idx; // Go back to last used token.
}
/**
* Function called before the token was processed.
* Function called before the token is processed.
*
* @param Parser $parser The instance that requests parsing.
* @param TokensList $list The list of tokens to be parsed.
@@ -175,5 +192,4 @@ abstract class Statement
{
}
}