Skip to content

Commit 0ccc3a2

Browse files
committed
Introduced the buffered query parser. This is used to extract statements from a
buffered string that may be parsed using the parser. DELIMITER is no longer reported as unexpected beginning of statement. Fixed typos.
1 parent 77d5409 commit 0ccc3a2

5 files changed

Lines changed: 404 additions & 4 deletions

File tree

src/Components/ExpressionArray.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Parses a a list of expression delimited by a comma.
4+
* Parses a a list of expressions delimited by a comma.
55
*
66
* @package SqlParser
77
* @subpackage Components
@@ -14,7 +14,7 @@
1414
use SqlParser\TokensList;
1515

1616
/**
17-
* Parses a a list of expression delimited by a comma.
17+
* Parses a a list of expressions delimited by a comma.
1818
*
1919
* @category Keywords
2020
* @package SqlParser

src/Parser.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,16 @@ public function parse()
368368
*/
369369
$token = $list->tokens[$list->idx];
370370

371+
// `DELIMITER` is not an actual statement and it requires
372+
// special handling.
373+
if (($token->type === Token::TYPE_NONE)
374+
&& (strtoupper($token->token) === 'DELIMITER')
375+
) {
376+
// Skipping to the end of this statement.
377+
$list->getNextOfType(Token::TYPE_DELIMITER);
378+
continue;
379+
}
380+
371381
// Statements can start with keywords only.
372382
// Comments, whitespaces, etc. are ignored.
373383
if ($token->type !== Token::TYPE_KEYWORD) {

0 commit comments

Comments
 (0)