From: <asf...@us...> - 2010-06-20 23:11:23
|
Revision: 51275 http://firebird.svn.sourceforge.net/firebird/?rev=51275&view=rev Author: asfernandes Date: 2010-06-20 23:11:17 +0000 (Sun, 20 Jun 2010) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-06-20 14:49:34 UTC (rev 51274) +++ firebird/trunk/src/dsql/parse.y 2010-06-20 23:11:17 UTC (rev 51275) @@ -666,7 +666,7 @@ %type <legacyNode> column_constraint_def column_constraint_list column_def %type <legacyNode> column_list column_name column_parens column_parens_opt column_select -%type <legacyNode> column_singleton comment commit comparison_predicate complex_proc_statement +%type <legacyNode> column_singleton commit comparison_predicate complex_proc_statement %type <legacyNode> computed_by computed_clause conditional constant continue constraint_index_opt %type <legacyNode> constraint_name_opt containing_predicate correlation_name create %type <legacyNode> create_clause create_or_alter create_user_clause cross_join current_role @@ -814,7 +814,7 @@ %type <boolVal> release_only_opt -%type <ddlNode> alter_charset_clause generator_clause +%type <ddlNode> alter_charset_clause comment generator_clause %type <stmtNode> if_then_else in_autonomous_transaction excp_statement raise_statement %type <execBlockNode> exec_block @@ -843,38 +843,39 @@ // list of possible statements -top : statement - { DSQL_parse = $1; } - | statement ';' - { DSQL_parse = $1; } - ; +top + : statement + { DSQL_parse = $1; } + | statement ';' + { DSQL_parse = $1; } + ; -statement : alter - | blob_io - | comment - | commit - | create - | create_or_alter - | declare - | delete - | drop - | grant - | insert - | merge - | exec_procedure - | exec_block - { - $$ = makeClassNode($1); - } - | recreate - | revoke - | rollback - | savepoint - | select - | set - | update - | update_or_insert - ; +statement + : alter + | blob_io + | comment + { $$ = makeClassNode($1); } + | commit + | create + | create_or_alter + | declare + | delete + | drop + | grant + | insert + | merge + | exec_procedure + | exec_block + { $$ = makeClassNode($1); } + | recreate + | revoke + | rollback + | savepoint + | select + | set + | update + | update_or_insert + ; // GRANT statement @@ -4031,18 +4032,18 @@ comment : COMMENT ON ddl_type0 IS ddl_desc { - $$ = makeClassNode(FB_NEW(getPool()) CommentOnNode(getPool(), compilingText, $3, - "", "", ($5 ? toString($5) : ""), ($5 ? $5->str_charset : NULL))); + $$ = FB_NEW(getPool()) CommentOnNode(getPool(), compilingText, $3, + "", "", ($5 ? toString($5) : ""), ($5 ? $5->str_charset : NULL)); } | COMMENT ON ddl_type1 symbol_ddl_name IS ddl_desc { - $$ = makeClassNode(FB_NEW(getPool()) CommentOnNode(getPool(), compilingText, $3, - toName($4), "", ($6 ? toString($6) : ""), ($6 ? $6->str_charset : NULL))); + $$ = FB_NEW(getPool()) CommentOnNode(getPool(), compilingText, $3, + toName($4), "", ($6 ? toString($6) : ""), ($6 ? $6->str_charset : NULL)); } | COMMENT ON ddl_type2 symbol_ddl_name ddl_subname IS ddl_desc { - $$ = makeClassNode(FB_NEW(getPool()) CommentOnNode(getPool(), compilingText, $3, - toName($4), toName($5), ($7 ? toString($7) : ""), ($7 ? $7->str_charset : NULL))); + $$ = FB_NEW(getPool()) CommentOnNode(getPool(), compilingText, $3, + toName($4), toName($5), ($7 ? toString($7) : ""), ($7 ? $7->str_charset : NULL)); } ; @@ -6694,31 +6695,31 @@ return STRING; } -/* - * Check for a numeric constant, which starts either with a digit or with - * a decimal point followed by a digit. - * - * This code recognizes the following token types: - * - * NUMBER: string of digits which fits into a 32-bit integer - * - * NUMBER64BIT: string of digits whose value might fit into an SINT64, - * depending on whether or not there is a preceding '-', which is to - * say that "9223372036854775808" is accepted here. - * - * SCALEDINT: string of digits and a single '.', where the digits - * represent a value which might fit into an SINT64, depending on - * whether or not there is a preceding '-'. - * - * FLOAT: string of digits with an optional '.', and followed by an "e" - * or "E" and an optionally-signed exponent. - * - * NOTE: we swallow leading or trailing blanks, but we do NOT accept - * embedded blanks: - * - * Another note: c is the first character which need to be considered, - * ptr points to the next character. - */ + /* + * Check for a numeric constant, which starts either with a digit or with + * a decimal point followed by a digit. + * + * This code recognizes the following token types: + * + * NUMBER: string of digits which fits into a 32-bit integer + * + * NUMBER64BIT: string of digits whose value might fit into an SINT64, + * depending on whether or not there is a preceding '-', which is to + * say that "9223372036854775808" is accepted here. + * + * SCALEDINT: string of digits and a single '.', where the digits + * represent a value which might fit into an SINT64, depending on + * whether or not there is a preceding '-'. + * + * FLOAT: string of digits with an optional '.', and followed by an "e" + * or "E" and an optionally-signed exponent. + * + * NOTE: we swallow leading or trailing blanks, but we do NOT accept + * embedded blanks: + * + * Another note: c is the first character which need to be considered, + * ptr points to the next character. + */ fb_assert(lex.ptr <= lex.end); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-09-18 18:19:27
|
Revision: 51573 http://firebird.svn.sourceforge.net/firebird/?rev=51573&view=rev Author: asfernandes Date: 2010-09-18 18:19:21 +0000 (Sat, 18 Sep 2010) Log Message: ----------- Simplificate repetitive code Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-09-18 18:18:35 UTC (rev 51572) +++ firebird/trunk/src/dsql/parse.y 2010-09-18 18:19:21 UTC (rev 51573) @@ -870,14 +870,16 @@ %type <sysFuncCallNode> system_function_special_syntax // Predicates -%type <boolExprNode> between_predicate comparison_predicate containing_predicate distinct_predicate -%type <boolExprNode> exists_predicate in_predicate like_predicate null_predicate predicate -%type <boolExprNode> quantified_predicate similar_predicate singular_predicate starting_predicate +%type <boolExprNode> between_predicate comparison_predicate distinct_predicate +%type <boolExprNode> exists_predicate in_predicate binary_pattern_predicate ternary_pattern_predicate null_predicate predicate +%type <boolExprNode> quantified_predicate singular_predicate %type <boolExprNode> trigger_action_predicate %type <boolExprNode> search_condition_impl -%type <blrOp> comparison_operator +%type <blrOp> binary_pattern_operator ternary_pattern_operator comparison_operator %type <cmpBoolFlag> quantified_flag +%type <legacyNode> escape_opt +%type <intVal> trigger_action_code %% @@ -4886,14 +4888,12 @@ : comparison_predicate | distinct_predicate | between_predicate - | like_predicate + | binary_pattern_predicate + | ternary_pattern_predicate | in_predicate | null_predicate | quantified_predicate | exists_predicate - | containing_predicate - | similar_predicate - | starting_predicate | singular_predicate | trigger_action_predicate | '(' search_condition_impl ')' @@ -4961,27 +4961,46 @@ } ; -like_predicate - : value LIKE value - { $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_like, $1, $3); } - | value NOT LIKE value +binary_pattern_predicate + : value binary_pattern_operator value + { $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), $2, $1, $3); } + | value NOT binary_pattern_operator value { - ComparativeBoolNode* likeNode = FB_NEW(getPool()) ComparativeBoolNode(getPool(), - blr_like, $1, $4); + ComparativeBoolNode* containingNode = FB_NEW(getPool()) ComparativeBoolNode(getPool(), + $3, $1, $4); - $$ = FB_NEW(getPool()) NotBoolNode(getPool(), makeClassNode(likeNode)); + $$ = FB_NEW(getPool()) NotBoolNode(getPool(), makeClassNode(containingNode)); } - | value LIKE value ESCAPE value - { $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_like, $1, $3, $5); } - | value NOT LIKE value ESCAPE value + ; + +binary_pattern_operator + : CONTAINING { $$ = blr_containing; } + | STARTING { $$ = blr_starting; } + | STARTING WITH { $$ = blr_starting; } + ; + +ternary_pattern_predicate + : value ternary_pattern_operator value escape_opt + { $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), $2, $1, $3, $4); } + | value NOT ternary_pattern_operator value escape_opt { ComparativeBoolNode* likeNode = FB_NEW(getPool()) ComparativeBoolNode(getPool(), - blr_like, $1, $4, $6); + $3, $1, $4, $5); $$ = FB_NEW(getPool()) NotBoolNode(getPool(), makeClassNode(likeNode)); } ; +ternary_pattern_operator + : LIKE { $$ = blr_like; } + | SIMILAR { $$ = blr_similar; } + ; + +escape_opt + : { $$ = NULL; } + | ESCAPE value { $$ = $2; } + ; + in_predicate : value KW_IN in_predicate_value { @@ -4999,60 +5018,6 @@ } ; -containing_predicate - : value CONTAINING value - { $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_containing, $1, $3); } - | value NOT CONTAINING value - { - ComparativeBoolNode* containingNode = FB_NEW(getPool()) ComparativeBoolNode(getPool(), - blr_containing, $1, $4); - - $$ = FB_NEW(getPool()) NotBoolNode(getPool(), makeClassNode(containingNode)); - } - ; - -similar_predicate - : value SIMILAR TO value - { $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_similar, $1, $4); } - | value NOT SIMILAR TO value - { - ComparativeBoolNode* similarNode = FB_NEW(getPool()) ComparativeBoolNode(getPool(), - blr_similar, $1, $5); - - $$ = FB_NEW(getPool()) NotBoolNode(getPool(), makeClassNode(similarNode)); - } - | value SIMILAR TO value ESCAPE value - { $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_similar, $1, $4, $6); } - | value NOT SIMILAR TO value ESCAPE value - { - ComparativeBoolNode* similarNode = FB_NEW(getPool()) ComparativeBoolNode(getPool(), - blr_similar, $1, $5, $7); - - $$ = FB_NEW(getPool()) NotBoolNode(getPool(), makeClassNode(similarNode)); - } - ; - -starting_predicate - : value STARTING value - { $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_starting, $1, $3); } - | value NOT STARTING value - { - ComparativeBoolNode* startingNode = FB_NEW(getPool()) ComparativeBoolNode(getPool(), - blr_starting, $1, $4); - - $$ = FB_NEW(getPool()) NotBoolNode(getPool(), makeClassNode(startingNode)); - } - | value STARTING WITH value - { $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_starting, $1, $4); } - | value NOT STARTING WITH value - { - ComparativeBoolNode* startingNode = FB_NEW(getPool()) ComparativeBoolNode(getPool(), - blr_starting, $1, $5); - - $$ = FB_NEW(getPool()) NotBoolNode(getPool(), makeClassNode(startingNode)); - } - ; - exists_predicate : EXISTS '(' select_expr ')' { $$ = FB_NEW(getPool()) RseBoolNode(getPool(), blr_any, $3); } @@ -5074,29 +5039,21 @@ ; trigger_action_predicate - : INSERTING + : trigger_action_code { InternalInfoNode* infoNode = FB_NEW(getPool()) InternalInfoNode(getPool(), MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_TRIGGER_ACTION))); $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_eql, - makeClassNode(infoNode), MAKE_const_slong(1)); + makeClassNode(infoNode), MAKE_const_slong($1)); } - | UPDATING - { - InternalInfoNode* infoNode = FB_NEW(getPool()) InternalInfoNode(getPool(), - MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_TRIGGER_ACTION))); - $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_eql, - makeClassNode(infoNode), MAKE_const_slong(2)); - } - | DELETING - { - InternalInfoNode* infoNode = FB_NEW(getPool()) InternalInfoNode(getPool(), - MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_TRIGGER_ACTION))); - $$ = FB_NEW(getPool()) ComparativeBoolNode(getPool(), blr_eql, - makeClassNode(infoNode), MAKE_const_slong(3)); - } ; +trigger_action_code + : INSERTING { $$ = 1; } + | UPDATING { $$ = 2; } + | DELETING { $$ = 3; } + ; + // set values in_predicate_value : table_subquery This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2010-09-24 14:55:51
|
Revision: 51603 http://firebird.svn.sourceforge.net/firebird/?rev=51603&view=rev Author: hvlad Date: 2010-09-24 14:55:45 +0000 (Fri, 24 Sep 2010) Log Message: ----------- Fixed SIMILAR TO syntax Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-09-24 11:34:09 UTC (rev 51602) +++ firebird/trunk/src/dsql/parse.y 2010-09-24 14:55:45 UTC (rev 51603) @@ -4992,8 +4992,8 @@ ; ternary_pattern_operator - : LIKE { $$ = blr_like; } - | SIMILAR { $$ = blr_similar; } + : LIKE { $$ = blr_like; } + | SIMILAR TO { $$ = blr_similar; } ; escape_opt This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-10-24 21:35:52
|
Revision: 51764 http://firebird.svn.sourceforge.net/firebird/?rev=51764&view=rev Author: asfernandes Date: 2010-10-24 21:35:45 +0000 (Sun, 24 Oct 2010) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-10-24 03:13:20 UTC (rev 51763) +++ firebird/trunk/src/dsql/parse.y 2010-10-24 21:35:45 UTC (rev 51764) @@ -4260,48 +4260,61 @@ // SELECT expression -select_expr : with_clause select_expr_body order_clause rows_clause - { $$ = make_node (nod_select_expr, (int) e_sel_count, $2, $3, $4, $1); } - ; +select_expr + : with_clause select_expr_body order_clause rows_clause + { $$ = make_node (nod_select_expr, (int) e_sel_count, $2, $3, $4, $1); } + ; -with_clause : WITH RECURSIVE with_list - { $$ = make_flag_node (nod_with, NOD_UNION_RECURSIVE, 1, make_list($3)); } - | WITH with_list - { $$ = make_node (nod_with, 1, make_list($2)); } - | - { $$ = NULL; } - ; +with_clause + : + { $$ = NULL; } + | WITH RECURSIVE with_list + { $$ = make_flag_node (nod_with, NOD_UNION_RECURSIVE, 1, make_list($3)); } + | WITH with_list + { $$ = make_node (nod_with, 1, make_list($2)); } + ; -with_list : with_item - | with_item ',' with_list - { $$ = make_node (nod_list, 2, $1, $3); } - ; +with_list + : with_item + | with_item ',' with_list + { $$ = make_node (nod_list, 2, $1, $3); } + ; -with_item : symbol_table_alias_name derived_column_list AS '(' select_expr ')' - { $$ = make_node (nod_derived_table, (int) e_derived_table_count, $5, $1, $2, NULL); } - ; +with_item + : symbol_table_alias_name derived_column_list AS '(' select_expr ')' + { $$ = make_node (nod_derived_table, (int) e_derived_table_count, $5, $1, $2, NULL); } + ; -column_select : with_clause select_expr_body order_clause rows_clause - { $$ = make_flag_node (nod_select_expr, NOD_SELECT_EXPR_VALUE, - (int) e_sel_count, $2, $3, $4, $1); } - ; +column_select + : select_expr + { + $$ = $1; + $$->nod_flags |= NOD_SELECT_EXPR_VALUE; + } + ; -column_singleton : with_clause select_expr_body order_clause rows_clause - { $$ = make_flag_node (nod_select_expr, NOD_SELECT_EXPR_VALUE | NOD_SELECT_EXPR_SINGLETON, - (int) e_sel_count, $2, $3, $4, $1); } - ; +column_singleton + : column_select + { + $$ = $1; + $$->nod_flags |= NOD_SELECT_EXPR_SINGLETON; + } + ; -select_expr_body : query_term - | select_expr_body UNION distinct_noise query_term - { $$ = make_node (nod_list, 2, $1, $4); } - | select_expr_body UNION ALL query_term - { $$ = make_flag_node (nod_list, NOD_UNION_ALL, 2, $1, $4); } - ; +select_expr_body + : query_term + | select_expr_body UNION distinct_noise query_term + { $$ = make_node (nod_list, 2, $1, $4); } + | select_expr_body UNION ALL query_term + { $$ = make_flag_node (nod_list, NOD_UNION_ALL, 2, $1, $4); } + ; -query_term : query_spec - ; +query_term + : query_spec + ; -query_spec : SELECT limit_clause +query_spec + : SELECT limit_clause distinct_clause select_list from_clause @@ -4309,18 +4322,19 @@ group_clause having_clause plan_clause - { $$ = make_node (nod_query_spec, (int) e_qry_count, $2, $3, $4, $5, $6, $7, $8, $9); } - ; + { $$ = make_node (nod_query_spec, (int) e_qry_count, $2, $3, $4, $5, $6, $7, $8, $9); } + ; -limit_clause : first_clause skip_clause - { $$ = make_node (nod_limit, (int) e_limit_count, $2, $1); } - | first_clause - { $$ = make_node (nod_limit, (int) e_limit_count, NULL, $1); } - | skip_clause - { $$ = make_node (nod_limit, (int) e_limit_count, $1, NULL); } - | - { $$ = 0; } - ; +limit_clause + : + { $$ = NULL; } + | first_clause skip_clause + { $$ = make_node (nod_limit, (int) e_limit_count, $2, $1); } + | first_clause + { $$ = make_node (nod_limit, (int) e_limit_count, NULL, $1); } + | skip_clause + { $$ = make_node (nod_limit, (int) e_limit_count, $1, NULL); } + ; first_clause : FIRST long_integer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-10-30 16:51:26
|
Revision: 51803 http://firebird.svn.sourceforge.net/firebird/?rev=51803&view=rev Author: asfernandes Date: 2010-10-30 16:51:19 +0000 (Sat, 30 Oct 2010) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-10-30 03:14:04 UTC (rev 51802) +++ firebird/trunk/src/dsql/parse.y 2010-10-30 16:51:19 UTC (rev 51803) @@ -656,7 +656,7 @@ %type <legacyNode> array_spec array_type as_opt assignment assignments %type <legacyStr> admin_opt -%type <legacyNode> begin_string begin_trigger bit_length_expression +%type <legacyNode> begin_string begin_trigger %type <legacyNode> blob_filter_subtype blob_io blob_segsize blob_subtype blob_subtype_io %type <legacyNode> blob_subtype_value_io blob_type breakleave @@ -664,7 +664,7 @@ %type block_parameters(<parametersClause>) %type <legacyNode> case_abbreviation case_expression case_operand case_result case_specification -%type <legacyNode> cast_specification char_length_expression character_keyword character_type +%type <legacyNode> cast_specification character_keyword character_type %type <legacyNode> charset_clause check_constraint close_cursor col_opt collate_clause %type <legacyNode> column_constraint column_constraint_clause %type <legacyNode> column_constraint_def column_constraint_list column_def @@ -674,11 +674,11 @@ %type <legacyNode> column_singleton commit complex_proc_statement %type <legacyNode> computed_by computed_clause conditional constant continue constraint_index_opt %type <legacyNode> constraint_name_opt correlation_name create -%type <legacyNode> create_clause create_or_alter create_user_clause cross_join current_role -%type <legacyNode> current_user cursor_clause cursor_declaration_item cursor_def +%type <legacyNode> create_clause create_or_alter create_user_clause cross_join +%type <legacyNode> cursor_clause cursor_declaration_item cursor_def %type <legacyNode> cursor_statement -%type <legacyNode> data_type data_type_or_domain datetime_value_expression +%type <legacyNode> data_type data_type_or_domain %type <legacyNode> db_alter_clause db_clause db_file db_file_list db_initial_desc db_initial_desc1 %type <legacyNode> db_initial_option db_rem_desc db_rem_desc1 db_rem_option ddl_subname %type <legacyNode> decimal_keyword declare declare_clause @@ -695,14 +695,14 @@ %type <legacyNode> exec_function exec_into exec_procedure exec_sql exec_stmt_inputs %type <legacyNode> exec_stmt_option exec_stmt_options exec_stmt_options_list %type <legacyNode> ext_datasrc ext_privs ext_pwd ext_role ext_tran ext_user extra_indices_opt -%type <legacyNode> extract_expression execute_privilege +%type <legacyNode> execute_privilege %type <legacyStr> end_trigger entry_op %type <pathNamePtr> external_file %type <legacyNode> fetch_cursor fetch_opt fetch_scroll_opt file1 file_clause file_desc file_desc1 %type <legacyNode> filter_clause_io filter_decl_clause first_clause %type <legacyNode> float_type for_exec_into for_select for_update_clause for_update_list from_clause -%type <legacyNode> from_list full_proc_block full_proc_block_body function +%type <legacyNode> from_list full_proc_block full_proc_block_body %type <legacyStr> firstname_opt %type <int32Val> first_file_length @@ -715,7 +715,7 @@ %type <legacyNode> identity_clause in_predicate_value %type <legacyNode> index_definition index_list init_alter_db %type <legacyNode> ins_column_list ins_column_parens -%type <legacyNode> ins_column_parens_opt insert integer_keyword internal_info +%type <legacyNode> ins_column_parens_opt insert integer_keyword %type <legacyNode> iso_mode isolation_mode %type input_parameters(<parametersClause>) input_proc_parameter(<parametersClause>) %type input_proc_parameters(<parametersClause>) @@ -724,7 +724,7 @@ %type <legacyNode> keyword_or_column -%type <legacyNode> label_opt length_expression limit_clause +%type <legacyNode> label_opt limit_clause %type <legacyNode> local_declaration local_declaration_item local_declaration_list local_declarations %type <legacyNode> lock_clause lock_mode lock_type lock_wait %type <legacyStr> lastname_opt @@ -736,15 +736,14 @@ %type <legacyNode> named_columns_join named_param named_params_list national_character_keyword %type <legacyNode> national_character_type natural_join -%type <legacyNode> next_value_expression non_aggregate_function non_array_type +%type <legacyNode> non_array_type %type <legacyNode> non_charset_simple_type non_reserved_word non_role_grantee_list %type <legacyNode> not_named_param not_named_params_list null_constraint -%type <legacyNode> null_value nulls_clause nulls_placement numeric_type numeric_value_function +%type <legacyNode> nulls_clause nulls_placement numeric_type %type <int32Val> neg_short_integer nonneg_short_integer -%type <legacyNode> octet_length_expression open_cursor opt_snapshot optional_retain +%type <legacyNode> open_cursor opt_snapshot optional_retain %type <legacyNode> optional_savepoint optional_work order_clause order_direction order_item order_list -%type <legacyNode> over_clause %type output_parameters(<parametersClause>) output_proc_parameter(<parametersClause>) %type output_proc_parameters(<parametersClause>) @@ -776,14 +775,14 @@ %type <legacyNode> simple_column_name simple_package_name simple_proc_name simple_proc_statement simple_table_name %type <legacyNode> simple_type simple_when_clause singleton_select skip_clause %type <legacyNode> snap_shot statement stmt_start_column -%type <legacyNode> stmt_start_line string_length_opt string_value_function substring_function +%type <legacyNode> stmt_start_line string_length_opt %type <legacyNode> symbol_UDF_call_name symbol_UDF_name symbol_blob_subtype_name symbol_character_set_name %type <legacyNode> symbol_collation_name symbol_column_name symbol_constraint_name symbol_cursor_name %type <legacyNode> symbol_ddl_name symbol_domain_name symbol_exception_name symbol_filter_name %type <legacyNode> symbol_gdscode_name symbol_generator_name symbol_index_name symbol_item_alias_name %type <legacyNode> symbol_label_name symbol_procedure_name symbol_role_name symbol_savepoint_name %type <legacyNode> symbol_table_alias_name symbol_table_name symbol_trigger_name symbol_user_name -%type <legacyNode> symbol_variable_name symbol_view_name system_function_expression +%type <legacyNode> symbol_variable_name symbol_view_name %type <legacyNode> system_function_std_syntax %type <legacyStr> sql_string %type <int32Val> signed_long_integer signed_short_integer @@ -798,10 +797,9 @@ %type <legacyNode> table_list table_lock table_name table_or_alias_list table_primary %type <legacyNode> table_proc table_proc_inputs table_reference table_subquery tbl_reserve_options %type <legacyNode> top tra_misc_options tra_timeout tran_opt tran_opt_list tran_opt_list_m -%type <legacyNode> trim_function %type <uintVal> time_precision_opt timestamp_precision_opt -%type <legacyNode> u_constant u_numeric_constant udf udf_data_type udf_decl_clause undo_savepoint +%type <legacyNode> u_constant u_numeric_constant udf_data_type udf_decl_clause undo_savepoint %type <legacyNode> unique_constraint unique_opt update update_column_name %type <legacyNode> update_or_insert update_or_insert_matching_opt update_positioned update_rule %type <legacyNode> update_searched user_grantee user_grantee_list @@ -870,12 +868,17 @@ %type <blrOp> timestamp_part trim_specification +%type <exprNode> bit_length_expression char_length_expression current_role current_user +%type <exprNode> datetime_value_expression extract_expression function internal_info +%type <exprNode> length_expression next_value_expression non_aggregate_function null_value +%type <exprNode> numeric_value_function octet_length_expression over_clause string_value_function +%type <exprNode> substring_function system_function_expression trim_function udf + // Predicates %type <boolExprNode> between_predicate comparison_predicate distinct_predicate -%type <boolExprNode> exists_predicate in_predicate binary_pattern_predicate ternary_pattern_predicate null_predicate predicate -%type <boolExprNode> quantified_predicate singular_predicate -%type <boolExprNode> trigger_action_predicate -%type <boolExprNode> search_condition_impl +%type <boolExprNode> exists_predicate in_predicate binary_pattern_predicate +%type <boolExprNode> null_predicate predicate quantified_predicate search_condition_impl +%type <boolExprNode> singular_predicate ternary_pattern_predicate trigger_action_predicate %type <blrOp> binary_pattern_operator ternary_pattern_operator comparison_operator %type <cmpBoolFlag> quantified_flag @@ -1844,13 +1847,14 @@ ; -default_value : constant - | current_user - | current_role - | internal_info - | null_value - | datetime_value_expression - ; +default_value + : constant + | current_user { $$ = makeClassNode($1); } + | current_role { $$ = makeClassNode($1); } + | internal_info { $$ = makeClassNode($1); } + | null_value { $$ = makeClassNode($1); } + | datetime_value_expression { $$ = makeClassNode($1); } + ; column_constraint_clause : { $$ = NULL; } @@ -4788,12 +4792,12 @@ exec_function : udf { - $$ = make_node (nod_assign, e_asgn_count, $1, + $$ = make_node (nod_assign, e_asgn_count, makeClassNode($1), makeClassNode(FB_NEW(getPool()) NullNode(getPool()))); } | non_aggregate_function { - $$ = make_node (nod_assign, e_asgn_count, $1, + $$ = make_node (nod_assign, e_asgn_count, makeClassNode($1), makeClassNode(FB_NEW(getPool()) NullNode(getPool()))); } ; @@ -5159,13 +5163,16 @@ value : column_name | array_element | function + { $$ = makeClassNode($1); } | u_constant | parameter | variable | cast_specification | case_expression | next_value_expression + { $$ = makeClassNode($1); } | udf + { $$ = makeClassNode($1); } | '-' value %prec UMINUS { $$ = makeClassNode(FB_NEW(getPool()) NegateNode(getPool(), $2)); } | '+' value %prec UPLUS @@ -5199,8 +5206,11 @@ | '(' column_singleton ')' { $$ = $2; } | current_user + { $$ = makeClassNode($1); } | current_role + { $$ = makeClassNode($1); } | internal_info + { $$ = makeClassNode($1); } | DB_KEY { $$ = make_node (nod_dbkey, 1, NULL); } | symbol_table_alias_name '.' DB_KEY @@ -5208,7 +5218,9 @@ | KW_VALUE { $$ = make_node (nod_dom_value, 0, NULL); } | datetime_value_expression + { $$ = makeClassNode($1); } | null_value + { $$ = makeClassNode($1); } ; datetime_value_expression : CURRENT_DATE @@ -5227,7 +5239,7 @@ Arg::Str("DATE")); } - $$ = makeClassNode(FB_NEW(getPool()) CurrentDateNode(getPool())); + $$ = FB_NEW(getPool()) CurrentDateNode(getPool()); } | CURRENT_TIME time_precision_opt { @@ -5245,10 +5257,10 @@ Arg::Str("TIME")); } - $$ = makeClassNode(FB_NEW(getPool()) CurrentTimeNode(getPool(), $2)); + $$ = FB_NEW(getPool()) CurrentTimeNode(getPool(), $2); } | CURRENT_TIMESTAMP timestamp_precision_opt - { $$ = makeClassNode(FB_NEW(getPool()) CurrentTimeStampNode(getPool(), $2)); } + { $$ = FB_NEW(getPool()) CurrentTimeStampNode(getPool(), $2); } ; time_precision_opt @@ -5301,7 +5313,7 @@ u_constant : u_numeric_constant | sql_string - { $$ = MAKE_str_constant ($1, lex.att_charset); } + { $$ = MAKE_str_constant ($1, lex.att_charset); } | DATE STRING { if (client_dialect < SQL_DIALECT_V6_TRANSITION) @@ -5343,47 +5355,44 @@ ; current_user - : USER - { $$ = makeClassNode(FB_NEW(getPool()) CurrentUserNode(getPool())); } - | CURRENT_USER - { $$ = makeClassNode(FB_NEW(getPool()) CurrentUserNode(getPool())); } + : USER { $$ = FB_NEW(getPool()) CurrentUserNode(getPool()); } + | CURRENT_USER { $$ = FB_NEW(getPool()) CurrentUserNode(getPool()); } ; current_role - : CURRENT_ROLE - { $$ = makeClassNode(FB_NEW(getPool()) CurrentRoleNode(getPool())); } + : CURRENT_ROLE { $$ = FB_NEW(getPool()) CurrentRoleNode(getPool()); } ; internal_info : CURRENT_CONNECTION { - $$ = makeClassNode(FB_NEW(getPool()) InternalInfoNode(getPool(), - MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_CONNECTION_ID)))); + $$ = FB_NEW(getPool()) InternalInfoNode(getPool(), + MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_CONNECTION_ID))); } | CURRENT_TRANSACTION { - $$ = makeClassNode(FB_NEW(getPool()) InternalInfoNode(getPool(), - MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_TRANSACTION_ID)))); + $$ = FB_NEW(getPool()) InternalInfoNode(getPool(), + MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_TRANSACTION_ID))); } | GDSCODE { - $$ = makeClassNode(FB_NEW(getPool()) InternalInfoNode(getPool(), - MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_GDSCODE)))); + $$ = FB_NEW(getPool()) InternalInfoNode(getPool(), + MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_GDSCODE))); } | SQLCODE { - $$ = makeClassNode(FB_NEW(getPool()) InternalInfoNode(getPool(), - MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_SQLCODE)))); + $$ = FB_NEW(getPool()) InternalInfoNode(getPool(), + MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_SQLCODE))); } | SQLSTATE { - $$ = makeClassNode(FB_NEW(getPool()) InternalInfoNode(getPool(), - MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_SQLSTATE)))); + $$ = FB_NEW(getPool()) InternalInfoNode(getPool(), + MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_SQLSTATE))); } | ROW_COUNT { - $$ = makeClassNode(FB_NEW(getPool()) InternalInfoNode(getPool(), - MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_ROWS_AFFECTED)))); + $$ = FB_NEW(getPool()) InternalInfoNode(getPool(), + MAKE_const_slong(SLONG(InternalInfoNode::INFO_TYPE_ROWS_AFFECTED))); } ; @@ -5466,8 +5475,7 @@ // functions function - : aggregate_function - { $$ = makeClassNode($1); } + : aggregate_function { $$ = $1; } | non_aggregate_function | over_clause ; @@ -5559,10 +5567,7 @@ over_clause : aggregate_window_function OVER '(' window_partition_opt order_clause ')' - { - $$ = makeClassNode(FB_NEW(getPool()) OverNode(getPool(), makeClassNode($1), - make_list($4), $5)); - } + { $$ = FB_NEW(getPool()) OverNode(getPool(), makeClassNode($1), make_list($4), $5); } ; window_partition_opt @@ -5586,7 +5591,7 @@ extract_expression : EXTRACT '(' timestamp_part FROM value ')' - { $$ = makeClassNode(FB_NEW(getPool()) ExtractNode(getPool(), $3, $5)); } + { $$ = FB_NEW(getPool()) ExtractNode(getPool(), $3, $5); } ; length_expression @@ -5597,26 +5602,26 @@ bit_length_expression : BIT_LENGTH '(' value ')' - { $$ = makeClassNode(FB_NEW(getPool()) StrLenNode(getPool(), blr_strlen_bit, $3)); } + { $$ = FB_NEW(getPool()) StrLenNode(getPool(), blr_strlen_bit, $3); } ; char_length_expression : CHAR_LENGTH '(' value ')' - { $$ = makeClassNode(FB_NEW(getPool()) StrLenNode(getPool(), blr_strlen_char, $3)); } + { $$ = FB_NEW(getPool()) StrLenNode(getPool(), blr_strlen_char, $3); } | CHARACTER_LENGTH '(' value ')' - { $$ = makeClassNode(FB_NEW(getPool()) StrLenNode(getPool(), blr_strlen_char, $3)); } + { $$ = FB_NEW(getPool()) StrLenNode(getPool(), blr_strlen_char, $3); } ; octet_length_expression : OCTET_LENGTH '(' value ')' - { $$ = makeClassNode(FB_NEW(getPool()) StrLenNode(getPool(), blr_strlen_octet, $3)); } + { $$ = FB_NEW(getPool()) StrLenNode(getPool(), blr_strlen_octet, $3); } ; system_function_expression : system_function_std_syntax '(' value_list_opt ')' - { $$ = makeClassNode(FB_NEW(getPool()) SysFuncCallNode(getPool(), toName($1), $3)); } + { $$ = FB_NEW(getPool()) SysFuncCallNode(getPool(), toName($1), $3); } | system_function_special_syntax - { $$ = makeClassNode($1); } + { $$ = $1; } ; system_function_std_syntax @@ -5721,12 +5726,12 @@ ; string_value_function - : substring_function + : substring_function | trim_function | KW_UPPER '(' value ')' - { $$ = makeClassNode(FB_NEW(getPool()) StrCaseNode(getPool(), blr_upcase, $3)); } + { $$ = FB_NEW(getPool()) StrCaseNode(getPool(), blr_upcase, $3); } | KW_LOWER '(' value ')' - { $$ = makeClassNode(FB_NEW(getPool()) StrCaseNode(getPool(), blr_lowcase, $3)); } + { $$ = FB_NEW(getPool()) StrCaseNode(getPool(), blr_lowcase, $3); } ; substring_function @@ -5738,10 +5743,10 @@ dsql_nod* subtractNode = makeClassNode(FB_NEW(getPool()) ArithmeticNode(getPool(), blr_subtract, true, $5, MAKE_const_slong(1))); - $$ = makeClassNode(FB_NEW(getPool()) SubstringNode(getPool(), $3, subtractNode, $6)); + $$ = FB_NEW(getPool()) SubstringNode(getPool(), $3, subtractNode, $6); } | SUBSTRING '(' value SIMILAR value ESCAPE value ')' - { $$ = makeClassNode(FB_NEW(getPool()) SubstringSimilarNode(getPool(), $3, $5, $7)); } + { $$ = FB_NEW(getPool()) SubstringSimilarNode(getPool(), $3, $5, $7); } ; string_length_opt @@ -5751,13 +5756,13 @@ trim_function : TRIM '(' trim_specification value FROM value ')' - { $$ = makeClassNode(FB_NEW(getPool()) TrimNode(getPool(), $3, $6, $4)); } + { $$ = FB_NEW(getPool()) TrimNode(getPool(), $3, $6, $4); } | TRIM '(' value FROM value ')' - { $$ = makeClassNode(FB_NEW(getPool()) TrimNode(getPool(), blr_trim_both, $5, $3)); } + { $$ = FB_NEW(getPool()) TrimNode(getPool(), blr_trim_both, $5, $3); } | TRIM '(' trim_specification FROM value ')' - { $$ = makeClassNode(FB_NEW(getPool()) TrimNode(getPool(), $3, $5, NULL)); } + { $$ = FB_NEW(getPool()) TrimNode(getPool(), $3, $5, NULL); } | TRIM '(' value ')' - { $$ = makeClassNode(FB_NEW(getPool()) TrimNode(getPool(), blr_trim_both, $3, NULL)); } + { $$ = FB_NEW(getPool()) TrimNode(getPool(), blr_trim_both, $3, NULL); } ; trim_specification @@ -5769,23 +5774,23 @@ udf : symbol_UDF_call_name '(' value_list ')' { - $$ = makeClassNode(FB_NEW(getPool()) UdfCallNode( - getPool(), QualifiedName(toName($1), ""), make_list($3))); + $$ = FB_NEW(getPool()) UdfCallNode( + getPool(), QualifiedName(toName($1), ""), make_list($3)); } | symbol_UDF_call_name '(' ')' { - $$ = makeClassNode(FB_NEW(getPool()) UdfCallNode( - getPool(), QualifiedName(toName($1), ""), make_node(nod_list, 0))); + $$ = FB_NEW(getPool()) UdfCallNode( + getPool(), QualifiedName(toName($1), ""), make_node(nod_list, 0)); } | symbol_package_name '.' symbol_UDF_name '(' value_list ')' { - $$ = makeClassNode(FB_NEW(getPool()) UdfCallNode( - getPool(), QualifiedName(toName($3), toName($1)), make_list($5))); + $$ = FB_NEW(getPool()) UdfCallNode( + getPool(), QualifiedName(toName($3), toName($1)), make_list($5)); } | symbol_package_name '.' symbol_UDF_name '(' ')' { - $$ = makeClassNode(FB_NEW(getPool()) UdfCallNode( - getPool(), QualifiedName(toName($3), toName($1)), make_node(nod_list, 0))); + $$ = FB_NEW(getPool()) UdfCallNode( + getPool(), QualifiedName(toName($3), toName($1)), make_node(nod_list, 0)); } ; @@ -5878,13 +5883,13 @@ next_value_expression : NEXT KW_VALUE FOR symbol_generator_name { - $$ = makeClassNode(FB_NEW(getPool()) GenIdNode(getPool(), - (client_dialect < SQL_DIALECT_V6_TRANSITION), toName($4))); + $$ = FB_NEW(getPool()) GenIdNode(getPool(), + (client_dialect < SQL_DIALECT_V6_TRANSITION), toName($4)); } | GEN_ID '(' symbol_generator_name ',' value ')' { - $$ = makeClassNode(FB_NEW(getPool()) GenIdNode(getPool(), - (client_dialect < SQL_DIALECT_V6_TRANSITION), toName($3), $5)); + $$ = FB_NEW(getPool()) GenIdNode(getPool(), + (client_dialect < SQL_DIALECT_V6_TRANSITION), toName($3), $5); } ; @@ -5913,7 +5918,7 @@ ; null_value - : KW_NULL { $$ = makeClassNode(FB_NEW(getPool()) NullNode(getPool())); } + : KW_NULL { $$ = FB_NEW(getPool()) NullNode(getPool()); } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2010-11-13 15:04:50
|
Revision: 51911 http://firebird.svn.sourceforge.net/firebird/?rev=51911&view=rev Author: dimitr Date: 2010-11-13 15:04:43 +0000 (Sat, 13 Nov 2010) Log Message: ----------- Let's clearly distinguish between deterministic and invariant functions, they're not the same thing actually. Runtime optimization usage is to be re-considered, if necessary. Warning: this includes an ODS change, please boot-build. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-11-13 15:03:44 UTC (rev 51910) +++ firebird/trunk/src/dsql/parse.y 2010-11-13 15:04:43 UTC (rev 51911) @@ -2064,7 +2064,7 @@ { $$ = $2; $$->returnType = TypeClause(getPool(), $<legacyField>5, toName($7)); - $$->invariant = ($8 != NULL); + $$->deterministic = ($8 != NULL); } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-12-16 21:11:07
|
Revision: 52048 http://firebird.svn.sourceforge.net/firebird/?rev=52048&view=rev Author: asfernandes Date: 2010-12-16 21:11:01 +0000 (Thu, 16 Dec 2010) Log Message: ----------- Fixed the crash about NEXT VALUE FOR reported in fb-devel Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-12-16 03:48:28 UTC (rev 52047) +++ firebird/trunk/src/dsql/parse.y 2010-12-16 21:11:01 UTC (rev 52048) @@ -5841,7 +5841,10 @@ next_value_expression : NEXT KW_VALUE FOR symbol_generator_name - { $$ = newNode<GenIdNode>((client_dialect < SQL_DIALECT_V6_TRANSITION), toName($4)); } + { + $$ = newNode<GenIdNode>((client_dialect < SQL_DIALECT_V6_TRANSITION), + toName($4), MAKE_const_slong(1)); + } | GEN_ID '(' symbol_generator_name ',' value ')' { $$ = newNode<GenIdNode>((client_dialect < SQL_DIALECT_V6_TRANSITION), toName($3), $5); } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-01-23 00:32:49
|
Revision: 52186 http://firebird.svn.sourceforge.net/firebird/?rev=52186&view=rev Author: asfernandes Date: 2011-01-23 00:32:42 +0000 (Sun, 23 Jan 2011) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-01-22 21:32:29 UTC (rev 52185) +++ firebird/trunk/src/dsql/parse.y 2011-01-23 00:32:42 UTC (rev 52186) @@ -4232,47 +4232,41 @@ ; ddl_type2 - : COLUMN - { $$ = ddl_relation; } - | PARAMETER - { $$ = ddl_procedure; } + : COLUMN { $$ = ddl_relation; } + | PARAMETER { $$ = ddl_procedure; } ; ddl_subname - : '.' symbol_ddl_name - { $$ = $2; } + : '.' symbol_ddl_name { $$ = $2; } ; ddl_desc : sql_string - | KW_NULL - { $$ = NULL; } + | KW_NULL { $$ = NULL; } ; // SELECT statement -select : select_expr for_update_clause lock_clause - { $$ = make_node (nod_select, (int) e_select_count, $1, $2, $3); } - ; +select + : select_expr for_update_clause lock_clause + { $$ = make_node(nod_select, (int) e_select_count, $1, $2, $3); } + ; -for_update_clause : FOR UPDATE for_update_list - { $$ = make_node (nod_for_update, (int) e_fpd_count, $3); } - | - { $$ = NULL; } - ; +for_update_clause + : /* nothing */ { $$ = NULL; } + | FOR UPDATE for_update_list { $$ = make_node(nod_for_update, (int) e_fpd_count, $3); } + ; -for_update_list : OF column_list - { $$ = $2; } - | - { $$ = make_node (nod_flag, 0, NULL); } - ; +for_update_list + : /* nothing */ { $$ = make_node(nod_flag, 0, NULL); } + | OF column_list { $$ = $2; } + ; -lock_clause : WITH LOCK - { $$ = make_node (nod_flag, 0, NULL); } - | - { $$ = NULL; } - ; +lock_clause + : /* nothing */ { $$ = NULL; } + | WITH LOCK { $$ = make_node(nod_flag, 0, NULL); } + ; // SELECT expression @@ -4283,18 +4277,17 @@ ; with_clause - : + : /* nothing */ { $$ = NULL; } | WITH RECURSIVE with_list - { $$ = make_flag_node (nod_with, NOD_UNION_RECURSIVE, 1, make_list($3)); } + { $$ = make_flag_node(nod_with, NOD_UNION_RECURSIVE, 1, make_list($3)); } | WITH with_list - { $$ = make_node (nod_with, 1, make_list($2)); } + { $$ = make_node(nod_with, 1, make_list($2)); } ; with_list : with_item - | with_item ',' with_list - { $$ = make_node (nod_list, 2, $1, $3); } + | with_item ',' with_list { $$ = make_node (nod_list, 2, $1, $3); } ; with_item @@ -4360,32 +4353,22 @@ ; limit_clause - : - { $$ = NULL; } - | first_clause skip_clause - { $$ = make_node(nod_list, 2, $2, $1); } - | first_clause - { $$ = make_node(nod_list, 2, NULL, $1); } - | skip_clause - { $$ = make_node(nod_list, 2, $1, NULL); } + : /* nothing */ { $$ = NULL; } + | first_clause skip_clause { $$ = make_node(nod_list, 2, $2, $1); } + | first_clause { $$ = make_node(nod_list, 2, NULL, $1); } + | skip_clause { $$ = make_node(nod_list, 2, $1, NULL); } ; first_clause - : FIRST long_integer - { $$ = MAKE_const_slong($2); } - | FIRST '(' value ')' - { $$ = $3; } - | FIRST parameter - { $$ = $2; } + : FIRST long_integer { $$ = MAKE_const_slong($2); } + | FIRST '(' value ')' { $$ = $3; } + | FIRST parameter { $$ = $2; } ; skip_clause - : SKIP long_integer - { $$ = MAKE_const_slong($2); } - | SKIP '(' value ')' - { $$ = $3; } - | SKIP parameter - { $$ = $2; } + : SKIP long_integer { $$ = MAKE_const_slong($2); } + | SKIP '(' value ')' { $$ = $3; } + | SKIP parameter { $$ = $2; } ; distinct_clause @@ -4532,20 +4515,21 @@ { $$ = make_node (nod_rel_proc_name, (int) e_rpn_count, $3, NULL, $4, $1); } ; -table_proc_inputs : '(' value_list ')' - { $$ = make_list ($2); } - | - { $$ = NULL; } - ; +table_proc_inputs + : /* nothing */ { $$ = NULL; } + | '(' value_list ')' { $$ = make_list ($2); } + ; -table_name : simple_table_name - | symbol_table_name as_noise symbol_table_alias_name - { $$ = make_node (nod_relation_name, (int) e_rln_count, $1, $3); } - ; +table_name + : simple_table_name + | symbol_table_name as_noise symbol_table_alias_name + { $$ = make_node(nod_relation_name, (int) e_rln_count, $1, $3); } + ; -simple_table_name: symbol_table_name - { $$ = make_node (nod_relation_name, (int) e_rln_count, $1, NULL); } - ; +simple_table_name + : symbol_table_name + { $$ = make_node(nod_relation_name, (int) e_rln_count, $1, NULL); } + ; join_type : /* nothing */ { $$ = blr_inner; } @@ -4595,19 +4579,17 @@ // PLAN clause to specify an access plan for a query -plan_clause : PLAN plan_expression - { $$ = $2; } - | - { $$ = NULL; } - ; +plan_clause + : /* nothing */ { $$ = NULL; } + | PLAN plan_expression { $$ = $2; } + ; -plan_expression : plan_type '(' plan_item_list ')' - { $$ = make_node (nod_plan_expr, 1, make_list ($3)); } - ; +plan_expression + : plan_type '(' plan_item_list ')' { $$ = make_node(nod_plan_expr, 1, make_list($3)); } + ; plan_type - : - { $$ = NULL; } + : /* nothing */ { $$ = NULL; } | JOIN | SORT MERGE | MERGE @@ -4615,70 +4597,64 @@ | SORT ; -plan_item_list : plan_item - | plan_item ',' plan_item_list - { $$ = make_node (nod_list, 2, $1, $3); } - ; +plan_item_list + : plan_item + | plan_item ',' plan_item_list { $$ = make_node(nod_list, 2, $1, $3); } + ; -plan_item : table_or_alias_list access_type - { $$ = make_node (nod_plan_item, 2, make_list ($1), $2); } - | plan_expression - ; +plan_item + : table_or_alias_list access_type { $$ = make_node(nod_plan_item, 2, make_list($1), $2); } + | plan_expression + ; -table_or_alias_list : symbol_table_name - | symbol_table_name table_or_alias_list - { $$ = make_node (nod_list, 2, $1, $2); } - ; +table_or_alias_list + : symbol_table_name + | symbol_table_name table_or_alias_list { $$ = make_node(nod_list, 2, $1, $2); } + ; -access_type : NATURAL - { $$ = make_node (nod_natural, (int) 0, NULL); } - | INDEX '(' index_list ')' - { $$ = make_node (nod_index, 1, make_list ($3)); } - | ORDER symbol_index_name extra_indices_opt - { $$ = make_node (nod_index_order, 2, $2, $3); } - ; +access_type + : NATURAL { $$ = make_node(nod_natural, (int) 0, NULL); } + | INDEX '(' index_list ')' { $$ = make_node(nod_index, 1, make_list($3)); } + | ORDER symbol_index_name extra_indices_opt { $$ = make_node(nod_index_order, 2, $2, $3); } + ; -index_list : symbol_index_name - | symbol_index_name ',' index_list - { $$ = make_node (nod_list, 2, $1, $3); } - ; +index_list + : symbol_index_name + | symbol_index_name ',' index_list { $$ = make_node (nod_list, 2, $1, $3); } + ; -extra_indices_opt : INDEX '(' index_list ')' - { $$ = make_list ($3); } - | - { $$ = 0; } - ; +extra_indices_opt + : /* nothing */ { $$ = NULL; } + | INDEX '(' index_list ')' { $$ = make_list ($3); } + ; // ORDER BY clause -order_clause : ORDER BY order_list - { $$ = make_list ($3); } - | - { $$ = 0; } - ; +order_clause + : /* nothing */ { $$ = NULL; } + | ORDER BY order_list { $$ = make_list ($3); } + ; -order_list : order_item - | order_list ',' order_item - { $$ = make_node (nod_list, 2, $1, $3); } - ; +order_list + : order_item + | order_list ',' order_item { $$ = make_node (nod_list, 2, $1, $3); } + ; -order_item : value order_direction nulls_clause - { $$ = make_node (nod_order, (int) e_order_count, $1, $2, $3); } - ; +order_item + : value order_direction nulls_clause + { $$ = make_node (nod_order, (int) e_order_count, $1, $2, $3); } + ; -order_direction : ASC - { $$ = 0; } - | DESC - { $$ = make_node (nod_flag, 0, NULL); } - | - { $$ = 0; } - ; +order_direction + : /* nothing */ { $$ = NULL; } + | ASC { $$ = NULL; } + | DESC { $$ = make_node(nod_flag, 0, NULL); } + ; -nulls_clause : NULLS nulls_placement - { $$ = $2; } - | - { $$ = 0; } - ; +nulls_clause + : /* nothing */ { $$ = NULL; } + | NULLS nulls_placement { $$ = $2; } + ; nulls_placement : FIRST { $$ = MAKE_const_slong(NOD_NULLS_FIRST); } @@ -4687,35 +4663,36 @@ // ROWS clause -rows_clause : ROWS value - // equivalent to FIRST value - { $$ = make_node (nod_rows, (int) e_rows_count, NULL, $2); } - | ROWS value TO value - // equivalent to FIRST (upper_value - lower_value + 1) SKIP (lower_value - 1) - { - $$ = make_node (nod_rows, (int) e_rows_count, +rows_clause + : /* nothing */ + { $$ = NULL; } + // equivalent to FIRST value + | ROWS value + { $$ = make_node (nod_rows, (int) e_rows_count, NULL, $2); } + // equivalent to FIRST (upper_value - lower_value + 1) SKIP (lower_value - 1) + | ROWS value TO value + { + $$ = make_node (nod_rows, (int) e_rows_count, + makeClassNode(newNode<ArithmeticNode>(blr_subtract, true, + $2, MAKE_const_slong(1))), + makeClassNode(newNode<ArithmeticNode>(blr_add, true, makeClassNode(newNode<ArithmeticNode>(blr_subtract, true, - $2, MAKE_const_slong(1))), - makeClassNode(newNode<ArithmeticNode>(blr_add, true, - makeClassNode(newNode<ArithmeticNode>(blr_subtract, true, - $4, $2)), - MAKE_const_slong(1)))); - } - | - { $$ = NULL; } - ; + $4, $2)), + MAKE_const_slong(1)))); + } + ; // INSERT statement // IBO hack: replace column_parens_opt by ins_column_parens_opt. -insert : INSERT INTO simple_table_name ins_column_parens_opt - VALUES '(' value_list ')' returning_clause - { $$ = make_node (nod_insert, (int) e_ins_count, $3, $4, make_list ($7), NULL, $9); } - | INSERT INTO simple_table_name ins_column_parens_opt select_expr returning_clause - { $$ = make_node (nod_insert, (int) e_ins_count, $3, $4, NULL, $5, $6); } - | INSERT INTO simple_table_name DEFAULT VALUES returning_clause - { $$ = make_node (nod_insert, (int) e_ins_count, $3, NULL, NULL, NULL, $6); } - ; +insert + : INSERT INTO simple_table_name ins_column_parens_opt VALUES '(' value_list ')' returning_clause + { $$ = make_node (nod_insert, (int) e_ins_count, $3, $4, make_list ($7), NULL, $9); } + | INSERT INTO simple_table_name ins_column_parens_opt select_expr returning_clause + { $$ = make_node (nod_insert, (int) e_ins_count, $3, $4, NULL, $5, $6); } + | INSERT INTO simple_table_name DEFAULT VALUES returning_clause + { $$ = make_node (nod_insert, (int) e_ins_count, $3, NULL, NULL, NULL, $6); } + ; // MERGE statement @@ -4769,82 +4746,89 @@ // DELETE statement -delete : delete_searched - | delete_positioned - ; +delete + : delete_searched + | delete_positioned + ; -delete_searched : KW_DELETE FROM table_name where_clause - plan_clause order_clause rows_clause returning_clause - { $$ = make_node (nod_delete, (int) e_del_count, $3, $4, $5, $6, $7, NULL, $8); } - ; +delete_searched + : KW_DELETE FROM table_name where_clause plan_clause order_clause rows_clause returning_clause + { $$ = make_node(nod_delete, (int) e_del_count, $3, $4, $5, $6, $7, NULL, $8); } + ; -delete_positioned : KW_DELETE FROM table_name cursor_clause - { $$ = make_node (nod_delete, (int) e_del_count, $3, NULL, NULL, NULL, NULL, $4, NULL); } - ; +delete_positioned + : KW_DELETE FROM table_name cursor_clause + { $$ = make_node(nod_delete, (int) e_del_count, $3, NULL, NULL, NULL, NULL, $4, NULL); } + ; // UPDATE statement -update : update_searched - | update_positioned - ; +update + : update_searched + | update_positioned + ; -update_searched : UPDATE table_name SET assignments where_clause - plan_clause order_clause rows_clause returning_clause - { $$ = make_node (nod_update, (int) e_upd_count, - $2, make_list ($4), $5, $6, $7, $8, NULL, $9, NULL); } - ; +update_searched + : UPDATE table_name SET assignments where_clause plan_clause + order_clause rows_clause returning_clause + { + $$ = make_node(nod_update, (int) e_upd_count, $2, make_list($4), + $5, $6, $7, $8, NULL, $9, NULL); + } + ; -update_positioned : UPDATE table_name SET assignments cursor_clause - { $$ = make_node (nod_update, (int) e_upd_count, - $2, make_list ($4), NULL, NULL, NULL, NULL, $5, NULL, NULL); } - ; +update_positioned + : UPDATE table_name SET assignments cursor_clause + { + $$ = make_node(nod_update, (int) e_upd_count, + $2, make_list($4), NULL, NULL, NULL, NULL, $5, NULL, NULL); + } + ; // UPDATE OR INSERT statement update_or_insert - : UPDATE OR INSERT INTO simple_table_name ins_column_parens_opt - VALUES '(' value_list ')' - update_or_insert_matching_opt - returning_clause + : UPDATE OR INSERT INTO simple_table_name ins_column_parens_opt + VALUES '(' value_list ')' update_or_insert_matching_opt returning_clause { - $$ = make_node (nod_update_or_insert, (int) e_upi_count, - $5, make_list ($6), make_list ($9), $11, $12); + $$ = make_node(nod_update_or_insert, (int) e_upi_count, + $5, make_list($6), make_list($9), $11, $12); } ; update_or_insert_matching_opt - : MATCHING ins_column_parens - { $$ = $2; } - | - { $$ = NULL; } + : /* nothing */ { $$ = NULL; } + | MATCHING ins_column_parens { $$ = $2; } ; -returning_clause : RETURNING value_list - { $$ = make_node (nod_returning, (int) e_ret_count, make_list ($2), NULL); } - | RETURNING value_list INTO variable_list - { $$ = make_node (nod_returning, (int) e_ret_count, make_list ($2), make_list ($4)); } - | - { $$ = NULL; } - ; +returning_clause + : /* nothing */ + { $$ = NULL; } + | RETURNING value_list + { $$ = make_node(nod_returning, (int) e_ret_count, make_list($2), NULL); } + | RETURNING value_list INTO variable_list + { $$ = make_node(nod_returning, (int) e_ret_count, make_list($2), make_list($4)); } + ; -cursor_clause : WHERE CURRENT OF symbol_cursor_name - { $$ = make_node (nod_cursor, (int) e_cur_count, $4, NULL, NULL, NULL, NULL); } - ; +cursor_clause + : WHERE CURRENT OF symbol_cursor_name + { $$ = make_node(nod_cursor, (int) e_cur_count, $4, NULL, NULL, NULL, NULL); } + ; // Assignments -assignments : assignment - | assignments ',' assignment - { $$ = make_node (nod_list, 2, $1, $3); } - ; +assignments + : assignment + | assignments ',' assignment { $$ = make_node(nod_list, 2, $1, $3); } + ; -assignment : update_column_name '=' value - { $$ = make_node (nod_assign, e_asgn_count, $3, $1); } - ; +assignment + : update_column_name '=' value { $$ = make_node(nod_assign, e_asgn_count, $3, $1); } + ; exec_function : udf This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-01-31 00:12:26
|
Revision: 52233 http://firebird.svn.sourceforge.net/firebird/?rev=52233&view=rev Author: asfernandes Date: 2011-01-31 00:12:19 +0000 (Mon, 31 Jan 2011) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-01-30 14:44:20 UTC (rev 52232) +++ firebird/trunk/src/dsql/parse.y 2011-01-31 00:12:19 UTC (rev 52233) @@ -2248,16 +2248,15 @@ ; -local_declaration_list : local_declarations - { $$ = make_list ($1); } - | - { $$ = NULL; } - ; +local_declaration_list + : /* nothing */ { $$ = NULL; } + | local_declarations { $$ = make_list ($1); } + ; -local_declarations : local_declaration - | local_declarations local_declaration - { $$ = make_node (nod_list, 2, $1, $2); } - ; +local_declarations + : local_declaration + | local_declarations local_declaration { $$ = make_node (nod_list, 2, $1, $2); } + ; local_declaration : stmt_start_line stmt_start_column DECLARE var_decl_opt local_declaration_item ';' @@ -2268,113 +2267,108 @@ } ; -local_declaration_item : var_declaration_item - | cursor_declaration_item - ; +local_declaration_item + : var_declaration_item + | cursor_declaration_item + ; -var_declaration_item : column_def_name domain_or_non_array_type collate_clause default_par_opt - { $$ = make_node (nod_def_field, (int) e_dfl_count, $1, $4, NULL, $3, NULL, NULL, NULL); } - ; +var_declaration_item + : column_def_name domain_or_non_array_type collate_clause default_par_opt + { $$ = make_node (nod_def_field, (int) e_dfl_count, $1, $4, NULL, $3, NULL, NULL, NULL); } + ; -var_decl_opt : VARIABLE - { $$ = NULL; } - | - { $$ = NULL; } - ; +var_decl_opt + : /* nothing */ { $$ = NULL; } + | VARIABLE { $$ = NULL; } + ; -cursor_declaration_item : symbol_cursor_name scroll_opt CURSOR FOR '(' select ')' - { $$ = make_flag_node (nod_cursor, NOD_CURSOR_EXPLICIT, - (int) e_cur_count, $1, $2, $6, NULL, NULL); } - ; +cursor_declaration_item + : symbol_cursor_name scroll_opt CURSOR FOR '(' select ')' + { + $$ = make_flag_node (nod_cursor, NOD_CURSOR_EXPLICIT, + (int) e_cur_count, $1, $2, $6, NULL, NULL); + } + ; -scroll_opt : SCROLL - { $$ = make_node (nod_flag, 0, NULL); } - | NO SCROLL - { $$ = NULL; } - | - { $$ = NULL; } - ; +scroll_opt + : /* nothing */ { $$ = NULL; } + | NO SCROLL { $$ = NULL; } + | SCROLL { $$ = make_node (nod_flag, 0, NULL); } + ; -proc_block : proc_statement - | full_proc_block - ; +proc_block + : proc_statement + | full_proc_block + ; -full_proc_block : stmt_start_line stmt_start_column BEGIN full_proc_block_body END - { - $$ = make_node (nod_src_info, e_src_info_count, $1, $2, $4); - } - ; +full_proc_block + : stmt_start_line stmt_start_column BEGIN full_proc_block_body END + { $$ = make_node (nod_src_info, e_src_info_count, $1, $2, $4); } + ; -full_proc_block_body : proc_statements - { $$ = make_node (nod_block, (int) e_blk_count, make_list ($1), NULL); } - | proc_statements excp_hndl_statements - { $$ = make_node (nod_block, (int) e_blk_count, make_list ($1), make_list ($2)); } - | - { $$ = make_node (nod_block, (int) e_blk_count, NULL, NULL);} - ; +full_proc_block_body + : // nothing + { $$ = make_node (nod_block, (int) e_blk_count, NULL, NULL);} + | proc_statements + { $$ = make_node (nod_block, (int) e_blk_count, make_list ($1), NULL); } + | proc_statements excp_hndl_statements + { $$ = make_node (nod_block, (int) e_blk_count, make_list ($1), make_list ($2)); } + ; -proc_statements : proc_block - | proc_statements proc_block - { $$ = make_node (nod_list, 2, $1, $2); } - ; +proc_statements + : proc_block + | proc_statements proc_block + { $$ = make_node (nod_list, 2, $1, $2); } + ; -proc_statement : stmt_start_line stmt_start_column simple_proc_statement ';' - { - $$ = make_node (nod_src_info, e_src_info_count, $1, $2, $3); - } - | stmt_start_line stmt_start_column complex_proc_statement - { - $$ = make_node (nod_src_info, e_src_info_count, $1, $2, $3); - } - ; +proc_statement + : stmt_start_line stmt_start_column simple_proc_statement ';' + { $$ = make_node (nod_src_info, e_src_info_count, $1, $2, $3); } + | stmt_start_line stmt_start_column complex_proc_statement + { $$ = make_node (nod_src_info, e_src_info_count, $1, $2, $3); } + ; -stmt_start_line : - { $$ = (dsql_nod*) (IPTR) lex.lines_bk; } +stmt_start_line + : /* nothing */ { $$ = (dsql_nod*) (IPTR) lex.lines_bk; } + ; -stmt_start_column : +stmt_start_column + : // nothing { const USHORT column = (lex.last_token_bk - lex.line_start_bk + 1); $$ = (dsql_nod*) (IPTR) column; } + ; -simple_proc_statement : assignment - | insert - | merge - | update - | update_or_insert - | delete - | singleton_select - | exec_procedure - | exec_sql - { $$ = makeClassNode($1); } - | exec_into - { $$ = makeClassNode($1); } - | exec_function - | excp_statement - { $$ = makeClassNode($1); } - | raise_statement - { $$ = makeClassNode($1); } - | post_event - | cursor_statement - | breakleave - | continue - | SUSPEND - { $$ = makeClassNode(newNode<SuspendNode>()); } - | EXIT - { $$ = makeClassNode(newNode<ExitNode>()); } - | RETURN value - { $$ = makeClassNode(newNode<ReturnNode>($2)); } - ; +simple_proc_statement + : assignment + | insert + | merge + | update + | update_or_insert + | delete + | singleton_select + | exec_procedure + | exec_sql { $$ = makeClassNode($1); } + | exec_into { $$ = makeClassNode($1); } + | exec_function + | excp_statement { $$ = makeClassNode($1); } + | raise_statement { $$ = makeClassNode($1); } + | post_event + | cursor_statement + | breakleave + | continue + | SUSPEND { $$ = makeClassNode(newNode<SuspendNode>()); } + | EXIT { $$ = makeClassNode(newNode<ExitNode>()); } + | RETURN value { $$ = makeClassNode(newNode<ReturnNode>($2)); } + ; complex_proc_statement - : in_autonomous_transaction - { $$ = makeClassNode($1); } - | if_then_else - { $$ = makeClassNode($1); } + : in_autonomous_transaction { $$ = makeClassNode($1); } + | if_then_else { $$ = makeClassNode($1); } | while | for_select - | for_exec_into - { $$ = makeClassNode($1); } + | for_exec_into { $$ = makeClassNode($1); } ; in_autonomous_transaction @@ -2396,8 +2390,7 @@ ; raise_statement - : EXCEPTION - { $$ = newNode<ExceptionNode>(); } + : EXCEPTION { $$ = newNode<ExceptionNode>(); } ; for_select @@ -2574,27 +2567,26 @@ } ; -variable : ':' symbol_variable_name - { $$ = make_node (nod_var_name, (int) e_vrn_count, $2); } - ; +variable + : ':' symbol_variable_name { $$ = make_node (nod_var_name, (int) e_vrn_count, $2); } + ; -variable_list : variable - | column_name - | variable_list ',' column_name - { $$ = make_node (nod_list, 2, $1, $3); } - | variable_list ',' variable - { $$ = make_node (nod_list, 2, $1, $3); } - ; +variable_list + : variable + | column_name + | variable_list ',' column_name { $$ = make_node (nod_list, 2, $1, $3); } + | variable_list ',' variable { $$ = make_node (nod_list, 2, $1, $3); } + ; -while : label_opt WHILE '(' search_condition ')' DO proc_block - { $$ = make_node (nod_while, (int) e_while_count, $4, $7, $1); } - ; +while + : label_opt WHILE '(' search_condition ')' DO proc_block + { $$ = make_node (nod_while, (int) e_while_count, $4, $7, $1); } + ; -label_opt : symbol_label_name ':' - { $$ = make_node (nod_label, (int) e_label_count, $1, NULL); } - | - { $$ = NULL; } - ; +label_opt + : /* nothing */ { $$ = NULL; } + | symbol_label_name ':' { $$ = make_node (nod_label, (int) e_label_count, $1, NULL); } + ; breakleave : KW_BREAK @@ -2620,38 +2612,37 @@ } ; -cursor_def : AS CURSOR symbol_cursor_name - { $$ = make_flag_node (nod_cursor, NOD_CURSOR_FOR, - (int) e_cur_count, $3, NULL, NULL, NULL, NULL); } - | - { $$ = NULL; } - ; +cursor_def + : // nothing + { $$ = NULL; } + | AS CURSOR symbol_cursor_name + { $$ = make_flag_node (nod_cursor, NOD_CURSOR_FOR, + (int) e_cur_count, $3, NULL, NULL, NULL, NULL); } + ; -excp_hndl_statements : excp_hndl_statement - | excp_hndl_statements excp_hndl_statement - { $$ = make_node (nod_list, 2, $1, $2); } - ; +excp_hndl_statements + : excp_hndl_statement + | excp_hndl_statements excp_hndl_statement { $$ = make_node (nod_list, 2, $1, $2); } + ; -excp_hndl_statement : WHEN errors DO proc_block - { $$ = make_node (nod_on_error, (int) e_err_count, make_list ($2), $4); } - ; +excp_hndl_statement + : WHEN errors DO proc_block + { $$ = make_node (nod_on_error, (int) e_err_count, make_list ($2), $4); } + ; -errors : err - | errors ',' err - { $$ = make_node (nod_list, 2, $1, $3); } +errors + : err + | errors ',' err { $$ = make_node (nod_list, 2, $1, $3); } ; -err : SQLCODE signed_short_integer - { $$ = make_node (nod_sqlcode, 1, (dsql_nod*)(IPTR) $2); } - | GDSCODE symbol_gdscode_name - { $$ = make_node (nod_gdscode, 1, $2); } - | EXCEPTION symbol_exception_name - { $$ = make_node (nod_exception, 1, $2); } - | ANY - { $$ = make_node (nod_default, 1, NULL); } +err : SQLCODE signed_short_integer { $$ = make_node (nod_sqlcode, 1, (dsql_nod*)(IPTR) $2); } + | GDSCODE symbol_gdscode_name { $$ = make_node (nod_gdscode, 1, $2); } + | EXCEPTION symbol_exception_name { $$ = make_node (nod_exception, 1, $2); } + | ANY { $$ = make_node (nod_default, 1, NULL); } ; -cursor_statement : open_cursor +cursor_statement + : open_cursor | fetch_cursor | close_cursor ; @@ -2711,21 +2702,17 @@ { $$ = makeClassNode(newNode<ExecProcedureNode>(QualifiedName(toName($5), toName($3)), $6, $7)); } ; -proc_inputs : value_list - { $$ = make_list ($1); } - | '(' value_list ')' - { $$ = make_list ($2); } - | - { $$ = NULL; } - ; +proc_inputs + : /* nothing */ { $$ = NULL; } + | value_list { $$ = make_list ($1); } + | '(' value_list ')' { $$ = make_list ($2); } + ; -proc_outputs_opt : RETURNING_VALUES variable_list - { $$ = make_list ($2); } - | RETURNING_VALUES '(' variable_list ')' - { $$ = make_list ($3); } - | - { $$ = NULL; } - ; +proc_outputs_opt + : /* nothing */ { $$ = NULL; } + | RETURNING_VALUES variable_list { $$ = make_list ($2); } + | RETURNING_VALUES '(' variable_list ')' { $$ = make_list ($3); } + ; // EXECUTE BLOCK @@ -2796,48 +2783,50 @@ // these rules will capture the input string for storage in metadata -begin_string : - { lex.beginnings.push(lex_position()); } - ; +begin_string + : /* nothing */ { lex.beginnings.push(lex_position()); } + ; + /* -end_string : - { - const TEXT* start = lex.beginnings.pop(); - $$ = (dsql_nod*) MAKE_string(start, - (lex_position() == lex.end) ? lex_position() - start : lex.last_token - start); - } - ; +end_string + : + { + const TEXT* start = lex.beginnings.pop(); + $$ = (dsql_nod*) MAKE_string(start, + (lex_position() == lex.end) ? lex_position() - start : lex.last_token - start); + } + ; */ -begin_trigger : - { lex.beginnings.push(lex.last_token); } - ; -end_trigger : - { - const TEXT* start = lex.beginnings.pop(); - string str; - transformString(start, lex_position() - start, str); - $$ = MAKE_string(str.c_str(), str.length()); - } - ; +begin_trigger + : /* nothing */ { lex.beginnings.push(lex.last_token); } + ; -end_default : - { - const TEXT* start = lex.beginnings.pop(); - $$ = (dsql_nod*) MAKE_string(start, - (yychar <= 0 ? lex_position() : lex.last_token) - start); - } - ; +end_trigger + : // nothing + { + const TEXT* start = lex.beginnings.pop(); + string str; + transformString(start, lex_position() - start, str); + $$ = MAKE_string(str.c_str(), str.length()); + } + ; +end_default + : // nothing + { + const TEXT* start = lex.beginnings.pop(); + $$ = (dsql_nod*) MAKE_string(start, + (yychar <= 0 ? lex_position() : lex.last_token) - start); + } + ; + check_opt - : - { $$ = false; } - | WITH CHECK OPTION - { $$ = true; } + : /* nothing */ { $$ = false; } + | WITH CHECK OPTION { $$ = true; } ; - // CREATE TRIGGER trigger_clause @@ -3224,61 +3213,62 @@ // below are reserved words that could be used as column identifiers // in the previous versions -keyword_or_column : valid_symbol_name - | ADMIN // added in IB 5.0 - | COLUMN // added in IB 6.0 - | EXTRACT - | YEAR - | MONTH - | DAY - | HOUR - | MINUTE - | SECOND - | TIME - | TIMESTAMP - | CURRENT_DATE - | CURRENT_TIME - | CURRENT_TIMESTAMP - | CURRENT_USER // added in FB 1.0 - | CURRENT_ROLE - | RECREATE - | CURRENT_CONNECTION // added in FB 1.5 - | CURRENT_TRANSACTION - | BIGINT - | CASE - | RELEASE - | ROW_COUNT - | SAVEPOINT - | OPEN // added in FB 2.0 - | CLOSE - | FETCH - | ROWS - | USING - | CROSS - | BIT_LENGTH - | BOTH - | CHAR_LENGTH - | CHARACTER_LENGTH - | COMMENT - | LEADING - | KW_LOWER - | OCTET_LENGTH - | TRAILING - | TRIM - | CONNECT // added in FB 2.1 - | DISCONNECT - | GLOBAL - | INSENSITIVE - | RECURSIVE - | SENSITIVE - | START - | SIMILAR // added in FB 2.5 - | OVER // added in FB 3.0 - | SCROLL - | RETURN - | DETERMINISTIC - | SQLSTATE - ; +keyword_or_column + : valid_symbol_name + | ADMIN // added in IB 5.0 + | COLUMN // added in IB 6.0 + | EXTRACT + | YEAR + | MONTH + | DAY + | HOUR + | MINUTE + | SECOND + | TIME + | TIMESTAMP + | CURRENT_DATE + | CURRENT_TIME + | CURRENT_TIMESTAMP + | CURRENT_USER // added in FB 1.0 + | CURRENT_ROLE + | RECREATE + | CURRENT_CONNECTION // added in FB 1.5 + | CURRENT_TRANSACTION + | BIGINT + | CASE + | RELEASE + | ROW_COUNT + | SAVEPOINT + | OPEN // added in FB 2.0 + | CLOSE + | FETCH + | ROWS + | USING + | CROSS + | BIT_LENGTH + | BOTH + | CHAR_LENGTH + | CHARACTER_LENGTH + | COMMENT + | LEADING + | KW_LOWER + | OCTET_LENGTH + | TRAILING + | TRIM + | CONNECT // added in FB 2.1 + | DISCONNECT + | GLOBAL + | INSENSITIVE + | RECURSIVE + | SENSITIVE + | START + | SIMILAR // added in FB 2.5 + | OVER // added in FB 3.0 + | SCROLL + | RETURN + | DETERMINISTIC + | SQLSTATE + ; col_opt : ALTER { $$ = NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2011-02-02 10:16:31
|
Revision: 52261 http://firebird.svn.sourceforge.net/firebird/?rev=52261&view=rev Author: dimitr Date: 2011-02-02 10:16:25 +0000 (Wed, 02 Feb 2011) Log Message: ----------- Fixed CORE-3245: SUBSTRING on long blobs truncates result to 32767 if third argument not present. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-02-02 10:14:55 UTC (rev 52260) +++ firebird/trunk/src/dsql/parse.y 2011-02-02 10:16:25 UTC (rev 52261) @@ -5827,7 +5827,7 @@ ; string_length_opt - : { $$ = MAKE_const_slong(SHRT_POS_MAX); } + : { $$ = MAKE_const_slong(LONG_POS_MAX); } | FOR value { $$ = $2; } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-02-16 14:37:58
|
Revision: 52380 http://firebird.svn.sourceforge.net/firebird/?rev=52380&view=rev Author: asfernandes Date: 2011-02-16 14:37:52 +0000 (Wed, 16 Feb 2011) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-02-16 03:31:19 UTC (rev 52379) +++ firebird/trunk/src/dsql/parse.y 2011-02-16 14:37:52 UTC (rev 52380) @@ -4862,91 +4862,94 @@ // BLOB get and put -blob_io : READ BLOB simple_column_name FROM simple_table_name filter_clause_io segment_clause_io - { $$ = make_node (nod_get_segment, (int) e_blb_count, $3, $5, $6, $7); } - | INSERT BLOB simple_column_name INTO simple_table_name filter_clause_io segment_clause_io - { $$ = make_node (nod_put_segment, (int) e_blb_count, $3, $5, $6, $7); } - ; +blob_io + : READ BLOB simple_column_name FROM simple_table_name filter_clause_io segment_clause_io + { $$ = make_node (nod_get_segment, (int) e_blb_count, $3, $5, $6, $7); } + | INSERT BLOB simple_column_name INTO simple_table_name filter_clause_io segment_clause_io + { $$ = make_node (nod_put_segment, (int) e_blb_count, $3, $5, $6, $7); } + ; -filter_clause_io : FILTER FROM blob_subtype_value_io TO blob_subtype_value_io - { $$ = make_node (nod_list, 2, $3, $5); } - | FILTER TO blob_subtype_value_io - { $$ = make_node (nod_list, 2, NULL, $3); } - | - { $$ = NULL; } - ; +filter_clause_io + : /* nothing */ + { $$ = NULL; } + | FILTER FROM blob_subtype_value_io TO blob_subtype_value_io + { $$ = make_node (nod_list, 2, $3, $5); } + | FILTER TO blob_subtype_value_io + { $$ = make_node (nod_list, 2, NULL, $3); } + ; -blob_subtype_value_io : blob_subtype_io - | parameter - ; +blob_subtype_value_io + : blob_subtype_io + | parameter + ; blob_subtype_io - : signed_short_integer - { $$ = MAKE_const_slong($1); } + : signed_short_integer { $$ = MAKE_const_slong($1); } ; -segment_clause_io : MAX_SEGMENT segment_length_io - { $$ = $2; } - | - { $$ = NULL; } - ; +segment_clause_io + : /* nothing */ { $$ = NULL; } + | MAX_SEGMENT segment_length_io { $$ = $2; } + ; segment_length_io - : unsigned_short_integer - { $$ = MAKE_const_slong($1); } + : unsigned_short_integer { $$ = MAKE_const_slong($1); } | parameter ; // column specifications -column_parens_opt : column_parens - | - { $$ = NULL; } - ; +column_parens_opt + : /* nothing */ { $$ = NULL; } + | column_parens + ; -column_parens : '(' column_list ')' - { $$ = make_list ($2); } - ; +column_parens + : '(' column_list ')' { $$ = make_list ($2); } + ; -column_list : simple_column_name - | column_list ',' simple_column_name - { $$ = make_node (nod_list, 2, $1, $3); } - ; +column_list + : simple_column_name + | column_list ',' simple_column_name { $$ = make_node (nod_list, 2, $1, $3); } + ; // begin IBO hack -ins_column_parens_opt : ins_column_parens - | - { $$ = NULL; } - ; +ins_column_parens_opt + : /* nothing */ { $$ = NULL; } + | ins_column_parens + ; -ins_column_parens : '(' ins_column_list ')' - { $$ = make_list ($2); } - ; +ins_column_parens + : '(' ins_column_list ')' { $$ = make_list ($2); } + ; -ins_column_list : update_column_name - | ins_column_list ',' update_column_name - { $$ = make_node (nod_list, 2, $1, $3); } - ; +ins_column_list + : update_column_name + | ins_column_list ',' update_column_name { $$ = make_node (nod_list, 2, $1, $3); } + ; // end IBO hack -column_name : simple_column_name - | symbol_table_alias_name '.' symbol_column_name - { $$ = make_node (nod_field_name, (int) e_fln_count, $1, $3); } - | symbol_table_alias_name '.' '*' - { $$ = make_node (nod_field_name, (int) e_fln_count, $1, NULL); } - ; +column_name + : simple_column_name + | symbol_table_alias_name '.' symbol_column_name + { $$ = make_node (nod_field_name, (int) e_fln_count, $1, $3); } + | symbol_table_alias_name '.' '*' + { $$ = make_node (nod_field_name, (int) e_fln_count, $1, NULL); } + ; -simple_column_name : symbol_column_name - { $$ = make_node (nod_field_name, (int) e_fln_count, NULL, $1); } - ; +simple_column_name + : symbol_column_name + { $$ = make_node (nod_field_name, (int) e_fln_count, NULL, $1); } + ; -update_column_name : simple_column_name -// CVC: This option should be deprecated! The only allowed syntax should be -// Update...set column = expr, without qualifier for the column. - | symbol_table_alias_name '.' symbol_column_name - { $$ = make_node (nod_field_name, (int) e_fln_count, $1, $3); } - ; +update_column_name + : simple_column_name + // CVC: This option should be deprecated! The only allowed syntax should be + // Update...set column = expr, without qualifier for the column. + | symbol_table_alias_name '.' symbol_column_name + { $$ = make_node (nod_field_name, (int) e_fln_count, $1, $3); } + ; // boolean expressions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-02-16 14:38:31
|
Revision: 52381 http://firebird.svn.sourceforge.net/firebird/?rev=52381&view=rev Author: asfernandes Date: 2011-02-16 14:38:25 +0000 (Wed, 16 Feb 2011) Log Message: ----------- Move ALIAS.* construct from column_name to select_item. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-02-16 14:37:52 UTC (rev 52380) +++ firebird/trunk/src/dsql/parse.y 2011-02-16 14:38:25 UTC (rev 52381) @@ -4381,6 +4381,8 @@ select_item : value | value as_noise symbol_item_alias_name { $$ = make_node(nod_alias, 2, $1, $3); } + | symbol_table_alias_name '.' '*' + { $$ = make_node (nod_field_name, (int) e_fln_count, $1, NULL); } ; as_noise @@ -4934,8 +4936,6 @@ : simple_column_name | symbol_table_alias_name '.' symbol_column_name { $$ = make_node (nod_field_name, (int) e_fln_count, $1, $3); } - | symbol_table_alias_name '.' '*' - { $$ = make_node (nod_field_name, (int) e_fln_count, $1, NULL); } ; simple_column_name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-02-22 15:44:58
|
Revision: 52444 http://firebird.svn.sourceforge.net/firebird/?rev=52444&view=rev Author: asfernandes Date: 2011-02-22 15:44:51 +0000 (Tue, 22 Feb 2011) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-02-22 15:30:06 UTC (rev 52443) +++ firebird/trunk/src/dsql/parse.y 2011-02-22 15:44:51 UTC (rev 52444) @@ -728,7 +728,7 @@ %type <legacyNode> having_clause %type <legacyNode> identity_clause in_predicate_value -%type <legacyNode> index_definition index_list init_alter_db +%type <legacyNode> index_definition index_list %type <legacyNode> ins_column_list ins_column_parens %type <legacyNode> ins_column_parens_opt insert integer_keyword %type <legacyNode> iso_mode isolation_mode @@ -761,8 +761,9 @@ %type named_param(<execStatementNode>) named_params_list(<execStatementNode>) %type not_named_param(<execStatementNode>) not_named_params_list(<execStatementNode>) -%type <legacyNode> open_cursor opt_snapshot optional_retain -%type <legacyNode> optional_savepoint optional_work order_clause order_direction order_item order_list +%type <legacyNode> open_cursor optional_retain +%type optional_savepoint opt_snapshot optional_work +%type <legacyNode> order_clause order_direction order_item order_list %type output_parameters(<parametersClause>) output_proc_parameter(<parametersClause>) %type output_proc_parameters(<parametersClause>) @@ -3145,8 +3146,8 @@ { $$ = makeClassNode($2); } | PACKAGE alter_package_clause { $$ = makeClassNode($2); } - | DATABASE init_alter_db alter_db - { $$ = make_node (nod_mod_database, (int) e_adb_count, make_list ($3)); } + | DATABASE alter_db + { $$ = make_node(nod_mod_database, (int) e_adb_count, make_list($2)); } | DOMAIN alter_domain { $$ = makeClassNode($2); } | INDEX alter_index_clause @@ -3410,15 +3411,12 @@ // ALTER DATABASE -init_alter_db : - { $$ = NULL; } - ; +alter_db + : db_alter_clause + | alter_db db_alter_clause + { $$ = make_node (nod_list, (int) 2, $1, $2); } + ; -alter_db : db_alter_clause - | alter_db db_alter_clause - { $$ = make_node (nod_list, (int) 2, $1, $2); } - ; - db_alter_clause : ADD db_file_list { $$ = $2; } @@ -3574,30 +3572,33 @@ ; -non_array_type : simple_type - | blob_type - ; +non_array_type + : simple_type + | blob_type + ; -array_type : non_charset_simple_type '[' array_spec ']' - { - lex.g_field->fld_ranges = make_list ($3); - lex.g_field->fld_dimensions = lex.g_field->fld_ranges->nod_count / 2; - lex.g_field->fld_element_dtype = lex.g_field->fld_dtype; - $$ = $1; - } - | character_type '[' array_spec ']' charset_clause - { - lex.g_field->fld_ranges = make_list ($3); - lex.g_field->fld_dimensions = lex.g_field->fld_ranges->nod_count / 2; - lex.g_field->fld_element_dtype = lex.g_field->fld_dtype; - $$ = $1; - } - ; +array_type + : non_charset_simple_type '[' array_spec ']' + { + lex.g_field->fld_ranges = make_list ($3); + lex.g_field->fld_dimensions = lex.g_field->fld_ranges->nod_count / 2; + lex.g_field->fld_element_dtype = lex.g_field->fld_dtype; + $$ = $1; + } + | character_type '[' array_spec ']' charset_clause + { + lex.g_field->fld_ranges = make_list ($3); + lex.g_field->fld_dimensions = lex.g_field->fld_ranges->nod_count / 2; + lex.g_field->fld_element_dtype = lex.g_field->fld_dtype; + $$ = $1; + } + ; -array_spec : array_range - | array_spec ',' array_range - { $$ = make_node (nod_list, 2, $1, $3); } - ; +array_spec + : array_range + | array_spec ',' array_range + { $$ = make_node (nod_list, 2, $1, $3); } + ; array_range : signed_long_integer @@ -3611,91 +3612,94 @@ { $$ = make_node(nod_list, 2, MAKE_const_slong($1), MAKE_const_slong($3)); } ; -simple_type : non_charset_simple_type - | character_type charset_clause - ; +simple_type + : non_charset_simple_type + | character_type charset_clause + ; -non_charset_simple_type : national_character_type - | numeric_type - | float_type - | BIGINT +non_charset_simple_type + : national_character_type + | numeric_type + | float_type + | BIGINT + { + if (client_dialect < SQL_DIALECT_V6_TRANSITION) { - if (client_dialect < SQL_DIALECT_V6_TRANSITION) - { - ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-104) << - Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) << - Arg::Str("BIGINT")); - } - if (db_dialect < SQL_DIALECT_V6_TRANSITION) - { - ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-104) << - Arg::Gds(isc_sql_db_dialect_dtype_unsupport) << Arg::Num(db_dialect) << + ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) << Arg::Str("BIGINT")); - } - lex.g_field->fld_dtype = dtype_int64; - lex.g_field->fld_length = sizeof (SINT64); } - | integer_keyword + if (db_dialect < SQL_DIALECT_V6_TRANSITION) { - lex.g_field->fld_dtype = dtype_long; - lex.g_field->fld_length = sizeof (SLONG); + ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + Arg::Gds(isc_sql_db_dialect_dtype_unsupport) << Arg::Num(db_dialect) << + Arg::Str("BIGINT")); } - | SMALLINT + lex.g_field->fld_dtype = dtype_int64; + lex.g_field->fld_length = sizeof (SINT64); + } + | integer_keyword + { + lex.g_field->fld_dtype = dtype_long; + lex.g_field->fld_length = sizeof (SLONG); + } + | SMALLINT + { + lex.g_field->fld_dtype = dtype_short; + lex.g_field->fld_length = sizeof (SSHORT); + } + | DATE + { + stmt_ambiguous = true; + if (client_dialect <= SQL_DIALECT_V5) { - lex.g_field->fld_dtype = dtype_short; - lex.g_field->fld_length = sizeof (SSHORT); + // Post warning saying that DATE is equivalent to TIMESTAMP + ERRD_post_warning(Arg::Warning(isc_sqlwarn) << Arg::Num(301) << + Arg::Warning(isc_dtype_renamed)); + lex.g_field->fld_dtype = dtype_timestamp; + lex.g_field->fld_length = sizeof (GDS_TIMESTAMP); } - | DATE + else if (client_dialect == SQL_DIALECT_V6_TRANSITION) + yyabandon (-104, isc_transitional_date); + else { - stmt_ambiguous = true; - if (client_dialect <= SQL_DIALECT_V5) - { - // Post warning saying that DATE is equivalent to TIMESTAMP - ERRD_post_warning(Arg::Warning(isc_sqlwarn) << Arg::Num(301) << - Arg::Warning(isc_dtype_renamed)); - lex.g_field->fld_dtype = dtype_timestamp; - lex.g_field->fld_length = sizeof (GDS_TIMESTAMP); - } - else if (client_dialect == SQL_DIALECT_V6_TRANSITION) - yyabandon (-104, isc_transitional_date); - else - { - lex.g_field->fld_dtype = dtype_sql_date; - lex.g_field->fld_length = sizeof (ULONG); - } + lex.g_field->fld_dtype = dtype_sql_date; + lex.g_field->fld_length = sizeof (ULONG); } - | TIME + } + | TIME + { + if (client_dialect < SQL_DIALECT_V6_TRANSITION) { - if (client_dialect < SQL_DIALECT_V6_TRANSITION) - { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << - Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) << - Arg::Str("TIME")); - } - if (db_dialect < SQL_DIALECT_V6_TRANSITION) - { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << - Arg::Gds(isc_sql_db_dialect_dtype_unsupport) << Arg::Num(db_dialect) << - Arg::Str("TIME")); - } - lex.g_field->fld_dtype = dtype_sql_time; - lex.g_field->fld_length = sizeof (SLONG); + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + Arg::Gds(isc_sql_dialect_datatype_unsupport) << Arg::Num(client_dialect) << + Arg::Str("TIME")); } - | TIMESTAMP + if (db_dialect < SQL_DIALECT_V6_TRANSITION) { - lex.g_field->fld_dtype = dtype_timestamp; - lex.g_field->fld_length = sizeof (GDS_TIMESTAMP); + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + Arg::Gds(isc_sql_db_dialect_dtype_unsupport) << Arg::Num(db_dialect) << + Arg::Str("TIME")); } - | KW_BOOLEAN - { - lex.g_field->fld_dtype = dtype_boolean; - lex.g_field->fld_length = sizeof(UCHAR); - } - ; + lex.g_field->fld_dtype = dtype_sql_time; + lex.g_field->fld_length = sizeof (SLONG); + } + | TIMESTAMP + { + lex.g_field->fld_dtype = dtype_timestamp; + lex.g_field->fld_length = sizeof (GDS_TIMESTAMP); + } + | KW_BOOLEAN + { + lex.g_field->fld_dtype = dtype_boolean; + lex.g_field->fld_length = sizeof(UCHAR); + } + ; -integer_keyword : INTEGER - | KW_INT - ; +integer_keyword + : INTEGER + | KW_INT + ; // allow a blob to be specified with any combination of segment length and subtype @@ -3730,33 +3734,23 @@ ; blob_segsize - : SEGMENT KW_SIZE unsigned_short_integer - { - lex.g_field->fld_seg_length = (USHORT) $3; - } - | - { - lex.g_field->fld_seg_length = (USHORT) 80; - } + : // nothing + { lex.g_field->fld_seg_length = (USHORT) 80; } + | SEGMENT KW_SIZE unsigned_short_integer + { lex.g_field->fld_seg_length = (USHORT) $3; } ; blob_subtype - : SUB_TYPE signed_short_integer - { - lex.g_field->fld_sub_type = (USHORT) $2; - } + : // nothing + { lex.g_field->fld_sub_type = (USHORT) 0; } + | SUB_TYPE signed_short_integer + { lex.g_field->fld_sub_type = (USHORT) $2; } | SUB_TYPE symbol_blob_subtype_name - { - lex.g_field->fld_sub_type_name = $2; - } - | - { - lex.g_field->fld_sub_type = (USHORT) 0; - } + { lex.g_field->fld_sub_type_name = $2; } ; charset_clause - : + : // nothing { $$ = NULL; } | CHARACTER SET symbol_character_set_name { @@ -3810,22 +3804,24 @@ } ; -varying_keyword : VARCHAR - | CHARACTER VARYING - | KW_CHAR VARYING - ; +varying_keyword + : VARCHAR + | CHARACTER VARYING + | KW_CHAR VARYING + ; -character_keyword : CHARACTER - | KW_CHAR - ; +character_keyword + : CHARACTER + | KW_CHAR + ; -national_character_keyword : NCHAR - | NATIONAL CHARACTER - | NATIONAL KW_CHAR - ; +national_character_keyword + : NCHAR + | NATIONAL CHARACTER + | NATIONAL KW_CHAR + ; - // numeric type numeric_type : KW_NUMERIC prec_scale @@ -3989,10 +3985,11 @@ // SET statements -set : set_transaction - | set_generator - | set_statistics - ; +set + : set_transaction + | set_generator + | set_statistics + ; set_generator @@ -4013,10 +4010,11 @@ // transaction statements -savepoint : set_savepoint - | release_savepoint - | undo_savepoint - ; +savepoint + : set_savepoint + | release_savepoint + | undo_savepoint + ; set_savepoint : SAVEPOINT symbol_savepoint_name @@ -4039,10 +4037,8 @@ ; release_only_opt - : - { $$ = false; } - | ONLY - { $$ = true; } + : /* nothing */ { $$ = false; } + | ONLY { $$ = true; } ; undo_savepoint @@ -4056,152 +4052,162 @@ ; optional_savepoint - : SAVEPOINT - | { $$ = NULL; } + : // nothing + | SAVEPOINT ; -commit : COMMIT optional_work optional_retain - { $$ = make_node (nod_commit, e_commit_count, $3); } - ; +commit + : COMMIT optional_work optional_retain + { $$ = make_node (nod_commit, e_commit_count, $3); } + ; -rollback : ROLLBACK optional_work optional_retain - { $$ = make_node (nod_rollback, e_rollback_count, $3); } - ; +rollback + : ROLLBACK optional_work optional_retain + { $$ = make_node (nod_rollback, e_rollback_count, $3); } + ; optional_work - : WORK - | { $$ = NULL; } + : // nothing + | WORK ; -optional_retain : RETAIN opt_snapshot - { $$ = make_node (nod_retain, 0, NULL); } - | - { $$ = NULL; } - ; +optional_retain + : /* nothing */ { $$ = NULL; } + | RETAIN opt_snapshot { $$ = make_node(nod_retain, 0, NULL); } + ; -opt_snapshot : SNAPSHOT - | - { $$ = NULL; } - ; +opt_snapshot + : // nothing + | SNAPSHOT + ; -set_transaction : SET TRANSACTION tran_opt_list_m - {$$ = make_node (nod_trans, 1, make_list ($3)); } - ; +set_transaction + : SET TRANSACTION tran_opt_list_m + { $$ = make_node (nod_trans, 1, make_list ($3)); } + ; -tran_opt_list_m : tran_opt_list - | - { $$ = NULL; } - ; +tran_opt_list_m + : /* nothing */ { $$ = NULL; } + | tran_opt_list + ; -tran_opt_list : tran_opt - | tran_opt_list tran_opt - { $$ = make_node (nod_list, (int) 2, $1, $2); } - ; +tran_opt_list + : tran_opt + | tran_opt_list tran_opt + { $$ = make_node (nod_list, (int) 2, $1, $2); } + ; -tran_opt : access_mode - | lock_wait - | isolation_mode - | tra_misc_options - | tra_timeout - | tbl_reserve_options - ; +tran_opt + : access_mode + | lock_wait + | isolation_mode + | tra_misc_options + | tra_timeout + | tbl_reserve_options + ; -access_mode : READ ONLY - { $$ = make_flag_node (nod_access, NOD_READ_ONLY, (int) 0, NULL); } - | READ WRITE - { $$ = make_flag_node (nod_access, NOD_READ_WRITE, (int) 0, NULL); } - ; +access_mode + : READ ONLY + { $$ = make_flag_node (nod_access, NOD_READ_ONLY, (int) 0, NULL); } + | READ WRITE + { $$ = make_flag_node (nod_access, NOD_READ_WRITE, (int) 0, NULL); } + ; -lock_wait : WAIT - { $$ = make_flag_node (nod_wait, NOD_WAIT, (int) 0, NULL); } - | NO WAIT - { $$ = make_flag_node (nod_wait, NOD_NO_WAIT, (int) 0, NULL); } - ; +lock_wait + : WAIT + { $$ = make_flag_node (nod_wait, NOD_WAIT, (int) 0, NULL); } + | NO WAIT + { $$ = make_flag_node (nod_wait, NOD_NO_WAIT, (int) 0, NULL); } + ; -isolation_mode : ISOLATION LEVEL iso_mode - { $$ = $3;} - | iso_mode - ; +isolation_mode + : ISOLATION LEVEL iso_mode { $$ = $3;} + | iso_mode + ; -iso_mode : snap_shot - { $$ = $1;} - | READ UNCOMMITTED version_mode - { $$ = make_flag_node (nod_isolation, NOD_READ_COMMITTED, 1, $3); } - | READ COMMITTED version_mode - { $$ = make_flag_node (nod_isolation, NOD_READ_COMMITTED, 1, $3); } - ; +iso_mode + : snap_shot + { $$ = $1;} + | READ UNCOMMITTED version_mode + { $$ = make_flag_node (nod_isolation, NOD_READ_COMMITTED, 1, $3); } + | READ COMMITTED version_mode + { $$ = make_flag_node (nod_isolation, NOD_READ_COMMITTED, 1, $3); } + ; -snap_shot : SNAPSHOT - { $$ = make_flag_node (nod_isolation, NOD_CONCURRENCY, 0, NULL); } - | SNAPSHOT TABLE - { $$ = make_flag_node (nod_isolation, NOD_CONSISTENCY, 0, NULL); } - | SNAPSHOT TABLE STABILITY - { $$ = make_flag_node (nod_isolation, NOD_CONSISTENCY, 0, NULL); } - ; +snap_shot + : SNAPSHOT + { $$ = make_flag_node (nod_isolation, NOD_CONCURRENCY, 0, NULL); } + | SNAPSHOT TABLE + { $$ = make_flag_node (nod_isolation, NOD_CONSISTENCY, 0, NULL); } + | SNAPSHOT TABLE STABILITY + { $$ = make_flag_node (nod_isolation, NOD_CONSISTENCY, 0, NULL); } + ; -version_mode : VERSION - { $$ = make_flag_node (nod_version, NOD_VERSION, 0, NULL); } - | NO VERSION - { $$ = make_flag_node (nod_version, NOD_NO_VERSION, 0, NULL); } - | - { $$ = 0; } - ; +version_mode + : /* nothing */ { $$ = NULL; } + | VERSION { $$ = make_flag_node (nod_version, NOD_VERSION, 0, NULL); } + | NO VERSION { $$ = make_flag_node (nod_version, NOD_NO_VERSION, 0, NULL); } + ; -tra_misc_options: NO AUTO UNDO - { $$ = make_flag_node(nod_tra_misc, NOD_NO_AUTO_UNDO, 0, NULL); } - | KW_IGNORE LIMBO - { $$ = make_flag_node(nod_tra_misc, NOD_IGNORE_LIMBO, 0, NULL); } - | RESTART REQUESTS - { $$ = make_flag_node(nod_tra_misc, NOD_RESTART_REQUESTS, 0, NULL); } - ; +tra_misc_options + : NO AUTO UNDO + { $$ = make_flag_node(nod_tra_misc, NOD_NO_AUTO_UNDO, 0, NULL); } + | KW_IGNORE LIMBO + { $$ = make_flag_node(nod_tra_misc, NOD_IGNORE_LIMBO, 0, NULL); } + | RESTART REQUESTS + { $$ = make_flag_node(nod_tra_misc, NOD_RESTART_REQUESTS, 0, NULL); } + ; tra_timeout : LOCK TIMEOUT nonneg_short_integer { $$ = make_node(nod_lock_timeout, 1, MAKE_const_slong($3)); } ; -tbl_reserve_options: RESERVING restr_list - { $$ = make_node (nod_reserve, 1, make_list ($2)); } - ; +tbl_reserve_options + : RESERVING restr_list + { $$ = make_node (nod_reserve, 1, make_list ($2)); } + ; -lock_type : KW_SHARED - { $$ = (dsql_nod*) NOD_SHARED; } - | PROTECTED - { $$ = (dsql_nod*) NOD_PROTECTED; } - | - { $$ = (dsql_nod*) 0; } - ; +lock_type + : /* nothing */ { $$ = NULL; } + | KW_SHARED { $$ = (dsql_nod*) NOD_SHARED; } + | PROTECTED { $$ = (dsql_nod*) NOD_PROTECTED; } + ; -lock_mode : READ - { $$ = (dsql_nod*) NOD_READ; } - | WRITE - { $$ = (dsql_nod*) NOD_WRITE; } - ; +lock_mode + : READ { $$ = (dsql_nod*) NOD_READ; } + | WRITE { $$ = (dsql_nod*) NOD_WRITE; } + ; -restr_list : restr_option - | restr_list ',' restr_option - { $$ = make_node (nod_list, (int) 2, $1, $3); } - ; +restr_list + : restr_option + | restr_list ',' restr_option + { $$ = make_node (nod_list, (int) 2, $1, $3); } + ; -restr_option : table_list table_lock - { $$ = make_node (nod_table_lock, (int) 2, make_list ($1), $2); } - ; +restr_option + : table_list table_lock + { $$ = make_node (nod_table_lock, (int) 2, make_list ($1), $2); } + ; -table_lock : FOR lock_type lock_mode - { $$ = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT)(IPTR) $2 | (SSHORT)(IPTR) $3), (SSHORT) 0, NULL); } - | - { $$ = 0; } - ; +table_lock + : // nothing + { $$ = NULL; } + | FOR lock_type lock_mode + { $$ = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT)(IPTR) $2 | (SSHORT)(IPTR) $3), (SSHORT) 0, NULL); } + ; -table_list : simple_table_name - | table_list ',' simple_table_name - { $$ = make_node (nod_list, (int) 2, $1, $3); } - ; +table_list + : simple_table_name + | table_list ',' simple_table_name + { $$ = make_node (nod_list, (int) 2, $1, $3); } + ; -set_statistics : SET STATISTICS INDEX symbol_index_name - { $$ = make_node (nod_set_statistics, (int) e_stat_count, $4); } - ; +set_statistics + : SET STATISTICS INDEX symbol_index_name + { $$ = make_node (nod_set_statistics, (int) e_stat_count, $4); } + ; comment : COMMENT ON ddl_type0 IS ddl_desc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-02-26 21:58:40
|
Revision: 52478 http://firebird.svn.sourceforge.net/firebird/?rev=52478&view=rev Author: asfernandes Date: 2011-02-26 21:58:33 +0000 (Sat, 26 Feb 2011) Log Message: ----------- Explicitelly delete the strings created. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-02-26 21:52:47 UTC (rev 52477) +++ firebird/trunk/src/dsql/parse.y 2011-02-26 21:58:33 UTC (rev 52478) @@ -6519,6 +6519,13 @@ KeywordVersion(token->tok_ident, str, token->tok_version)); } } + + ~KeywordsMap() + { + Accessor accessor(this); + for (bool found = accessor.getFirst(); found; found = accessor.getNext()) + delete accessor.current()->second.str; + } }; GlobalPtr<KeywordsMap> keywordsMap; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-02-26 22:03:49
|
Revision: 52479 http://firebird.svn.sourceforge.net/firebird/?rev=52479&view=rev Author: asfernandes Date: 2011-02-26 22:03:43 +0000 (Sat, 26 Feb 2011) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-02-26 21:58:33 UTC (rev 52478) +++ firebird/trunk/src/dsql/parse.y 2011-02-26 22:03:43 UTC (rev 52479) @@ -6489,13 +6489,6 @@ { } - KeywordVersion() - : keyword(-1), - str(NULL), - version(0) - { - } - int keyword; dsql_str* str; USHORT version; @@ -7626,16 +7619,16 @@ *p = 0; Firebird::string str(string, p - string); - KeywordVersion keyVer; + KeywordVersion* keyVer = keywordsMap->get(str); - if (keywordsMap->get(str, keyVer) && parser_version >= keyVer.version && - (keyVer.keyword != COMMENT || lex.prev_keyword == -1)) + if (keyVer && parser_version >= keyVer->version && + (keyVer->keyword != COMMENT || lex.prev_keyword == -1)) { - yylval.legacyNode = (dsql_nod*) keyVer.str; + yylval.legacyNode = (dsql_nod*) keyVer->str; lex.last_token_bk = lex.last_token; lex.line_start_bk = lex.line_start; lex.lines_bk = lex.lines; - return keyVer.keyword; + return keyVer->keyword; } if (p > &string[MAX_SQL_IDENTIFIER_LEN]) @@ -7653,12 +7646,12 @@ if (lex.last_token + 1 < lex.end) { Firebird::string str(lex.last_token, 2); - KeywordVersion keyVer; + KeywordVersion* keyVer = keywordsMap->get(str); - if (keywordsMap->get(str, keyVer) && parser_version >= keyVer.version) + if (keyVer && parser_version >= keyVer->version) { ++lex.ptr; - return keyVer.keyword; + return keyVer->keyword; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-03-07 03:15:40
|
Revision: 52522 http://firebird.svn.sourceforge.net/firebird/?rev=52522&view=rev Author: asfernandes Date: 2011-03-07 03:15:33 +0000 (Mon, 07 Mar 2011) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-03-07 03:15:07 UTC (rev 52521) +++ firebird/trunk/src/dsql/parse.y 2011-03-07 03:15:33 UTC (rev 52522) @@ -666,7 +666,7 @@ %type <legacyNode> alter_role_clause alter_role_enable alter_sequence_clause %type <legacyNode> alter_udf_clause alter_user_clause alter_view_clause %type <legacyNode> arg_desc arg_desc_list arg_desc_list1 array_element array_range -%type <legacyNode> array_spec array_type as_opt +%type <legacyNode> array_spec array_type %type <stmtNode> assignment %type <compoundStmtNode> assignments %type <legacyStr> admin_opt @@ -978,151 +978,139 @@ // GRANT statement -grant : GRANT privileges ON table_noise simple_table_name - TO non_role_grantee_list grant_option granted_by - { $$ = make_node (nod_grant, (int) e_grant_count, - $2, $5, make_list($7), $8, $9); } - | GRANT execute_privilege ON PROCEDURE simple_proc_name - TO non_role_grantee_list grant_option granted_by - { $$ = make_node (nod_grant, (int) e_grant_count, - $2, $5, make_list($7), $8, $9); } - | GRANT execute_privilege ON FUNCTION simple_UDF_name - TO non_role_grantee_list grant_option granted_by - { $$ = make_node (nod_grant, (int) e_grant_count, - $2, $5, make_list($7), $8, $9); } - | GRANT execute_privilege ON PACKAGE simple_package_name - TO non_role_grantee_list grant_option granted_by - { $$ = make_node (nod_grant, (int) e_grant_count, $2, $5, make_list($7), $8, $9); } - | GRANT role_name_list TO role_grantee_list role_admin_option granted_by - { $$ = make_node (nod_grant, (int) e_grant_count, - make_list($2), make_list($4), NULL, $5, $6); } - ; +grant + : GRANT privileges ON table_noise simple_table_name + TO non_role_grantee_list grant_option granted_by + { $$ = make_node (nod_grant, (int) e_grant_count, + $2, $5, make_list($7), $8, $9); } + | GRANT execute_privilege ON PROCEDURE simple_proc_name + TO non_role_grantee_list grant_option granted_by + { $$ = make_node (nod_grant, (int) e_grant_count, + $2, $5, make_list($7), $8, $9); } + | GRANT execute_privilege ON FUNCTION simple_UDF_name + TO non_role_grantee_list grant_option granted_by + { $$ = make_node (nod_grant, (int) e_grant_count, + $2, $5, make_list($7), $8, $9); } + | GRANT execute_privilege ON PACKAGE simple_package_name + TO non_role_grantee_list grant_option granted_by + { $$ = make_node (nod_grant, (int) e_grant_count, $2, $5, make_list($7), $8, $9); } + | GRANT role_name_list TO role_grantee_list role_admin_option granted_by + { $$ = make_node (nod_grant, (int) e_grant_count, + make_list($2), make_list($4), NULL, $5, $6); } + ; table_noise - : + : // nothing | TABLE ; -privileges : ALL - { $$ = make_node (nod_all, (int) 0, NULL); } - | ALL PRIVILEGES - { $$ = make_node (nod_all, (int) 0, NULL); } - | privilege_list - { $$ = make_list ($1); } - ; +privileges + : ALL { $$ = make_node (nod_all, (int) 0, NULL); } + | ALL PRIVILEGES { $$ = make_node (nod_all, (int) 0, NULL); } + | privilege_list { $$ = make_list ($1); } + ; -privilege_list : privilege - | privilege_list ',' privilege - { $$ = make_node (nod_list, (int) 2, $1, $3); } - ; +privilege_list + : privilege + | privilege_list ',' privilege { $$ = make_node (nod_list, (int) 2, $1, $3); } + ; -execute_privilege : EXECUTE - { $$ = make_list (make_node (nod_execute, (int) 0, NULL)); } - ; +execute_privilege + : EXECUTE { $$ = make_list (make_node (nod_execute, (int) 0, NULL)); } + ; -privilege : SELECT - { $$ = make_node (nod_select, (int) 0, NULL); } - | INSERT - { $$ = make_node (nod_insert, (int) 0, NULL); } - | KW_DELETE - { $$ = make_node (nod_delete, (int) 0, NULL); } - | UPDATE column_parens_opt - { $$ = make_node (nod_update, (int) 1, $2); } - | REFERENCES column_parens_opt - { $$ = make_node (nod_references, (int) 1, $2); } - ; +privilege + : SELECT { $$ = make_node (nod_select, (int) 0, NULL); } + | INSERT { $$ = make_node (nod_insert, (int) 0, NULL); } + | KW_DELETE { $$ = make_node (nod_delete, (int) 0, NULL); } + | UPDATE column_parens_opt { $$ = make_node (nod_update, (int) 1, $2); } + | REFERENCES column_parens_opt { $$ = make_node (nod_references, (int) 1, $2); } + ; -grant_option : WITH GRANT OPTION - { $$ = make_node (nod_grant, (int) 0, NULL); } - | - { $$ = NULL; } - ; +grant_option + : /* nothing */ { $$ = NULL; } + | WITH GRANT OPTION { $$ = make_node (nod_grant, (int) 0, NULL); } + ; -role_admin_option : WITH ADMIN OPTION - { $$ = make_node (nod_grant_admin, (int) 0, NULL); } - | - { $$ = NULL; } - ; +role_admin_option + : /* nothing */ { $$ = NULL; } + | WITH ADMIN OPTION { $$ = make_node (nod_grant_admin, (int) 0, NULL); } + ; -granted_by : granted_by_text grantor - { $$ = $2; } - | - { $$ = NULL; } - ; +granted_by + : /* nothing */ { $$ = NULL; } + | granted_by_text grantor { $$ = $2; } + ; -granted_by_text : GRANTED BY - | AS - ; +granted_by_text + : GRANTED BY + | AS + ; -grantor : role_grantee - { $$ = $1; } - ; +grantor + : role_grantee { $$ = $1; } + ; simple_package_name - : symbol_package_name - { $$ = make_node(nod_package_name, (int) 1, $1); } + : symbol_package_name { $$ = make_node(nod_package_name, (int) 1, $1); } ; simple_proc_name - : symbol_procedure_name - { $$ = make_node(nod_procedure_name, (int) 1, $1); } + : symbol_procedure_name { $$ = make_node(nod_procedure_name, (int) 1, $1); } ; simple_UDF_name - : symbol_UDF_name - { $$ = make_node(nod_function_name, (int) 1, $1); } + : symbol_UDF_name { $$ = make_node(nod_function_name, (int) 1, $1); } ; // REVOKE statement -revoke : REVOKE rev_grant_option privileges ON table_noise simple_table_name - FROM non_role_grantee_list granted_by - { $$ = make_node (nod_revoke, (int) e_grant_count, - $3, $6, make_list($8), $2, $9); } - | REVOKE rev_grant_option execute_privilege ON PROCEDURE simple_proc_name - FROM non_role_grantee_list granted_by - { $$ = make_node (nod_revoke, (int) e_grant_count, - $3, $6, make_list($8), $2, $9); } - | REVOKE rev_grant_option execute_privilege ON FUNCTION simple_UDF_name - FROM non_role_grantee_list granted_by - { $$ = make_node (nod_revoke, (int) e_grant_count, - $3, $6, make_list($8), $2, $9); } - | REVOKE rev_grant_option execute_privilege ON PACKAGE simple_package_name - FROM non_role_grantee_list granted_by - { $$ = make_node (nod_revoke, (int) e_grant_count, $3, $6, make_list($8), $2, $9); } - | REVOKE rev_admin_option role_name_list FROM role_grantee_list granted_by - { $$ = make_node (nod_revoke, (int) e_grant_count, - make_list($3), make_list($5), NULL, $2, $6); } - | REVOKE ALL ON ALL FROM non_role_grantee_list - { $$ = make_node (nod_revoke, (int) e_grant_count, - NULL, NULL, make_list($6), NULL, NULL); } - ; +revoke + : REVOKE rev_grant_option privileges ON table_noise simple_table_name + FROM non_role_grantee_list granted_by + { $$ = make_node (nod_revoke, (int) e_grant_count, + $3, $6, make_list($8), $2, $9); } + | REVOKE rev_grant_option execute_privilege ON PROCEDURE simple_proc_name + FROM non_role_grantee_list granted_by + { $$ = make_node (nod_revoke, (int) e_grant_count, + $3, $6, make_list($8), $2, $9); } + | REVOKE rev_grant_option execute_privilege ON FUNCTION simple_UDF_name + FROM non_role_grantee_list granted_by + { $$ = make_node (nod_revoke, (int) e_grant_count, + $3, $6, make_list($8), $2, $9); } + | REVOKE rev_grant_option execute_privilege ON PACKAGE simple_package_name + FROM non_role_grantee_list granted_by + { $$ = make_node (nod_revoke, (int) e_grant_count, $3, $6, make_list($8), $2, $9); } + | REVOKE rev_admin_option role_name_list FROM role_grantee_list granted_by + { $$ = make_node (nod_revoke, (int) e_grant_count, + make_list($3), make_list($5), NULL, $2, $6); } + | REVOKE ALL ON ALL FROM non_role_grantee_list + { $$ = make_node (nod_revoke, (int) e_grant_count, + NULL, NULL, make_list($6), NULL, NULL); } + ; -rev_grant_option : GRANT OPTION FOR - { $$ = make_node (nod_grant, (int) 0, NULL); } - | - { $$ = NULL; } - ; +rev_grant_option + : /* nothing */ { $$ = NULL; } + | GRANT OPTION FOR { $$ = make_node (nod_grant, (int) 0, NULL); } + ; -rev_admin_option : ADMIN OPTION FOR - { $$ = make_node (nod_grant_admin, (int) 0, NULL); } - | - { $$ = NULL; } - ; +rev_admin_option + : /* nothing */ { $$ = NULL; } + | ADMIN OPTION FOR { $$ = make_node (nod_grant_admin, (int) 0, NULL); } + ; -non_role_grantee_list : grantee_list - | user_grantee_list - ; +non_role_grantee_list + : grantee_list + | user_grantee_list + ; -grantee_list : grantee - | grantee_list ',' grantee - { $$ = make_node (nod_list, (int) 2, $1, $3); } - | grantee_list ',' user_grantee - { $$ = make_node (nod_list, (int) 2, $1, $3); } - | user_grantee_list ',' grantee - { $$ = make_node (nod_list, (int) 2, $1, $3); } - ; +grantee_list + : grantee + | grantee_list ',' grantee { $$ = make_node (nod_list, (int) 2, $1, $3); } + | grantee_list ',' user_grantee { $$ = make_node (nod_list, (int) 2, $1, $3); } + | user_grantee_list ',' grantee { $$ = make_node (nod_list, (int) 2, $1, $3); } + ; grantee : PROCEDURE symbol_procedure_name @@ -1136,57 +1124,52 @@ | VIEW symbol_view_name { $$ = make_node (nod_view_obj, (int) 1, $2); } | ROLE symbol_role_name - { $$ = make_node (nod_role_name, (int) 1, $2); } + { $$ = make_node (nod_role_name, (int) 1, $2); } ; -user_grantee_list : user_grantee - | user_grantee_list ',' user_grantee - { $$ = make_node (nod_list, (int) 2, $1, $3); } - ; +user_grantee_list + : user_grantee + | user_grantee_list ',' user_grantee { $$ = make_node (nod_list, (int) 2, $1, $3); } + ; // CVC: In the future we can deprecate the first implicit form since we'll support // explicit grant/revoke for both USER and ROLE keywords & object types. -user_grantee : symbol_user_name - { $$ = make_node (nod_user_name, (int) 1, $1); } - | USER symbol_user_name - { $$ = make_node (nod_user_name, (int) 2, $2, NULL); } - | GROUP symbol_user_name - { $$ = make_node (nod_user_group, (int) 1, $2); } +user_grantee + : symbol_user_name { $$ = make_node (nod_user_name, (int) 1, $1); } + | USER symbol_user_name { $$ = make_node (nod_user_name, (int) 2, $2, NULL); } + | GROUP symbol_user_name { $$ = make_node (nod_user_group, (int) 1, $2); } ; -role_name_list : role_name - | role_name_list ',' role_name - { $$ = make_node (nod_list, (int) 2, $1, $3); } - ; +role_name_list + : role_name + | role_name_list ',' role_name { $$ = make_node (nod_list, (int) 2, $1, $3); } + ; -role_name : symbol_role_name - { $$ = make_node (nod_role_name, (int) 1, $1); } - ; +role_name + : symbol_role_name { $$ = make_node (nod_role_name, (int) 1, $1); } + ; -role_grantee_list : role_grantee - | role_grantee_list ',' role_grantee - { $$ = make_node (nod_list, (int) 2, $1, $3); } - ; +role_grantee_list + : role_grantee + | role_grantee_list ',' role_grantee { $$ = make_node (nod_list, (int) 2, $1, $3); } + ; -role_grantee : symbol_user_name - { $$ = make_node (nod_user_name, (int) 1, $1); } - | USER symbol_user_name - { $$ = make_node (nod_user_name, (int) 1, $2); } - ; +role_grantee + : symbol_user_name { $$ = make_node (nod_user_name, (int) 1, $1); } + | USER symbol_user_name { $$ = make_node (nod_user_name, (int) 1, $2); } + ; // DECLARE operations -declare : DECLARE declare_clause - { $$ = $2;} - ; +declare + : DECLARE declare_clause { $$ = $2;} + ; declare_clause - : FILTER filter_decl_clause - { $$ = $2; } - | EXTERNAL FUNCTION udf_decl_clause - { $$ = $3; } + : FILTER filter_decl_clause { $$ = $2; } + | EXTERNAL FUNCTION udf_decl_clause { $$ = $3; } ; udf_decl_clause @@ -1208,38 +1191,33 @@ } ; -arg_desc_list1 : - { $$ = NULL; } - | arg_desc_list - | '(' arg_desc_list ')' - { $$ = $2; } - ; +arg_desc_list1 + : /* nothing */ { $$ = NULL; } + | arg_desc_list + | '(' arg_desc_list ')' { $$ = $2; } + ; -arg_desc_list : arg_desc - | arg_desc_list ',' arg_desc - { $$ = make_node (nod_list, (int) 2, $1, $3); } - ; +arg_desc_list + : arg_desc + | arg_desc_list ',' arg_desc { $$ = make_node (nod_list, (int) 2, $1, $3); } + ; -/*arg_desc : init_data_type udf_data_type - { $$ = $1; } */ -arg_desc : init_data_type udf_data_type param_mechanism - { $$ = make_node (nod_udf_param, (int) e_udf_param_count, $1, $3); } - ; +arg_desc + : init_data_type udf_data_type param_mechanism + { $$ = make_node (nod_udf_param, (int) e_udf_param_count, $1, $3); } + ; -param_mechanism : - { $$ = NULL; } // Beware: ddl.cpp converts this to mean FUN_reference. - | BY KW_DESCRIPTOR - { $$ = MAKE_const_slong (FUN_descriptor); } - | BY SCALAR_ARRAY - { $$ = MAKE_const_slong (FUN_scalar_array); } - | KW_NULL - { $$ = MAKE_const_slong (FUN_ref_with_null); } - ; +param_mechanism + : /* nothing */ { $$ = NULL; } // Beware: ddl.cpp converts this to mean FUN_reference. + | BY KW_DESCRIPTOR { $$ = MAKE_const_slong (FUN_descriptor); } + | BY SCALAR_ARRAY { $$ = MAKE_const_slong (FUN_scalar_array); } + | KW_NULL { $$ = MAKE_const_slong (FUN_ref_with_null); } + ; -return_value1 : return_value - | '(' return_value ')' - { $$ = $2; } - ; +return_value1 + : return_value + | '(' return_value ')' { $$ = $2; } + ; return_value : init_data_type udf_data_type return_mechanism @@ -1250,24 +1228,21 @@ } ; -return_mechanism : - { $$ = MAKE_const_slong (FUN_reference); } - | BY KW_VALUE - { $$ = MAKE_const_slong (FUN_value); } - | BY KW_DESCRIPTOR - { $$ = MAKE_const_slong (FUN_descriptor); } - | FREE_IT - { $$ = MAKE_const_slong (-1 * FUN_reference); } - // FUN_refrence with FREE_IT is -ve - | BY KW_DESCRIPTOR FREE_IT - { $$ = MAKE_const_slong (-1 * FUN_descriptor); } - ; +return_mechanism + : /* nothing */ { $$ = MAKE_const_slong (FUN_reference); } + | BY KW_VALUE { $$ = MAKE_const_slong (FUN_value); } + | BY KW_DESCRIPTOR { $$ = MAKE_const_slong (FUN_descriptor); } + // FUN_refrence with FREE_IT is -ve + | FREE_IT { $$ = MAKE_const_slong (-1 * FUN_reference); } + | BY KW_DESCRIPTOR FREE_IT { $$ = MAKE_const_slong (-1 * FUN_descriptor); } + ; -filter_decl_clause : symbol_filter_name INPUT_TYPE blob_filter_subtype OUTPUT_TYPE blob_filter_subtype +filter_decl_clause + : symbol_filter_name INPUT_TYPE blob_filter_subtype OUTPUT_TYPE blob_filter_subtype ENTRY_POINT sql_string MODULE_NAME sql_string - { $$ = make_node (nod_def_filter, (int) e_filter_count, $1, $3, $5, $7, $9); } - ; + { $$ = make_node (nod_def_filter, (int) e_filter_count, $1, $3, $5, $7, $9); } + ; blob_filter_subtype : symbol_blob_subtype_name @@ -1278,52 +1253,53 @@ // CREATE metadata operations -create : CREATE create_clause - { $$ = $2; } - ; +create + : CREATE create_clause { $$ = $2; } + ; -create_clause : EXCEPTION exception_clause - { $$ = $2; } - | unique_opt order_direction INDEX symbol_index_name ON simple_table_name index_definition - { $$ = make_node (nod_def_index, (int) e_idx_count, $1, $2, $4, $6, $7); } - | FUNCTION function_clause - { $$ = makeClassNode($2); } - | PROCEDURE procedure_clause - { $$ = makeClassNode($2); } - | TABLE table_clause - { $$ = makeClassNode($2); } - | GLOBAL TEMPORARY TABLE gtt_table_clause - { $$ = makeClassNode($4); } - | TRIGGER trigger_clause - { $$ = makeClassNode($2); } - | VIEW view_clause - { $$ = makeClassNode($2); } - | GENERATOR generator_clause - { $$ = makeClassNode($2); } - | SEQUENCE generator_clause - { $$ = makeClassNode($2); } - | DATABASE db_clause - { $$ = $2; } - | DOMAIN domain_clause - { $$ = makeClassNode($2); } - | SHADOW shadow_clause - { $$ = $2; } - | ROLE role_clause - { $$ = $2; } - | COLLATION collation_clause - { $$ = makeClassNode($2); } - | USER create_user_clause - { $$ = $2; } - | PACKAGE package_clause - { $$ = makeClassNode($2); } - | PACKAGE BODY package_body_clause - { $$ = makeClassNode($3); } - ; +create_clause + : EXCEPTION exception_clause + { $$ = $2; } + | unique_opt order_direction INDEX symbol_index_name ON simple_table_name index_definition + { $$ = make_node (nod_def_index, (int) e_idx_count, $1, $2, $4, $6, $7); } + | FUNCTION function_clause + { $$ = makeClassNode($2); } + | PROCEDURE procedure_clause + { $$ = makeClassNode($2); } + | TABLE table_clause + { $$ = makeClassNode($2); } + | GLOBAL TEMPORARY TABLE gtt_table_clause + { $$ = makeClassNode($4); } + | TRIGGER trigger_clause + { $$ = makeClassNode($2); } + | VIEW view_clause + { $$ = makeClassNode($2); } + | GENERATOR generator_clause + { $$ = makeClassNode($2); } + | SEQUENCE generator_clause + { $$ = makeClassNode($2); } + | DATABASE db_clause + { $$ = $2; } + | DOMAIN domain_clause + { $$ = makeClassNode($2); } + | SHADOW shadow_clause + { $$ = $2; } + | ROLE role_clause + { $$ = $2; } + | COLLATION collation_clause + { $$ = makeClassNode($2); } + | USER create_user_clause + { $$ = $2; } + | PACKAGE package_clause + { $$ = makeClassNode($2); } + | PACKAGE BODY package_body_clause + { $$ = makeClassNode($3); } + ; -recreate : RECREATE recreate_clause - { $$ = $2; } - ; +recreate + : RECREATE recreate_clause { $$ = $2; } + ; recreate_clause : PROCEDURE procedure_clause @@ -1346,23 +1322,17 @@ { $$ = $2; } ; -create_or_alter : CREATE OR ALTER replace_clause - { $$ = $4; } - ; +create_or_alter + : CREATE OR ALTER replace_clause { $$ = $4; } + ; replace_clause - : PROCEDURE replace_procedure_clause - { $$ = makeClassNode($2); } - | FUNCTION replace_function_clause - { $$ = makeClassNode($2); } - | TRIGGER replace_trigger_clause - { $$ = makeClassNode($2); } - | PACKAGE replace_package_clause - { $$ = makeClassNode($2); } - | VIEW replace_view_clause - { $$ = $2; } - | EXCEPTION replace_exception_clause - { $$ = $2; } + : PROCEDURE replace_procedure_clause { $$ = makeClassNode($2); } + | FUNCTION replace_function_clause { $$ = makeClassNode($2); } + | TRIGGER replace_trigger_clause { $$ = makeClassNode($2); } + | PACKAGE replace_package_clause { $$ = makeClassNode($2); } + | VIEW replace_view_clause { $$ = $2; } + | EXCEPTION replace_exception_clause { $$ = $2; } ; @@ -1406,18 +1376,18 @@ // CREATE INDEX -unique_opt : UNIQUE - { $$ = make_node (nod_unique, 0, NULL); } - | - { $$ = NULL; } - ; +unique_opt + : /* nothing */ { $$ = NULL; } + | UNIQUE { $$ = make_node (nod_unique, 0, NULL); } + ; -index_definition : column_list - { $$ = make_list ($1); } - | column_parens - | computed_by '(' begin_trigger value end_trigger ')' - { $$ = make_node (nod_def_computed, 2, $4, $5); } - ; +index_definition + : column_list + { $$ = make_list ($1); } + | column_parens + | computed_by '(' begin_trigger value end_trigger ')' + { $$ = make_node (nod_def_computed, 2, $4, $5); } + ; // CREATE SHADOW @@ -1429,36 +1399,31 @@ } ; -manual_auto : MANUAL - { $$ = MAKE_const_slong (1); } - | AUTO - { $$ = MAKE_const_slong (0); } - | - { $$ = MAKE_const_slong (0); } - ; +manual_auto + : /* nothing */ { $$ = MAKE_const_slong (0); } + | MANUAL { $$ = MAKE_const_slong (1); } + | AUTO { $$ = MAKE_const_slong (0); } + ; -conditional : - { $$ = MAKE_const_slong (0); } - | CONDITIONAL - { $$ = MAKE_const_slong (1); } - ; +conditional + : /* nothing */ { $$ = MAKE_const_slong (0); } + | CONDITIONAL { $$ = MAKE_const_slong (1); } + ; first_file_length - : - { $$ = 0;} - | LENGTH equals long_integer page_noise - { $$ = $3; } + : /* nothing */ { $$ = NULL; } + | LENGTH equals long_integer page_noise { $$ = $3; } ; -sec_shadow_files : - { $$ = NULL; } - | db_file_list - ; +sec_shadow_files + : /* nothing */ { $$ = NULL; } + | db_file_list + ; -db_file_list : db_file - | db_file_list db_file - { $$ = make_node (nod_list, (int) 2, $1, $2); } - ; +db_file_list + : db_file + | db_file_list db_file { $$ = make_node (nod_list, (int) 2, $1, $2); } + ; // CREATE DOMAIN @@ -1494,10 +1459,8 @@ ; as_opt - : - { $$ = NULL; } + : // nothing | AS - { $$ = NULL; } ; domain_default @@ -1506,14 +1469,12 @@ ; domain_default_opt - : - { $$ = NULL; } + : /* nothing */ { $$ = NULL; } | domain_default ; null_constraint - : NOT KW_NULL - { $$ = make_node (nod_not_null, (int) 0, NULL); } + : NOT KW_NULL { $$ = make_node (nod_not_null, (int) 0, NULL); } ; check_constraint @@ -1525,16 +1486,15 @@ // CREATE SEQUENCE/GENERATOR generator_clause - : symbol_generator_name - { $$ = newNode<CreateSequenceNode>(toName($1)); } + : symbol_generator_name { $$ = newNode<CreateSequenceNode>(toName($1)); } ; // CREATE ROLE -role_clause : symbol_role_name - { $$ = make_node (nod_def_role, (int) 1, $1); } - ; +role_clause + : symbol_role_name { $$ = make_node (nod_def_role, (int) 1, $1); } + ; // CREATE COLLATION @@ -1548,7 +1508,7 @@ ; collation_sequence_definition($createCollation) - : + : // nothing | FROM symbol_collation_name { $createCollation->fromName = toName($2); } | FROM EXTERNAL '(' sql_string ')' @@ -1556,7 +1516,7 @@ ; collation_attribute_list_opt($createCollation) - : + : // nothing | collation_attribute_list($createCollation) ; @@ -1572,28 +1532,22 @@ ; collation_pad_attribute($createCollation) - : NO PAD - { $createCollation->unsetAttribute(TEXTTYPE_ATTR_PAD_SPACE); } - | PAD SPACE - { $createCollation->setAttribute(TEXTTYPE_ATTR_PAD_SPACE); } + : NO PAD { $createCollation->unsetAttribute(TEXTTYPE_ATTR_PAD_SPACE); } + | PAD SPACE { $createCollation->setAttribute(TEXTTYPE_ATTR_PAD_SPACE); } ; collation_case_attribute($createCollation) - : CASE SENSITIVE - { $createCollation->unsetAttribute(TEXTTYPE_ATTR_CASE_INSENSITIVE); } - | CASE INSENSITIVE - { $createCollation->setAttribute(TEXTTYPE_ATTR_CASE_INSENSITIVE); } + : CASE SENSITIVE { $createCollation->unsetAttribute(TEXTTYPE_ATTR_CASE_INSENSITIVE); } + | CASE INSENSITIVE { $createCollation->setAttribute(TEXTTYPE_ATTR_CASE_INSENSITIVE); } ; collation_accent_attribute($createCollation) - : ACCENT SENSITIVE - { $createCollation->unsetAttribute(TEXTTYPE_ATTR_ACCENT_INSENSITIVE); } - | ACCENT INSENSITIVE - { $createCollation->setAttribute(TEXTTYPE_ATTR_ACCENT_INSENSITIVE); } + : ACCENT SENSITIVE { $createCollation->unsetAttribute(TEXTTYPE_ATTR_ACCENT_INSENSITIVE); } + | ACCENT INSENSITIVE { $createCollation->setAttribute(TEXTTYPE_ATTR_ACCENT_INSENSITIVE); } ; collation_specific_attribute_opt($createCollation) - : + : // nothing | sql_string { string s(toString($1)); @@ -1625,7 +1579,7 @@ ; equals - : + : // nothing | '=' ; @@ -1634,15 +1588,13 @@ ; db_initial_desc1 - : - { $$ = NULL; } + : /* nothing */ { $$ = NULL; } | db_initial_desc ; db_initial_desc : db_initial_option - | db_initial_desc db_initial_option - { $$ = make_node(nod_list, 2, $1, $2); } + | db_initial_desc db_initial_option { $$ = make_node(nod_list, 2, $1, $2); } ; db_initial_option @@ -1659,15 +1611,13 @@ ; db_rem_desc1 - : - { $$ = NULL; } + : /* nothing */ { $$ = NULL; } | db_rem_desc ; db_rem_desc : db_rem_option - | db_rem_desc db_rem_option - { $$ = make_node(nod_list, 2, $1, $2); } + | db_rem_desc db_rem_option { $$ = make_node(nod_list, 2, $1, $2); } ; db_rem_option @@ -1698,7 +1648,7 @@ ; file_desc1 - : { $$ = NULL; } + : /* nothing */ { $$ = NULL; } | file_desc ; @@ -1715,13 +1665,13 @@ ; file_clause_noise - : + : // nothing | AT | AT PAGE ; page_noise - : + : // nothing | PAGE | PAGES ; @@ -5352,82 +5302,74 @@ // set values -in_predicate_value : table_subquery - | '(' value_list ')' - { $$ = make_list ($2); } +in_predicate_value + : table_subquery + | '(' value_list ')' { $$ = make_list ($2); } ; -table_subquery : '(' column_select ')' - { $$ = $2; } - ; +table_subquery + : '(' column_select ')' { $$ = $2; } + ; // USER control SQL interface -create_user_clause : symbol_user_name passwd_clause firstname_opt middlename_opt lastname_opt grant_admin_opt +create_user_clause + : symbol_user_name passwd_clause firstname_opt middlename_opt lastname_opt grant_admin_opt { $$ = make_node(nod_add_user, (int) e_user_count, $1, $2, $3, $4, $5, $6); } ; -alter_user_clause : symbol_user_name passwd_opt firstname_opt middlename_opt lastname_opt admin_opt +alter_user_clause + : symbol_user_name passwd_opt firstname_opt middlename_opt lastname_opt admin_opt { $$ = make_node(nod_mod_user, (int) e_user_count, $1, $2, $3, $4, $5, $6); } | symbol_user_name SET passwd_opt firstname_opt middlename_opt lastname_opt admin_opt { $$ = make_node(nod_mod_user, (int) e_user_count, $1, $3, $4, $5, $6, $7); } ; -drop_user_clause : symbol_user_name - { $$ = make_node(nod_del_user, (int) e_del_user_count, $1); } +drop_user_clause + : symbol_user_name { $$ = make_node(nod_del_user, (int) e_del_user_count, $1); } + ; -passwd_clause : PASSWORD sql_string - { $$ = $2; } +passwd_clause + : PASSWORD sql_string { $$ = $2; } ; -passwd_opt : passwd_clause - { $$ = $1; } - | - { $$ = NULL; } +passwd_opt + : /* nothing */ { $$ = NULL; } + | passwd_clause { $$ = $1; } ; -firstname_opt : FIRSTNAME sql_string - { $$ = $2; } - | - { $$ = NULL; } +firstname_opt + : /* nothing */ { $$ = NULL; } + | FIRSTNAME sql_string { $$ = $2; } ; -middlename_opt : MIDDLENAME sql_string - { $$ = $2; } - | - { $$ = NULL; } +middlename_opt + : /* nothing */ { $$ = NULL; } + | MIDDLENAME sql_string { $$ = $2; } ; -lastname_opt : LASTNAME sql_string - { $$ = $2; } - | - { $$ = NULL; } +lastname_opt + : /* nothing */ { $$ = NULL; } + | LASTNAME sql_string { $$ = $2; } ; admin_opt - : revoke_admin - { $$ = $1; } + : /* nothing */ { $$ = NULL; } + | revoke_admin | grant_admin - { $$ = $1; } - | - { $$ = NULL; } ; grant_admin_opt - : grant_admin - { $$ = $1; } - | - { $$ = NULL; } + : /* nothing */ { $$ = NULL; } + | grant_admin { $$ = $1; } ; revoke_admin - : REVOKE ADMIN ROLE - { $$ = MAKE_cstring("0"); } + : REVOKE ADMIN ROLE { $$ = MAKE_cstring("0"); } ; grant_admin - : GRANT ADMIN ROLE - { $$ = MAKE_cstring("1"); } + : GRANT ADMIN ROLE { $$ = MAKE_cstring("1"); } ; // value types @@ -5439,71 +5381,72 @@ ; common_value - : column_name - | array_element - | function - { $$ = makeClassNode($1); } - | u_constant - | boolean_literal - | parameter - | variable - | cast_specification - | case_expression - | next_value_expression - { $$ = makeClassNode($1); } - | udf - { $$ = makeClassNode($1); } - | '-' common_value %prec UMINUS - { $$ = makeClassNode(newNode<NegateNode>($2)); } - | '+' common_value %prec UPLUS - { $$ = $2; } - | common_value '+' common_value - { - $$ = makeClassNode(newNode<ArithmeticNode>(blr_add, - (client_dialect < SQL_DIALECT_V6_TRANSITION), $1, $3)); - } - | common_value CONCATENATE common_value - { $$ = makeClassNode(newNode<ConcatenateNode>($1, $3)); } - | common_value COLLATE symbol_collation_name - { $$ = make_node (nod_collate, (int) e_coll_count, (dsql_nod*) $3, $1); } - | common_value '-' common_value - { - $$ = makeClassNode(newNode<ArithmeticNode>(blr_subtract, - (client_dialect < SQL_DIALECT_V6_TRANSITION), $1, $3)); - } - | common_value '*' common_value - { - $$ = makeClassNode(newNode<ArithmeticNode>(blr_multiply, - (client_dialect < SQL_DIALECT_V6_TRANSITION), $1, $3)); - } - | common_value '/' common_value - { - $$ = makeClassNode(newNode<ArithmeticNode>(blr_divide, - (client_dialect < SQL_DIALECT_V6_TRANSITION), $1, $3)); - } - | '(' common_value ')' - { $$ = $2; } - | '(' column_singleton ')' - { $$ = $2; } - | current_user - { $$ = makeClassNode($1); } - | current_role - { $$ = makeClassNode($1); } - | internal_info - { $$ = makeClassNode($1); } - | DB_KEY - { $$ = makeClassNode(newNode<RecordKeyNode>(blr_dbkey)); } - | symbol_table_alias_name '.' DB_KEY - { $$ = makeClassNode(newNode<RecordKeyNode>(blr_dbkey, toName($1))); } - | KW_VALUE - { $$ = makeClassNode(newNode<DomainValidationNode>()); } - | datetime_value_expression - { $$ = makeClassNode($1); } - | null_value - { $$ = makeClassNode($1); } - ; + : column_name + | array_element + | function + { $$ = makeClassNode($1); } + | u_constant + | boolean_literal + | parameter + | variable + | cast_specification + | case_expression + | next_value_expression + { $$ = makeClassNode($1); } + | udf + { $$ = makeClassNode($1); } + | '-' common_value %prec UMINUS + { $$ = makeClassNode(newNode<NegateNode>($2)); } + | '+' common_value %prec UPLUS + { $$ = $2; } + | common_value '+' common_value + { + $$ = makeClassNode(newNode<ArithmeticNode>(blr_add, + (client_dialect < SQL_DIALECT_V6_TRANSITION), $1, $3)); + } + | common_value CONCATENATE common_value + { $$ = makeClassNode(newNode<ConcatenateNode>($1, $3)); } + | common_value COLLATE symbol_collation_name + { $$ = make_node (nod_collate, (int) e_coll_count, (dsql_nod*) $3, $1); } + | common_value '-' common_value + { + $$ = makeClassNode(newNode<ArithmeticNode>(blr_subtract, + (client_dialect < SQL_DIALECT_V6_TRANSITION), $1, $3)); + } + | common_value '*' common_value + { + $$ = makeClassNode(newNode<ArithmeticNode>(blr_multiply, + (client_dialect < SQL_DIALECT_V6_TRANSITION), $1, $3)); + } + | common_value '/' common_value + { + $$ = makeClassNode(newNode<ArithmeticNode>(blr_divide, + (client_dialect < SQL_DIALECT_V6_TRANSITION), $1, $3)); + } + | '(' common_value ')' + { $$ = $2; } + | '(' column_singleton ')' + { $$ = $2; } + | current_user + { $$ = makeClassNode($1); } + | current_role + { $$ = makeClassNode($1); } + | internal_info + { $$ = makeClassNode($1); } + | DB_KEY + { $$ = makeClassNode(newNode<RecordKeyNode>(blr_dbkey)); } + | symbol_table_alias_name '.' DB_KEY + { $$ = makeClassNode(newNode<RecordKeyNode>(blr_dbkey, toName($1))); } + | KW_VALUE + { $$ = makeClassNode(newNode<DomainValidationNode>()); } + | datetime_value_expression + { $$ = makeClassNode($1); } + | null_value + { $$ = makeClassNode($1); } + ; -datetime_value_expression : CURRENT_DATE +datetime_value_expression + : CURRENT_DATE { if (client_dialect < SQL_DIALECT_V6_TRANSITION) { @@ -5544,69 +5487,56 @@ ; time_precision_opt - : - { $$ = DEFAULT_TIME_PRECISION; } - | '(' nonneg_short_integer ')' - { $$ = $2; } + : /* nothing */ { $$ = DEFAULT_TIME_PRECISION; } + | '(' nonneg_short_integer ')' { $$ = $2; } ; timestamp_precision_opt - : - { $$ = DEFAULT_TIMESTAMP_PRECISION; } - | '(' nonneg_short_integer ')' - { $$ = $2; } + : /* nothing */ { $$ = DEFAULT_TIMESTAMP_PRECISION; } + | '(' nonneg_short_integer ')' { $$ = $2; } ; -array_element : column_name '[' value_list ']' - { $$ = make_node (nod_array, (int) e_ary_count, $1, make_list ($3)); } - ; +array_element + : column_name '[' value_list ']' + { $$ = make_node (nod_array, (int) e_ary_count, $1, make_list ($3)); } + ; common_value_list_opt - : - { $$ = make_node(nod_list, 0, NULL); } - | common_value_list - { $$ = make_list($1); } + : /* nothing */ { $$ = make_node(nod_list, 0, NULL); } + | common_value_list { $$ = make_list($1); } ; common_value_list : common_value - | common_value_list ',' common_value - { $$ = make_node(nod_list, 2, $1, $3); } + | common_value_list ',' common_value { $$ = make_node(nod_list, 2, $1, $3); } ; value_list_opt - : - { $$ = make_node(nod_list, 0, NULL); } - | value_list - { $$ = make_list($1); } + : /* nothing */ { $$ = make_node(nod_list, 0, NULL); } + | value_list { $$ = make_list($1); } ; value_list : value - | value_list ',' value - { $$ = make_node(nod_list, 2, $1, $3); } + | value_list ',' value { $$ = make_node(nod_list, 2, $1, $3); } ; constant : u_constant - | '-' u_numeric_constant - { $$ = makeClassNode(newNode<NegateNode>($2)); } + | '-' u_numeric_constant { $$ = makeClassNode(newNode<NegateNode>($2)); } | boolean_literal ; -u_numeric_constant : NUMERIC - { $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_STRING); } - | NUMBER - { $$ = MAKE_const_slong($1); } - | FLOAT_NUMBER - { $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_DOUBLE); } - | NUMBER64BIT - { $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_SINT64); } - | SCALEDINT - { $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_SINT64); } - ; +u_numeric_constant + : NUMERIC { $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_STRING); } + | NUMBER { $$ = MAKE_const_slong($1); } + | FLOAT_NUMBER { $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_DOUBLE); } + | NUMBER64BIT { $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_SINT64); } + | SCALEDINT { $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_SINT64); } + ; -u_constant : u_numeric_constant +u_constant + : u_numeric_constant | sql_string { $$ = MAKE_str_constant ($1, lex.att_charset); } | DATE STRING @@ -5762,13 +5692,11 @@ signed_long_integer : long_integer - | '-' long_integer - { $$ = -$2; } + | '-' long_integer { $$ = -$2; } ; long_integer - : NUMBER - { $$ = $1;} + : NUMBER { $$ = $1;} ; @@ -5871,17 +5799,13 @@ ; window_partition_opt - : - { $$ = NULL; } - | PARTITION BY value_list - { $$ = $3; } + : /* nothing */ { $$ = NULL; } + | PARTITION BY value_list { $$ = $3; } ; delimiter_opt - : ',' value - { $$ = $2; } - | - { $$ = MAKE_str_constant (MAKE_cstring(","), lex.att_charset); } + : /* nothing */ { $$ = MAKE_str_constant(MAKE_cstring(","), lex.att_charset); } + | ',' value { $$ = $2; } ; numeric_value_function @@ -5890,8 +5814,7 @@ ; extract_expression - : EXTRACT '(' timestamp_part FROM value ')' - { $$ = newNode<ExtractNode>($3, $5); } + : EXTRACT '(' timestamp_part FROM value ')' { $$ = newNode<ExtractNode>($3, $5); } ; length_expression @@ -5901,20 +5824,16 @@ ; bit_length_expression - : BIT_LENGTH '(' value ')' - { $$ = newNode<StrLenNode>(blr_strlen_bit, $3); } + : BIT_LENGTH '(' value ')' { $$ = newNode<StrLenNode>(blr_strlen_bit, $3); } ; char_length_expression - : CHAR_LENGTH '(' value ')' - { $$ = newNode<StrLenNode>(blr_strlen_char, $3); } - | CHARACTER_LENGTH '(' value ')' - { $$ = newNode<StrLenNode>(blr_strlen_char, $3); } + : CHAR_LENGTH '(' value ')' { $$ = newNode<StrLenNode>(blr_strlen_char, $3); } + | CHARACTER_LENGTH '(' value ')' { $$ = newNode<StrLenNode>(blr_strlen_char, $3); } ; octet_length_expression - : OCTET_LENGTH '(' value ')' - { $$ = newNode<StrLenNode>(blr_strlen_octet, $3); } + : OCTET_LENGTH '(' value ')' { $$ = newNode<StrLenNode>(blr_strlen_octet, $3); } ; system_function_expression @@ -6295,82 +6214,108 @@ // Performs special mapping of keywords into symbols -symbol_UDF_call_name : SYMBOL +symbol_UDF_call_name + : SYMBOL ; -symbol_UDF_name : valid_symbol_name +symbol_UDF_name + : valid_symbol_name ; -symbol_blob_subtype_name : valid_symbol_name +symbol_blob_subtype_name + : valid_symbol_name ; -symbol_character_set_name : valid_symbol_name +symbol_character_set_name + : valid_symbol_name ; -symbol_collation_name : valid_symbol_name +symbol_collation_name + : valid_symbol_name ; -symbol_column_name : valid_symbol_name +symbol_column_name + : valid_symbol_name ; -symbol_constraint_name : valid_symbol_name +symbol_constraint_name + : valid_symbol_name ; -symbol_cursor_name : valid_symbol_name +symbol_cursor_name + : valid_symbol_name ; -symbol_domain_name : valid_symbol_name +symbol_domain_name + : valid_symbol_name ; -symbol_exception_name : valid_symbol_name +symbol_exception_name + : valid_symbol_name ; -symbol_filter_name : valid_symbol_name +symbol_filter_name + : valid_symbol_name ; -symbol_gdscode_name : valid_symbol_name +symbol_gdscode_name + : valid_symbol_name ; -symbol_generator_name : valid_symbol_name +symbol_generator_name + : valid_symbol_name ; -symbol_index_name : valid_symbol_name +symbol_index_name + : valid_symbol_name ; -symbol_item_alias_name : valid_symbol_name +symbol_item_alias_name + : valid_symbol_name ; -symbol_label_name : valid_symbol_name +symbol_label_name + : valid_symbol_name ; -symbol_ddl_name : valid_symbol_name +symbol_ddl_name + : valid_symbol_name ; -symbol_procedure_name : valid_symbol_name +symbol_procedure_name + : valid_symbol_name ; -symbol_role_name : valid_symbol_name +symbol_role_name + : valid_symbol_name ; -symbol_table_alias_name : valid_symbol_name +symbol_table_alias_name + : valid_symbol_name ; -symbol_table_name : valid_symbol_name +symbol_table_name + : valid_symbol_name ; -symbol_trigger_name : valid_symbol_name +symbol_trigger_name + : valid_symbol_name ; -symbol_user_name : valid_symbol_name +symbol_user_name + : valid_symbol_name ; -symbol_variable_name : valid_symbol_name +symbol_variable_name + : valid_symbol_name ; -symbol_view_name : valid_symbol_name +symbol_view_name + : valid_symbol_name ; -symbol_savepoint_name : valid_symbol_name +symbol_savepoint_name + : valid_symbol_name ; symbol_package_name @@ -6379,14 +6324,15 @@ // symbols -valid_symbol_name : SYMBOL +valid_symbol_name + : SYMBOL | non_reserved_word ; // list of non-reserved words -non_reserved_word : - ACTION // added in IB 5.0/ +non_reserved_word + : ACTION // added in IB 5.0/ | CASCADE | FREE_IT | RESTRICT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-03-07 20:56:23
|
Revision: 52528 http://firebird.svn.sourceforge.net/firebird/?rev=52528&view=rev Author: asfernandes Date: 2011-03-07 20:56:17 +0000 (Mon, 07 Mar 2011) Log Message: ----------- Fixed problem reported by Dmitry about values in DECLARE not being assigned to variables. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-03-07 19:41:46 UTC (rev 52527) +++ firebird/trunk/src/dsql/parse.y 2011-03-07 20:56:17 UTC (rev 52528) @@ -2281,7 +2281,7 @@ : column_def_name domain_or_non_array_type collate_clause default_par_opt { DeclareVariableNode* node = newNode<DeclareVariableNode>(); - node->dsqlDef = FB_NEW(getPool()) ParameterClause(getPool(), $1, toName($3), NULL, $4); + node->dsqlDef = FB_NEW(getPool()) ParameterClause(getPool(), $1, toName($3), $4, NULL); $$ = node; } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-06-25 18:13:32
|
Revision: 53237 http://firebird.svn.sourceforge.net/firebird/?rev=53237&view=rev Author: asfernandes Date: 2011-06-25 18:13:25 +0000 (Sat, 25 Jun 2011) Log Message: ----------- Warning. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-06-25 03:40:18 UTC (rev 53236) +++ firebird/trunk/src/dsql/parse.y 2011-06-25 18:13:25 UTC (rev 53237) @@ -1413,7 +1413,7 @@ ; first_file_length - : /* nothing */ { $$ = NULL; } + : /* nothing */ { $$ = 0; } | LENGTH equals long_integer page_noise { $$ = $3; } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-10-27 00:22:29
|
Revision: 53597 http://firebird.svn.sourceforge.net/firebird/?rev=53597&view=rev Author: asfernandes Date: 2011-10-27 00:22:23 +0000 (Thu, 27 Oct 2011) Log Message: ----------- Correction. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-10-26 08:52:40 UTC (rev 53596) +++ firebird/trunk/src/dsql/parse.y 2011-10-27 00:22:23 UTC (rev 53597) @@ -576,6 +576,8 @@ %token <legacyNode> IDENTITY %token <legacyNode> DENSE_RANK %token <legacyNode> FIRST_VALUE +%token <legacyNode> NTH_VALUE +%token <legacyNode> LAST_VALUE %token <legacyNode> LAG %token <legacyNode> LEAD %token <legacyNode> RANK @@ -6513,6 +6515,8 @@ | KW_RELATIVE | DENSE_RANK | FIRST_VALUE + | NTH_VALUE + | LAST_VALUE | LAG | LEAD | RANK This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-11-10 15:03:18
|
Revision: 53624 http://firebird.svn.sourceforge.net/firebird/?rev=53624&view=rev Author: asfernandes Date: 2011-11-10 15:03:12 +0000 (Thu, 10 Nov 2011) Log Message: ----------- Cleanup for RECREATE commands. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-11-10 14:55:06 UTC (rev 53623) +++ firebird/trunk/src/dsql/parse.y 2011-11-10 15:03:12 UTC (rev 53624) @@ -742,7 +742,8 @@ %type <execStatementNode> for_exec_into %type <legacyNode> generated_always_clause grant grant_option granted_by granted_by_text grantee grantee_list -%type <legacyNode> grantor group_by_item group_by_list group_clause gtt_recreate_clause +%type <legacyNode> grantor group_by_item group_by_list group_clause +%type <ddlNode> gtt_recreate_clause %type <legacyStr> grant_admin grant_admin_opt %type <legacyNode> having_clause @@ -805,7 +806,8 @@ %type <legacyNode> qualified_join query_spec query_term -%type <legacyNode> recreate recreate_clause referential_action referential_constraint +%type <ddlNode> recreate recreate_clause +%type <legacyNode> referential_action referential_constraint %type <legacyNode> referential_trigger_action release_savepoint replace_clause %type <legacyNode> replace_exception_clause %type <legacyNode> replace_view_clause restr_list restr_option @@ -813,9 +815,11 @@ %type <legacyNode> rev_admin_option rev_grant_option revoke %type return_value1(<createAlterFunctionNode>) return_value(<createAlterFunctionNode>) %type <returningClause> returning_clause -%type <legacyNode> rexception_clause role_admin_option role_clause role_grantee role_grantee_list -%type <legacyNode> role_name role_name_list rollback rows_clause rtable_clause -%type <legacyNode> rview_clause +%type <ddlNode> rexception_clause +%type <legacyNode> role_admin_option role_clause role_grantee role_grantee_list +%type <legacyNode> role_name role_name_list rollback rows_clause +%type <ddlNode> rtable_clause +%type <ddlNode> rview_clause %type <legacyStr> revoke_admin %type <legacyNode> savepoint scroll_opt search_condition searched_case @@ -978,6 +982,7 @@ | exec_block { $$ = makeClassNode($1); } | recreate + { $$ = makeClassNode($1); } | revoke | rollback | savepoint @@ -1327,9 +1332,9 @@ recreate_clause : PROCEDURE procedure_clause - { $$ = makeClassNode(newNode<RecreateProcedureNode>($2)); } + { $$ = newNode<RecreateProcedureNode>($2); } | FUNCTION function_clause - { $$ = makeClassNode(newNode<RecreateFunctionNode>($2)); } + { $$ = newNode<RecreateFunctionNode>($2); } | TABLE rtable_clause { $$ = $2; } | GLOBAL TEMPORARY TABLE gtt_recreate_clause @@ -1337,17 +1342,17 @@ | VIEW rview_clause { $$ = $2; } | TRIGGER trigger_clause - { $$ = makeClassNode(newNode<RecreateTriggerNode>($2)); } + { $$ = newNode<RecreateTriggerNode>($2); } | PACKAGE package_clause - { $$ = makeClassNode(newNode<RecreatePackageNode>($2)); } + { $$ = newNode<RecreatePackageNode>($2); } | PACKAGE BODY package_body_clause - { $$ = makeClassNode(newNode<RecreatePackageBodyNode>($3)); } + { $$ = newNode<RecreatePackageBodyNode>($3); } | EXCEPTION rexception_clause { $$ = $2; } | GENERATOR generator_clause - { $$ = makeClassNode(newNode<RecreateSequenceNode>($2)); } + { $$ = newNode<RecreateSequenceNode>($2); } | SEQUENCE generator_clause - { $$ = makeClassNode(newNode<RecreateSequenceNode>($2)); } + { $$ = newNode<RecreateSequenceNode>($2); } ; create_or_alter @@ -1376,7 +1381,7 @@ { CreateAlterExceptionNode* createNode = newNode<CreateAlterExceptionNode>( toName($1), toString($2)); - $$ = makeClassNode(newNode<RecreateExceptionNode>(createNode)); + $$ = newNode<RecreateExceptionNode>(createNode); } ; @@ -1722,7 +1727,7 @@ rtable_clause : table_clause - { $$ = makeClassNode(newNode<RecreateTableNode>($1)); } + { $$ = newNode<RecreateTableNode>($1); } ; gtt_table_clause @@ -1737,7 +1742,7 @@ gtt_recreate_clause : gtt_table_clause - { $$ = makeClassNode(newNode<RecreateTableNode>($1)); } + { $$ = newNode<RecreateTableNode>($1); } ; gtt_scope @@ -2897,7 +2902,7 @@ rview_clause : view_clause - { $$ = makeClassNode(newNode<RecreateViewNode>($1)); } + { $$ = newNode<RecreateViewNode>($1); } ; replace_view_clause This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-11-14 18:15:22
|
Revision: 53630 http://firebird.svn.sourceforge.net/firebird/?rev=53630&view=rev Author: asfernandes Date: 2011-11-14 18:15:16 +0000 (Mon, 14 Nov 2011) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-11-14 18:06:44 UTC (rev 53629) +++ firebird/trunk/src/dsql/parse.y 2011-11-14 18:15:16 UTC (rev 53630) @@ -701,8 +701,9 @@ %type <stmtNode> complex_proc_statement %type <legacyNode> computed_by computed_clause conditional constant constraint_index_opt %type <legacyNode> constraint_name_opt correlation_name create -%type <legacyNode> create_clause create_or_alter create_user_clause cross_join +%type <legacyNode> create_clause create_user_clause cross_join %type <legacyNode> cursor_clause cursor_def +%type <ddlNode> create_or_alter %type <stmtNode> cursor_declaration_item continue cursor_statement %type <legacyNode> data_type data_type_or_domain @@ -806,11 +807,10 @@ %type <legacyNode> qualified_join query_spec query_term -%type <ddlNode> recreate recreate_clause +%type <ddlNode> recreate recreate_clause replace_clause replace_exception_clause replace_view_clause %type <legacyNode> referential_action referential_constraint -%type <legacyNode> referential_trigger_action release_savepoint replace_clause -%type <legacyNode> replace_exception_clause -%type <legacyNode> replace_view_clause restr_list restr_option +%type <legacyNode> referential_trigger_action release_savepoint +%type <legacyNode> restr_list restr_option %type <int32Val> return_mechanism %type <legacyNode> rev_admin_option rev_grant_option revoke %type return_value1(<createAlterFunctionNode>) return_value(<createAlterFunctionNode>) @@ -968,6 +968,7 @@ | commit | create | create_or_alter + { $$ = makeClassNode($1); } | declare | delete { $$ = makeClassNode($1); } @@ -1357,14 +1358,14 @@ ; create_or_alter - : CREATE OR ALTER replace_clause { $$ = $4; } + : CREATE OR ALTER replace_clause { $$ = $4; } ; replace_clause - : PROCEDURE replace_procedure_clause { $$ = makeClassNode($2); } - | FUNCTION replace_function_clause { $$ = makeClassNode($2); } - | TRIGGER replace_trigger_clause { $$ = makeClassNode($2); } - | PACKAGE replace_package_clause { $$ = makeClassNode($2); } + : PROCEDURE replace_procedure_clause { $$ = $2; } + | FUNCTION replace_function_clause { $$ = $2; } + | TRIGGER replace_trigger_clause { $$ = $2; } + | PACKAGE replace_package_clause { $$ = $2; } | VIEW replace_view_clause { $$ = $2; } | EXCEPTION replace_exception_clause { $$ = $2; } ; @@ -1392,7 +1393,7 @@ CreateAlterExceptionNode* node = newNode<CreateAlterExceptionNode>( toName($1), toString($2)); node->alter = true; - $$ = makeClassNode(node); + $$ = node; } ; @@ -2910,7 +2911,7 @@ : view_clause { $1->alter = true; - $$ = makeClassNode($1); + $$ = $1; } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2011-12-06 15:08:17
|
Revision: 53680 http://firebird.svn.sourceforge.net/firebird/?rev=53680&view=rev Author: hvlad Date: 2011-12-06 15:08:08 +0000 (Tue, 06 Dec 2011) Log Message: ----------- Cleanup Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2011-12-06 14:38:49 UTC (rev 53679) +++ firebird/trunk/src/dsql/parse.y 2011-12-06 15:08:08 UTC (rev 53680) @@ -751,7 +751,6 @@ %type exec_stmt_options_list(<execStatementNode>) exec_stmt_inputs(<execStatementNode>) %type <stmtNode> fetch_cursor -%type <legacyNode> file1 %type <legacyNode> filter_clause_io first_clause %type <legacyNode> float_type for_update_clause for_update_list from_clause %type <legacyNode> from_list This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2012-01-09 00:49:32
|
Revision: 53823 http://firebird.svn.sourceforge.net/firebird/?rev=53823&view=rev Author: asfernandes Date: 2012-01-09 00:49:25 +0000 (Mon, 09 Jan 2012) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2012-01-09 00:08:58 UTC (rev 53822) +++ firebird/trunk/src/dsql/parse.y 2012-01-09 00:49:25 UTC (rev 53823) @@ -676,11 +676,11 @@ } %type <legacyNode> access_mode access_type alias_list -%type <legacyNode> alter alter_clause alter_column_name +%type <legacyNode> alter_column_name %type <legacyNode> alter_data_type_or_domain %type <legacyNode> alter_op alter_ops %type <stmtNode> alter_sequence_clause -%type <ddlNode> alter_user_clause +%type <ddlNode> alter alter_clause alter_user_clause %type <legacyNode> array_element array_range %type <ddlNode> alter_exception_clause alter_index_clause alter_role_clause alter_udf_clause %type <ddlNode> alter_view_clause @@ -715,9 +715,9 @@ %type <stmtNode> complex_proc_statement %type <legacyNode> computed_by computed_clause constant constraint_index_opt %type <boolVal> conditional -%type <legacyNode> constraint_name_opt correlation_name create -%type <ddlNode> create_user_clause -%type <legacyNode> create_clause cross_join +%type <legacyNode> constraint_name_opt correlation_name +%type <ddlNode> create create_clause create_user_clause +%type <legacyNode> cross_join %type <legacyNode> cursor_clause cursor_def %type <ddlNode> create_or_alter %type <stmtNode> cursor_declaration_item continue cursor_statement @@ -990,40 +990,30 @@ ; statement - : alter + : alter { $$ = makeClassNode($1); } + // ASF: ALTER SEQUENCE is defined here cause it's treated as DML. + | ALTER SEQUENCE alter_sequence_clause { $$ = makeClassNode($3); } | blob_io - | comment - { $$ = makeClassNode($1); } + | comment { $$ = makeClassNode($1); } | commit - | create - | create_or_alter - { $$ = makeClassNode($1); } - | declare - { $$ = makeClassNode($1); } - | delete - { $$ = makeClassNode($1); } - | drop - { $$ = makeClassNode($1); } + | create { $$ = makeClassNode($1); } + | create_or_alter { $$ = makeClassNode($1); } + | declare { $$ = makeClassNode($1); } + | delete { $$ = makeClassNode($1); } + | drop { $$ = makeClassNode($1); } | grant - | insert - { $$ = makeClassNode($1); } - | merge - { $$ = makeClassNode($1); } - | exec_procedure - { $$ = makeClassNode($1); } - | exec_block - { $$ = makeClassNode($1); } - | recreate - { $$ = makeClassNode($1); } + | insert { $$ = makeClassNode($1); } + | merge { $$ = makeClassNode($1); } + | exec_procedure { $$ = makeClassNode($1); } + | exec_block { $$ = makeClassNode($1); } + | recreate { $$ = makeClassNode($1); } | revoke | rollback | savepoint | select | set - | update - { $$ = makeClassNode($1); } - | update_or_insert - { $$ = makeClassNode($1); } + | update { $$ = makeClassNode($1); } + | update_or_insert { $$ = makeClassNode($1); } ; @@ -1328,8 +1318,7 @@ ; create_clause - : EXCEPTION exception_clause - { $$ = makeClassNode($2); } + : EXCEPTION exception_clause { $$ = $2; } | unique_opt order_direction INDEX symbol_index_name ON simple_table_name index_definition { CreateIndexNode* node = newNode<CreateIndexNode>(toName($4)); @@ -1337,40 +1326,24 @@ node->descending = $2; node->legacyRelation = $6; node->legacyDef = $7; - $$ = makeClassNode(node); + $$ = node; } - | FUNCTION function_clause - { $$ = makeClassNode($2); } - | PROCEDURE procedure_clause - { $$ = makeClassNode($2); } - | TABLE table_clause - { $$ = makeClassNode($2); } - | GLOBAL TEMPORARY TABLE gtt_table_clause - { $$ = makeClassNode($4); } - | TRIGGER trigger_clause - { $$ = makeClassNode($2); } - | VIEW view_clause - { $$ = makeClassNode($2); } - | GENERATOR generator_clause - { $$ = makeClassNode($2); } - | SEQUENCE generator_clause - { $$ = makeClassNode($2); } - | DATABASE db_clause - { $$ = makeClassNode($2); } - | DOMAIN domain_clause - { $$ = makeClassNode($2); } - | SHADOW shadow_clause - { $$ = makeClassNode($2); } - | ROLE role_clause - { $$ = makeClassNode($2); } - | COLLATION collation_clause - { $$ = makeClassNode($2); } - | USER create_user_clause - { $$ = makeClassNode($2); } - | PACKAGE package_clause - { $$ = makeClassNode($2); } - | PACKAGE BODY package_body_clause - { $$ = makeClassNode($3); } + | FUNCTION function_clause { $$ = $2; } + | PROCEDURE procedure_clause { $$ = $2; } + | TABLE table_clause { $$ = $2; } + | GLOBAL TEMPORARY TABLE gtt_table_clause { $$ = $4; } + | TRIGGER trigger_clause { $$ = $2; } + | VIEW view_clause { $$ = $2; } + | GENERATOR generator_clause { $$ = $2; } + | SEQUENCE generator_clause { $$ = $2; } + | DATABASE db_clause { $$ = $2; } + | DOMAIN domain_clause { $$ = $2; } + | SHADOW shadow_clause { $$ = $2; } + | ROLE role_clause { $$ = $2; } + | COLLATION collation_clause { $$ = $2; } + | USER create_user_clause { $$ = $2; } + | PACKAGE package_clause { $$ = $2; } + | PACKAGE BODY package_body_clause { $$ = $3; } ; @@ -3222,13 +3195,12 @@ // ALTER statement -alter : ALTER alter_clause - { $$ = $2; } - ; +alter + : ALTER alter_clause { $$ = $2; } + ; alter_clause - : EXCEPTION alter_exception_clause - { $$ = makeClassNode($2); } + : EXCEPTION alter_exception_clause { $$ = $2; } | TABLE simple_table_name alter_ops { AlterRelationNode* node = newNode<AlterRelationNode>($2); @@ -3237,36 +3209,23 @@ for (dsql_nod** ptr = list->nod_arg; ptr != list->nod_arg + list->nod_count; ++ptr) node->elements.add(*ptr); - $$ = makeClassNode(node); + $$ = node; } - | VIEW alter_view_clause - { $$ = makeClassNode($2); } - | TRIGGER alter_trigger_clause - { $$ = makeClassNode($2); } - | PROCEDURE alter_procedure_clause - { $$ = makeClassNode($2); } - | PACKAGE alter_package_clause - { $$ = makeClassNode($2); } + | VIEW alter_view_clause { $$ = $2; } + | TRIGGER alter_trigger_clause { $$ = $2; } + | PROCEDURE alter_procedure_clause { $$ = $2; } + | PACKAGE alter_package_clause { $$ = $2; } | DATABASE { $<alterDatabaseNode>$ = newNode<AlterDatabaseNode>(); } alter_db($<alterDatabaseNode>2) - { $$ = makeClassNode($<alterDatabaseNode>2); } - | DOMAIN alter_domain - { $$ = makeClassNode($2); } - | INDEX alter_index_clause - { $$ = makeClassNode($2); } - | SEQUENCE alter_sequence_clause - { $$ = makeClassNode($2); } - | EXTERNAL FUNCTION alter_udf_clause - { $$ = makeClassNode($3); } - | FUNCTION alter_function_clause - { $$ = makeClassNode($2); } - | ROLE alter_role_clause - { $$ = makeClassNode($2); } - | USER alter_user_clause - { $$ = makeClassNode($2); } - | CHARACTER SET alter_charset_clause - { $$ = makeClassNode($3); } + { $$ = $<alterDatabaseNode>2; } + | DOMAIN alter_domain { $$ = $2; } + | INDEX alter_index_clause { $$ = $2; } + | EXTERNAL FUNCTION alter_udf_clause { $$ = $3; } + | FUNCTION alter_function_clause { $$ = $2; } + | ROLE alter_role_clause { $$ = $2; } + | USER alter_user_clause { $$ = $2; } + | CHARACTER SET alter_charset_clause { $$ = $3; } ; alter_domain @@ -3313,47 +3272,48 @@ { $$ = make_node(nod_list, 2, $1, $3); } ; -alter_op : DROP simple_column_name drop_behaviour - { $$ = make_node (nod_del_field, 2, $2, $3); } - | DROP CONSTRAINT symbol_constraint_name - { $$ = make_node (nod_delete_rel_constraint, (int) 1, $3);} - | ADD column_def - { $$ = $2; } - | ADD table_constraint_definition - { $$ = $2; } - /* CVC: From SQL, field positions start at 1, not zero. Think in ORDER BY, for example - | col_opt simple_column_name POSITION nonneg_short_integer - { $$ = make_node (nod_mod_field_pos, 2, $2, - MAKE_const_slong ((IPTR) $4)); } */ - | col_opt simple_column_name POSITION pos_short_integer - { $$ = make_node(nod_mod_field_pos, 2, $2, MAKE_const_slong($4)); } - | col_opt alter_column_name TO simple_column_name - { $$ = make_node(nod_mod_field_name, 2, $2, $4); } - | col_opt alter_column_name KW_NULL - { - $$ = make_node(nod_mod_field_null_flag, e_mod_fld_null_flag_count, - $2, MAKE_const_slong(0)); - } - | col_opt alter_column_name NOT KW_NULL - { - $$ = make_node(nod_mod_field_null_flag, e_mod_fld_null_flag_count, - $2, MAKE_const_slong(1)); - } - | col_opt alter_col_name KW_TYPE alter_data_type_or_domain - { $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, $4, NULL, NULL); } - | col_opt alter_col_name KW_TYPE non_array_type def_computed - { - // Due to parser hacks, we should not pass $4 (non_array_type) to make_node. - $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, NULL, NULL, $5); - } - | col_opt alter_col_name def_computed - { $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, NULL, NULL, $3); } - | col_opt alter_col_name SET domain_default - { $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, NULL, $4, NULL); } - | col_opt alter_col_name DROP DEFAULT - { $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, NULL, - make_node(nod_del_default, (int) 0, NULL), NULL); } - ; +alter_op + : DROP simple_column_name drop_behaviour + { $$ = make_node (nod_del_field, 2, $2, $3); } + | DROP CONSTRAINT symbol_constraint_name + { $$ = make_node (nod_delete_rel_constraint, (int) 1, $3);} + | ADD column_def + { $$ = $2; } + | ADD table_constraint_definition + { $$ = $2; } + /* CVC: From SQL, field positions start at 1, not zero. Think in ORDER BY, for example + | col_opt simple_column_name POSITION nonneg_short_integer + { $$ = make_node (nod_mod_field_pos, 2, $2, + MAKE_const_slong ((IPTR) $4)); } */ + | col_opt simple_column_name POSITION pos_short_integer + { $$ = make_node(nod_mod_field_pos, 2, $2, MAKE_const_slong($4)); } + | col_opt alter_column_name TO simple_column_name + { $$ = make_node(nod_mod_field_name, 2, $2, $4); } + | col_opt alter_column_name KW_NULL + { + $$ = make_node(nod_mod_field_null_flag, e_mod_fld_null_flag_count, + $2, MAKE_const_slong(0)); + } + | col_opt alter_column_name NOT KW_NULL + { + $$ = make_node(nod_mod_field_null_flag, e_mod_fld_null_flag_count, + $2, MAKE_const_slong(1)); + } + | col_opt alter_col_name KW_TYPE alter_data_type_or_domain + { $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, $4, NULL, NULL); } + | col_opt alter_col_name KW_TYPE non_array_type def_computed + { + // Due to parser hacks, we should not pass $4 (non_array_type) to make_node. + $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, NULL, NULL, $5); + } + | col_opt alter_col_name def_computed + { $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, NULL, NULL, $3); } + | col_opt alter_col_name SET domain_default + { $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, NULL, $4, NULL); } + | col_opt alter_col_name DROP DEFAULT + { $$ = make_node(nod_mod_field_type, e_mod_fld_type_count, $2, NULL, + make_node(nod_del_default, (int) 0, NULL), NULL); } + ; alter_column_name : keyword_or_column This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2012-03-18 22:22:49
|
Revision: 54194 http://firebird.svn.sourceforge.net/firebird/?rev=54194&view=rev Author: asfernandes Date: 2012-03-18 22:22:43 +0000 (Sun, 18 Mar 2012) Log Message: ----------- Fix a parser conflict. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2012-03-18 22:22:14 UTC (rev 54193) +++ firebird/trunk/src/dsql/parse.y 2012-03-18 22:22:43 UTC (rev 54194) @@ -725,7 +725,8 @@ %type <legacyNode> column_singleton %type <traNode> commit %type <stmtNode> complex_proc_statement -%type <legacyNode> computed_by computed_clause constant +%type computed_by +%type <legacyNode> computed_clause constant %type <indexConstraintClause> constraint_index_opt %type <boolVal> conditional %type <legacyNode> constraint_name_opt correlation_name @@ -794,7 +795,7 @@ %type <legacyNode> having_clause -%type <boolVal> identity_clause +%type identity_clause %type <legacyNode> in_predicate_value %type index_definition(<createIndexNode>) %type <legacyNode> index_list @@ -1948,7 +1949,7 @@ RelationNode::AddColumnClause* clause = $<addColumnClause>$ = newNode<RelationNode::AddColumnClause>(); clause->field = $1; - clause->identity = $3; + clause->identity = true; $relationNode->clauses.add(clause); } column_constraint_clause($<addColumnClause>4) collate_clause @@ -1970,8 +1971,7 @@ ; identity_clause - : /* nothing */ { $$ = false; } - | GENERATED BY DEFAULT AS IDENTITY { $$ = true; } + : GENERATED BY DEFAULT AS IDENTITY ; // value does allow parens around it, but there is a problem getting the source text. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2012-03-26 01:04:04
|
Revision: 54243 http://firebird.svn.sourceforge.net/firebird/?rev=54243&view=rev Author: asfernandes Date: 2012-03-26 01:03:58 +0000 (Mon, 26 Mar 2012) Log Message: ----------- Correction. Modified Paths: -------------- firebird/trunk/src/dsql/parse.y Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2012-03-25 18:21:21 UTC (rev 54242) +++ firebird/trunk/src/dsql/parse.y 2012-03-26 01:03:58 UTC (rev 54243) @@ -5746,6 +5746,7 @@ { ArrayNode* node = newNode<ArrayNode>(ExprNode::as<FieldNode>($1)); node->dsqlField->dsqlIndices = make_list($3); + $$ = makeClassNode(node); } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |