From e3ce4238a5e626a2975089ed387e48f0b22cc47a Mon Sep 17 00:00:00 2001 From: user <> Date: Wed, 16 Dec 2015 00:12:08 +0300 Subject: [PATCH 1/5] some rules for SELECT copied from original grammar --- test1/Globals.cs | 31 +----- test1/grammars/test-grammar-3.ebnf | 155 +++++++++++++++++++++++++++++ test1/test1.csproj | 1 + 3 files changed, 157 insertions(+), 30 deletions(-) create mode 100644 test1/grammars/test-grammar-3.ebnf diff --git a/test1/Globals.cs b/test1/Globals.cs index abfee47..675b183 100644 --- a/test1/Globals.cs +++ b/test1/Globals.cs @@ -6,7 +6,7 @@ partial class Globals { static void Main(string[] args) { - var fileContent = LoadFromResource("test1", "grammars", "test-grammar-2.ebnf"); + var fileContent = LoadFromResource("test1", "grammars", "test-grammar-3.ebnf"); EbnfStyle style = (EbnfStyle)( (uint)EbnfStyle.Iso14977 @@ -43,32 +43,3 @@ at Globals.Main (System.String[] args) [0x0002b] in /var/calculate/remote/distfi } } } - -/* -Parsed as: -1: SELECT, reserved_word -2: *, asterisk -3: FROM, reserved_word -4: table1, regular_identifier -5: AS, reserved_word -6: a, regular_identifier -7: INNER, reserved_word -8: JOIN, reserved_word -9: table2, regular_identifier -10: AS, reserved_word -11: B, regular_identifier -12: ON, reserved_word -13: a, regular_identifier -14: ., period -15: id, regular_identifier -16: =, equals_operator -17: b, regular_identifier -18: ., period -19: a_id, regular_identifier -20: WHERE, reserved_word -21: a, regular_identifier -22: ., period -23: name, regular_identifier -24: =, equals_operator -25: 'test', character_string_literal -*/ \ No newline at end of file diff --git a/test1/grammars/test-grammar-3.ebnf b/test1/grammars/test-grammar-3.ebnf new file mode 100644 index 0000000..4243939 --- /dev/null +++ b/test1/grammars/test-grammar-3.ebnf @@ -0,0 +1,155 @@ +simple_Latin_upper_case_letter = + "A" | "B" | "C" | "D" | "E" | + "F" | "G" | "H" | "I" | "J" | + "K" | "L" | "M" | "N" | "O" | + "P" | "Q" | "R" | "S" | "T" | + "U" | "V" | "W" | "X" | "Y" | "Z" + ; + +simple_Latin_lower_case_letter = + "a" | "b" | "c" | "d" | "e" | + "f" | "g" | "h" | "i" | "j" | + "k" | "l" | "m" | "n" | "o" | + "p" | "q" | "r" | "s" | "t" | + "u" | "v" | "w" | "x" | "y" | "z" + ; + +digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" + ; + +asterisk = "*" ; +period = "." ; +equals_operator = "=" ; +underscore = "_" ; +quote = "'"; +comma = ","; +left_paren = "("; +right_paren = ")"; +double_quote = "\x0022"; + +quote_symbol := quote, quote ; +nonquote_character := ? Terminals.AnyChar ? - quote ; +doublequote_symbol := double_quote, double_quote; +nondoublequote_character := ? Terminals.AnyChar ? - doublequote_symbol ; + +reserved_word = "SELECT" + | "FROM" + | "AS" + | "INNER" + | "JOIN" + | "ON" + | "WHERE" + ; + +identifier_start = simple_Latin_upper_case_letter | simple_Latin_lower_case_letter | underscore ; +identifier_extend = identifier_start | digit ; +regular_identifier := identifier_start, { identifier_extend } ; + +delimited_identifier = double_quote, delimited_identifier_body, double_quote; +delimited_identifier_body = {delimited_identifier_part}; +delimited_identifier_part = nondoublequote_character | doublequote_symbol; + +actual_identifier = regular_identifier | delimited_identifier; + +identifier = actual_identifier; + +column_name = identifier; +correlation_name = identifier; +query_name = identifier; +catalog_name = identifier; +qualified_identifier = identifier; + +identifier_chain = identifier, [ { period, identifier } ]; +basic_identifier_chain = identifier_chain; + + + +character_string_literal := quote, { character_representation }, quote ; +character_representation := nonquote_character | quote_symbol; + +query_specification = SELECT, select_list, table_expression ; +table_expression = from_clause, [where_clause] ; (* , [group_by_clause], [ having_clause], [window_clause] ; *) +select_list = asterisk ; (* | select_sublist [ { comma, select_sublist } ]; *) +from_clause = "FROM", table_reference_list; +table_reference_list = table_reference, [ { comma, table_reference } ] ; +table_reference = table_primary_or_joined_table; (* [ ] *) +table_primary_or_joined_table = table_primary | joined_table ; +table_primary = table_or_query_name [ [ "AS" ], correlation_name ]; +(* ::= +
[ [ AS ] [ ] ] + | [ AS ] [ ] + | [ AS ] [ ] + | [ AS ] [ ] + |
[ AS ] [ ] + | [ [ AS ] [ ] ] + | *) +joined_table = qualified_join; +(* + | + | + | *) + +qualified_join = table_reference, [ join_type ], "JOIN", table_reference, join_specification; +join_type = "INNER" | outer_join_type, [ "OUTER" ] ; +outer_join_type = "LEFT" | "RIGHT" | "FULL" ; + +join_specification = join_condition | named_columns_join; +join_condition = "ON", search_condition ; + +named_columns_join = "USING" left_paren join_column_list, right_paren; + +join_column_list = column_name_list; + +column_name_list = column_name, [ { comma, column_name } ]; + +table_or_query_name = table_name | query_name ; +table_name = local_or_schema_qualified_name; + +local_or_schema_qualified_name = local_or_schema_qualifier, period, qualified_identifier; +local_or_schema_qualifier = schema_name | "MODULE"; + +schema_name = [ catalog_name, period ], unqualified_schema_name; +unqualified_schema_name = identifier; + + +where_clause = "WHERE", search_condition; + +search_condition = boolean_value_expression; + +boolean_value_expression = boolean_term | boolean_value_expression, "OR", boolean_term ; +boolean_term = boolean_factor | boolean_term, "AND", boolean_factor ; +boolean_factor = [ "NOT" ], boolean_test ; +boolean_test = boolean_primary, [ "IS", [ "NOT" ], truth_value ]; +truth_value = "TRUE" | "FALSE" | "UNKNOWN"; +boolean_primary = predicate | boolean_predicand; +boolean_predicand = parenthesized_boolean_value_expression | nonparenthesized_value_expression_primary; +parenthesized_boolean_value_expression = left_paren, boolean_value_expression, right_paren; +nonparenthesized_value_expression_primary = column_reference; +(* | field_reference | reference_resolution *) +(* + + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +*) +column_reference = basic_identifier_chain ; +(* | "MODULE" period, *) + +SQL_procedure_statement = { reserved_word | regular_identifier | character_string_literal + | asterisk | period | equals_operator | underscore | quote + } ; diff --git a/test1/test1.csproj b/test1/test1.csproj index 16d06a7..87ced6e 100644 --- a/test1/test1.csproj +++ b/test1/test1.csproj @@ -51,5 +51,6 @@ + \ No newline at end of file From 9329d6bb61513d2c2b0e680044d4a27b24435815 Mon Sep 17 00:00:00 2001 From: user <> Date: Wed, 16 Dec 2015 00:17:01 +0300 Subject: [PATCH 2/5] some commas was added --- test1/Globals.cs | 16 ++++++++++++++++ test1/grammars/test-grammar-3.ebnf | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/test1/Globals.cs b/test1/Globals.cs index 675b183..3167d90 100644 --- a/test1/Globals.cs +++ b/test1/Globals.cs @@ -43,3 +43,19 @@ at Globals.Main (System.String[] args) [0x0002b] in /var/calculate/remote/distfi } } } +/* +ditted indetifier was not parsed: +1: SELECT * FROM table1 AS a INNER JOIN table2 AS B ON a, query_specification +2: ., period +3: id, regular_identifier +4: =, equals_operator +5: b, regular_identifier +6: ., period +7: a_id, regular_identifier +8: WHERE, reserved_word +9: a, regular_identifier +10: ., period +11: name, regular_identifier +12: =, equals_operator +13: 'test', character_string_literal +*/ \ No newline at end of file diff --git a/test1/grammars/test-grammar-3.ebnf b/test1/grammars/test-grammar-3.ebnf index 4243939..4caf2e8 100644 --- a/test1/grammars/test-grammar-3.ebnf +++ b/test1/grammars/test-grammar-3.ebnf @@ -74,7 +74,7 @@ from_clause = "FROM", table_reference_list; table_reference_list = table_reference, [ { comma, table_reference } ] ; table_reference = table_primary_or_joined_table; (* [ ] *) table_primary_or_joined_table = table_primary | joined_table ; -table_primary = table_or_query_name [ [ "AS" ], correlation_name ]; +table_primary = table_or_query_name, [ [ "AS" ], correlation_name ]; (*
::=
[ [ AS ] [ ] ] | [ AS ] [ ] @@ -96,7 +96,7 @@ outer_join_type = "LEFT" | "RIGHT" | "FULL" ; join_specification = join_condition | named_columns_join; join_condition = "ON", search_condition ; -named_columns_join = "USING" left_paren join_column_list, right_paren; +named_columns_join = "USING", left_paren, join_column_list, right_paren; join_column_list = column_name_list; @@ -150,6 +150,6 @@ nonparenthesized_value_expression_primary = column_reference; column_reference = basic_identifier_chain ; (* | "MODULE" period, *) -SQL_procedure_statement = { reserved_word | regular_identifier | character_string_literal +SQL_procedure_statement = { query_specification | reserved_word | regular_identifier | character_string_literal | asterisk | period | equals_operator | underscore | quote } ; From 8c3f47682896665e40553e9d74b1844aaa31a91b Mon Sep 17 00:00:00 2001 From: user <> Date: Wed, 16 Dec 2015 00:31:20 +0300 Subject: [PATCH 3/5] join_specification rule should be checked --- test1/Globals.cs | 63 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/test1/Globals.cs b/test1/Globals.cs index 3167d90..c12c341 100644 --- a/test1/Globals.cs +++ b/test1/Globals.cs @@ -36,26 +36,57 @@ at Globals.Main (System.String[] args) [0x0002b] in /var/calculate/remote/distfi Console.Out.WriteLine ("No luck!"); } else { - int token = 0; + int token1 = 0; foreach (var m in match.Matches) { - Console.WriteLine ("{0}: {1}, {2}", ++token, m.Text, m.Name); + Console.WriteLine ("{0}: {1}, {2}", token1++, m.Text, m.Name); } + Console.WriteLine ("Matches of query_specification"); + var query_specification = match.Matches[0]; + int token2 = 0; + foreach (var m in query_specification.Matches) { + Console.WriteLine ("{0}: {1}, {2}", token2++, m.Text, m.Name); + } + Console.WriteLine ("Matches of from_clause"); + var table_expression = query_specification.Matches [2]; + var from_clause = table_expression.Matches[0]; + var table_reference_list = from_clause.Matches [0]; + var table_reference = table_reference_list.Matches [0]; + var table_primary_or_joined_table = table_reference.Matches [0]; + int token3 = 0; + foreach (var m in table_primary_or_joined_table.Matches) { + Console.WriteLine ("{0}: {1}, {2}", token3++, m.Text, m.Name); + } + var joined_table = table_primary_or_joined_table.Matches [1]; + var qualified_join = joined_table.Matches [0]; + foreach (var m in qualified_join.Matches) { + Console.WriteLine ("{0}: {1}, {2}", token3++, m.Text, m.Name); + } + // join_specification rule fails } } } /* -ditted indetifier was not parsed: -1: SELECT * FROM table1 AS a INNER JOIN table2 AS B ON a, query_specification -2: ., period -3: id, regular_identifier -4: =, equals_operator -5: b, regular_identifier -6: ., period -7: a_id, regular_identifier -8: WHERE, reserved_word -9: a, regular_identifier -10: ., period -11: name, regular_identifier -12: =, equals_operator -13: 'test', character_string_literal +0: SELECT * FROM table1 AS a INNER JOIN table2 AS B ON a, query_specification +1: ., period +2: id, regular_identifier +3: =, equals_operator +4: b, regular_identifier +5: ., period +6: a_id, regular_identifier +7: WHERE, reserved_word +8: a, regular_identifier +9: ., period +10: name, regular_identifier +11: =, equals_operator +12: 'test', character_string_literal +Matches of query_specification +0: SELECT, SELECT +1: *, select_list +2: FROM table1 AS a INNER JOIN table2 AS B ON a, table_expression +Matches of from_clause +0: table1 AS a, table_primary +1: INNER JOIN table2 AS B ON a, joined_table +2: INNER, join_type +3: table2 AS B, table_reference +4: ON a, join_specification */ \ No newline at end of file From f7d654ec9a907ac56e911b5e23dc72d7de545597 Mon Sep 17 00:00:00 2001 From: user <> Date: Wed, 16 Dec 2015 00:47:32 +0300 Subject: [PATCH 4/5] comapison part of join was fixed --- test1/Globals.cs | 26 +++++--------- test1/grammars/test-grammar-3.ebnf | 57 ++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 17 deletions(-) diff --git a/test1/Globals.cs b/test1/Globals.cs index c12c341..dbe8eb7 100644 --- a/test1/Globals.cs +++ b/test1/Globals.cs @@ -61,32 +61,24 @@ at Globals.Main (System.String[] args) [0x0002b] in /var/calculate/remote/distfi foreach (var m in qualified_join.Matches) { Console.WriteLine ("{0}: {1}, {2}", token3++, m.Text, m.Name); } - // join_specification rule fails + // Now one more bug is in WHERE clause: } } } /* -0: SELECT * FROM table1 AS a INNER JOIN table2 AS B ON a, query_specification -1: ., period -2: id, regular_identifier -3: =, equals_operator -4: b, regular_identifier -5: ., period -6: a_id, regular_identifier -7: WHERE, reserved_word -8: a, regular_identifier -9: ., period -10: name, regular_identifier -11: =, equals_operator -12: 'test', character_string_literal + +0: SELECT * FROM table1 AS a INNER JOIN table2 AS B ON a.id = b.a_id WHERE a.nam, query_specification +1: =, equals_operator +2: 'test', character_string_literal Matches of query_specification 0: SELECT, SELECT 1: *, select_list -2: FROM table1 AS a INNER JOIN table2 AS B ON a, table_expression +2: FROM table1 AS a INNER JOIN table2 AS B ON a.id = b.a_id WHERE a.nam, table_expression Matches of from_clause 0: table1 AS a, table_primary -1: INNER JOIN table2 AS B ON a, joined_table +1: INNER JOIN table2 AS B ON a.id = b.a_id, joined_table 2: INNER, join_type 3: table2 AS B, table_reference -4: ON a, join_specification +4: ON a.id = b.a_id, join_specification + */ \ No newline at end of file diff --git a/test1/grammars/test-grammar-3.ebnf b/test1/grammars/test-grammar-3.ebnf index 4caf2e8..362e644 100644 --- a/test1/grammars/test-grammar-3.ebnf +++ b/test1/grammars/test-grammar-3.ebnf @@ -149,6 +149,63 @@ nonparenthesized_value_expression_primary = column_reference; *) column_reference = basic_identifier_chain ; (* | "MODULE" period, *) +predicate = comparison_predicate; +(* + ::= + + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +*) +comparison_predicate = row_value_predicand, comparison_predicate_part_2; +row_value_predicand = row_value_special_case (*| row_value_constructor_predicand*); +comparison_predicate_part_2 = comp_op, row_value_predicand; +comp_op = equals_operator ; +(* + | + | + | + | + | *) + +row_value_special_case = nonparenthesized_value_expression_primary; + +nonparenthesized_value_expression_primary = column_reference; +(* + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | *) + + + SQL_procedure_statement = { query_specification | reserved_word | regular_identifier | character_string_literal | asterisk | period | equals_operator | underscore | quote From 9c4e2edadf0756760c6c40878c06441292af253a Mon Sep 17 00:00:00 2001 From: user <> Date: Wed, 16 Dec 2015 01:52:51 +0300 Subject: [PATCH 5/5] literal part fixed --- test1/Globals.cs | 135 ++++++++++++++++++++--------- test1/grammars/test-grammar-3.ebnf | 26 ++++-- 2 files changed, 115 insertions(+), 46 deletions(-) diff --git a/test1/Globals.cs b/test1/Globals.cs index dbe8eb7..82ba0ca 100644 --- a/test1/Globals.cs +++ b/test1/Globals.cs @@ -3,8 +3,10 @@ using Eto.Parse; using Eto.Parse.Grammars; using System.Diagnostics; +using System.Collections.Generic; partial class Globals { + const string nameOfTheStartingRule = "SQL_procedure_statement"; static void Main(string[] args) { var fileContent = LoadFromResource("test1", "grammars", "test-grammar-3.ebnf"); @@ -13,11 +15,11 @@ static void Main(string[] args) { //& ~(uint) EbnfStyle.WhitespaceSeparator | (uint) EbnfStyle.EscapeTerminalStrings); + EbnfGrammar grammar; Grammar parser; try { - var grammar = new EbnfGrammar(style); - var nameOfTheStartingRule = "SQL_procedure_statement"; + grammar = new EbnfGrammar(style); parser = grammar.Build(fileContent, nameOfTheStartingRule); } catch (Exception ex) @@ -36,49 +38,102 @@ at Globals.Main (System.String[] args) [0x0002b] in /var/calculate/remote/distfi Console.Out.WriteLine ("No luck!"); } else { - int token1 = 0; - foreach (var m in match.Matches) { - Console.WriteLine ("{0}: {1}, {2}", token1++, m.Text, m.Name); - } - Console.WriteLine ("Matches of query_specification"); - var query_specification = match.Matches[0]; - int token2 = 0; - foreach (var m in query_specification.Matches) { - Console.WriteLine ("{0}: {1}, {2}", token2++, m.Text, m.Name); - } - Console.WriteLine ("Matches of from_clause"); - var table_expression = query_specification.Matches [2]; - var from_clause = table_expression.Matches[0]; - var table_reference_list = from_clause.Matches [0]; - var table_reference = table_reference_list.Matches [0]; - var table_primary_or_joined_table = table_reference.Matches [0]; - int token3 = 0; - foreach (var m in table_primary_or_joined_table.Matches) { - Console.WriteLine ("{0}: {1}, {2}", token3++, m.Text, m.Name); + DumpAllMatches (match, nameOfTheStartingRule); + } + } + public static void DumpAllMatches(Match m, string name) + { + for (int pos = 0; pos < m.Matches.Count; pos++) + { + Match nm = m.Matches [pos]; + var full_name = nm.Name + " <- " + name; + + bool low = IsTooLow (nm.Name); + if (nm.Text != m.Text) { + string fmt = "\"{0}\"" + Environment.NewLine + "\t" + "{1}"; + Console.WriteLine (fmt, nm.Text, full_name); } - var joined_table = table_primary_or_joined_table.Matches [1]; - var qualified_join = joined_table.Matches [0]; - foreach (var m in qualified_join.Matches) { - Console.WriteLine ("{0}: {1}, {2}", token3++, m.Text, m.Name); + if (!low) { + DumpAllMatches (nm, full_name); } - // Now one more bug is in WHERE clause: } } + static bool IsTooLow(string rule) + { + if (rule == "identifier") return true; + if (rule == "character_string_literal") return true; + return false; + } } -/* -0: SELECT * FROM table1 AS a INNER JOIN table2 AS B ON a.id = b.a_id WHERE a.nam, query_specification -1: =, equals_operator -2: 'test', character_string_literal -Matches of query_specification -0: SELECT, SELECT -1: *, select_list -2: FROM table1 AS a INNER JOIN table2 AS B ON a.id = b.a_id WHERE a.nam, table_expression -Matches of from_clause -0: table1 AS a, table_primary -1: INNER JOIN table2 AS B ON a.id = b.a_id, joined_table -2: INNER, join_type -3: table2 AS B, table_reference -4: ON a.id = b.a_id, join_specification +/* +"SELECT" + SELECT <- query_specification <- SQL_procedure_statement +"*" + select_list <- query_specification <- SQL_procedure_statement +"FROM table1 AS a INNER JOIN table2 AS B ON a.id = b.a_id WHERE a.name = 'test" + table_expression <- query_specification <- SQL_procedure_statement +"FROM table1 AS a INNER JOIN table2 AS B ON a.id = b.a_id" + from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"table1 AS a INNER JOIN table2 AS B ON a.id = b.a_id" + table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"table1 AS a" + table_primary <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"table1" + table_or_query_name <- table_primary <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"a" + correlation_name <- table_primary <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +" INNER JOIN table2 AS B ON a.id = b.a_id" + joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"INNER" + join_type <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"table2 AS B" + table_reference <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"table2" + table_or_query_name <- table_primary <- table_primary_or_joined_table <- table_reference <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"B" + correlation_name <- table_primary <- table_primary_or_joined_table <- table_reference <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"ON a.id = b.a_id" + join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"a.id = b.a_id" + search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"a.id" + row_value_predicand <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"a" + identifier <- identifier_chain <- basic_identifier_chain <- column_reference <- nonparenthesized_value_expression_primary <- row_value_special_case <- row_value_predicand <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"." + period <- identifier_chain <- basic_identifier_chain <- column_reference <- nonparenthesized_value_expression_primary <- row_value_special_case <- row_value_predicand <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"id" + identifier <- identifier_chain <- basic_identifier_chain <- column_reference <- nonparenthesized_value_expression_primary <- row_value_special_case <- row_value_predicand <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"= b.a_id" + comparison_predicate_part_2 <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"=" + comp_op <- comparison_predicate_part_2 <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"b.a_id" + row_value_predicand <- comparison_predicate_part_2 <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"b" + identifier <- identifier_chain <- basic_identifier_chain <- column_reference <- nonparenthesized_value_expression_primary <- row_value_special_case <- row_value_predicand <- comparison_predicate_part_2 <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"." + period <- identifier_chain <- basic_identifier_chain <- column_reference <- nonparenthesized_value_expression_primary <- row_value_special_case <- row_value_predicand <- comparison_predicate_part_2 <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"a_id" + identifier <- identifier_chain <- basic_identifier_chain <- column_reference <- nonparenthesized_value_expression_primary <- row_value_special_case <- row_value_predicand <- comparison_predicate_part_2 <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- join_condition <- join_specification <- qualified_join <- joined_table <- table_primary_or_joined_table <- table_reference <- table_reference_list <- from_clause <- table_expression <- query_specification <- SQL_procedure_statement +"WHERE a.name = 'test'" + where_clause <- table_expression <- query_specification <- SQL_procedure_statement +"a.name = 'test'" + search_condition <- where_clause <- table_expression <- query_specification <- SQL_procedure_statement +"a.name" + row_value_predicand <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- where_clause <- table_expression <- query_specification <- SQL_procedure_statement +"a" + identifier <- identifier_chain <- basic_identifier_chain <- column_reference <- nonparenthesized_value_expression_primary <- row_value_special_case <- row_value_predicand <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- where_clause <- table_expression <- query_specification <- SQL_procedure_statement +"." + period <- identifier_chain <- basic_identifier_chain <- column_reference <- nonparenthesized_value_expression_primary <- row_value_special_case <- row_value_predicand <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- where_clause <- table_expression <- query_specification <- SQL_procedure_statement +"name" + identifier <- identifier_chain <- basic_identifier_chain <- column_reference <- nonparenthesized_value_expression_primary <- row_value_special_case <- row_value_predicand <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- where_clause <- table_expression <- query_specification <- SQL_procedure_statement +"= 'test'" + comparison_predicate_part_2 <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- where_clause <- table_expression <- query_specification <- SQL_procedure_statement +"=" + comp_op <- comparison_predicate_part_2 <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- where_clause <- table_expression <- query_specification <- SQL_procedure_statement +"'test'" + row_value_predicand <- comparison_predicate_part_2 <- comparison_predicate <- predicate <- boolean_primary <- boolean_test <- boolean_factor <- boolean_term <- boolean_value_expression <- search_condition <- where_clause <- table_expression <- query_specification <- SQL_procedure_statement */ \ No newline at end of file diff --git a/test1/grammars/test-grammar-3.ebnf b/test1/grammars/test-grammar-3.ebnf index 362e644..7333b27 100644 --- a/test1/grammars/test-grammar-3.ebnf +++ b/test1/grammars/test-grammar-3.ebnf @@ -55,9 +55,9 @@ identifier = actual_identifier; column_name = identifier; correlation_name = identifier; -query_name = identifier; catalog_name = identifier; qualified_identifier = identifier; +(*query_name = identifier;*) identifier_chain = identifier, [ { period, identifier } ]; basic_identifier_chain = identifier_chain; @@ -102,10 +102,10 @@ join_column_list = column_name_list; column_name_list = column_name, [ { comma, column_name } ]; -table_or_query_name = table_name | query_name ; +table_or_query_name = table_name (*| query_name*) ; table_name = local_or_schema_qualified_name; -local_or_schema_qualified_name = local_or_schema_qualifier, period, qualified_identifier; +local_or_schema_qualified_name = [local_or_schema_qualifier, period], qualified_identifier; local_or_schema_qualifier = schema_name | "MODULE"; schema_name = [ catalog_name, period ], unqualified_schema_name; @@ -183,7 +183,9 @@ comp_op = equals_operator ; row_value_special_case = nonparenthesized_value_expression_primary; -nonparenthesized_value_expression_primary = column_reference; +nonparenthesized_value_expression_primary = column_reference + | unsigned_value_specification + ; (* | | @@ -204,8 +206,20 @@ nonparenthesized_value_expression_primary = column_reference; | | *) - - +unsigned_value_specification = unsigned_literal; +unsigned_literal = general_literal; +(* ::= | *) + +general_literal = character_string_literal; +(* ::= + + | + | + | + | + | + | +*) SQL_procedure_statement = { query_specification | reserved_word | regular_identifier | character_string_literal | asterisk | period | equals_operator | underscore | quote