lib/timing/natural_time_language.rb in timing-0.0.4 vs lib/timing/natural_time_language.rb in timing-0.0.5
- old
+ new
@@ -23,11 +23,11 @@
def _nt_expression
start_index = index
if node_cache[:expression].has_key?(index)
cached = node_cache[:expression][index]
if cached
- node_cache[:expression][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
@@ -98,40 +98,35 @@
def _nt_moment
start_index = index
if node_cache[:moment].has_key?(index)
cached = node_cache[:moment][index]
if cached
- node_cache[:moment][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_timestamp
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_time_ago
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
r3 = _nt_moment_at_time
if r3
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
r0 = r3
else
r4 = _nt_before_from_moment
if r4
- r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
r0 = r4
else
r5 = _nt_date_moment
if r5
- r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
r0 = r5
else
@index = i0
r0 = nil
end
@@ -148,40 +143,35 @@
def _nt_date_moment
start_index = index
if node_cache[:date_moment].has_key?(index)
cached = node_cache[:date_moment][index]
if cached
- node_cache[:date_moment][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_named_moment
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_last_next_day_name
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
r3 = _nt_day_month_name_year
if r3
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
r0 = r3
else
r4 = _nt_year_month_day
if r4
- r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
r0 = r4
else
r5 = _nt_beginning_end_interval
if r5
- r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
r0 = r5
else
@index = i0
r0 = nil
end
@@ -198,35 +188,31 @@
def _nt_named_moment
start_index = index
if node_cache[:named_moment].has_key?(index)
cached = node_cache[:named_moment][index]
if cached
- node_cache[:named_moment][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_now
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_today
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
r3 = _nt_tomorrow
if r3
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
r0 = r3
else
r4 = _nt_yesterday
if r4
- r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
r0 = r4
else
@index = i0
r0 = nil
end
@@ -252,11 +238,11 @@
def _nt_last_next_day_name
start_index = index
if node_cache[:last_next_day_name].has_key?(index)
cached = node_cache[:last_next_day_name][index]
if cached
- node_cache[:last_next_day_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
@@ -311,11 +297,11 @@
def _nt_day_month_name_year
start_index = index
if node_cache[:day_month_name_year].has_key?(index)
cached = node_cache[:day_month_name_year][index]
if cached
- node_cache[:day_month_name_year][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
@@ -404,37 +390,37 @@
def _nt_year_month_day
start_index = index
if node_cache[:year_month_day].has_key?(index)
cached = node_cache[:year_month_day][index]
if cached
- node_cache[:year_month_day][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
r1 = _nt_integer
s0 << r1
if r1
- if (match_len = has_terminal?('-', false, index))
- r2 = true
- @index += match_len
+ if has_terminal?('-', false, index)
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'-\'')
+ terminal_parse_failure('-')
r2 = nil
end
s0 << r2
if r2
r3 = _nt_integer
s0 << r3
if r3
- if (match_len = has_terminal?('-', false, index))
- r4 = true
- @index += match_len
+ if has_terminal?('-', false, index)
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'-\'')
+ terminal_parse_failure('-')
r4 = nil
end
s0 << r4
if r4
r5 = _nt_integer
@@ -469,11 +455,11 @@
def _nt_beginning_end_interval
start_index = index
if node_cache[:beginning_end_interval].has_key?(index)
cached = node_cache[:beginning_end_interval][index]
if cached
- node_cache[:beginning_end_interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
@@ -524,11 +510,11 @@
def _nt_time_ago
start_index = index
if node_cache[:time_ago].has_key?(index)
cached = node_cache[:time_ago][index]
if cached
- node_cache[:time_ago][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
@@ -561,15 +547,15 @@
end
end
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
s0 << r5
if r5
- if (match_len = has_terminal?('ago', :insens, index))
- r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('ago', false, index)
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'ago\'')
+ terminal_parse_failure('ago')
r7 = nil
end
s0 << r7
end
end
@@ -601,11 +587,11 @@
def _nt_moment_at_time
start_index = index
if node_cache[:moment_at_time].has_key?(index)
cached = node_cache[:moment_at_time][index]
if cached
- node_cache[:moment_at_time][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
@@ -623,15 +609,15 @@
end
end
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
s0 << r2
if r2
- if (match_len = has_terminal?('at', :insens, index))
- r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('at', false, index)
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
else
- terminal_parse_failure('\'at\'')
+ terminal_parse_failure('at')
r4 = nil
end
s0 << r4
if r4
s5, i5 = [], index
@@ -686,11 +672,11 @@
def _nt_before_from_moment
start_index = index
if node_cache[:before_from_moment].has_key?(index)
cached = node_cache[:before_from_moment][index]
if cached
- node_cache[:before_from_moment][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
@@ -767,24 +753,23 @@
def _nt_timestamp
start_index = index
if node_cache[:timestamp].has_key?(index)
cached = node_cache[:timestamp][index]
if cached
- node_cache[:timestamp][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
s1, i1 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r2 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r2 = nil
end
if r2
s1 << r2
else
@@ -796,33 +781,29 @@
end
if s1.size < 4
@index = i1
r1 = nil
else
- if s1.size < 4
- terminal_failures.pop
- end
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
end
s0 << r1
if r1
- if (match_len = has_terminal?('-', false, index))
- r3 = true
- @index += match_len
+ if has_terminal?('-', false, index)
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'-\'')
+ terminal_parse_failure('-')
r3 = nil
end
s0 << r3
if r3
s4, i4 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r5 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r5 = nil
end
if r5
s4 << r5
else
@@ -834,33 +815,29 @@
end
if s4.size < 2
@index = i4
r4 = nil
else
- if s4.size < 2
- terminal_failures.pop
- end
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
end
s0 << r4
if r4
- if (match_len = has_terminal?('-', false, index))
- r6 = true
- @index += match_len
+ if has_terminal?('-', false, index)
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'-\'')
+ terminal_parse_failure('-')
r6 = nil
end
s0 << r6
if r6
s7, i7 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r8 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r8 = nil
end
if r8
s7 << r8
else
@@ -872,13 +849,10 @@
end
if s7.size < 2
@index = i7
r7 = nil
else
- if s7.size < 2
- terminal_failures.pop
- end
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
end
s0 << r7
if r7
s9, i9 = [], index
@@ -891,15 +865,15 @@
end
end
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
s0 << r9
if r9
- if (match_len = has_terminal?('T', false, index))
- r12 = true
- @index += match_len
+ if has_terminal?('t', false, index)
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'T\'')
+ terminal_parse_failure('t')
r12 = nil
end
if r12
r11 = r12
else
@@ -919,15 +893,14 @@
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
s0 << r13
if r13
s15, i15 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r16 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r16 = nil
end
if r16
s15 << r16
else
@@ -939,33 +912,29 @@
end
if s15.size < 2
@index = i15
r15 = nil
else
- if s15.size < 2
- terminal_failures.pop
- end
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
end
s0 << r15
if r15
- if (match_len = has_terminal?(':', false, index))
- r17 = true
- @index += match_len
+ if has_terminal?(':', false, index)
+ r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\':\'')
+ terminal_parse_failure(':')
r17 = nil
end
s0 << r17
if r17
s18, i18 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r19 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r19 = nil
end
if r19
s18 << r19
else
@@ -977,33 +946,29 @@
end
if s18.size < 2
@index = i18
r18 = nil
else
- if s18.size < 2
- terminal_failures.pop
- end
r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
end
s0 << r18
if r18
- if (match_len = has_terminal?(':', false, index))
- r20 = true
- @index += match_len
+ if has_terminal?(':', false, index)
+ r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\':\'')
+ terminal_parse_failure(':')
r20 = nil
end
s0 << r20
if r20
s21, i21 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r22 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r22 = nil
end
if r22
s21 << r22
else
@@ -1015,13 +980,10 @@
end
if s21.size < 2
@index = i21
r21 = nil
else
- if s21.size < 2
- terminal_failures.pop
- end
r21 = instantiate_node(SyntaxNode,input, i21...index, s21)
end
s0 << r21
end
end
@@ -1051,21 +1013,21 @@
def _nt_now
start_index = index
if node_cache[:now].has_key?(index)
cached = node_cache[:now][index]
if cached
- node_cache[:now][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
- if (match_len = has_terminal?('now', :insens, index))
- r0 = instantiate_node(Now,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('now', false, index)
+ r0 = instantiate_node(Now,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'now\'')
+ terminal_parse_failure('now')
r0 = nil
end
node_cache[:now][start_index] = r0
@@ -1075,21 +1037,21 @@
def _nt_today
start_index = index
if node_cache[:today].has_key?(index)
cached = node_cache[:today][index]
if cached
- node_cache[:today][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
- if (match_len = has_terminal?('today', :insens, index))
- r0 = instantiate_node(Today,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('today', false, index)
+ r0 = instantiate_node(Today,input, index...(index + 5))
+ @index += 5
else
- terminal_parse_failure('\'today\'')
+ terminal_parse_failure('today')
r0 = nil
end
node_cache[:today][start_index] = r0
@@ -1099,21 +1061,21 @@
def _nt_tomorrow
start_index = index
if node_cache[:tomorrow].has_key?(index)
cached = node_cache[:tomorrow][index]
if cached
- node_cache[:tomorrow][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
- if (match_len = has_terminal?('tomorrow', :insens, index))
- r0 = instantiate_node(Tomorrow,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('tomorrow', false, index)
+ r0 = instantiate_node(Tomorrow,input, index...(index + 8))
+ @index += 8
else
- terminal_parse_failure('\'tomorrow\'')
+ terminal_parse_failure('tomorrow')
r0 = nil
end
node_cache[:tomorrow][start_index] = r0
@@ -1123,21 +1085,21 @@
def _nt_yesterday
start_index = index
if node_cache[:yesterday].has_key?(index)
cached = node_cache[:yesterday][index]
if cached
- node_cache[:yesterday][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
- if (match_len = has_terminal?('yesterday', :insens, index))
- r0 = instantiate_node(Yesterday,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('yesterday', false, index)
+ r0 = instantiate_node(Yesterday,input, index...(index + 9))
+ @index += 9
else
- terminal_parse_failure('\'yesterday\'')
+ terminal_parse_failure('yesterday')
r0 = nil
end
node_cache[:yesterday][start_index] = r0
@@ -1147,25 +1109,23 @@
def _nt_last_next
start_index = index
if node_cache[:last_next].has_key?(index)
cached = node_cache[:last_next][index]
if cached
- node_cache[:last_next][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_last
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_next
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
@index = i0
r0 = nil
end
@@ -1179,21 +1139,21 @@
def _nt_last
start_index = index
if node_cache[:last].has_key?(index)
cached = node_cache[:last][index]
if cached
- node_cache[:last][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
- if (match_len = has_terminal?('last', :insens, index))
- r0 = instantiate_node(LastNext,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('last', false, index)
+ r0 = instantiate_node(LastNext,input, index...(index + 4))
+ @index += 4
else
- terminal_parse_failure('\'last\'')
+ terminal_parse_failure('last')
r0 = nil
end
node_cache[:last][start_index] = r0
@@ -1203,21 +1163,21 @@
def _nt_next
start_index = index
if node_cache[:next].has_key?(index)
cached = node_cache[:next][index]
if cached
- node_cache[:next][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
- if (match_len = has_terminal?('next', :insens, index))
- r0 = instantiate_node(LastNext,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('next', false, index)
+ r0 = instantiate_node(LastNext,input, index...(index + 4))
+ @index += 4
else
- terminal_parse_failure('\'next\'')
+ terminal_parse_failure('next')
r0 = nil
end
node_cache[:next][start_index] = r0
@@ -1227,25 +1187,23 @@
def _nt_beginning_end
start_index = index
if node_cache[:beginning_end].has_key?(index)
cached = node_cache[:beginning_end][index]
if cached
- node_cache[:beginning_end][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_beginning_of
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_end_of
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
@index = i0
r0 = nil
end
@@ -1266,22 +1224,22 @@
def _nt_beginning_of
start_index = index
if node_cache[:beginning_of].has_key?(index)
cached = node_cache[:beginning_of][index]
if cached
- node_cache[:beginning_of][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if (match_len = has_terminal?('beginning', :insens, index))
- r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('beginning', false, index)
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 9))
+ @index += 9
else
- terminal_parse_failure('\'beginning\'')
+ terminal_parse_failure('beginning')
r1 = nil
end
s0 << r1
if r1
s2, i2 = [], index
@@ -1294,15 +1252,15 @@
end
end
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
s0 << r2
if r2
- if (match_len = has_terminal?('of', :insens, index))
- r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('of', false, index)
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
else
- terminal_parse_failure('\'of\'')
+ terminal_parse_failure('of')
r4 = nil
end
s0 << r4
end
end
@@ -1329,22 +1287,22 @@
def _nt_end_of
start_index = index
if node_cache[:end_of].has_key?(index)
cached = node_cache[:end_of][index]
if cached
- node_cache[:end_of][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if (match_len = has_terminal?('end', :insens, index))
- r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('end', false, index)
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'end\'')
+ terminal_parse_failure('end')
r1 = nil
end
s0 << r1
if r1
s2, i2 = [], index
@@ -1357,15 +1315,15 @@
end
end
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
s0 << r2
if r2
- if (match_len = has_terminal?('of', :insens, index))
- r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('of', false, index)
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
else
- terminal_parse_failure('\'of\'')
+ terminal_parse_failure('of')
r4 = nil
end
s0 << r4
end
end
@@ -1385,25 +1343,23 @@
def _nt_before_from
start_index = index
if node_cache[:before_from].has_key?(index)
cached = node_cache[:before_from][index]
if cached
- node_cache[:before_from][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_before
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_from
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
@index = i0
r0 = nil
end
@@ -1417,21 +1373,21 @@
def _nt_before
start_index = index
if node_cache[:before].has_key?(index)
cached = node_cache[:before][index]
if cached
- node_cache[:before][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
- if (match_len = has_terminal?('before', :insens, index))
- r0 = instantiate_node(BeforeFrom,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('before', false, index)
+ r0 = instantiate_node(BeforeFrom,input, index...(index + 6))
+ @index += 6
else
- terminal_parse_failure('\'before\'')
+ terminal_parse_failure('before')
r0 = nil
end
node_cache[:before][start_index] = r0
@@ -1441,21 +1397,21 @@
def _nt_from
start_index = index
if node_cache[:from].has_key?(index)
cached = node_cache[:from][index]
if cached
- node_cache[:from][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
- if (match_len = has_terminal?('from', :insens, index))
- r0 = instantiate_node(BeforeFrom,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('from', false, index)
+ r0 = instantiate_node(BeforeFrom,input, index...(index + 4))
+ @index += 4
else
- terminal_parse_failure('\'from\'')
+ terminal_parse_failure('from')
r0 = nil
end
node_cache[:from][start_index] = r0
@@ -1465,50 +1421,43 @@
def _nt_interval
start_index = index
if node_cache[:interval].has_key?(index)
cached = node_cache[:interval][index]
if cached
- node_cache[:interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_second_interval
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_minute_interval
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
r3 = _nt_hour_interval
if r3
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
r0 = r3
else
r4 = _nt_day_interval
if r4
- r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
r0 = r4
else
r5 = _nt_week_interval
if r5
- r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
r0 = r5
else
r6 = _nt_month_interval
if r6
- r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
r0 = r6
else
r7 = _nt_year_interval
if r7
- r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
r0 = r7
else
@index = i0
r0 = nil
end
@@ -1530,31 +1479,31 @@
def _nt_second_interval
start_index = index
if node_cache[:second_interval].has_key?(index)
cached = node_cache[:second_interval][index]
if cached
- node_cache[:second_interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if (match_len = has_terminal?('second', :insens, index))
- r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('second', false, index)
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
+ @index += 6
else
- terminal_parse_failure('\'second\'')
+ terminal_parse_failure('second')
r1 = nil
end
s0 << r1
if r1
- if (match_len = has_terminal?('s', :insens, index))
- r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('s', false, index)
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'s\'')
+ terminal_parse_failure('s')
r3 = nil
end
if r3
r2 = r3
else
@@ -1581,31 +1530,31 @@
def _nt_minute_interval
start_index = index
if node_cache[:minute_interval].has_key?(index)
cached = node_cache[:minute_interval][index]
if cached
- node_cache[:minute_interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if (match_len = has_terminal?('minute', :insens, index))
- r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('minute', false, index)
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
+ @index += 6
else
- terminal_parse_failure('\'minute\'')
+ terminal_parse_failure('minute')
r1 = nil
end
s0 << r1
if r1
- if (match_len = has_terminal?('s', :insens, index))
- r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('s', false, index)
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'s\'')
+ terminal_parse_failure('s')
r3 = nil
end
if r3
r2 = r3
else
@@ -1632,31 +1581,31 @@
def _nt_hour_interval
start_index = index
if node_cache[:hour_interval].has_key?(index)
cached = node_cache[:hour_interval][index]
if cached
- node_cache[:hour_interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if (match_len = has_terminal?('hour', :insens, index))
- r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('hour', false, index)
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
else
- terminal_parse_failure('\'hour\'')
+ terminal_parse_failure('hour')
r1 = nil
end
s0 << r1
if r1
- if (match_len = has_terminal?('s', :insens, index))
- r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('s', false, index)
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'s\'')
+ terminal_parse_failure('s')
r3 = nil
end
if r3
r2 = r3
else
@@ -1683,31 +1632,31 @@
def _nt_day_interval
start_index = index
if node_cache[:day_interval].has_key?(index)
cached = node_cache[:day_interval][index]
if cached
- node_cache[:day_interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if (match_len = has_terminal?('day', :insens, index))
- r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('day', false, index)
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'day\'')
+ terminal_parse_failure('day')
r1 = nil
end
s0 << r1
if r1
- if (match_len = has_terminal?('s', :insens, index))
- r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('s', false, index)
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'s\'')
+ terminal_parse_failure('s')
r3 = nil
end
if r3
r2 = r3
else
@@ -1734,31 +1683,31 @@
def _nt_week_interval
start_index = index
if node_cache[:week_interval].has_key?(index)
cached = node_cache[:week_interval][index]
if cached
- node_cache[:week_interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if (match_len = has_terminal?('week', :insens, index))
- r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('week', false, index)
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
else
- terminal_parse_failure('\'week\'')
+ terminal_parse_failure('week')
r1 = nil
end
s0 << r1
if r1
- if (match_len = has_terminal?('s', :insens, index))
- r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('s', false, index)
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'s\'')
+ terminal_parse_failure('s')
r3 = nil
end
if r3
r2 = r3
else
@@ -1785,31 +1734,31 @@
def _nt_month_interval
start_index = index
if node_cache[:month_interval].has_key?(index)
cached = node_cache[:month_interval][index]
if cached
- node_cache[:month_interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if (match_len = has_terminal?('month', :insens, index))
- r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('month', false, index)
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
+ @index += 5
else
- terminal_parse_failure('\'month\'')
+ terminal_parse_failure('month')
r1 = nil
end
s0 << r1
if r1
- if (match_len = has_terminal?('s', :insens, index))
- r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('s', false, index)
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'s\'')
+ terminal_parse_failure('s')
r3 = nil
end
if r3
r2 = r3
else
@@ -1836,31 +1785,31 @@
def _nt_year_interval
start_index = index
if node_cache[:year_interval].has_key?(index)
cached = node_cache[:year_interval][index]
if cached
- node_cache[:year_interval][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if (match_len = has_terminal?('year', :insens, index))
- r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('year', false, index)
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
else
- terminal_parse_failure('\'year\'')
+ terminal_parse_failure('year')
r1 = nil
end
s0 << r1
if r1
- if (match_len = has_terminal?('s', :insens, index))
- r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('s', false, index)
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\'s\'')
+ terminal_parse_failure('s')
r3 = nil
end
if r3
r2 = r3
else
@@ -1884,25 +1833,23 @@
def _nt_day_name
start_index = index
if node_cache[:day_name].has_key?(index)
cached = node_cache[:day_name][index]
if cached
- node_cache[:day_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_long_day_name
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_short_day_name
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
@index = i0
r0 = nil
end
@@ -1916,92 +1863,85 @@
def _nt_long_day_name
start_index = index
if node_cache[:long_day_name].has_key?(index)
cached = node_cache[:long_day_name][index]
if cached
- node_cache[:long_day_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
- if (match_len = has_terminal?('sunday', :insens, index))
- r1 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('sunday', false, index)
+ r1 = instantiate_node(DayName,input, index...(index + 6))
+ @index += 6
else
- terminal_parse_failure('\'sunday\'')
+ terminal_parse_failure('sunday')
r1 = nil
end
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
- if (match_len = has_terminal?('monday', :insens, index))
- r2 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('monday', false, index)
+ r2 = instantiate_node(DayName,input, index...(index + 6))
+ @index += 6
else
- terminal_parse_failure('\'monday\'')
+ terminal_parse_failure('monday')
r2 = nil
end
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
- if (match_len = has_terminal?('tuesday', :insens, index))
- r3 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('tuesday', false, index)
+ r3 = instantiate_node(DayName,input, index...(index + 7))
+ @index += 7
else
- terminal_parse_failure('\'tuesday\'')
+ terminal_parse_failure('tuesday')
r3 = nil
end
if r3
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
r0 = r3
else
- if (match_len = has_terminal?('wednesday', :insens, index))
- r4 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('wednesday', false, index)
+ r4 = instantiate_node(DayName,input, index...(index + 9))
+ @index += 9
else
- terminal_parse_failure('\'wednesday\'')
+ terminal_parse_failure('wednesday')
r4 = nil
end
if r4
- r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
r0 = r4
else
- if (match_len = has_terminal?('thursday', :insens, index))
- r5 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('thursday', false, index)
+ r5 = instantiate_node(DayName,input, index...(index + 8))
+ @index += 8
else
- terminal_parse_failure('\'thursday\'')
+ terminal_parse_failure('thursday')
r5 = nil
end
if r5
- r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
r0 = r5
else
- if (match_len = has_terminal?('friday', :insens, index))
- r6 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('friday', false, index)
+ r6 = instantiate_node(DayName,input, index...(index + 6))
+ @index += 6
else
- terminal_parse_failure('\'friday\'')
+ terminal_parse_failure('friday')
r6 = nil
end
if r6
- r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
r0 = r6
else
- if (match_len = has_terminal?('saturday', :insens, index))
- r7 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('saturday', false, index)
+ r7 = instantiate_node(DayName,input, index...(index + 8))
+ @index += 8
else
- terminal_parse_failure('\'saturday\'')
+ terminal_parse_failure('saturday')
r7 = nil
end
if r7
- r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
r0 = r7
else
@index = i0
r0 = nil
end
@@ -2020,92 +1960,85 @@
def _nt_short_day_name
start_index = index
if node_cache[:short_day_name].has_key?(index)
cached = node_cache[:short_day_name][index]
if cached
- node_cache[:short_day_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
- if (match_len = has_terminal?('sun', :insens, index))
- r1 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('sun', false, index)
+ r1 = instantiate_node(DayName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'sun\'')
+ terminal_parse_failure('sun')
r1 = nil
end
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
- if (match_len = has_terminal?('mon', :insens, index))
- r2 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('mon', false, index)
+ r2 = instantiate_node(DayName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'mon\'')
+ terminal_parse_failure('mon')
r2 = nil
end
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
- if (match_len = has_terminal?('tue', :insens, index))
- r3 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('tue', false, index)
+ r3 = instantiate_node(DayName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'tue\'')
+ terminal_parse_failure('tue')
r3 = nil
end
if r3
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
r0 = r3
else
- if (match_len = has_terminal?('wed', :insens, index))
- r4 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('wed', false, index)
+ r4 = instantiate_node(DayName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'wed\'')
+ terminal_parse_failure('wed')
r4 = nil
end
if r4
- r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
r0 = r4
else
- if (match_len = has_terminal?('thu', :insens, index))
- r5 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('thu', false, index)
+ r5 = instantiate_node(DayName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'thu\'')
+ terminal_parse_failure('thu')
r5 = nil
end
if r5
- r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
r0 = r5
else
- if (match_len = has_terminal?('fri', :insens, index))
- r6 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('fri', false, index)
+ r6 = instantiate_node(DayName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'fri\'')
+ terminal_parse_failure('fri')
r6 = nil
end
if r6
- r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
r0 = r6
else
- if (match_len = has_terminal?('sat', :insens, index))
- r7 = instantiate_node(DayName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('sat', false, index)
+ r7 = instantiate_node(DayName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'sat\'')
+ terminal_parse_failure('sat')
r7 = nil
end
if r7
- r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
r0 = r7
else
@index = i0
r0 = nil
end
@@ -2124,25 +2057,23 @@
def _nt_month_name
start_index = index
if node_cache[:month_name].has_key?(index)
cached = node_cache[:month_name][index]
if cached
- node_cache[:month_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_long_month_name
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_short_month_name
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
@index = i0
r0 = nil
end
@@ -2156,147 +2087,135 @@
def _nt_long_month_name
start_index = index
if node_cache[:long_month_name].has_key?(index)
cached = node_cache[:long_month_name][index]
if cached
- node_cache[:long_month_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
- if (match_len = has_terminal?('january', :insens, index))
- r1 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('january', false, index)
+ r1 = instantiate_node(MonthName,input, index...(index + 7))
+ @index += 7
else
- terminal_parse_failure('\'january\'')
+ terminal_parse_failure('january')
r1 = nil
end
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
- if (match_len = has_terminal?('february', :insens, index))
- r2 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('february', false, index)
+ r2 = instantiate_node(MonthName,input, index...(index + 8))
+ @index += 8
else
- terminal_parse_failure('\'february\'')
+ terminal_parse_failure('february')
r2 = nil
end
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
- if (match_len = has_terminal?('march', :insens, index))
- r3 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('march', false, index)
+ r3 = instantiate_node(MonthName,input, index...(index + 5))
+ @index += 5
else
- terminal_parse_failure('\'march\'')
+ terminal_parse_failure('march')
r3 = nil
end
if r3
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
r0 = r3
else
- if (match_len = has_terminal?('april', :insens, index))
- r4 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('april', false, index)
+ r4 = instantiate_node(MonthName,input, index...(index + 5))
+ @index += 5
else
- terminal_parse_failure('\'april\'')
+ terminal_parse_failure('april')
r4 = nil
end
if r4
- r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
r0 = r4
else
- if (match_len = has_terminal?('may', :insens, index))
- r5 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('may', false, index)
+ r5 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'may\'')
+ terminal_parse_failure('may')
r5 = nil
end
if r5
- r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
r0 = r5
else
- if (match_len = has_terminal?('june', :insens, index))
- r6 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('june', false, index)
+ r6 = instantiate_node(MonthName,input, index...(index + 4))
+ @index += 4
else
- terminal_parse_failure('\'june\'')
+ terminal_parse_failure('june')
r6 = nil
end
if r6
- r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
r0 = r6
else
- if (match_len = has_terminal?('july', :insens, index))
- r7 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('july', false, index)
+ r7 = instantiate_node(MonthName,input, index...(index + 4))
+ @index += 4
else
- terminal_parse_failure('\'july\'')
+ terminal_parse_failure('july')
r7 = nil
end
if r7
- r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
r0 = r7
else
- if (match_len = has_terminal?('august', :insens, index))
- r8 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('august', false, index)
+ r8 = instantiate_node(MonthName,input, index...(index + 6))
+ @index += 6
else
- terminal_parse_failure('\'august\'')
+ terminal_parse_failure('august')
r8 = nil
end
if r8
- r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
r0 = r8
else
- if (match_len = has_terminal?('september', :insens, index))
- r9 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('september', false, index)
+ r9 = instantiate_node(MonthName,input, index...(index + 9))
+ @index += 9
else
- terminal_parse_failure('\'september\'')
+ terminal_parse_failure('september')
r9 = nil
end
if r9
- r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
r0 = r9
else
- if (match_len = has_terminal?('october', :insens, index))
- r10 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('october', false, index)
+ r10 = instantiate_node(MonthName,input, index...(index + 7))
+ @index += 7
else
- terminal_parse_failure('\'october\'')
+ terminal_parse_failure('october')
r10 = nil
end
if r10
- r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
r0 = r10
else
- if (match_len = has_terminal?('november', :insens, index))
- r11 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('november', false, index)
+ r11 = instantiate_node(MonthName,input, index...(index + 8))
+ @index += 8
else
- terminal_parse_failure('\'november\'')
+ terminal_parse_failure('november')
r11 = nil
end
if r11
- r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
r0 = r11
else
- if (match_len = has_terminal?('december', :insens, index))
- r12 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('december', false, index)
+ r12 = instantiate_node(MonthName,input, index...(index + 8))
+ @index += 8
else
- terminal_parse_failure('\'december\'')
+ terminal_parse_failure('december')
r12 = nil
end
if r12
- r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
r0 = r12
else
@index = i0
r0 = nil
end
@@ -2320,147 +2239,135 @@
def _nt_short_month_name
start_index = index
if node_cache[:short_month_name].has_key?(index)
cached = node_cache[:short_month_name][index]
if cached
- node_cache[:short_month_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
- if (match_len = has_terminal?('jan', :insens, index))
- r1 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('jan', false, index)
+ r1 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'jan\'')
+ terminal_parse_failure('jan')
r1 = nil
end
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
- if (match_len = has_terminal?('feb', :insens, index))
- r2 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('feb', false, index)
+ r2 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'feb\'')
+ terminal_parse_failure('feb')
r2 = nil
end
if r2
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
- if (match_len = has_terminal?('mar', :insens, index))
- r3 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('mar', false, index)
+ r3 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'mar\'')
+ terminal_parse_failure('mar')
r3 = nil
end
if r3
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
r0 = r3
else
- if (match_len = has_terminal?('apr', :insens, index))
- r4 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('apr', false, index)
+ r4 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'apr\'')
+ terminal_parse_failure('apr')
r4 = nil
end
if r4
- r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
r0 = r4
else
- if (match_len = has_terminal?('may', :insens, index))
- r5 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('may', false, index)
+ r5 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'may\'')
+ terminal_parse_failure('may')
r5 = nil
end
if r5
- r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
r0 = r5
else
- if (match_len = has_terminal?('jun', :insens, index))
- r6 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('jun', false, index)
+ r6 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'jun\'')
+ terminal_parse_failure('jun')
r6 = nil
end
if r6
- r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
r0 = r6
else
- if (match_len = has_terminal?('jul', :insens, index))
- r7 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('jul', false, index)
+ r7 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'jul\'')
+ terminal_parse_failure('jul')
r7 = nil
end
if r7
- r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
r0 = r7
else
- if (match_len = has_terminal?('aug', :insens, index))
- r8 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('aug', false, index)
+ r8 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'aug\'')
+ terminal_parse_failure('aug')
r8 = nil
end
if r8
- r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
r0 = r8
else
- if (match_len = has_terminal?('sep', :insens, index))
- r9 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('sep', false, index)
+ r9 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'sep\'')
+ terminal_parse_failure('sep')
r9 = nil
end
if r9
- r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
r0 = r9
else
- if (match_len = has_terminal?('oct', :insens, index))
- r10 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('oct', false, index)
+ r10 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'oct\'')
+ terminal_parse_failure('oct')
r10 = nil
end
if r10
- r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
r0 = r10
else
- if (match_len = has_terminal?('nov', :insens, index))
- r11 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('nov', false, index)
+ r11 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'nov\'')
+ terminal_parse_failure('nov')
r11 = nil
end
if r11
- r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
r0 = r11
else
- if (match_len = has_terminal?('dec', :insens, index))
- r12 = instantiate_node(MonthName,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('dec', false, index)
+ r12 = instantiate_node(MonthName,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'dec\'')
+ terminal_parse_failure('dec')
r12 = nil
end
if r12
- r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
r0 = r12
else
@index = i0
r0 = nil
end
@@ -2487,33 +2394,31 @@
def _nt_zone_offset
start_index = index
if node_cache[:zone_offset].has_key?(index)
cached = node_cache[:zone_offset][index]
if cached
- node_cache[:zone_offset][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
- if has_terminal?(@regexps[gr = '\A[+-]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[+-]', true, index)
r1 = true
@index += 1
else
- terminal_parse_failure('[+-]')
r1 = nil
end
s0 << r1
if r1
s2, i2 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r3 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r3 = nil
end
if r3
s2 << r3
else
@@ -2525,22 +2430,19 @@
end
if s2.size < 2
@index = i2
r2 = nil
else
- if s2.size < 2
- terminal_failures.pop
- end
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
end
s0 << r2
if r2
- if (match_len = has_terminal?(':', false, index))
- r5 = true
- @index += match_len
+ if has_terminal?(':', false, index)
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\':\'')
+ terminal_parse_failure(':')
r5 = nil
end
if r5
r4 = r5
else
@@ -2548,15 +2450,14 @@
end
s0 << r4
if r4
s6, i6 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r7 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r7 = nil
end
if r7
s6 << r7
else
@@ -2568,13 +2469,10 @@
end
if s6.size < 2
@index = i6
r6 = nil
else
- if s6.size < 2
- terminal_failures.pop
- end
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
end
s0 << r6
end
end
@@ -2601,25 +2499,24 @@
def _nt_hour_minute_second
start_index = index
if node_cache[:hour_minute_second].has_key?(index)
cached = node_cache[:hour_minute_second][index]
if cached
- node_cache[:hour_minute_second][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
i1, s1 = index, []
s2, i2 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r3 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r3 = nil
end
if r3
s2 << r3
else
@@ -2631,33 +2528,29 @@
end
if s2.size < 2
@index = i2
r2 = nil
else
- if s2.size < 2
- terminal_failures.pop
- end
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
end
s1 << r2
if r2
- if (match_len = has_terminal?(':', false, index))
- r4 = true
- @index += match_len
+ if has_terminal?(':', false, index)
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\':\'')
+ terminal_parse_failure(':')
r4 = nil
end
s1 << r4
if r4
s5, i5 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r6 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r6 = nil
end
if r6
s5 << r6
else
@@ -2669,34 +2562,30 @@
end
if s5.size < 2
@index = i5
r5 = nil
else
- if s5.size < 2
- terminal_failures.pop
- end
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
end
s1 << r5
if r5
i8, s8 = index, []
- if (match_len = has_terminal?(':', false, index))
- r9 = true
- @index += match_len
+ if has_terminal?(':', false, index)
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure('\':\'')
+ terminal_parse_failure(':')
r9 = nil
end
s8 << r9
if r9
s10, i10 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r11 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r11 = nil
end
if r11
s10 << r11
else
@@ -2708,13 +2597,10 @@
end
if s10.size < 2
@index = i10
r10 = nil
else
- if s10.size < 2
- terminal_failures.pop
- end
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
end
s8 << r10
end
if s8.last
@@ -2739,33 +2625,30 @@
else
@index = i1
r1 = nil
end
if r1
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
- if (match_len = has_terminal?('beginning', false, index))
- r12 = instantiate_node(HourMinuteSecond,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('beginning', false, index)
+ r12 = instantiate_node(HourMinuteSecond,input, index...(index + 9))
+ @index += 9
else
- terminal_parse_failure('\'beginning\'')
+ terminal_parse_failure('beginning')
r12 = nil
end
if r12
- r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
r0 = r12
else
- if (match_len = has_terminal?('end', false, index))
- r13 = instantiate_node(HourMinuteSecond,input, index...(index + match_len))
- @index += match_len
+ if has_terminal?('end', false, index)
+ r13 = instantiate_node(HourMinuteSecond,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure('\'end\'')
+ terminal_parse_failure('end')
r13 = nil
end
if r13
- r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
r0 = r13
else
@index = i0
r0 = nil
end
@@ -2780,23 +2663,22 @@
def _nt_integer
start_index = index
if node_cache[:integer].has_key?(index)
cached = node_cache[:integer][index]
if cached
- node_cache[:integer][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
s0, i0 = [], index
loop do
- if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\d]', true, index)
r1 = true
@index += 1
else
- terminal_parse_failure('[\\d]')
r1 = nil
end
if r1
s0 << r1
else
@@ -2818,20 +2700,19 @@
def _nt_space
start_index = index
if node_cache[:space].has_key?(index)
cached = node_cache[:space][index]
if cached
- node_cache[:space][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
- if has_terminal?(@regexps[gr = '\A[\\s\\t\\n]'] ||= Regexp.new(gr), :regexp, index)
+ if has_terminal?('\G[\\s\\t\\n]', true, index)
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
- terminal_parse_failure('[\\s\\t\\n]')
r0 = nil
end
node_cache[:space][start_index] = r0
\ No newline at end of file