Module: OracleSqlParser::Grammar::Expression::Function

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

Defined Under Namespace

Modules: FunctionArg0, FunctionArgs0, FunctionArgs1, FunctionArgs2, FunctionExpression0, FunctionExpression1, FunctionName0, FunctionName1

Instance Method Summary collapse

Instance Method Details

#_nt_function_argObject



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/oracle-sql-parser/grammar/expression/function.rb', line 301

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

  r0 = _nt_expr
  r0.extend(FunctionArg0)
  r0.extend(FunctionArg0)

  node_cache[:function_arg][start_index] = r0

  r0
end

#_nt_function_argsObject



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
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/oracle-sql-parser/grammar/expression/function.rb', line 217

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

  i0, s0 = index, []
  r1 = _nt_function_arg
  s0 << r1
  if r1
    s2, i2 = [], index
    loop do
      i3, s3 = index, []
      r5 = _nt_space
      if r5
        r4 = r5
      else
        r4 = instantiate_node(SyntaxNode,input, index...index)
      end
      s3 << r4
      if r4
        if (match_len = has_terminal?(',', false, index))
          r6 = true
          @index += match_len
        else
          terminal_parse_failure('\',\'')
          r6 = nil
        end
        s3 << r6
        if r6
          r8 = _nt_space
          if r8
            r7 = r8
          else
            r7 = instantiate_node(SyntaxNode,input, index...index)
          end
          s3 << r7
          if r7
            r9 = _nt_function_arg
            s3 << r9
          end
        end
      end
      if s3.last
        r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
        r3.extend(FunctionArgs0)
      else
        @index = i3
        r3 = nil
      end
      if r3
        s2 << r3
      else
        break
      end
    end
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    s0 << r2
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(FunctionArgs1)
    r0.extend(FunctionArgs2)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:function_args][start_index] = r0

  r0
end

#_nt_function_expressionObject



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
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
# File 'lib/oracle-sql-parser/grammar/expression/function.rb', line 32

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

  i0, s0 = index, []
  r1 = _nt_function_name
  s0 << r1
  if r1
    r3 = _nt_space
    if r3
      r2 = r3
    else
      r2 = instantiate_node(SyntaxNode,input, index...index)
    end
    s0 << r2
    if r2
      if (match_len = has_terminal?('(', false, index))
        r4 = true
        @index += match_len
      else
        terminal_parse_failure('\'(\'')
        r4 = nil
      end
      s0 << r4
      if r4
        r6 = _nt_space
        if r6
          r5 = r6
        else
          r5 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r5
        if r5
          r8 = _nt_function_args
          if r8
            r7 = r8
          else
            r7 = instantiate_node(SyntaxNode,input, index...index)
          end
          s0 << r7
          if r7
            r10 = _nt_space
            if r10
              r9 = r10
            else
              r9 = instantiate_node(SyntaxNode,input, index...index)
            end
            s0 << r9
            if r9
              if (match_len = has_terminal?(')', false, index))
                r11 = true
                @index += match_len
              else
                terminal_parse_failure('\')\'')
                r11 = nil
              end
              s0 << r11
            end
          end
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(FunctionExpression0)
    r0.extend(FunctionExpression1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:function_expression][start_index] = r0

  r0
end

#_nt_function_nameObject



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
# File 'lib/oracle-sql-parser/grammar/expression/function.rb', line 132

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

  i0 = index
  i1, s1 = index, []
  r2 = _nt_package_name
  s1 << r2
  if r2
    if (match_len = has_terminal?('.', false, index))
      r3 = true
      @index += match_len
    else
      terminal_parse_failure('\'.\'')
      r3 = nil
    end
    s1 << r3
    if r3
      r4 = _nt_procedure_name
      s1 << r4
    end
  end
  if s1.last
    r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
    r1.extend(FunctionName0)
  else
    @index = i1
    r1 = nil
  end
  if r1
    r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
    r0 = r1
    r0.extend(FunctionName1)
    r0.extend(FunctionName1)
  else
    r5 = _nt_procedure_name
    if r5
      r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
      r0 = r5
      r0.extend(FunctionName1)
      r0.extend(FunctionName1)
    else
      @index = i0
      r0 = nil
    end
  end

  node_cache[:function_name][start_index] = r0

  r0
end

#rootObject



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

def root
  @root ||= :function_expression
end