Module: OracleSqlParser::Grammar::Expression::Datetime

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

Defined Under Namespace

Modules: DatetimeExpression0, DatetimeExpression1, DatetimeExpression2, DatetimeExpression3, DatetimeTimezoneClause0, DatetimeTimezoneClause1

Instance Method Summary collapse

Instance Method Details

#_nt_datetime_expressionObject



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
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
144
145
146
147
148
149
150
# File 'lib/oracle-sql-parser/grammar/expression/datetime.rb', line 53

def _nt_datetime_expression
  start_index = index
  if node_cache[:datetime_expression].has_key?(index)
    cached = node_cache[:datetime_expression][index]
    if cached
      node_cache[:datetime_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_not_loop_sql_expression
  s0 << r1
  if r1
    r3 = _nt_space
    if r3
      r2 = r3
    else
      r2 = instantiate_node(SyntaxNode,input, index...index)
    end
    s0 << r2
    if r2
      i4 = index
      i5, s5 = index, []
      r6 = _nt_at_keyword
      s5 << r6
      if r6
        r8 = _nt_space
        if r8
          r7 = r8
        else
          r7 = instantiate_node(SyntaxNode,input, index...index)
        end
        s5 << r7
        if r7
          r9 = _nt_local_keyword
          s5 << r9
        end
      end
      if s5.last
        r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
        r5.extend(DatetimeExpression0)
      else
        @index = i5
        r5 = nil
      end
      if r5
        r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
        r4 = r5
      else
        i10, s10 = index, []
        r11 = _nt_at_keyword
        s10 << r11
        if r11
          r13 = _nt_space
          if r13
            r12 = r13
          else
            r12 = instantiate_node(SyntaxNode,input, index...index)
          end
          s10 << r12
          if r12
            r14 = _nt_datetime_timezone_clause
            s10 << r14
          end
        end
        if s10.last
          r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
          r10.extend(DatetimeExpression1)
        else
          @index = i10
          r10 = nil
        end
        if r10
          r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
          r4 = r10
        else
          @index = i4
          r4 = nil
        end
      end
      s0 << r4
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(DatetimeExpression2)
    r0.extend(DatetimeExpression3)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:datetime_expression][start_index] = r0

  r0
end

#_nt_datetime_timezone_clauseObject



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

def _nt_datetime_timezone_clause
  start_index = index
  if node_cache[:datetime_timezone_clause].has_key?(index)
    cached = node_cache[:datetime_timezone_clause][index]
    if cached
      node_cache[:datetime_timezone_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_time_keyword
  s0 << r1
  if r1
    r3 = _nt_space
    if r3
      r2 = r3
    else
      r2 = instantiate_node(SyntaxNode,input, index...index)
    end
    s0 << r2
    if r2
      r4 = _nt_zone_keyword
      s0 << r4
      if r4
        r6 = _nt_space
        if r6
          r5 = r6
        else
          r5 = instantiate_node(SyntaxNode,input, index...index)
        end
        s0 << r5
        if r5
          i7 = index
          r8 = _nt_text_literal
          if r8
            r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
            r7 = r8
          else
            r9 = _nt_dbtimezone_keyword
            if r9
              r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
              r7 = r9
            else
              r10 = _nt_sessiontimezone_keyword
              if r10
                r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
                r7 = r10
              else
                r11 = _nt_expr
                if r11
                  r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
                  r7 = r11
                else
                  @index = i7
                  r7 = nil
                end
              end
            end
          end
          s0 << r7
        end
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(DatetimeTimezoneClause0)
    r0.extend(DatetimeTimezoneClause1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:datetime_timezone_clause][start_index] = r0

  r0
end

#rootObject



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

def root
  @root ||= :datetime_expression
end