From: <ibr...@us...> - 2010-05-21 08:35:27
|
Revision: 3530 http://tora.svn.sourceforge.net/tora/?rev=3530&view=rev Author: ibre5041 Date: 2010-05-21 08:35:21 +0000 (Fri, 21 May 2010) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/sandbox/SELECT_SIMPLE.g Modified: branches/tora-trotl/sandbox/SELECT_SIMPLE.g =================================================================== --- branches/tora-trotl/sandbox/SELECT_SIMPLE.g 2010-05-20 07:39:17 UTC (rev 3529) +++ branches/tora-trotl/sandbox/SELECT_SIMPLE.g 2010-05-21 08:35:21 UTC (rev 3530) @@ -51,18 +51,18 @@ tokens { T_RESERVED = 'reserved'; - T_WITH = 'with'; + T_WITH = 't_with'; T_SELECT = 't_select'; - T_COLUMN_LIST = 'column_list'; - T_SELECT_COLUMN = 'select_column'; + T_COLUMN_LIST = 't_column_list'; + T_SELECT_COLUMN = 't_select_column'; T_FROM = 'from'; T_SELECTED_TABLE = 'selected_table'; - T_WHERE = 'where'; - T_HIERARCHICAL = 'hierarchical'; - T_GROUP_BY = 'group_by'; - T_HAVING = 'having'; + T_WHERE = 't_where'; + T_HIERARCHICAL = 't_hierarchical'; + T_GROUP_BY = 't_group_by'; + T_HAVING = 't_having'; T_MODEL = 't_model'; - T_SET_OP = 'set_op'; + T_UNION = 't_union'; T_ORDER_BY_CLAUSE='t_order_by'; } @@ -116,13 +116,14 @@ where_clause? hierarchical_query_clause? //TODO TEST ME model_clause? + union_clause? order_by_clause? ) ; subquery_factoring_clause - : /*'WITH'*/k_with sql_identifier /*'AS'*/k_as subquery (COMMA sql_identifier /*'AS'*/k_as subquery)* - //->^('with' 'WITH' (sql_identifier 'AS' subquery)+ ) + : k_with sql_identifier (LPAREN select_list RPAREN)? k_as subquery (COMMA sql_identifier k_as subquery)* + //->^('t_with' 'WITH' select_list? (sql_identifier 'AS' subquery)+ ) //TODO comma is missing here ; @@ -131,7 +132,7 @@ ================================================================================ */ select_list : displayed_column ( COMMA displayed_column )* - -> ^('column_list' displayed_column*) + -> ^('t_column_list' displayed_column*) ; displayed_column @@ -580,9 +581,22 @@ bracket_literals_list : bracket_literals ( COMMA bracket_literals )* ; + /* ================================================================================ ORDER BY clause ================================================================================ */ +union_clause + : + ( /*'UNION'*/k_union ( /*'ALL'*/k_all )? + | /*'INTERSECT'*/k_intersect + | /*'MINUS'*/k_minus + ) + ( select_expression | subquery ) + ; + +/* ================================================================================ + ORDER BY clause + ================================================================================ */ order_by_clause : 'ORDER' 'SIBLINGS'? 'BY' ( sql_expression 'ASC'? 'DESC'? ('NULLS' 'FIRST')? ('NULLS' 'LAST')? ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |