yaparc 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/tests/test_sql.rb CHANGED
@@ -22,6 +22,9 @@ require 'test/unit'
22
22
  ### op := <> | = | < | > | <= | >=
23
23
 
24
24
  module SQL
25
+
26
+ KEYWORDS = %w{NOT AND OR ALL IN select from where EXISTS}
27
+
25
28
  ### query_body := select_expression from_expression where_expression
26
29
  class QueryBody
27
30
  include Yaparc::Parsable
@@ -65,8 +68,9 @@ module SQL
65
68
  Yaparc::Symbol.new(','),
66
69
  TermSequence.new) do |_, terms|
67
70
  terms
68
- end,
69
- []
71
+ end
72
+ # end,
73
+ # []
70
74
  )
71
75
  ) do |term,terms|
72
76
  [term] + terms
@@ -89,9 +93,7 @@ module SQL
89
93
  Yaparc::Symbol.new(','),
90
94
  PathExpression.new) do |_, path|
91
95
  [path]
92
- end,
93
- []
94
- )
96
+ end)
95
97
  ) do |_,path,paths|
96
98
  path + paths
97
99
  end
@@ -112,9 +114,7 @@ module SQL
112
114
  Yaparc::ManyParser.new(
113
115
  PathExpression.new do |path|
114
116
  path
115
- end,
116
- []
117
- )
117
+ end)
118
118
  ) do |_,term, paths|
119
119
  [term] + paths
120
120
  end
@@ -138,9 +138,9 @@ module SQL
138
138
  class Term
139
139
  include Yaparc::Parsable
140
140
 
141
- def initialize
141
+ def initialize#(*keywords)
142
142
  @parser = lambda do
143
- Yaparc::Identifier.new
143
+ Yaparc::Identifier.new(*KEYWORDS)
144
144
  end
145
145
  end
146
146
  end