@@ -427,33 +427,32 @@ public static function parse(Parser $parser, TokensList $list, array $options =
427427 break ;
428428 }
429429 } elseif (! self ::checkIfTokenQuotedSymbol ($ token )) {
430- if (! empty (Parser::$ STATEMENT_PARSERS [$ token ->value ])) {
430+ // If the current token is "SET" or "ENUM", we want to avoid the token between their parenthesis in
431+ // the unknown tokens.
432+ if (in_array ($ token ->value , ['SET ' , 'ENUM ' ], true )) {
431433 $ list ->idx ++; // Ignore the current token
432434 $ nextToken = $ list ->getNext ();
433435
434- if (
435- in_array ($ token ->value , ['SET ' , 'ENUM ' ], true )
436- && $ nextToken !== null
437- && $ nextToken ->value === '( '
438- ) {
439- // To avoid adding the tokens between the SET() or ENUM() parentheses to the unknown tokens
436+ if ($ nextToken !== null && $ nextToken ->value === '( ' ) {
440437 $ list ->getNextOfTypeAndValue (Token::TYPE_OPERATOR , ') ' );
441- } elseif (
442- in_array ($ token ->value , ['SET ' , 'ENUM ' ], true )
443- && $ nextToken !== null
444- && $ nextToken ->value === 'DEFAULT '
445- ) {
438+ } elseif ($ nextToken !== null && $ nextToken ->value === 'DEFAULT ' ) {
446439 // to avoid adding the `DEFAULT` token to the unknown tokens.
447440 ++$ list ->idx ;
448441 } else {
449- // We have reached the end of ALTER operation and suddenly found
450- // a start to new statement, but have not find a delimiter between them
451442 $ parser ->error (
452443 'A new statement was found, but no delimiter between it and the previous one. ' ,
453444 $ token
454445 );
455446 break ;
456447 }
448+ } elseif (! empty (Parser::$ statementParsers [$ token ->value ])) {
449+ // We have reached the end of ALTER operation and suddenly found
450+ // a start to new statement, but have not found a delimiter between them
451+ $ parser ->error (
452+ 'A new statement was found, but no delimiter between it and the previous one. ' ,
453+ $ token
454+ );
455+ break ;
457456 } elseif (
458457 (array_key_exists ($ arrayKey , self ::$ DB_OPTIONS )
459458 || array_key_exists ($ arrayKey , self ::$ TABLE_OPTIONS ))
0 commit comments