Module: OracleSqlParser::Grammar::Expression::Simple

Includes:
Treetop::Runtime
Included in:
OracleSqlParser::Grammar::Expression, SimpleParser
Defined in:
lib/oracle-sql-parser/grammar/expression/simple.rb

Defined Under Namespace

Modules: SimpleExpression0, SimpleExpressionColumn0, SimpleExpressionColumn1, SimpleExpressionColumn2, SimpleExpressionColumn3, SimpleExpressionColumn4

Instance Method Summary collapse

Instance Method Details

#_nt_simple_expressionObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/oracle-sql-parser/grammar/expression/simple.rb', line 18

def _nt_simple_expression
  start_index = index
  if node_cache[:simple_expression].has_key?(index)
    cached = node_cache[:simple_expression][index]
    if cached
      node_cache[:simple_expression][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0 = index
  r1 = _nt_rownum_keyword
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
  else
    r2 = _nt_sysdate_keyword
    if r2
      r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
      r0 = r2
    else
      r3 = _nt_systimestamp_keyword
      if r3
        r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
        r0 = r3
      else
        r4 = _nt_null_keyword
        if r4
          r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
          r0 = r4
        else
          r5 = _nt_text_literal
          if r5
            r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
            r0 = r5
          else
            r6 = _nt_number_literal
            if r6
              r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
              r0 = r6
            else
              r7 = _nt_sequence
              if r7
                r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
                r0 = r7
              else
                r8 = _nt_simple_expression_column
                r8.extend(SimpleExpression0)
                r8.extend(SimpleExpression0)
                if r8
                  r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
                  r0 = r8
                else
                  @index = i0
                  r0 = nil
                end
              end
            end
          end
        end
      end
    end
  end

  node_cache[:simple_expression][start_index] = r0

  r0
end

#_nt_simple_expression_columnObject



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/oracle-sql-parser/grammar/expression/simple.rb', line 121

def _nt_simple_expression_column
  start_index = index
  if node_cache[:simple_expression_column].has_key?(index)
    cached = node_cache[:simple_expression_column][index]
    if cached
      node_cache[:simple_expression_column][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  i0, s0 = index, []
  i1, s1 = index, []
  i3 = index
  i4, s4 = index, []
  r5 = _nt_schema_name
  s4 << r5
  if r5
    r7 = _nt_space
    if r7
      r6 = r7
    else
      r6 = instantiate_node(SyntaxNode,input, index...index)
    end
    s4 << r6
    if r6
      if (match_len = has_terminal?('.', false, index))
        r8 = true
        @index += match_len
      else
        terminal_parse_failure('\'.\'')
        r8 = nil
      end
      s4 << r8
      if r8
        r10 = _nt_space
        if r10
          r9 = r10
        else
          r9 = instantiate_node(SyntaxNode,input, index...index)
        end
        s4 << r9
        if r9
          r11 = _nt_table_name
          s4 << r11
          if r11
            if (match_len = has_terminal?('.', false, index))
              r12 = true
              @index += match_len
            else
              terminal_parse_failure('\'.\'')
              r12 = nil
            end
            s4 << r12
          end
        end
      end
    end
  end
  if s4.last
    r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
    r4.extend(SimpleExpressionColumn0)
  else
    @index = i4
    r4 = nil
  end
  if r4
    r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
    r3 = r4
  else
    i13, s13 = index, []
    r14 = _nt_table_name
    s13 << r14
    if r14
      r16 = _nt_space
      if r16
        r15 = r16
      else
        r15 = instantiate_node(SyntaxNode,input, index...index)
      end
      s13 << r15
      if r15
        if (match_len = has_terminal?('.', false, index))
          r17 = true
          @index += match_len
        else
          terminal_parse_failure('\'.\'')
          r17 = nil
        end
        s13 << r17
        if r17
          r19 = _nt_space
          if r19
            r18 = r19
          else
            r18 = instantiate_node(SyntaxNode,input, index...index)
          end
          s13 << r18
        end
      end
    end
    if s13.last
      r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
      r13.extend(SimpleExpressionColumn1)
    else
      @index = i13
      r13 = nil
    end
    if r13
      r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
      r3 = r13
    else
      @index = i3
      r3 = nil
    end
  end
  if r3
    r2 = r3
  else
    r2 = instantiate_node(SyntaxNode,input, index...index)
  end
  s1 << r2
  if r2
    i20 = index
    r21 = _nt_rowid_keyword
    if r21
      r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
      r20 = r21
    else
      r22 = _nt_column_name
      if r22
        r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
        r20 = r22
      else
        @index = i20
        r20 = nil
      end
    end
    s1 << r20
  end
  if s1.last
    r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
    r1.extend(SimpleExpressionColumn2)
  else
    @index = i1
    r1 = nil
  end
  s0 << r1
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(SimpleExpressionColumn3)
    r0.extend(SimpleExpressionColumn4)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:simple_expression_column][start_index] = r0

  r0
end

#rootObject



8
9
10
# File 'lib/oracle-sql-parser/grammar/expression/simple.rb', line 8

def root
  @root ||= :simple_expression
end