Module: OracleSqlParser::Grammar::Select::RowLimit

Includes:
Treetop::Runtime
Included in:
OracleSqlParser::Grammar::Select, RowLimitParser
Defined in:
lib/oracle-sql-parser/grammar/select/row_limit.rb

Defined Under Namespace

Modules: Fetch0, Fetch1, Fetch2, Fetch3, Fetch4, Fetch5, Offset0, Offset1, RowLimitingClause0, RowLimitingClause1

Instance Method Summary collapse

Instance Method Details

#_nt_fetchObject



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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/oracle-sql-parser/grammar/select/row_limit.rb', line 235

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

  i0, s0 = index, []
  r1 = _nt_fetch_keyword
  s0 << r1
  if r1
    r2 = _nt_space
    s0 << r2
    if r2
      i3 = index
      r4 = _nt_first_keyword
      if r4
        r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
        r3 = r4
      else
        r5 = _nt_next_keyword
        if r5
          r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
          r3 = r5
        else
          @index = i3
          r3 = nil
        end
      end
      s0 << r3
      if r3
        r6 = _nt_space
        s0 << r6
        if r6
          i7 = index
          i8, s8 = index, []
          r9 = _nt_integer
          s8 << r9
          if s8.last
            r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
            r8.extend(Fetch0)
          else
            @index = i8
            r8 = nil
          end
          if r8
            r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
            r7 = r8
          else
            i10, s10 = index, []
            r11 = _nt_integer
            s10 << r11
            if r11
              r12 = _nt_percentage_keyword
              s10 << r12
            end
            if s10.last
              r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
              r10.extend(Fetch1)
            else
              @index = i10
              r10 = nil
            end
            if r10
              r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
              r7 = r10
            else
              @index = i7
              r7 = nil
            end
          end
          s0 << r7
          if r7
            r13 = _nt_space
            s0 << r13
            if r13
              i14 = index
              r15 = _nt_row_keyword
              if r15
                r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
                r14 = r15
              else
                r16 = _nt_rows_keyword
                if r16
                  r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
                  r14 = r16
                else
                  @index = i14
                  r14 = nil
                end
              end
              s0 << r14
              if r14
                r17 = _nt_space
                s0 << r17
                if r17
                  i18 = index
                  i19, s19 = index, []
                  r20 = _nt_only_keyword
                  s19 << r20
                  if s19.last
                    r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
                    r19.extend(Fetch2)
                  else
                    @index = i19
                    r19 = nil
                  end
                  if r19
                    r19 = SyntaxNode.new(input, (index-1)...index) if r19 == true
                    r18 = r19
                  else
                    i21, s21 = index, []
                    r22 = _nt_with_keyword
                    s21 << r22
                    if r22
                      r23 = _nt_space
                      s21 << r23
                      if r23
                        r24 = _nt_ties_keyword
                        s21 << r24
                      end
                    end
                    if s21.last
                      r21 = instantiate_node(SyntaxNode,input, i21...index, s21)
                      r21.extend(Fetch3)
                    else
                      @index = i21
                      r21 = nil
                    end
                    if r21
                      r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
                      r18 = r21
                    else
                      @index = i18
                      r18 = nil
                    end
                  end
                  s0 << r18
                end
              end
            end
          end
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(Fetch4)
    r0.extend(Fetch5)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:fetch][start_index] = r0

  r0
end

#_nt_offsetObject



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/oracle-sql-parser/grammar/select/row_limit.rb', line 87

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

  i0, s0 = index, []
  r1 = _nt_offset_keyword
  s0 << r1
  if r1
    r2 = _nt_space
    s0 << r2
    if r2
      r3 = _nt_number_literal
      s0 << r3
      if r3
        r4 = _nt_space
        s0 << r4
        if r4
          i5 = index
          r6 = _nt_row_keyword
          if r6
            r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
            r5 = r6
          else
            r7 = _nt_rows_keyword
            if r7
              r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
              r5 = r7
            else
              @index = i5
              r5 = nil
            end
          end
          s0 << r5
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(Offset0)
    r0.extend(Offset1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:offset][start_index] = r0

  r0
end

#_nt_row_limiting_clauseObject



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
# File 'lib/oracle-sql-parser/grammar/select/row_limit.rb', line 26

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

  i0, s0 = index, []
  r1 = _nt_fetch
  s0 << r1
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(RowLimitingClause0)
    r0.extend(RowLimitingClause1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:row_limiting_clause][start_index] = r0

  r0
end

#rootObject



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

def root
  @root ||= :row_limiting_clause
end