Skip to content

Commit

Permalink
Merge pull request antlr#324 from scotture/master
Browse files Browse the repository at this point in the history
A few small fixes, mainly related to insert_statement.
  • Loading branch information
parrt committed Mar 23, 2016
2 parents f818789 + cf83413 commit e6cfb1b
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions tsql/tsql.g4
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ insert_statement
: with_expression?
INSERT (TOP '(' expression ')' PERCENT?)?
INTO? (ddl_object | rowset_function_limited)
with_table_hints?
insert_with_table_hints?
('(' column_name_list ')')?
output_clause?
(VALUES '(' expression_list ')' (',' '(' expression_list ')')* |
derived_table | execute_statement | dml_table_source | DEFAULT VALUES)
derived_table | execute_statement | DEFAULT VALUES)
for_clause? option_clause? ';'?
;

Expand Down Expand Up @@ -483,10 +483,6 @@ subquery
: select_statement
;

dml_table_source
: query_specification
;

// https://msdn.microsoft.com/en-us/library/ms175972.aspx
with_expression
: WITH (XMLNAMESPACES ',')? common_table_expression (',' common_table_expression)*
Expand Down Expand Up @@ -665,7 +661,6 @@ bulk_option
derived_table
: subquery
| '(' subquery ')'
| table_value_constructor
;

function_call
Expand Down Expand Up @@ -723,6 +718,11 @@ with_table_hints
: WITH? '(' table_hint (',' table_hint)* ')'
;

// https://msdn.microsoft.com/en-us/library/ms187373.aspx
insert_with_table_hints
: WITH '(' table_hint (',' table_hint)* ')'
;

// Id runtime check. Id can be (FORCESCAN, HOLDLOCK, NOLOCK, NOWAIT, PAGLOCK, READCOMMITTED,
// READCOMMITTEDLOCK, READPAST, READUNCOMMITTED, REPEATABLEREAD, ROWLOCK, TABLOCK, TABLOCKX
// UPDLOCK, XLOCK)
Expand Down Expand Up @@ -753,10 +753,7 @@ column_alias
: id
| STRING
;

table_value_constructor
: VALUES '(' expression_list ')' (',' '(' expression_list ')')*
;


expression_list
: expression (',' expression)*
Expand Down

0 comments on commit e6cfb1b

Please sign in to comment.