oracle-sql-parser 0.9.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +213 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +66 -3
  5. data/Rakefile +62 -10
  6. data/lib/oracle-sql-parser/ast/fetch.rb +12 -0
  7. data/lib/oracle-sql-parser/ast/number_literal.rb +1 -1
  8. data/lib/oracle-sql-parser/ast/offset.rb +11 -0
  9. data/lib/oracle-sql-parser/ast/row_limiting_clause.rb +10 -0
  10. data/lib/oracle-sql-parser/ast/subquery.rb +8 -4
  11. data/lib/oracle-sql-parser/ast.rb +3 -0
  12. data/lib/oracle-sql-parser/grammar/condition/between.rb +5 -3
  13. data/lib/oracle-sql-parser/grammar/condition/comparison.rb +5 -3
  14. data/lib/oracle-sql-parser/grammar/condition/comparison.treetop +1 -0
  15. data/lib/oracle-sql-parser/grammar/condition/compound.rb +5 -3
  16. data/lib/oracle-sql-parser/grammar/condition/exists.rb +5 -3
  17. data/lib/oracle-sql-parser/grammar/condition/floating_point.rb +5 -3
  18. data/lib/oracle-sql-parser/grammar/condition/in.rb +5 -3
  19. data/lib/oracle-sql-parser/grammar/condition/is_of_type.rb +5 -3
  20. data/lib/oracle-sql-parser/grammar/condition/multiset.rb +5 -3
  21. data/lib/oracle-sql-parser/grammar/condition/null.rb +5 -3
  22. data/lib/oracle-sql-parser/grammar/condition/pattern_matching.rb +5 -3
  23. data/lib/oracle-sql-parser/grammar/condition.rb +5 -3
  24. data/lib/oracle-sql-parser/grammar/delete.rb +5 -3
  25. data/lib/oracle-sql-parser/grammar/expression/case.rb +5 -3
  26. data/lib/oracle-sql-parser/grammar/expression/compound.rb +5 -3
  27. data/lib/oracle-sql-parser/grammar/expression/cursor.rb +5 -3
  28. data/lib/oracle-sql-parser/grammar/expression/datetime.rb +5 -3
  29. data/lib/oracle-sql-parser/grammar/expression/function.rb +5 -3
  30. data/lib/oracle-sql-parser/grammar/expression/interval.rb +5 -3
  31. data/lib/oracle-sql-parser/grammar/expression/simple.rb +5 -3
  32. data/lib/oracle-sql-parser/grammar/expression.rb +5 -27
  33. data/lib/oracle-sql-parser/grammar/expression.treetop +0 -4
  34. data/lib/oracle-sql-parser/grammar/grammar.rb +5 -29
  35. data/lib/oracle-sql-parser/grammar/grammar.treetop +0 -8
  36. data/lib/oracle-sql-parser/grammar/insert.rb +5 -3
  37. data/lib/oracle-sql-parser/grammar/reserved_word.rb +662 -42
  38. data/lib/oracle-sql-parser/grammar/reserved_word.treetop +1150 -0
  39. data/lib/oracle-sql-parser/grammar/reserved_word_generator.rb +7 -1
  40. data/lib/oracle-sql-parser/grammar/select/for_update.rb +5 -3
  41. data/lib/oracle-sql-parser/grammar/select/group.rb +5 -3
  42. data/lib/oracle-sql-parser/grammar/select/join.rb +5 -3
  43. data/lib/oracle-sql-parser/grammar/select/order.rb +5 -3
  44. data/lib/oracle-sql-parser/grammar/select/query_block.rb +5 -3
  45. data/lib/oracle-sql-parser/grammar/select/row_limit.rb +407 -0
  46. data/lib/oracle-sql-parser/grammar/select/row_limit.treetop +49 -0
  47. data/lib/oracle-sql-parser/grammar/select/union.rb +5 -3
  48. data/lib/oracle-sql-parser/grammar/select.rb +46 -5
  49. data/lib/oracle-sql-parser/grammar/select.treetop +4 -1
  50. data/lib/oracle-sql-parser/grammar/update.rb +5 -3
  51. data/lib/oracle-sql-parser/grammar.rb +1 -0
  52. data/lib/oracle-sql-parser/version.rb +1 -1
  53. data/oracle-sql-parser.gemspec +14 -12
  54. metadata +40 -53
  55. data/.gitignore +0 -24
  56. data/Gemfile +0 -4
  57. data/HISTORY.md +0 -70
@@ -2,7 +2,7 @@
2
2
  # Autogenerated from a Treetop grammar. Edits may be lost.
3
3
 
4
4
 
5
- # reserved_word.treetop generated by lib/oracle-sql-parser/grammar/reserved_word_generator.rb at 2017-12-29 23:31:34 +0900
5
+ # reserved_word.treetop is generated by reserved_word_generator.rb. Do not edit.
6
6
  #
7
7
  module OracleSqlParser::Grammar
8
8
  module ReservedWord
@@ -70,7 +70,7 @@ module OracleSqlParser::Grammar
70
70
  s0 << r3
71
71
  if r3
72
72
  i5 = index
73
- r6 = lambda {|w| ["ACCESS", "ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AT", "AUDIT", "BETWEEN", "BY", "CASE", "CAST", "CHAR", "CHECK", "CLUSTER", "COLUMN", "COLUMN_VALUE", "COMMENT", "COMPRESS", "CONNECT", "CREATE", "CROSS", "CUBE", "CURRENT", "CURRENT_OF", "CURRVAL", "CURSOR", "DATE", "DAY", "DBTIMEZONE", "DECIMAL", "DEFAULT", "DELETE", "DESC", "DISTINCT", "DROP", "ELSE", "EMPTY", "END", "ESCAPE", "EXCLUSIVE", "EXISTS", "FILE", "FIRST", "FLOAT", "FOR", "FROM", "FULL", "GRANT", "GROUP", "HAVING", "IDENTIFIED", "IMMEDIATE", "IN", "INCREMENT", "INDEX", "INFINITE", "INITIAL", "INNER", "INSERT", "INTEGER", "INTERSECT", "INTO", "IS", "JOIN", "LAST", "LEFT", "LEVEL", "LIKE", "LIKE2", "LIKE4", "LIKEC", "LOCAL", "LOCK", "LONG", "MAXEXTENTS", "MEMBER", "MINUS", "MLSLABEL", "MODE", "MODIFY", "MONTH", "NAN", "NATURAL", "NESTED_TABLE_ID", "NEXTVAL", "NOAUDIT", "NOCOMPRESS", "NOT", "NOWAIT", "NULL", "NULLS", "NUMBER", "OF", "OFFLINE", "ON", "ONLINE", "ONLY", "OPTION", "OR", "ORDER", "OUTER", "PCTFREE", "PRIOR", "PRIVILEGES", "PUBLIC", "RAW", "REGEXP_LIKE", "RENAME", "RESOURCE", "REVOKE", "RIGHT", "ROLLUP", "ROW", "ROWID", "ROWNUM", "ROWS", "SECOND", "SELECT", "SESSION", "SESSIONTIMEZONE", "SET", "SHARE", "SIBLINGS", "SIZE", "SMALLINT", "START", "SUBMULTISET", "SUCCESSFUL", "SYNONYM", "SYSDATE", "SYSTIMESTAMP", "TABLE", "THEN", "TIME", "TO", "TRIGGER", "TYPE", "UID", "UNION", "UNIQUE", "UPDATE", "USER", "USING", "VALIDATE", "VALUES", "VARCHAR", "VARCHAR2", "VIEW", "WAIT", "WHEN", "WHENEVER", "WHERE", "YEAR", "ZONE"].include? w.first.text_value.upcase}.call(s0)
73
+ r6 = lambda {|w| ["ACCESS", "ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AT", "AUDIT", "BETWEEN", "BY", "CASE", "CAST", "CHAR", "CHECK", "CLUSTER", "COLUMN", "COLUMN_VALUE", "COMMENT", "COMPRESS", "CONNECT", "CREATE", "CROSS", "CUBE", "CURRENT", "CURRENT_OF", "CURRVAL", "CURSOR", "DATE", "DAY", "DBTIMEZONE", "DECIMAL", "DEFAULT", "DELETE", "DESC", "DISTINCT", "DROP", "ELSE", "EMPTY", "END", "ESCAPE", "EXCLUSIVE", "EXISTS", "FETCH", "FILE", "FIRST", "FLOAT", "FOR", "FROM", "FULL", "GRANT", "GROUP", "HAVING", "IDENTIFIED", "IMMEDIATE", "IN", "INCREMENT", "INDEX", "INFINITE", "INITIAL", "INNER", "INSERT", "INTEGER", "INTERSECT", "INTO", "IS", "JOIN", "LAST", "LEFT", "LEVEL", "LIKE", "LIKE2", "LIKE4", "LIKEC", "LOCAL", "LOCK", "LONG", "MAXEXTENTS", "MEMBER", "MINUS", "MLSLABEL", "MODE", "MODIFY", "MONTH", "NAN", "NATURAL", "NESTED_TABLE_ID", "NEXT", "NEXTVAL", "NOAUDIT", "NOCOMPRESS", "NOT", "NOWAIT", "NULL", "NULLS", "NUMBER", "OF", "OFFLINE", "OFFSET", "ON", "ONLINE", "ONLY", "OPTION", "OR", "ORDER", "OUTER", "PCTFREE", "PERCENT", "PRIOR", "PRIVILEGES", "PUBLIC", "RAW", "REGEXP_LIKE", "RENAME", "RESOURCE", "REVOKE", "RIGHT", "ROLLUP", "ROW", "ROWID", "ROWNUM", "ROWS", "SECOND", "SELECT", "SESSION", "SESSIONTIMEZONE", "SET", "SHARE", "SIBLINGS", "SIZE", "SMALLINT", "START", "SUBMULTISET", "SUCCESSFUL", "SYNONYM", "SYSDATE", "SYSTIMESTAMP", "TABLE", "THEN", "TIES", "TIME", "TO", "TRIGGER", "TYPE", "UID", "UNION", "UNIQUE", "UPDATE", "USER", "USING", "VALIDATE", "VALUES", "VARCHAR", "VARCHAR2", "VIEW", "WAIT", "WHEN", "WHENEVER", "WHERE", "WITH", "YEAR", "ZONE"].include? w.first.text_value.upcase}.call(s0)
74
74
  if !r6
75
75
  terminal_parse_failure("<semantic predicate>")
76
76
  end
@@ -4819,6 +4819,109 @@ module OracleSqlParser::Grammar
4819
4819
  r0
4820
4820
  end
4821
4821
 
4822
+ module FetchKeyword0
4823
+ end
4824
+
4825
+ module FetchKeyword1
4826
+ def ast
4827
+ OracleSqlParser::Ast::Keyword.new(:name => text_value)
4828
+ end
4829
+ end
4830
+
4831
+ def _nt_fetch_keyword
4832
+ start_index = index
4833
+ if node_cache[:fetch_keyword].has_key?(index)
4834
+ cached = node_cache[:fetch_keyword][index]
4835
+ if cached
4836
+ node_cache[:fetch_keyword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4837
+ @index = cached.interval.end
4838
+ end
4839
+ return cached
4840
+ end
4841
+
4842
+ i0, s0 = index, []
4843
+ if has_terminal?(@regexps[gr = '\A[fF]'] ||= Regexp.new(gr), :regexp, index)
4844
+ r1 = true
4845
+ @index += 1
4846
+ else
4847
+ terminal_parse_failure('[fF]')
4848
+ r1 = nil
4849
+ end
4850
+ s0 << r1
4851
+ if r1
4852
+ if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
4853
+ r2 = true
4854
+ @index += 1
4855
+ else
4856
+ terminal_parse_failure('[eE]')
4857
+ r2 = nil
4858
+ end
4859
+ s0 << r2
4860
+ if r2
4861
+ if has_terminal?(@regexps[gr = '\A[tT]'] ||= Regexp.new(gr), :regexp, index)
4862
+ r3 = true
4863
+ @index += 1
4864
+ else
4865
+ terminal_parse_failure('[tT]')
4866
+ r3 = nil
4867
+ end
4868
+ s0 << r3
4869
+ if r3
4870
+ if has_terminal?(@regexps[gr = '\A[cC]'] ||= Regexp.new(gr), :regexp, index)
4871
+ r4 = true
4872
+ @index += 1
4873
+ else
4874
+ terminal_parse_failure('[cC]')
4875
+ r4 = nil
4876
+ end
4877
+ s0 << r4
4878
+ if r4
4879
+ if has_terminal?(@regexps[gr = '\A[hH]'] ||= Regexp.new(gr), :regexp, index)
4880
+ r5 = true
4881
+ @index += 1
4882
+ else
4883
+ terminal_parse_failure('[hH]')
4884
+ r5 = nil
4885
+ end
4886
+ s0 << r5
4887
+ if r5
4888
+ i6 = index
4889
+ if has_terminal?(@regexps[gr = '\A[A-Za-z0-9]'] ||= Regexp.new(gr), :regexp, index)
4890
+ r7 = true
4891
+ @index += 1
4892
+ else
4893
+ terminal_parse_failure('[A-Za-z0-9]')
4894
+ r7 = nil
4895
+ end
4896
+ if r7
4897
+ @index = i6
4898
+ r6 = nil
4899
+ terminal_parse_failure('[A-Za-z0-9]', true)
4900
+ else
4901
+ @terminal_failures.pop
4902
+ @index = i6
4903
+ r6 = instantiate_node(SyntaxNode,input, index...index)
4904
+ end
4905
+ s0 << r6
4906
+ end
4907
+ end
4908
+ end
4909
+ end
4910
+ end
4911
+ if s0.last
4912
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
4913
+ r0.extend(FetchKeyword0)
4914
+ r0.extend(FetchKeyword1)
4915
+ else
4916
+ @index = i0
4917
+ r0 = nil
4918
+ end
4919
+
4920
+ node_cache[:fetch_keyword][start_index] = r0
4921
+
4922
+ r0
4923
+ end
4924
+
4822
4925
  module FileKeyword0
4823
4926
  end
4824
4927
 
@@ -9518,6 +9621,99 @@ module OracleSqlParser::Grammar
9518
9621
  r0
9519
9622
  end
9520
9623
 
9624
+ module NextKeyword0
9625
+ end
9626
+
9627
+ module NextKeyword1
9628
+ def ast
9629
+ OracleSqlParser::Ast::Keyword.new(:name => text_value)
9630
+ end
9631
+ end
9632
+
9633
+ def _nt_next_keyword
9634
+ start_index = index
9635
+ if node_cache[:next_keyword].has_key?(index)
9636
+ cached = node_cache[:next_keyword][index]
9637
+ if cached
9638
+ node_cache[:next_keyword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
9639
+ @index = cached.interval.end
9640
+ end
9641
+ return cached
9642
+ end
9643
+
9644
+ i0, s0 = index, []
9645
+ if has_terminal?(@regexps[gr = '\A[nN]'] ||= Regexp.new(gr), :regexp, index)
9646
+ r1 = true
9647
+ @index += 1
9648
+ else
9649
+ terminal_parse_failure('[nN]')
9650
+ r1 = nil
9651
+ end
9652
+ s0 << r1
9653
+ if r1
9654
+ if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
9655
+ r2 = true
9656
+ @index += 1
9657
+ else
9658
+ terminal_parse_failure('[eE]')
9659
+ r2 = nil
9660
+ end
9661
+ s0 << r2
9662
+ if r2
9663
+ if has_terminal?(@regexps[gr = '\A[xX]'] ||= Regexp.new(gr), :regexp, index)
9664
+ r3 = true
9665
+ @index += 1
9666
+ else
9667
+ terminal_parse_failure('[xX]')
9668
+ r3 = nil
9669
+ end
9670
+ s0 << r3
9671
+ if r3
9672
+ if has_terminal?(@regexps[gr = '\A[tT]'] ||= Regexp.new(gr), :regexp, index)
9673
+ r4 = true
9674
+ @index += 1
9675
+ else
9676
+ terminal_parse_failure('[tT]')
9677
+ r4 = nil
9678
+ end
9679
+ s0 << r4
9680
+ if r4
9681
+ i5 = index
9682
+ if has_terminal?(@regexps[gr = '\A[A-Za-z0-9]'] ||= Regexp.new(gr), :regexp, index)
9683
+ r6 = true
9684
+ @index += 1
9685
+ else
9686
+ terminal_parse_failure('[A-Za-z0-9]')
9687
+ r6 = nil
9688
+ end
9689
+ if r6
9690
+ @index = i5
9691
+ r5 = nil
9692
+ terminal_parse_failure('[A-Za-z0-9]', true)
9693
+ else
9694
+ @terminal_failures.pop
9695
+ @index = i5
9696
+ r5 = instantiate_node(SyntaxNode,input, index...index)
9697
+ end
9698
+ s0 << r5
9699
+ end
9700
+ end
9701
+ end
9702
+ end
9703
+ if s0.last
9704
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
9705
+ r0.extend(NextKeyword0)
9706
+ r0.extend(NextKeyword1)
9707
+ else
9708
+ @index = i0
9709
+ r0 = nil
9710
+ end
9711
+
9712
+ node_cache[:next_keyword][start_index] = r0
9713
+
9714
+ r0
9715
+ end
9716
+
9521
9717
  module NextvalKeyword0
9522
9718
  end
9523
9719
 
@@ -10618,6 +10814,119 @@ module OracleSqlParser::Grammar
10618
10814
  r0
10619
10815
  end
10620
10816
 
10817
+ module OffsetKeyword0
10818
+ end
10819
+
10820
+ module OffsetKeyword1
10821
+ def ast
10822
+ OracleSqlParser::Ast::Keyword.new(:name => text_value)
10823
+ end
10824
+ end
10825
+
10826
+ def _nt_offset_keyword
10827
+ start_index = index
10828
+ if node_cache[:offset_keyword].has_key?(index)
10829
+ cached = node_cache[:offset_keyword][index]
10830
+ if cached
10831
+ node_cache[:offset_keyword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
10832
+ @index = cached.interval.end
10833
+ end
10834
+ return cached
10835
+ end
10836
+
10837
+ i0, s0 = index, []
10838
+ if has_terminal?(@regexps[gr = '\A[oO]'] ||= Regexp.new(gr), :regexp, index)
10839
+ r1 = true
10840
+ @index += 1
10841
+ else
10842
+ terminal_parse_failure('[oO]')
10843
+ r1 = nil
10844
+ end
10845
+ s0 << r1
10846
+ if r1
10847
+ if has_terminal?(@regexps[gr = '\A[fF]'] ||= Regexp.new(gr), :regexp, index)
10848
+ r2 = true
10849
+ @index += 1
10850
+ else
10851
+ terminal_parse_failure('[fF]')
10852
+ r2 = nil
10853
+ end
10854
+ s0 << r2
10855
+ if r2
10856
+ if has_terminal?(@regexps[gr = '\A[fF]'] ||= Regexp.new(gr), :regexp, index)
10857
+ r3 = true
10858
+ @index += 1
10859
+ else
10860
+ terminal_parse_failure('[fF]')
10861
+ r3 = nil
10862
+ end
10863
+ s0 << r3
10864
+ if r3
10865
+ if has_terminal?(@regexps[gr = '\A[sS]'] ||= Regexp.new(gr), :regexp, index)
10866
+ r4 = true
10867
+ @index += 1
10868
+ else
10869
+ terminal_parse_failure('[sS]')
10870
+ r4 = nil
10871
+ end
10872
+ s0 << r4
10873
+ if r4
10874
+ if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
10875
+ r5 = true
10876
+ @index += 1
10877
+ else
10878
+ terminal_parse_failure('[eE]')
10879
+ r5 = nil
10880
+ end
10881
+ s0 << r5
10882
+ if r5
10883
+ if has_terminal?(@regexps[gr = '\A[tT]'] ||= Regexp.new(gr), :regexp, index)
10884
+ r6 = true
10885
+ @index += 1
10886
+ else
10887
+ terminal_parse_failure('[tT]')
10888
+ r6 = nil
10889
+ end
10890
+ s0 << r6
10891
+ if r6
10892
+ i7 = index
10893
+ if has_terminal?(@regexps[gr = '\A[A-Za-z0-9]'] ||= Regexp.new(gr), :regexp, index)
10894
+ r8 = true
10895
+ @index += 1
10896
+ else
10897
+ terminal_parse_failure('[A-Za-z0-9]')
10898
+ r8 = nil
10899
+ end
10900
+ if r8
10901
+ @index = i7
10902
+ r7 = nil
10903
+ terminal_parse_failure('[A-Za-z0-9]', true)
10904
+ else
10905
+ @terminal_failures.pop
10906
+ @index = i7
10907
+ r7 = instantiate_node(SyntaxNode,input, index...index)
10908
+ end
10909
+ s0 << r7
10910
+ end
10911
+ end
10912
+ end
10913
+ end
10914
+ end
10915
+ end
10916
+ if s0.last
10917
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
10918
+ r0.extend(OffsetKeyword0)
10919
+ r0.extend(OffsetKeyword1)
10920
+ else
10921
+ @index = i0
10922
+ r0 = nil
10923
+ end
10924
+
10925
+ node_cache[:offset_keyword][start_index] = r0
10926
+
10927
+ r0
10928
+ end
10929
+
10621
10930
  module OnKeyword0
10622
10931
  end
10623
10932
 
@@ -11252,24 +11561,147 @@ module OracleSqlParser::Grammar
11252
11561
  end
11253
11562
  s0 << r5
11254
11563
  if r5
11255
- i6 = index
11256
- if has_terminal?(@regexps[gr = '\A[A-Za-z0-9]'] ||= Regexp.new(gr), :regexp, index)
11257
- r7 = true
11564
+ i6 = index
11565
+ if has_terminal?(@regexps[gr = '\A[A-Za-z0-9]'] ||= Regexp.new(gr), :regexp, index)
11566
+ r7 = true
11567
+ @index += 1
11568
+ else
11569
+ terminal_parse_failure('[A-Za-z0-9]')
11570
+ r7 = nil
11571
+ end
11572
+ if r7
11573
+ @index = i6
11574
+ r6 = nil
11575
+ terminal_parse_failure('[A-Za-z0-9]', true)
11576
+ else
11577
+ @terminal_failures.pop
11578
+ @index = i6
11579
+ r6 = instantiate_node(SyntaxNode,input, index...index)
11580
+ end
11581
+ s0 << r6
11582
+ end
11583
+ end
11584
+ end
11585
+ end
11586
+ end
11587
+ if s0.last
11588
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
11589
+ r0.extend(OuterKeyword0)
11590
+ r0.extend(OuterKeyword1)
11591
+ else
11592
+ @index = i0
11593
+ r0 = nil
11594
+ end
11595
+
11596
+ node_cache[:outer_keyword][start_index] = r0
11597
+
11598
+ r0
11599
+ end
11600
+
11601
+ module PctfreeKeyword0
11602
+ end
11603
+
11604
+ module PctfreeKeyword1
11605
+ def ast
11606
+ OracleSqlParser::Ast::Keyword.new(:name => text_value)
11607
+ end
11608
+ end
11609
+
11610
+ def _nt_pctfree_keyword
11611
+ start_index = index
11612
+ if node_cache[:pctfree_keyword].has_key?(index)
11613
+ cached = node_cache[:pctfree_keyword][index]
11614
+ if cached
11615
+ node_cache[:pctfree_keyword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
11616
+ @index = cached.interval.end
11617
+ end
11618
+ return cached
11619
+ end
11620
+
11621
+ i0, s0 = index, []
11622
+ if has_terminal?(@regexps[gr = '\A[pP]'] ||= Regexp.new(gr), :regexp, index)
11623
+ r1 = true
11624
+ @index += 1
11625
+ else
11626
+ terminal_parse_failure('[pP]')
11627
+ r1 = nil
11628
+ end
11629
+ s0 << r1
11630
+ if r1
11631
+ if has_terminal?(@regexps[gr = '\A[cC]'] ||= Regexp.new(gr), :regexp, index)
11632
+ r2 = true
11633
+ @index += 1
11634
+ else
11635
+ terminal_parse_failure('[cC]')
11636
+ r2 = nil
11637
+ end
11638
+ s0 << r2
11639
+ if r2
11640
+ if has_terminal?(@regexps[gr = '\A[tT]'] ||= Regexp.new(gr), :regexp, index)
11641
+ r3 = true
11642
+ @index += 1
11643
+ else
11644
+ terminal_parse_failure('[tT]')
11645
+ r3 = nil
11646
+ end
11647
+ s0 << r3
11648
+ if r3
11649
+ if has_terminal?(@regexps[gr = '\A[fF]'] ||= Regexp.new(gr), :regexp, index)
11650
+ r4 = true
11651
+ @index += 1
11652
+ else
11653
+ terminal_parse_failure('[fF]')
11654
+ r4 = nil
11655
+ end
11656
+ s0 << r4
11657
+ if r4
11658
+ if has_terminal?(@regexps[gr = '\A[rR]'] ||= Regexp.new(gr), :regexp, index)
11659
+ r5 = true
11660
+ @index += 1
11661
+ else
11662
+ terminal_parse_failure('[rR]')
11663
+ r5 = nil
11664
+ end
11665
+ s0 << r5
11666
+ if r5
11667
+ if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
11668
+ r6 = true
11258
11669
  @index += 1
11259
11670
  else
11260
- terminal_parse_failure('[A-Za-z0-9]')
11261
- r7 = nil
11262
- end
11263
- if r7
11264
- @index = i6
11671
+ terminal_parse_failure('[eE]')
11265
11672
  r6 = nil
11266
- terminal_parse_failure('[A-Za-z0-9]', true)
11267
- else
11268
- @terminal_failures.pop
11269
- @index = i6
11270
- r6 = instantiate_node(SyntaxNode,input, index...index)
11271
11673
  end
11272
11674
  s0 << r6
11675
+ if r6
11676
+ if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
11677
+ r7 = true
11678
+ @index += 1
11679
+ else
11680
+ terminal_parse_failure('[eE]')
11681
+ r7 = nil
11682
+ end
11683
+ s0 << r7
11684
+ if r7
11685
+ i8 = index
11686
+ if has_terminal?(@regexps[gr = '\A[A-Za-z0-9]'] ||= Regexp.new(gr), :regexp, index)
11687
+ r9 = true
11688
+ @index += 1
11689
+ else
11690
+ terminal_parse_failure('[A-Za-z0-9]')
11691
+ r9 = nil
11692
+ end
11693
+ if r9
11694
+ @index = i8
11695
+ r8 = nil
11696
+ terminal_parse_failure('[A-Za-z0-9]', true)
11697
+ else
11698
+ @terminal_failures.pop
11699
+ @index = i8
11700
+ r8 = instantiate_node(SyntaxNode,input, index...index)
11701
+ end
11702
+ s0 << r8
11703
+ end
11704
+ end
11273
11705
  end
11274
11706
  end
11275
11707
  end
@@ -11277,33 +11709,33 @@ module OracleSqlParser::Grammar
11277
11709
  end
11278
11710
  if s0.last
11279
11711
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
11280
- r0.extend(OuterKeyword0)
11281
- r0.extend(OuterKeyword1)
11712
+ r0.extend(PctfreeKeyword0)
11713
+ r0.extend(PctfreeKeyword1)
11282
11714
  else
11283
11715
  @index = i0
11284
11716
  r0 = nil
11285
11717
  end
11286
11718
 
11287
- node_cache[:outer_keyword][start_index] = r0
11719
+ node_cache[:pctfree_keyword][start_index] = r0
11288
11720
 
11289
11721
  r0
11290
11722
  end
11291
11723
 
11292
- module PctfreeKeyword0
11724
+ module PercentKeyword0
11293
11725
  end
11294
11726
 
11295
- module PctfreeKeyword1
11727
+ module PercentKeyword1
11296
11728
  def ast
11297
11729
  OracleSqlParser::Ast::Keyword.new(:name => text_value)
11298
11730
  end
11299
11731
  end
11300
11732
 
11301
- def _nt_pctfree_keyword
11733
+ def _nt_percent_keyword
11302
11734
  start_index = index
11303
- if node_cache[:pctfree_keyword].has_key?(index)
11304
- cached = node_cache[:pctfree_keyword][index]
11735
+ if node_cache[:percent_keyword].has_key?(index)
11736
+ cached = node_cache[:percent_keyword][index]
11305
11737
  if cached
11306
- node_cache[:pctfree_keyword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
11738
+ node_cache[:percent_keyword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
11307
11739
  @index = cached.interval.end
11308
11740
  end
11309
11741
  return cached
@@ -11319,56 +11751,56 @@ module OracleSqlParser::Grammar
11319
11751
  end
11320
11752
  s0 << r1
11321
11753
  if r1
11322
- if has_terminal?(@regexps[gr = '\A[cC]'] ||= Regexp.new(gr), :regexp, index)
11754
+ if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
11323
11755
  r2 = true
11324
11756
  @index += 1
11325
11757
  else
11326
- terminal_parse_failure('[cC]')
11758
+ terminal_parse_failure('[eE]')
11327
11759
  r2 = nil
11328
11760
  end
11329
11761
  s0 << r2
11330
11762
  if r2
11331
- if has_terminal?(@regexps[gr = '\A[tT]'] ||= Regexp.new(gr), :regexp, index)
11763
+ if has_terminal?(@regexps[gr = '\A[rR]'] ||= Regexp.new(gr), :regexp, index)
11332
11764
  r3 = true
11333
11765
  @index += 1
11334
11766
  else
11335
- terminal_parse_failure('[tT]')
11767
+ terminal_parse_failure('[rR]')
11336
11768
  r3 = nil
11337
11769
  end
11338
11770
  s0 << r3
11339
11771
  if r3
11340
- if has_terminal?(@regexps[gr = '\A[fF]'] ||= Regexp.new(gr), :regexp, index)
11772
+ if has_terminal?(@regexps[gr = '\A[cC]'] ||= Regexp.new(gr), :regexp, index)
11341
11773
  r4 = true
11342
11774
  @index += 1
11343
11775
  else
11344
- terminal_parse_failure('[fF]')
11776
+ terminal_parse_failure('[cC]')
11345
11777
  r4 = nil
11346
11778
  end
11347
11779
  s0 << r4
11348
11780
  if r4
11349
- if has_terminal?(@regexps[gr = '\A[rR]'] ||= Regexp.new(gr), :regexp, index)
11781
+ if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
11350
11782
  r5 = true
11351
11783
  @index += 1
11352
11784
  else
11353
- terminal_parse_failure('[rR]')
11785
+ terminal_parse_failure('[eE]')
11354
11786
  r5 = nil
11355
11787
  end
11356
11788
  s0 << r5
11357
11789
  if r5
11358
- if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
11790
+ if has_terminal?(@regexps[gr = '\A[nN]'] ||= Regexp.new(gr), :regexp, index)
11359
11791
  r6 = true
11360
11792
  @index += 1
11361
11793
  else
11362
- terminal_parse_failure('[eE]')
11794
+ terminal_parse_failure('[nN]')
11363
11795
  r6 = nil
11364
11796
  end
11365
11797
  s0 << r6
11366
11798
  if r6
11367
- if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
11799
+ if has_terminal?(@regexps[gr = '\A[tT]'] ||= Regexp.new(gr), :regexp, index)
11368
11800
  r7 = true
11369
11801
  @index += 1
11370
11802
  else
11371
- terminal_parse_failure('[eE]')
11803
+ terminal_parse_failure('[tT]')
11372
11804
  r7 = nil
11373
11805
  end
11374
11806
  s0 << r7
@@ -11400,14 +11832,14 @@ module OracleSqlParser::Grammar
11400
11832
  end
11401
11833
  if s0.last
11402
11834
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
11403
- r0.extend(PctfreeKeyword0)
11404
- r0.extend(PctfreeKeyword1)
11835
+ r0.extend(PercentKeyword0)
11836
+ r0.extend(PercentKeyword1)
11405
11837
  else
11406
11838
  @index = i0
11407
11839
  r0 = nil
11408
11840
  end
11409
11841
 
11410
- node_cache[:pctfree_keyword][start_index] = r0
11842
+ node_cache[:percent_keyword][start_index] = r0
11411
11843
 
11412
11844
  r0
11413
11845
  end
@@ -15125,6 +15557,99 @@ module OracleSqlParser::Grammar
15125
15557
  r0
15126
15558
  end
15127
15559
 
15560
+ module TiesKeyword0
15561
+ end
15562
+
15563
+ module TiesKeyword1
15564
+ def ast
15565
+ OracleSqlParser::Ast::Keyword.new(:name => text_value)
15566
+ end
15567
+ end
15568
+
15569
+ def _nt_ties_keyword
15570
+ start_index = index
15571
+ if node_cache[:ties_keyword].has_key?(index)
15572
+ cached = node_cache[:ties_keyword][index]
15573
+ if cached
15574
+ node_cache[:ties_keyword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
15575
+ @index = cached.interval.end
15576
+ end
15577
+ return cached
15578
+ end
15579
+
15580
+ i0, s0 = index, []
15581
+ if has_terminal?(@regexps[gr = '\A[tT]'] ||= Regexp.new(gr), :regexp, index)
15582
+ r1 = true
15583
+ @index += 1
15584
+ else
15585
+ terminal_parse_failure('[tT]')
15586
+ r1 = nil
15587
+ end
15588
+ s0 << r1
15589
+ if r1
15590
+ if has_terminal?(@regexps[gr = '\A[iI]'] ||= Regexp.new(gr), :regexp, index)
15591
+ r2 = true
15592
+ @index += 1
15593
+ else
15594
+ terminal_parse_failure('[iI]')
15595
+ r2 = nil
15596
+ end
15597
+ s0 << r2
15598
+ if r2
15599
+ if has_terminal?(@regexps[gr = '\A[eE]'] ||= Regexp.new(gr), :regexp, index)
15600
+ r3 = true
15601
+ @index += 1
15602
+ else
15603
+ terminal_parse_failure('[eE]')
15604
+ r3 = nil
15605
+ end
15606
+ s0 << r3
15607
+ if r3
15608
+ if has_terminal?(@regexps[gr = '\A[sS]'] ||= Regexp.new(gr), :regexp, index)
15609
+ r4 = true
15610
+ @index += 1
15611
+ else
15612
+ terminal_parse_failure('[sS]')
15613
+ r4 = nil
15614
+ end
15615
+ s0 << r4
15616
+ if r4
15617
+ i5 = index
15618
+ if has_terminal?(@regexps[gr = '\A[A-Za-z0-9]'] ||= Regexp.new(gr), :regexp, index)
15619
+ r6 = true
15620
+ @index += 1
15621
+ else
15622
+ terminal_parse_failure('[A-Za-z0-9]')
15623
+ r6 = nil
15624
+ end
15625
+ if r6
15626
+ @index = i5
15627
+ r5 = nil
15628
+ terminal_parse_failure('[A-Za-z0-9]', true)
15629
+ else
15630
+ @terminal_failures.pop
15631
+ @index = i5
15632
+ r5 = instantiate_node(SyntaxNode,input, index...index)
15633
+ end
15634
+ s0 << r5
15635
+ end
15636
+ end
15637
+ end
15638
+ end
15639
+ if s0.last
15640
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
15641
+ r0.extend(TiesKeyword0)
15642
+ r0.extend(TiesKeyword1)
15643
+ else
15644
+ @index = i0
15645
+ r0 = nil
15646
+ end
15647
+
15648
+ node_cache[:ties_keyword][start_index] = r0
15649
+
15650
+ r0
15651
+ end
15652
+
15128
15653
  module TimeKeyword0
15129
15654
  end
15130
15655
 
@@ -17132,6 +17657,99 @@ module OracleSqlParser::Grammar
17132
17657
  r0
17133
17658
  end
17134
17659
 
17660
+ module WithKeyword0
17661
+ end
17662
+
17663
+ module WithKeyword1
17664
+ def ast
17665
+ OracleSqlParser::Ast::Keyword.new(:name => text_value)
17666
+ end
17667
+ end
17668
+
17669
+ def _nt_with_keyword
17670
+ start_index = index
17671
+ if node_cache[:with_keyword].has_key?(index)
17672
+ cached = node_cache[:with_keyword][index]
17673
+ if cached
17674
+ node_cache[:with_keyword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
17675
+ @index = cached.interval.end
17676
+ end
17677
+ return cached
17678
+ end
17679
+
17680
+ i0, s0 = index, []
17681
+ if has_terminal?(@regexps[gr = '\A[wW]'] ||= Regexp.new(gr), :regexp, index)
17682
+ r1 = true
17683
+ @index += 1
17684
+ else
17685
+ terminal_parse_failure('[wW]')
17686
+ r1 = nil
17687
+ end
17688
+ s0 << r1
17689
+ if r1
17690
+ if has_terminal?(@regexps[gr = '\A[iI]'] ||= Regexp.new(gr), :regexp, index)
17691
+ r2 = true
17692
+ @index += 1
17693
+ else
17694
+ terminal_parse_failure('[iI]')
17695
+ r2 = nil
17696
+ end
17697
+ s0 << r2
17698
+ if r2
17699
+ if has_terminal?(@regexps[gr = '\A[tT]'] ||= Regexp.new(gr), :regexp, index)
17700
+ r3 = true
17701
+ @index += 1
17702
+ else
17703
+ terminal_parse_failure('[tT]')
17704
+ r3 = nil
17705
+ end
17706
+ s0 << r3
17707
+ if r3
17708
+ if has_terminal?(@regexps[gr = '\A[hH]'] ||= Regexp.new(gr), :regexp, index)
17709
+ r4 = true
17710
+ @index += 1
17711
+ else
17712
+ terminal_parse_failure('[hH]')
17713
+ r4 = nil
17714
+ end
17715
+ s0 << r4
17716
+ if r4
17717
+ i5 = index
17718
+ if has_terminal?(@regexps[gr = '\A[A-Za-z0-9]'] ||= Regexp.new(gr), :regexp, index)
17719
+ r6 = true
17720
+ @index += 1
17721
+ else
17722
+ terminal_parse_failure('[A-Za-z0-9]')
17723
+ r6 = nil
17724
+ end
17725
+ if r6
17726
+ @index = i5
17727
+ r5 = nil
17728
+ terminal_parse_failure('[A-Za-z0-9]', true)
17729
+ else
17730
+ @terminal_failures.pop
17731
+ @index = i5
17732
+ r5 = instantiate_node(SyntaxNode,input, index...index)
17733
+ end
17734
+ s0 << r5
17735
+ end
17736
+ end
17737
+ end
17738
+ end
17739
+ if s0.last
17740
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
17741
+ r0.extend(WithKeyword0)
17742
+ r0.extend(WithKeyword1)
17743
+ else
17744
+ @index = i0
17745
+ r0 = nil
17746
+ end
17747
+
17748
+ node_cache[:with_keyword][start_index] = r0
17749
+
17750
+ r0
17751
+ end
17752
+
17135
17753
  module YearKeyword0
17136
17754
  end
17137
17755
 
@@ -17318,10 +17936,12 @@ module OracleSqlParser::Grammar
17318
17936
  r0
17319
17937
  end
17320
17938
 
17321
- end
17322
17939
 
17323
- class ReservedWordParser < Treetop::Runtime::CompiledParser
17324
- include ReservedWord
17940
+ class Parser < Treetop::Runtime::CompiledParser
17941
+ include ReservedWord
17942
+ end
17325
17943
  end
17326
17944
 
17945
+ (remove_const(:ReservedWordParser) if const_defined?(:ReservedWordParser)) rescue nil; ReservedWordParser = ReservedWord::Parser
17946
+
17327
17947
  end