def advance
Return next token: [type, value].
def advance
if @token_queue.any?
return @token_queue.shift
end
# Ugly, but dependent on Ragel output. Consider refactoring it somehow.
_lex_trans_keys = self.class.send :_lex_trans_keys
_lex_actions = self.class.send :_lex_actions
_lex_key_offsets = self.class.send :_lex_key_offsets
_lex_index_offsets = self.class.send :_lex_index_offsets
_lex_single_lengths = self.class.send :_lex_single_lengths
_lex_range_lengths = self.class.send :_lex_range_lengths
_lex_indicies = self.class.send :_lex_indicies
_lex_trans_targs = self.class.send :_lex_trans_targs
_lex_trans_actions = self.class.send :_lex_trans_actions
_lex_to_state_actions = self.class.send :_lex_to_state_actions
_lex_from_state_actions = self.class.send :_lex_from_state_actions
p, pe, eof = @p, @source.length + 1, nil
line 3399 "lib/parser/lexer.rb"
gin
klen, _trans, _keys, _acts, _nacts = nil
goto_level = 0
resume = 10
eof_trans = 15
again = 20
test_eof = 30
out = 40
hile true
trigger_goto = false
f _goto_level <= 0
f p == pe
_goto_level = _test_eof
next
nd
f @cs == 0
_goto_level = _out
next
nd
nd
f _goto_level <= _resume
acts = _lex_from_state_actions[ @cs]
nacts = _lex_actions[_acts]
acts += 1
hile _nacts > 0
_nacts -= 1
_acts += 1
case _lex_actions[_acts - 1]
when 46 then
line 1 "NONE"
begin
ts = p
end
line 3433 "lib/parser/lexer.rb"
end # from state action switch
nd
f _trigger_goto
next
nd
keys = _lex_key_offsets[ @cs]
trans = _lex_index_offsets[ @cs]
klen = _lex_single_lengths[ @cs]
break_match = false
egin
if _klen > 0
_lower = _keys
_upper = _keys + _klen - 1
loop do
break if _upper < _lower
_mid = _lower + ( (_upper - _lower) >> 1 )
if ( @source[p].ord) < _lex_trans_keys[_mid]
_upper = _mid - 1
elsif ( @source[p].ord) > _lex_trans_keys[_mid]
_lower = _mid + 1
else
_trans += (_mid - _keys)
_break_match = true
break
end
end # loop
break if _break_match
_keys += _klen
_trans += _klen
end
_klen = _lex_range_lengths[ @cs]
if _klen > 0
_lower = _keys
_upper = _keys + (_klen << 1) - 2
loop do
break if _upper < _lower
_mid = _lower + (((_upper-_lower) >> 1) & ~1)
if ( @source[p].ord) < _lex_trans_keys[_mid]
_upper = _mid - 2
elsif ( @source[p].ord) > _lex_trans_keys[_mid+1]
_lower = _mid + 2
else
_trans += ((_mid - _keys) >> 1)
_break_match = true
break
end
end # loop
break if _break_match
_trans += _klen
end
nd while false
trans = _lex_indicies[_trans]
nd
f _goto_level <= _eof_trans
@cs = _lex_trans_targs[_trans]
f _lex_trans_actions[_trans] != 0
_acts = _lex_trans_actions[_trans]
_nacts = _lex_actions[_acts]
_acts += 1
while _nacts > 0
_nacts -= 1
_acts += 1
case _lex_actions[_acts - 1]
en 0 then
line 373 "lib/parser/lexer.rl"
begin
# Record position of a newline for precise location reporting on tNL
# tokens.
#
# This action is embedded directly into c_nl, as it is idempotent and
# there are no cases when we need to skip it.
@newline_s = p
end
en 1 then
line 504 "lib/parser/lexer.rl"
begin
@escape = ""
codepoints = tok(@escape_s + 2, p - 1)
codepoint_s = @escape_s + 2
codepoints.split(/[ \t]/).each do |codepoint_str|
codepoint = codepoint_str.to_i(16)
if codepoint >= 0x110000
@escape = lambda do
diagnostic :error, Parser::ERRORS[:unicode_point_too_large],
range(codepoint_s, codepoint_s + codepoint_str.length)
end
break
end
@escape += codepoint.chr(Encoding::UTF_8)
codepoint_s += codepoint_str.length + 1
end
end
en 2 then
line 527 "lib/parser/lexer.rl"
begin
@escape = {
'a' => "\a", 'b' => "\b", 'e' => "\e", 'f' => "\f",
'n' => "\n", 'r' => "\r", 's' => "\s", 't' => "\t",
'v' => "\v", '\\' => "\\"
}.fetch(@source[p - 1].chr, @source[p - 1].chr)
end
en 3 then
line 535 "lib/parser/lexer.rl"
begin
@escape = lambda do
diagnostic :error, Parser::ERRORS[:invalid_escape]
end
end
en 4 then
line 541 "lib/parser/lexer.rl"
begin
@escape = (@escape[0].ord & 0x9f).chr
end
en 5 then
line 545 "lib/parser/lexer.rl"
begin
@escape = (@escape[0].ord | 0x80).chr
end
en 6 then
line 551 "lib/parser/lexer.rl"
begin
escape = @source[p - 1].chr end
en 7 then
line 556 "lib/parser/lexer.rl"
begin
escape = "\x7f" end
en 8 then
line 557 "lib/parser/lexer.rl"
begin
escape = @source[p - 1].chr end
en 9 then
line 563 "lib/parser/lexer.rl"
begin
escape = tok(@escape_s, p).to_i(8).chr end
en 10 then
line 567 "lib/parser/lexer.rl"
begin
escape = tok(@escape_s + 1, p).to_i(16).chr end
en 11 then
line 570 "lib/parser/lexer.rl"
begin
escape = tok(@escape_s + 1, p).to_i(16).chr(Encoding::UTF_8) end
en 12 then
line 575 "lib/parser/lexer.rl"
begin
@escape = lambda do
diagnostic :error, Parser::ERRORS[:invalid_hex_escape],
range(@escape_s - 1, p + 2)
end
end
en 13 then
line 590 "lib/parser/lexer.rl"
begin
@escape = lambda do
diagnostic :error, Parser::ERRORS[:invalid_unicode_escape],
range(@escape_s - 1, p)
end
end
en 14 then
line 604 "lib/parser/lexer.rl"
begin
@escape = lambda do
diagnostic :fatal, Parser::ERRORS[:unterminated_unicode],
range(p - 1, p)
end
end
en 15 then
line 633 "lib/parser/lexer.rl"
begin
diagnostic :fatal, Parser::ERRORS[:escape_eof],
range(p - 1, p)
end
en 16 then
line 640 "lib/parser/lexer.rl"
begin
@escape_s = p
@escape = nil
end
en 17 then
line 680 "lib/parser/lexer.rl"
begin
# After every heredoc was parsed, @herebody_s contains the
# position of next token after all heredocs.
if @herebody_s
p = @herebody_s
@herebody_s = nil
end
end
en 18 then
line 814 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
if literal
literal.start_interp_brace
end
end
en 19 then
line 822 "lib/parser/lexer.rl"
begin
if literal
if literal.end_interp_brace_and_try_closing
if version?(18, 19)
emit(:tRCURLY, '}', p - 1, p)
else
emit(:tSTRING_DEND, '}', p - 1, p)
end
if literal.saved_herebody_s
@herebody_s = literal.saved_herebody_s
end
p = p - 1;
@cs = (stack_pop);
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
end
en 20 then
line 928 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
en 21 then
line 928 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p) end
en 22 then
line 969 "lib/parser/lexer.rl"
begin
m = p end
en 23 then
line 970 "lib/parser/lexer.rl"
begin
m = p - 2 end
en 24 then
line 975 "lib/parser/lexer.rl"
begin
m = p end
en 25 then
line 976 "lib/parser/lexer.rl"
begin
m = p - 2 end
en 26 then
line 977 "lib/parser/lexer.rl"
begin
m = p - 2 end
en 27 then
line 978 "lib/parser/lexer.rl"
begin
m = p - 2 end
en 28 then
line 979 "lib/parser/lexer.rl"
begin
m = p - 3 end
en 29 then
line 984 "lib/parser/lexer.rl"
begin
m = p - 2 end
en 30 then
line 989 "lib/parser/lexer.rl"
begin
m = p - 2 end
en 31 then
line 995 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
end
en 32 then
line 1002 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
@paren_nest += 1
end
en 33 then
line 1008 "lib/parser/lexer.rl"
begin
@paren_nest -= 1
end
en 34 then
line 1232 "lib/parser/lexer.rl"
begin
m = p end
en 35 then
line 1406 "lib/parser/lexer.rl"
begin
heredoc_e = p end
en 36 then
line 1407 "lib/parser/lexer.rl"
begin
ew_herebody_s = p end
en 37 then
line 1694 "lib/parser/lexer.rl"
begin
num_base = 16; @num_digits_s = p end
en 38 then
line 1696 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = p end
en 39 then
line 1698 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = p end
en 40 then
line 1700 "lib/parser/lexer.rl"
begin
num_base = 2; @num_digits_s = p end
en 41 then
line 1703 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = @ts end
en 42 then
line 1705 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = @ts end
en 43 then
line 1707 "lib/parser/lexer.rl"
begin
m = p end
en 44 then
line 1743 "lib/parser/lexer.rl"
begin
m = p end
en 47 then
line 1 "NONE"
begin
te = p+1
end
en 48 then
line 842 "lib/parser/lexer.rl"
begin
te = p+1
egin
literal.flush_string
literal.extend_content
emit(:tSTRING_DBEG, '#{')
literal.saved_herebody_s = @herebody_s
@herebody_s = nil
literal.start_interp_brace
begin
@stack[ @top] = @cs
@top+= 1
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 49 then
line 790 "lib/parser/lexer.rl"
begin
te = p+1
egin
literal.flush_string
literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 355
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 50 then
line 745 "lib/parser/lexer.rl"
begin
te = p+1
egin
is_eof = eof_char? @source[p]
if literal.heredoc?
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if literal.nest_and_try_closing(tok(@herebody_s, @ts),
@herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = literal.heredoc_e - 1
begin
@cs = (pop_literal)
_trigger_goto = true
_goto_level = _again
break
nd
else
# Ditto.
@herebody_s = @te
end
end
if is_eof
diagnostic :fatal, Parser::ERRORS[:string_eof],
range(literal.str_s, literal.str_s + 1)
end
# A literal newline is appended if the heredoc was _not_ closed
# this time. See also Literal#nest_and_try_closing for rationale of
# calling #flush_string here.
literal.extend_string tok, @ts, @te
literal.flush_string
end
end
en 51 then
line 689 "lib/parser/lexer.rl"
begin
te = p+1
egin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 52 then
line 790 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
literal.flush_string
literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 355
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 53 then
line 697 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if literal.nest_and_try_closing('\\', @ts, @ts + 1)
# If the literal is actually closed by the backslash,
# rewind the input prior to consuming the escape sequence.
p = @escape_s - 1
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
# Get the first character after the backslash.
escaped_char = @source[@escape_s].chr
if literal.munge_escape? escaped_char
# If this particular literal uses this character as an opening
# or closing delimiter, it is an escape sequence for that
# particular character. Write it without the backslash.
if literal.regexp?
# Regular expressions should have every escape sequence in its
# raw form.
literal.extend_string(tok, @ts, @te)
else
literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
# Two things to consider here.
#
# 1. The `escape' rule should be pure and so won't raise any
# errors by itself. Instead, it stores them in lambdas.
#
# 2. Non-interpolated literals do not go through the aforementioned
# rule. As \\ and \' (and variants) are munged, the full token
# should always be written for such literals.
@escape.call if @escape.respond_to? :call
if literal.regexp?
# Ditto. Also, expand escaped newlines.
literal.extend_string(tok.gsub("\\\n", ''), @ts, @te)
else
literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
end
en 54 then
line 777 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
literal.extend_space @ts, @te
end
end
en 55 then
line 689 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 56 then
line 697 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
if literal.nest_and_try_closing('\\', @ts, @ts + 1)
# If the literal is actually closed by the backslash,
# rewind the input prior to consuming the escape sequence.
p = @escape_s - 1
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
# Get the first character after the backslash.
escaped_char = @source[@escape_s].chr
if literal.munge_escape? escaped_char
# If this particular literal uses this character as an opening
# or closing delimiter, it is an escape sequence for that
# particular character. Write it without the backslash.
if literal.regexp?
# Regular expressions should have every escape sequence in its
# raw form.
literal.extend_string(tok, @ts, @te)
else
literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
# Two things to consider here.
#
# 1. The `escape' rule should be pure and so won't raise any
# errors by itself. Instead, it stores them in lambdas.
#
# 2. Non-interpolated literals do not go through the aforementioned
# rule. As \\ and \' (and variants) are munged, the full token
# should always be written for such literals.
@escape.call if @escape.respond_to? :call
if literal.regexp?
# Ditto. Also, expand escaped newlines.
literal.extend_string(tok.gsub("\\\n", ''), @ts, @te)
else
literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
end
en 57 then
line 689 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 58 then
line 842 "lib/parser/lexer.rl"
begin
te = p+1
egin
literal.flush_string
literal.extend_content
emit(:tSTRING_DBEG, '#{')
literal.saved_herebody_s = @herebody_s
@herebody_s = nil
literal.start_interp_brace
begin
@stack[ @top] = @cs
@top+= 1
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 59 then
line 790 "lib/parser/lexer.rl"
begin
te = p+1
egin
literal.flush_string
literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 355
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 60 then
line 745 "lib/parser/lexer.rl"
begin
te = p+1
egin
is_eof = eof_char? @source[p]
if literal.heredoc?
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if literal.nest_and_try_closing(tok(@herebody_s, @ts),
@herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = literal.heredoc_e - 1
begin
@cs = (pop_literal)
_trigger_goto = true
_goto_level = _again
break
nd
else
# Ditto.
@herebody_s = @te
end
end
if is_eof
diagnostic :fatal, Parser::ERRORS[:string_eof],
range(literal.str_s, literal.str_s + 1)
end
# A literal newline is appended if the heredoc was _not_ closed
# this time. See also Literal#nest_and_try_closing for rationale of
# calling #flush_string here.
literal.extend_string tok, @ts, @te
literal.flush_string
end
end
en 61 then
line 689 "lib/parser/lexer.rl"
begin
te = p+1
egin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 62 then
line 790 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
literal.flush_string
literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 355
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 63 then
line 697 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if literal.nest_and_try_closing('\\', @ts, @ts + 1)
# If the literal is actually closed by the backslash,
# rewind the input prior to consuming the escape sequence.
p = @escape_s - 1
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
# Get the first character after the backslash.
escaped_char = @source[@escape_s].chr
if literal.munge_escape? escaped_char
# If this particular literal uses this character as an opening
# or closing delimiter, it is an escape sequence for that
# particular character. Write it without the backslash.
if literal.regexp?
# Regular expressions should have every escape sequence in its
# raw form.
literal.extend_string(tok, @ts, @te)
else
literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
# Two things to consider here.
#
# 1. The `escape' rule should be pure and so won't raise any
# errors by itself. Instead, it stores them in lambdas.
#
# 2. Non-interpolated literals do not go through the aforementioned
# rule. As \\ and \' (and variants) are munged, the full token
# should always be written for such literals.
@escape.call if @escape.respond_to? :call
if literal.regexp?
# Ditto. Also, expand escaped newlines.
literal.extend_string(tok.gsub("\\\n", ''), @ts, @te)
else
literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
end
en 64 then
line 689 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 65 then
line 697 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
if literal.nest_and_try_closing('\\', @ts, @ts + 1)
# If the literal is actually closed by the backslash,
# rewind the input prior to consuming the escape sequence.
p = @escape_s - 1
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
# Get the first character after the backslash.
escaped_char = @source[@escape_s].chr
if literal.munge_escape? escaped_char
# If this particular literal uses this character as an opening
# or closing delimiter, it is an escape sequence for that
# particular character. Write it without the backslash.
if literal.regexp?
# Regular expressions should have every escape sequence in its
# raw form.
literal.extend_string(tok, @ts, @te)
else
literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
# Two things to consider here.
#
# 1. The `escape' rule should be pure and so won't raise any
# errors by itself. Instead, it stores them in lambdas.
#
# 2. Non-interpolated literals do not go through the aforementioned
# rule. As \\ and \' (and variants) are munged, the full token
# should always be written for such literals.
@escape.call if @escape.respond_to? :call
if literal.regexp?
# Ditto. Also, expand escaped newlines.
literal.extend_string(tok.gsub("\\\n", ''), @ts, @te)
else
literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
end
en 66 then
line 689 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 67 then
line 697 "lib/parser/lexer.rl"
begin
te = p+1
egin
if literal.nest_and_try_closing('\\', @ts, @ts + 1)
# If the literal is actually closed by the backslash,
# rewind the input prior to consuming the escape sequence.
p = @escape_s - 1
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
# Get the first character after the backslash.
escaped_char = @source[@escape_s].chr
if literal.munge_escape? escaped_char
# If this particular literal uses this character as an opening
# or closing delimiter, it is an escape sequence for that
# particular character. Write it without the backslash.
if literal.regexp?
# Regular expressions should have every escape sequence in its
# raw form.
literal.extend_string(tok, @ts, @te)
else
literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
# Two things to consider here.
#
# 1. The `escape' rule should be pure and so won't raise any
# errors by itself. Instead, it stores them in lambdas.
#
# 2. Non-interpolated literals do not go through the aforementioned
# rule. As \\ and \' (and variants) are munged, the full token
# should always be written for such literals.
@escape.call if @escape.respond_to? :call
if literal.regexp?
# Ditto. Also, expand escaped newlines.
literal.extend_string(tok.gsub("\\\n", ''), @ts, @te)
else
literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
end
en 68 then
line 745 "lib/parser/lexer.rl"
begin
te = p+1
egin
is_eof = eof_char? @source[p]
if literal.heredoc?
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if literal.nest_and_try_closing(tok(@herebody_s, @ts),
@herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = literal.heredoc_e - 1
begin
@cs = (pop_literal)
_trigger_goto = true
_goto_level = _again
break
nd
else
# Ditto.
@herebody_s = @te
end
end
if is_eof
diagnostic :fatal, Parser::ERRORS[:string_eof],
range(literal.str_s, literal.str_s + 1)
end
# A literal newline is appended if the heredoc was _not_ closed
# this time. See also Literal#nest_and_try_closing for rationale of
# calling #flush_string here.
literal.extend_string tok, @ts, @te
literal.flush_string
end
end
en 69 then
line 689 "lib/parser/lexer.rl"
begin
te = p+1
egin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 70 then
line 777 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
literal.extend_space @ts, @te
end
end
en 71 then
line 689 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 72 then
line 745 "lib/parser/lexer.rl"
begin
te = p+1
egin
is_eof = eof_char? @source[p]
if literal.heredoc?
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if literal.nest_and_try_closing(tok(@herebody_s, @ts),
@herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = literal.heredoc_e - 1
begin
@cs = (pop_literal)
_trigger_goto = true
_goto_level = _again
break
nd
else
# Ditto.
@herebody_s = @te
end
end
if is_eof
diagnostic :fatal, Parser::ERRORS[:string_eof],
range(literal.str_s, literal.str_s + 1)
end
# A literal newline is appended if the heredoc was _not_ closed
# this time. See also Literal#nest_and_try_closing for rationale of
# calling #flush_string here.
literal.extend_string tok, @ts, @te
literal.flush_string
end
end
en 73 then
line 697 "lib/parser/lexer.rl"
begin
te = p+1
egin
if literal.nest_and_try_closing('\\', @ts, @ts + 1)
# If the literal is actually closed by the backslash,
# rewind the input prior to consuming the escape sequence.
p = @escape_s - 1
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
# Get the first character after the backslash.
escaped_char = @source[@escape_s].chr
if literal.munge_escape? escaped_char
# If this particular literal uses this character as an opening
# or closing delimiter, it is an escape sequence for that
# particular character. Write it without the backslash.
if literal.regexp?
# Regular expressions should have every escape sequence in its
# raw form.
literal.extend_string(tok, @ts, @te)
else
literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
# Two things to consider here.
#
# 1. The `escape' rule should be pure and so won't raise any
# errors by itself. Instead, it stores them in lambdas.
#
# 2. Non-interpolated literals do not go through the aforementioned
# rule. As \\ and \' (and variants) are munged, the full token
# should always be written for such literals.
@escape.call if @escape.respond_to? :call
if literal.regexp?
# Ditto. Also, expand escaped newlines.
literal.extend_string(tok.gsub("\\\n", ''), @ts, @te)
else
literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
end
en 74 then
line 745 "lib/parser/lexer.rl"
begin
te = p+1
egin
is_eof = eof_char? @source[p]
if literal.heredoc?
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if literal.nest_and_try_closing(tok(@herebody_s, @ts),
@herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = literal.heredoc_e - 1
begin
@cs = (pop_literal)
_trigger_goto = true
_goto_level = _again
break
nd
else
# Ditto.
@herebody_s = @te
end
end
if is_eof
diagnostic :fatal, Parser::ERRORS[:string_eof],
range(literal.str_s, literal.str_s + 1)
end
# A literal newline is appended if the heredoc was _not_ closed
# this time. See also Literal#nest_and_try_closing for rationale of
# calling #flush_string here.
literal.extend_string tok, @ts, @te
literal.flush_string
end
end
en 75 then
line 689 "lib/parser/lexer.rl"
begin
te = p+1
egin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 76 then
line 697 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if literal.nest_and_try_closing('\\', @ts, @ts + 1)
# If the literal is actually closed by the backslash,
# rewind the input prior to consuming the escape sequence.
p = @escape_s - 1
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
# Get the first character after the backslash.
escaped_char = @source[@escape_s].chr
if literal.munge_escape? escaped_char
# If this particular literal uses this character as an opening
# or closing delimiter, it is an escape sequence for that
# particular character. Write it without the backslash.
if literal.regexp?
# Regular expressions should have every escape sequence in its
# raw form.
literal.extend_string(tok, @ts, @te)
else
literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
# Two things to consider here.
#
# 1. The `escape' rule should be pure and so won't raise any
# errors by itself. Instead, it stores them in lambdas.
#
# 2. Non-interpolated literals do not go through the aforementioned
# rule. As \\ and \' (and variants) are munged, the full token
# should always be written for such literals.
@escape.call if @escape.respond_to? :call
if literal.regexp?
# Ditto. Also, expand escaped newlines.
literal.extend_string(tok.gsub("\\\n", ''), @ts, @te)
else
literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
end
en 77 then
line 689 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if !literal.heredoc? && literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
literal.extend_string(tok, @ts, @te)
end
end
end
en 78 then
line 903 "lib/parser/lexer.rl"
begin
te = p+1
egin
emit(:tREGEXP_OPT, tok(@ts, @te - 1), @ts, @te - 1)
p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 79 then
line 891 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
unknown_options = tok.scan(/[^imxouesn]/)
if unknown_options.any?
message = Parser::ERRORS[:regexp_options] % { :options => unknown_options.join }
diagnostic :error, message
end
emit(:tREGEXP_OPT)
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 80 then
line 1029 "lib/parser/lexer.rl"
begin
te = p+1
egin
if tok =~ /^\$([1-9][0-9]*)$/
emit(:tNTH_REF, tok(@ts + 1).to_i)
elsif tok =~ /^\$([&`'+])$/
emit(:tBACK_REF)
else
emit(:tGVAR)
end
@cs = (stack_pop); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 81 then
line 1029 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if tok =~ /^\$([1-9][0-9]*)$/
emit(:tNTH_REF, tok(@ts + 1).to_i)
elsif tok =~ /^\$([&`'+])$/
emit(:tBACK_REF)
else
emit(:tGVAR)
end
@cs = (stack_pop); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 82 then
line 1042 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if tok =~ /^@@[0-9]/
message = Parser::ERRORS[:cvar_name] % { :name => tok }
diagnostic :error, message
end
emit(:tCVAR)
@cs = (stack_pop); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 83 then
line 1053 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if tok =~ /^@[0-9]/
message = Parser::ERRORS[:ivar_name] % { :name => tok }
diagnostic :error, message
end
emit(:tIVAR)
@cs = (stack_pop); begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 84 then
line 1075 "lib/parser/lexer.rl"
begin
act = 25; end
en 85 then
line 1079 "lib/parser/lexer.rl"
begin
act = 26; end
en 86 then
line 1083 "lib/parser/lexer.rl"
begin
act = 27; end
en 87 then
line 1075 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(KEYWORDS_BEGIN[tok]);
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 88 then
line 1083 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tIDENTIFIER)
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 89 then
line 1087 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1
@cs = 770; begin
@stack[ @top] = @cs
@top+= 1
@cs = 355
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 90 then
line 1096 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 91 then
line 1100 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 92 then
line 1108 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 93 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 94 then
line 1075 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(KEYWORDS_BEGIN[tok]);
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 95 then
line 1079 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tCONSTANT)
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 96 then
line 1083 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tIDENTIFIER)
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 97 then
line 1087 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
@cs = 770; begin
@stack[ @top] = @cs
@top+= 1
@cs = 355
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 98 then
line 1096 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 99 then
line 1103 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 100 then
line 1105 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 101 then
line 1108 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 102 then
line 1108 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 103 then
line 1 "NONE"
begin
ase @act
hen 25 then
egin begin p = (( @te))-1; end
mit(KEYWORDS_BEGIN[tok]);
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 26 then
egin begin p = (( @te))-1; end
mit(:tCONSTANT)
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 27 then
egin begin p = (( @te))-1; end
mit(:tIDENTIFIER)
@cs = 473; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
d
end
en 104 then
line 1120 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tLABEL, tok(@ts, @te - 1))
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 105 then
line 1126 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 106 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 107 then
line 1123 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 108 then
line 1126 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 109 then
line 1126 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 110 then
line 1152 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 111 then
line 1158 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 112 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 113 then
line 1137 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tCONSTANT)
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 114 then
line 1141 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tIDENTIFIER)
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 115 then
line 1145 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tFID, tok(@ts, tm), @ts, tm)
@cs = 508; p = tm - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 116 then
line 1152 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 117 then
line 1155 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 118 then
line 1158 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 119 then
line 1158 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 120 then
line 1218 "lib/parser/lexer.rl"
begin
act = 51; end
en 121 then
line 1233 "lib/parser/lexer.rl"
begin
act = 53; end
en 122 then
line 1271 "lib/parser/lexer.rl"
begin
act = 58; end
en 123 then
line 1276 "lib/parser/lexer.rl"
begin
act = 59; end
en 124 then
line 1218 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 125 then
line 1245 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 126 then
line 1253 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 127 then
line 1262 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 128 then
line 1271 "lib/parser/lexer.rl"
begin
te = p+1
egin
p = @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 129 then
line 1285 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 130 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 131 then
line 1174 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLPAREN_ARG, '(', @te - 1, @te)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 132 then
line 1180 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLPAREN2)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 133 then
line 1186 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLBRACK, '[', @te - 1, @te)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 134 then
line 1192 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if @lambda_stack.last == @paren_nest
p = @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
else
emit(:tLCURLY, '{', @te - 1, @te)
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
end
en 135 then
line 1209 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 136 then
line 1223 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
diagnostic :warning, Parser::ERRORS[:ambiguous_literal],
range(@te - 1, @te)
p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 137 then
line 1233 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
message = Parser::ERRORS[:ambiguous_prefix] % { :prefix => tok(tm, @te) }
diagnostic :warning, message,
range(tm, @te)
p = tm - 1
begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 138 then
line 1250 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 139 then
line 1262 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 140 then
line 1271 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
p = @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 141 then
line 1276 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 142 then
line 1279 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 143 then
line 1282 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 144 then
line 1285 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 145 then
line 1276 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
end
en 146 then
line 1285 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 147 then
line 1 "NONE"
begin
ase @act
hen 51 then
egin begin p = (( @te))-1; end
= p - 1; p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
nd
hen 53 then
egin begin p = (( @te))-1; end
message = Parser::ERRORS[:ambiguous_prefix] % { :prefix => tok(tm, @te) }
diagnostic :warning, message,
range(tm, @te)
p = tm - 1
begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
hen 58 then
egin begin p = (( @te))-1; end
p = @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
lse
egin begin p = (( @te))-1; end
d
d
end
en 148 then
line 1311 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:kDO_BLOCK)
@cs = 763; end
end
en 149 then
line 1317 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 150 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 151 then
line 1307 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLBRACE_ARG)
@cs = 763; end
end
en 152 then
line 1314 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 153 then
line 1317 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 154 then
line 1317 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 155 then
line 1329 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(KEYWORDS)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 156 then
line 1338 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 157 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 158 then
line 1332 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 159 then
line 1335 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 160 then
line 1338 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 161 then
line 1338 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 162 then
line 1510 "lib/parser/lexer.rl"
begin
act = 89; end
en 163 then
line 1516 "lib/parser/lexer.rl"
begin
act = 90; end
en 164 then
line 1521 "lib/parser/lexer.rl"
begin
act = 91; end
en 165 then
line 1550 "lib/parser/lexer.rl"
begin
act = 93; end
en 166 then
line 1013 "lib/parser/lexer.rl"
begin
act = 94; end
en 167 then
line 1577 "lib/parser/lexer.rl"
begin
act = 97; end
en 168 then
line 1355 "lib/parser/lexer.rl"
begin
te = p+1
egin
p = p - 1;
if tok.start_with? '-'
emit(:tUMINUS_NUM, '-', @ts, @ts + 1)
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
end
en 169 then
line 1375 "lib/parser/lexer.rl"
begin
te = p+1
egin
type = delimiter = tok[0].chr
p = p - 1; begin
@cs = (push_literal(type, delimiter, @ts))
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 170 then
line 1382 "lib/parser/lexer.rl"
begin
te = p+1
egin
type, delimiter = tok[0].chr, tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts))
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 171 then
line 1389 "lib/parser/lexer.rl"
begin
te = p+1
egin
type, delimiter = tok[0..-2], tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts))
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 172 then
line 1395 "lib/parser/lexer.rl"
begin
te = p+1
egin
diagnostic :fatal, Parser::ERRORS[:string_eof],
range(@ts, @ts + 1)
end
end
en 173 then
line 1430 "lib/parser/lexer.rl"
begin
te = p+1
egin
type, delimiter = tok, tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts))
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 174 then
line 1444 "lib/parser/lexer.rl"
begin
te = p+1
egin
emit(:tSYMBOL, tok(@ts + 1), @ts)
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 175 then
line 1456 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Show an error if memorized.
@escape.call if @escape.respond_to? :call
value = @escape || tok(@ts + 1)
if version?(18)
emit(:tINTEGER, value[0].ord)
else
emit(:tSTRING, value)
end
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 176 then
line 1472 "lib/parser/lexer.rl"
begin
te = p+1
egin
escape = { " " => '\s', "\r" => '\r', "\n" => '\n', "\t" => '\t',
"\v" => '\v', "\f" => '\f' }[tok[1]]
message = Parser::ERRORS[:invalid_escape_use] % { :escape => escape }
diagnostic :warning, message, range
p = @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 177 then
line 1483 "lib/parser/lexer.rl"
begin
te = p+1
egin
diagnostic :fatal, Parser::ERRORS[:incomplete_escape],
range(@ts, @ts + 1)
end
end
en 178 then
line 1510 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION_BEGIN)
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 179 then
line 1529 "lib/parser/lexer.rl"
begin
te = p+1
egin
p = p - 1;
if version?(18)
emit(:tIDENTIFIER, tok(@ts, @te - 2), @ts, @te - 2)
p = p - 1; # continue as a symbol
else
emit(:tLABEL, tok(@ts, @te - 2), @ts, @te - 1)
end
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 180 then
line 1564 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1
begin
@cs = 214
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 181 then
line 1577 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 182 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 183 then
line 1365 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tSTAR)
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 184 then
line 1389 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
type, delimiter = tok[0..-2], tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts))
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 185 then
line 1408 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
tok(@ts, @heredoc_e) =~ /^<<(-?)(["'`]?)(.*)\2$/
indent = !$1.empty?
type = $2.empty? ? '"' : $2
delimiter = $3
@cs = (push_literal(type, delimiter, @ts, @heredoc_e, indent));
if @herebody_s.nil?
@herebody_s = new_herebody_s
end
p = @herebody_s - 1
end
end
en 186 then
line 1436 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1, tm), @ts, tm)
p = tm - 1
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 187 then
line 1444 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1), @ts)
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 188 then
line 1456 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
# Show an error if memorized.
@escape.call if @escape.respond_to? :call
value = @escape || tok(@ts + 1)
if version?(18)
emit(:tINTEGER, value[0].ord)
else
emit(:tSTRING, value)
end
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 189 then
line 1472 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
escape = { " " => '\s', "\r" => '\r', "\n" => '\n', "\t" => '\t',
"\v" => '\v', "\f" => '\f' }[tok[1]]
message = Parser::ERRORS[:invalid_escape_use] % { :escape => escape }
diagnostic :warning, message, range
p = @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 190 then
line 1490 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
p = @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 191 then
line 1505 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION_BEGIN)
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 192 then
line 1510 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION_BEGIN)
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 193 then
line 1550 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 194 then
line 1013 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tIDENTIFIER)
if !version?(18) &&
!@static_env.nil? && @static_env.declared?(tok)
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
end
en 195 then
line 1561 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 196 then
line 1564 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 214
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 197 then
line 1577 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 198 then
line 1456 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
# Show an error if memorized.
@escape.call if @escape.respond_to? :call
value = @escape || tok(@ts + 1)
if version?(18)
emit(:tINTEGER, value[0].ord)
else
emit(:tSTRING, value)
end
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 199 then
line 1561 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
end
en 200 then
line 1577 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = @ts - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 201 then
line 1 "NONE"
begin
ase @act
hen 89 then
egin begin p = (( @te))-1; end
mit_table(PUNCTUATION_BEGIN)
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 90 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS_BEGIN)
@cs = 546; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 91 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS_BEGIN)
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 93 then
egin begin p = (( @te))-1; end
= @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
nd
hen 94 then
egin begin p = (( @te))-1; end
emit(:tIDENTIFIER)
if !version?(18) &&
!@static_env.nil? && @static_env.declared?(tok)
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
hen 97 then
egin begin p = (( @te))-1; end
= @ts - 1; begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
nd
d
end
en 202 then
line 1587 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 203 then
line 1593 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 204 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 205 then
line 1590 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 206 then
line 1593 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 207 then
line 1593 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 558
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 208 then
line 1612 "lib/parser/lexer.rl"
begin
act = 104; end
en 209 then
line 1643 "lib/parser/lexer.rl"
begin
act = 105; end
en 210 then
line 1647 "lib/parser/lexer.rl"
begin
act = 106; end
en 211 then
line 1653 "lib/parser/lexer.rl"
begin
act = 107; end
en 212 then
line 1658 "lib/parser/lexer.rl"
begin
act = 108; end
en 213 then
line 1662 "lib/parser/lexer.rl"
begin
act = 109; end
en 214 then
line 1666 "lib/parser/lexer.rl"
begin
act = 110; end
en 215 then
line 1677 "lib/parser/lexer.rl"
begin
act = 111; end
en 216 then
line 1687 "lib/parser/lexer.rl"
begin
act = 112; end
en 217 then
line 1708 "lib/parser/lexer.rl"
begin
act = 113; end
en 218 then
line 1744 "lib/parser/lexer.rl"
begin
act = 114; end
en 219 then
line 1782 "lib/parser/lexer.rl"
begin
act = 116; end
en 220 then
line 1013 "lib/parser/lexer.rl"
begin
act = 120; end
en 221 then
line 1803 "lib/parser/lexer.rl"
begin
act = 121; end
en 222 then
line 1604 "lib/parser/lexer.rl"
begin
te = p+1
egin
emit_table(PUNCTUATION, @ts, @ts + 2)
@lambda_stack.push @paren_nest
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 223 then
line 1647 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:kCLASS, 'class', @ts, @ts + 5)
emit(:tLSHFT, '<<', @te - 2, @te)
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 224 then
line 1708 "lib/parser/lexer.rl"
begin
te = p+1
egin
unless (char = tok(tm, @te)).empty?
diagnostic :fatal, Parser::ERRORS[:unexpected] % { :character => char },
range(tm, tm + 1)
end
digits = tok(@num_digits_s, tm)
if digits.end_with? '_'
diagnostic :error, Parser::ERRORS[:trailing_underscore],
range(tm - 1, tm)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = "0"
elsif digits.empty?
diagnostic :error, Parser::ERRORS[:empty_numeric]
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, Parser::ERRORS[:invalid_octal],
range(invalid_s, invalid_s + 1)
end
emit(:tINTEGER, digits.to_i(@num_base), @ts, tm)
p = tm - 1
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 225 then
line 1744 "lib/parser/lexer.rl"
begin
te = p+1
egin
unless (char = tok(tm, @te)).empty?
diagnostic :fatal, Parser::ERRORS[:unexpected] % { :character => char },
range(tm, tm + 1)
end
digits = tok(@ts, tm)
if digits.start_with? '.'
diagnostic :error, Parser::ERRORS[:no_dot_digit_literal]
elsif digits =~ /^[eE]/
# The rule above allows to specify floats as just `e10', which is
# certainly not a float. Send a patch if you can do this better.
emit(:tIDENTIFIER, digits, @ts, tm)
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
emit(:tFLOAT, digits.to_f, @ts, tm)
p = tm - 1
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 226 then
line 1772 "lib/parser/lexer.rl"
begin
te = p+1
egin
type, delimiter = tok, tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts))
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 227 then
line 1790 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1; begin
@stack[ @top] = @cs
@top+= 1
@cs = 355
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 228 then
line 1797 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 480; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 229 then
line 1815 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 230 then
line 1819 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cond.lexpop; @cmdarg.lexpop
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 231 then
line 1824 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tOP_ASGN, tok(@ts, @te - 1))
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 232 then
line 1828 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 233 then
line 1836 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 234 then
line 1849 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 235 then
line 1852 "lib/parser/lexer.rl"
begin
te = p+1
egin
diagnostic :error, Parser::ERRORS[:bare_backslash],
range(@ts, @ts + 1)
p = p - 1;
end
end
en 236 then
line 1859 "lib/parser/lexer.rl"
begin
te = p+1
egin
message = Parser::ERRORS[:unexpected] % { :character => tok.inspect[1..-2] }
diagnostic :fatal, message
end
end
en 237 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 238 then
line 1612 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if @lambda_stack.last == @paren_nest
@lambda_stack.pop
if tok == '{'
emit(:tLAMBEG)
else # 'do'
emit(:kDO_LAMBDA)
end
else
if tok == '{'
emit_table(PUNCTUATION)
else # 'do'
if @cond.active?
emit(:kDO_COND)
elsif @cmdarg.active?
emit(:kDO_BLOCK)
else
emit(:kDO)
end
end
end
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 239 then
line 1643 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(KEYWORDS)
@cs = 360; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 240 then
line 1647 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:kCLASS, 'class', @ts, @ts + 5)
emit(:tLSHFT, '<<', @te - 2, @te)
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 241 then
line 1658 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(KEYWORDS)
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 242 then
line 1708 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
unless (char = tok(tm, @te)).empty?
diagnostic :fatal, Parser::ERRORS[:unexpected] % { :character => char },
range(tm, tm + 1)
end
digits = tok(@num_digits_s, tm)
if digits.end_with? '_'
diagnostic :error, Parser::ERRORS[:trailing_underscore],
range(tm - 1, tm)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = "0"
elsif digits.empty?
diagnostic :error, Parser::ERRORS[:empty_numeric]
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, Parser::ERRORS[:invalid_octal],
range(invalid_s, invalid_s + 1)
end
emit(:tINTEGER, digits.to_i(@num_base), @ts, tm)
p = tm - 1
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 243 then
line 1744 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
unless (char = tok(tm, @te)).empty?
diagnostic :fatal, Parser::ERRORS[:unexpected] % { :character => char },
range(tm, tm + 1)
end
digits = tok(@ts, tm)
if digits.start_with? '.'
diagnostic :error, Parser::ERRORS[:no_dot_digit_literal]
elsif digits =~ /^[eE]/
# The rule above allows to specify floats as just `e10', which is
# certainly not a float. Send a patch if you can do this better.
emit(:tIDENTIFIER, digits, @ts, tm)
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
emit(:tFLOAT, digits.to_f, @ts, tm)
p = tm - 1
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 244 then
line 1782 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tCONSTANT)
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 245 then
line 1786 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tCONSTANT, tok(@ts, tm), @ts, tm)
p = tm - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 246 then
line 1790 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1; begin
@stack[ @top] = @cs
@top+= 1
@cs = 355
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 247 then
line 1797 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 480; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 248 then
line 1013 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tIDENTIFIER)
if !version?(18) &&
!@static_env.nil? && @static_env.declared?(tok)
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
end
en 249 then
line 1803 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tFID, tok(@ts, tm), @ts, tm)
p = tm - 1
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 250 then
line 1815 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 251 then
line 1819 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cond.lexpop; @cmdarg.lexpop
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 252 then
line 1832 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 253 then
line 1836 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 254 then
line 1843 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 255 then
line 1846 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin begin
@cs = 944
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 256 then
line 1852 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
diagnostic :error, Parser::ERRORS[:bare_backslash],
range(@ts, @ts + 1)
p = p - 1;
end
end
en 257 then
line 1859 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
message = Parser::ERRORS[:unexpected] % { :character => tok.inspect[1..-2] }
diagnostic :fatal, message
end
end
en 258 then
line 1708 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
unless (char = tok(tm, @te)).empty?
diagnostic :fatal, Parser::ERRORS[:unexpected] % { :character => char },
range(tm, tm + 1)
end
digits = tok(@num_digits_s, tm)
if digits.end_with? '_'
diagnostic :error, Parser::ERRORS[:trailing_underscore],
range(tm - 1, tm)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = "0"
elsif digits.empty?
diagnostic :error, Parser::ERRORS[:empty_numeric]
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, Parser::ERRORS[:invalid_octal],
range(invalid_s, invalid_s + 1)
end
emit(:tINTEGER, digits.to_i(@num_base), @ts, tm)
p = tm - 1
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 259 then
line 1859 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
message = Parser::ERRORS[:unexpected] % { :character => tok.inspect[1..-2] }
diagnostic :fatal, message
end
end
en 260 then
line 1 "NONE"
begin
ase @act
hen 104 then
egin begin p = (( @te))-1; end
if @lambda_stack.last == @paren_nest
@lambda_stack.pop
if tok == '{'
emit(:tLAMBEG)
else # 'do'
emit(:kDO_LAMBDA)
end
else
if tok == '{'
emit_table(PUNCTUATION)
else # 'do'
if @cond.active?
emit(:kDO_COND)
elsif @cmdarg.active?
emit(:kDO_BLOCK)
else
emit(:kDO)
end
end
end
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
hen 105 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 360; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 106 then
egin begin p = (( @te))-1; end
mit(:kCLASS, 'class', @ts, @ts + 5)
emit(:tLSHFT, '<<', @te - 2, @te)
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 107 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 108 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 763; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 109 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 546; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 110 then
egin begin p = (( @te))-1; end
emit_table(KEYWORDS)
if version?(18) && tok == 'not'
@cs = 558; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
hen 111 then
egin begin p = (( @te))-1; end
if version?(18)
emit(:tIDENTIFIER)
else
emit_table(KEYWORDS)
end
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
hen 112 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 113 then
egin begin p = (( @te))-1; end
unless (char = tok(tm, @te)).empty?
diagnostic :fatal, Parser::ERRORS[:unexpected] % { :character => char },
range(tm, tm + 1)
end
digits = tok(@num_digits_s, tm)
if digits.end_with? '_'
diagnostic :error, Parser::ERRORS[:trailing_underscore],
range(tm - 1, tm)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = "0"
elsif digits.empty?
diagnostic :error, Parser::ERRORS[:empty_numeric]
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, Parser::ERRORS[:invalid_octal],
range(invalid_s, invalid_s + 1)
end
emit(:tINTEGER, digits.to_i(@num_base), @ts, tm)
p = tm - 1
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
hen 114 then
egin begin p = (( @te))-1; end
unless (char = tok(tm, @te)).empty?
diagnostic :fatal, Parser::ERRORS[:unexpected] % { :character => char },
range(tm, tm + 1)
end
digits = tok(@ts, tm)
if digits.start_with? '.'
diagnostic :error, Parser::ERRORS[:no_dot_digit_literal]
elsif digits =~ /^[eE]/
# The rule above allows to specify floats as just `e10', which is
# certainly not a float. Send a patch if you can do this better.
emit(:tIDENTIFIER, digits, @ts, tm)
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
emit(:tFLOAT, digits.to_f, @ts, tm)
p = tm - 1
begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
hen 116 then
egin begin p = (( @te))-1; end
mit(:tCONSTANT)
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
hen 120 then
egin begin p = (( @te))-1; end
emit(:tIDENTIFIER)
if !version?(18) &&
!@static_env.nil? && @static_env.declared?(tok)
@cs = 770; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
else
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
hen 121 then
egin begin p = (( @te))-1; end
mit(:tFID, tok(@ts, tm), @ts, tm)
p = tm - 1
@cs = 508; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
nd
d
end
en 261 then
line 1872 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; p = p - 1;
begin
@cs = 770
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 262 then
line 1876 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tNL, nil, @newline_s, @newline_s + 1)
p = p - 1; @cs = 214; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 263 then
line 1876 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tNL, nil, @newline_s, @newline_s + 1)
p = p - 1; @cs = 214; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 264 then
line 1876 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin emit(:tNL, nil, @newline_s, @newline_s + 1)
p = p - 1; @cs = 214; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 265 then
line 1886 "lib/parser/lexer.rl"
begin
te = p+1
egin
emit_comment(@eq_begin_s, @te)
begin
@cs = 214
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 266 then
line 1891 "lib/parser/lexer.rl"
begin
te = p+1
end
en 267 then
line 1894 "lib/parser/lexer.rl"
begin
te = p+1
egin
diagnostic :fatal, Parser::ERRORS[:embedded_document],
range(@eq_begin_s, @eq_begin_s + '=begin'.length)
end
end
en 268 then
line 1886 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit_comment(@eq_begin_s, @te)
begin
@cs = 214
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 269 then
line 1891 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 270 then
line 1891 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
end
en 271 then
line 1904 "lib/parser/lexer.rl"
begin
te = p+1
egin @eq_begin_s = @ts
begin
@cs = 947
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 272 then
line 1908 "lib/parser/lexer.rl"
begin
te = p+1
egin p = pe - 1 end
end
en 273 then
line 1911 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 763
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 274 then
line 396 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Sit at EOF indefinitely. #advance would return $eof each time.
# This allows to feed the lexer more data if needed; this is only used
# in tests.
#
# Note that this action is not embedded into e_eof like e_nl and e_bs
# below. This is due to the fact that scanner state at EOF is observed
# by tests, and encapsulating it in a rule would break the introspection.
p = p - 1; begin
p += 1
_trigger_goto = true
_goto_level = _out
break
nd
end
end
en 275 then
line 1901 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
en 276 then
line 1904 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin @eq_begin_s = @ts
begin
@cs = 947
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 277 then
line 1911 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 763
_trigger_goto = true
_goto_level = _again
break
nd
end
end
en 278 then
line 1911 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 763
_trigger_goto = true
_goto_level = _again
break
nd
end
end
line 7679 "lib/parser/lexer.rb"
end # action switch
end
nd
f _trigger_goto
next
nd
nd
f _goto_level <= _again
acts = _lex_to_state_actions[ @cs]
nacts = _lex_actions[_acts]
acts += 1
hile _nacts > 0
_nacts -= 1
_acts += 1
case _lex_actions[_acts - 1]
en 45 then
line 1 "NONE"
begin
ts = nil; end
line 7699 "lib/parser/lexer.rb"
end # to state action switch
nd
f _trigger_goto
next
nd
f @cs == 0
_goto_level = _out
next
nd
+= 1
f p != pe
_goto_level = _resume
next
nd
nd
f _goto_level <= _test_eof
f p == eof
f _lex_eof_trans[ @cs] > 0
_trans = _lex_eof_trans[ @cs] - 1;
_goto_level = _eof_trans
next;
nd
d
nd
f _goto_level <= _out
break
nd
nd
nd
line 206 "lib/parser/lexer.rl"
# %
@p = p
if @token_queue.any?
@token_queue.shift
elsif @cs == self.class.lex_error
[ false, [ '$error', range(p - 1, p) ] ]
else
[ false, [ '$eof', range(p - 1, p) ] ]
end
end