@@ -43,10 +43,6 @@ ql_statement
4343 ;
4444
4545select_statement
46- : select_query
47- ;
48-
49- select_query
5046 : select_clause from_clause (where_clause)? (groupby_clause)? (having_clause)? (orderby_clause)? (set_fuction)?
5147 ;
5248
@@ -57,11 +53,7 @@ setOperator
5753 ;
5854
5955set_fuction
60- : setOperator set_function_select
61- ;
62-
63- set_function_select
64- : select_query
56+ : setOperator select_statement
6557 ;
6658
6759update_statement
9587 ;
9688
9789fetch_join
98- : join_spec FETCH join_association_path_expression
90+ : join_spec FETCH join_association_path_expression AS ? identification_variable? join_condition?
9991 ;
10092
10193join_spec
@@ -315,7 +307,7 @@ scalar_expression
315307 | datetime_expression
316308 | boolean_expression
317309 | case_expression
318- | cast_expression
310+ | cast_function
319311 | entity_type_expression
320312 ;
321313
@@ -446,6 +438,7 @@ arithmetic_primary
446438 | functions_returning_numerics
447439 | aggregate_expression
448440 | case_expression
441+ | cast_function
449442 | function_invocation
450443 | ' (' subquery ' )'
451444 ;
@@ -458,7 +451,6 @@ string_expression
458451 | aggregate_expression
459452 | case_expression
460453 | function_invocation
461- | string_expression op=' ||' string_expression
462454 | ' (' subquery ' )'
463455 | string_expression ' ||' string_expression
464456 ;
@@ -544,8 +536,8 @@ functions_returning_strings
544536 | SUBSTRING ' (' string_expression ' ,' arithmetic_expression (' ,' arithmetic_expression)? ' )'
545537 | TRIM ' (' ((trim_specification)? (trim_character)? FROM )? string_expression ' )'
546538 | LOWER ' (' string_expression ' )'
547- | REPLACE ' (' string_expression ' ,' string_expression ' ,' string_expression ' )'
548539 | UPPER ' (' string_expression ' )'
540+ | REPLACE ' (' string_expression ' ,' string_expression ' ,' string_expression ' )'
549541 | LEFT ' (' string_expression ' ,' arithmetic_expression ' )'
550542 | RIGHT ' (' string_expression ' ,' arithmetic_expression ' )'
551543 ;
@@ -556,6 +548,9 @@ trim_specification
556548 | BOTH
557549 ;
558550
551+ cast_function
552+ : CAST ' (' single_valued_path_expression (identification_variable)? identification_variable (' (' numeric_literal (' ,' numeric_literal)* ' )' )? ' )'
553+ ;
559554
560555function_invocation
561556 : FUNCTION ' (' function_name (' ,' function_arg)* ' )'
@@ -620,9 +615,6 @@ nullif_expression
620615 : NULLIF ' (' scalar_expression ' ,' scalar_expression ' )'
621616 ;
622617
623- cast_expression
624- : CAST ' (' string_expression AS type_literal ' )'
625- ;
626618
627619/* ******************
628620 Gaps in the spec.
@@ -636,6 +628,7 @@ trim_character
636628identification_variable
637629 : IDENTIFICATION_VARIABLE
638630 | f=(COUNT
631+ | AS
639632 | DATE
640633 | FROM
641634 | INNER
@@ -651,6 +644,7 @@ identification_variable
651644 | TIME
652645 | TYPE
653646 | VALUE )
647+ | type_literal
654648 ;
655649
656650constructor_name
@@ -678,6 +672,9 @@ pattern_value
678672
679673date_time_timestamp_literal
680674 : STRINGLITERAL
675+ | DATELITERAL
676+ | TIMELITERAL
677+ | TIMESTAMPLITERAL
681678 ;
682679
683680entity_type_literal
@@ -974,9 +971,10 @@ ON : O N;
974971OR : O R ;
975972ORDER : O R D E R ;
976973OUTER : O U T E R ;
974+ POWER : P O W E R ;
975+ REGEXP : R E G E X P ;
977976REPLACE : R E P L A C E ;
978977RIGHT : R I G H T ;
979- POWER : P O W E R ;
980978ROUND : R O U N D ;
981979SELECT : S E L E C T ;
982980SET : S E T ;
@@ -1006,8 +1004,11 @@ NOT_EQUAL : '<>' | '!=' ;
10061004
10071005CHARACTER : ' \' ' (~ (' \' ' | ' \\ ' )) ' \' ' ;
10081006IDENTIFICATION_VARIABLE : (' a' .. ' z' | ' A' .. ' Z' | ' \u0080 ' .. ' \ufffe ' | ' $' | ' _' ) (' a' .. ' z' | ' A' .. ' Z' | ' \u0080 ' .. ' \ufffe ' | ' 0' .. ' 9' | ' $' | ' _' )* ;
1009- STRINGLITERAL : ' \' ' (~ (' \' ' | ' \\ ' ))* ' \' ' ;
1007+ STRINGLITERAL : ' \' ' (~ (' \' ' | ' \\ ' )| ' \\ ' )* ' \' ' ;
10101008JAVASTRINGLITERAL : ' "' ( (' \\ ' [btnfr" ']) | ~('" ' ))* ' " ';
10111009FLOATLITERAL : ('0' .. '9')* '.' ('0' .. '9')+ (E ('0' .. '9')+)* (F|D)?;
10121010INTLITERAL : ('0' .. '9')+ ;
1013- LONGLITERAL : ('0' .. '9')+L ;
1011+ LONGLITERAL : ('0' .. '9')+ L;
1012+ DATELITERAL : '{' D STRINGLITERAL '}';
1013+ TIMELITERAL : '{' T STRINGLITERAL '}';
1014+ TIMESTAMPLITERAL : '{' T S STRINGLITERAL '}';
0 commit comments