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.
klass = self.class
_lex_trans_keys = klass.send :_lex_trans_keys
_lex_key_spans = klass.send :_lex_key_spans
_lex_index_offsets = klass.send :_lex_index_offsets
_lex_indicies = klass.send :_lex_indicies
_lex_trans_targs = klass.send :_lex_trans_targs
_lex_trans_actions = klass.send :_lex_trans_actions
_lex_to_state_actions = klass.send :_lex_to_state_actions
_lex_from_state_actions = klass.send :_lex_from_state_actions
_lex_eof_trans = klass.send :_lex_eof_trans
pe = @source_pts.size + 2
p, eof = @p, pe
@command_state = (@cs == klass.lex_en_expr_value ||
@cs == klass.lex_en_line_begin)
line 10920 "lib/parser/lexer.rb"
gin
estEof = false
slen, _trans, _keys, _inds, _acts, _nacts = nil
goto_level = 0
resume = 10
eof_trans = 15
again = 20
test_eof = 30
out = 40
hile true
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
ase _lex_from_state_actions[ @cs]
hen 80 then
line 1 "NONE"
begin
ts = p
end
line 10948 "lib/parser/lexer.rb"
nd
keys = @cs << 1
inds = _lex_index_offsets[ @cs]
slen = _lex_key_spans[ @cs]
wide = ( (@source_pts[p] || 0))
trans = if ( _slen > 0 &&
_lex_trans_keys[_keys] <= _wide &&
_wide <= _lex_trans_keys[_keys + 1]
) then
_lex_indicies[ _inds + _wide - _lex_trans_keys[_keys] ]
else
_lex_indicies[ _inds + _slen ]
end
nd
f _goto_level <= _eof_trans
@cs = _lex_trans_targs[_trans]
f _lex_trans_actions[_trans] != 0
ase _lex_trans_actions[_trans]
hen 28 then
line 492 "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
hen 99 then
line 772 "lib/parser/lexer.rl"
begin
@escape_s = p
@escape = nil
end
hen 29 then
line 812 "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
hen 67 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
hen 70 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
hen 279 then
line 1172 "lib/parser/lexer.rl"
begin
m = p end
hen 36 then
line 1441 "lib/parser/lexer.rl"
begin
m = p end
hen 38 then
line 1457 "lib/parser/lexer.rl"
begin
m = p end
hen 40 then
line 1485 "lib/parser/lexer.rl"
begin
m = p end
hen 55 then
line 1671 "lib/parser/lexer.rl"
begin
eredoc_e = p end
hen 319 then
line 1725 "lib/parser/lexer.rl"
begin
escape = nil end
hen 348 then
line 1798 "lib/parser/lexer.rl"
begin
m = p end
hen 424 then
line 2016 "lib/parser/lexer.rl"
begin
num_base = 16; @num_digits_s = p end
hen 418 then
line 2017 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = p end
hen 421 then
line 2018 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = p end
hen 415 then
line 2019 "lib/parser/lexer.rl"
begin
num_base = 2; @num_digits_s = p end
hen 430 then
line 2020 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = @ts end
hen 398 then
line 2021 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = @ts end
hen 410 then
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
hen 405 then
line 2079 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
hen 403 then
line 2080 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
hen 76 then
line 2215 "lib/parser/lexer.rl"
begin
m = p end
hen 7 then
line 1 "NONE"
begin
te = p+1
end
hen 96 then
line 1013 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DBEG, '#{'.freeze)
if current_literal.heredoc?
current_literal.saved_herebody_s = @herebody_s
@herebody_s = nil
end
current_literal.start_interp_brace
begin
@stack[ @top] = @cs
@top+= 1
@cs = 758
_goto_level = _again
next
nd
end
end
hen 5 then
line 958 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 92 then
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 91 then
line 821 "lib/parser/lexer.rl"
begin
te = p+1
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 97 then
line 958 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 94 then
line 945 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
literal.extend_space @ts, @te
end
end
hen 95 then
line 821 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 6 then
line 845 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 4 then
line 821 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 123 then
line 1013 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DBEG, '#{'.freeze)
if current_literal.heredoc?
current_literal.saved_herebody_s = @herebody_s
@herebody_s = nil
end
current_literal.start_interp_brace
begin
@stack[ @top] = @cs
@top+= 1
@cs = 758
_goto_level = _again
next
nd
end
end
hen 10 then
line 958 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 120 then
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 119 then
line 821 "lib/parser/lexer.rl"
begin
te = p+1
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 124 then
line 958 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 122 then
line 821 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 11 then
line 845 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 9 then
line 821 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 146 then
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 145 then
line 821 "lib/parser/lexer.rl"
begin
te = p+1
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 148 then
line 945 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
literal.extend_space @ts, @te
end
end
hen 149 then
line 821 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 152 then
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 151 then
line 821 "lib/parser/lexer.rl"
begin
te = p+1
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 154 then
line 821 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 161 then
line 1013 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DBEG, '#{'.freeze)
if current_literal.heredoc?
current_literal.saved_herebody_s = @herebody_s
@herebody_s = nil
end
current_literal.start_interp_brace
begin
@stack[ @top] = @cs
@top+= 1
@cs = 758
_goto_level = _again
next
nd
end
end
hen 13 then
line 958 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 158 then
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 157 then
line 821 "lib/parser/lexer.rl"
begin
te = p+1
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 162 then
line 958 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 160 then
line 821 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 12 then
line 821 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 164 then
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 163 then
line 821 "lib/parser/lexer.rl"
begin
te = p+1
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 171 then
line 1013 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DBEG, '#{'.freeze)
if current_literal.heredoc?
current_literal.saved_herebody_s = @herebody_s
@herebody_s = nil
end
current_literal.start_interp_brace
begin
@stack[ @top] = @cs
@top+= 1
@cs = 758
_goto_level = _again
next
nd
end
end
hen 15 then
line 958 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 167 then
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 166 then
line 821 "lib/parser/lexer.rl"
begin
te = p+1
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 172 then
line 958 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
current_literal.flush_string
current_literal.extend_content
emit(:tSTRING_DVAR, nil, @ts, @ts + 1)
p = @ts
begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 169 then
line 945 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
literal.extend_space @ts, @te
end
end
hen 170 then
line 821 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 14 then
line 821 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 174 then
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 173 then
line 821 "lib/parser/lexer.rl"
begin
te = p+1
egin
string = tok
# tLABEL_END is only possible in non-cond context on >= 2.2
if @version >= 22 && !@cond.active?
lookahead = @source_buffer.slice(@te...@te+2)
end
current_literal = literal
if !current_literal.heredoc? &&
(token = current_literal.nest_and_try_closing(string, @ts, @te, lookahead))
if token[0] == :tLABEL_END
p += 1
pop_literal
@cs = 751;
else
@cs = (pop_literal);
end
begin
p += 1
_goto_level = _out
next
nd
else
current_literal.extend_string(string, @ts, @te)
end
end
end
hen 176 then
line 945 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
literal.extend_space @ts, @te
end
end
hen 177 then
line 1103 "lib/parser/lexer.rl"
begin
te = p+1
egin
emit(:tREGEXP_OPT, tok(@ts, @te - 1), @ts, @te - 1)
p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 178 then
line 1091 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
unknown_options = tok.scan(/[^imxouesn]/)
if unknown_options.any?
diagnostic :error, :regexp_options,
{ :options => unknown_options.join }
end
emit(:tREGEXP_OPT)
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 16 then
line 1231 "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
_goto_level = _out
next
nd
end
end
hen 179 then
line 1231 "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
_goto_level = _out
next
nd
end
end
hen 181 then
line 1244 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if tok =~ /^@@[0-9]/
diagnostic :error, :cvar_name, { :name => tok }
end
emit(:tCVAR)
@cs = (stack_pop); begin
p += 1
_goto_level = _out
next
nd
end
end
hen 180 then
line 1254 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if tok =~ /^@[0-9]/
diagnostic :error, :ivar_name, { :name => tok }
end
emit(:tIVAR)
@cs = (stack_pop); begin
p += 1
_goto_level = _out
next
nd
end
end
hen 202 then
line 1275 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(KEYWORDS_BEGIN);
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 188 then
line 1283 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tIDENTIFIER)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 18 then
line 1287 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1
@cs = 766; begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 185 then
line 1296 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 197 then
line 1300 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 20 then
line 1306 "lib/parser/lexer.rl"
begin
te = p+1
egin
if version?(23)
type, delimiter = tok[0..-2], tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts))
_goto_level = _again
next
nd
else
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
end
hen 184 then
line 1319 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 183 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 201 then
line 1275 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(KEYWORDS_BEGIN);
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 198 then
line 1279 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tCONSTANT)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 200 then
line 1283 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tIDENTIFIER)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 195 then
line 1287 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
@cs = 766; begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 191 then
line 1296 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 196 then
line 1303 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 189 then
line 1316 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 194 then
line 1319 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 19 then
line 1296 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin emit_table(PUNCTUATION)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 17 then
line 1319 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 187 then
line 1 "NONE"
begin
ase @act
hen 39 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS_BEGIN);
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
nd
hen 40 then
egin begin p = (( @te))-1; end
mit(:tCONSTANT)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
nd
hen 41 then
egin begin p = (( @te))-1; end
mit(:tIDENTIFIER)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
nd
d
end
hen 22 then
line 1331 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tLABEL, tok(@ts, @te - 2), @ts, @te - 1)
p = p - 1; @cs = 751; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 204 then
line 1337 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 203 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 206 then
line 1334 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 205 then
line 1337 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 21 then
line 1337 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 212 then
line 1363 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 468; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 211 then
line 1369 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 210 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 222 then
line 1348 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tCONSTANT)
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
end
end
hen 213 then
line 1352 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tIDENTIFIER)
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
end
end
hen 218 then
line 1363 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 468; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 216 then
line 1366 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 221 then
line 1369 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 245 then
line 1427 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Unlike expr_beg as invoked in the next rule, do not warn
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 228 then
line 1445 "lib/parser/lexer.rl"
begin
te = p+1
egin
if tok(tm, tm + 1) == '/'.freeze
# Ambiguous regexp literal.
diagnostic :warning, :ambiguous_literal, nil, range(tm, tm + 1)
end
p = tm - 1
begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 234 then
line 1469 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 24 then
line 1477 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 236 then
line 1486 "lib/parser/lexer.rl"
begin
te = p+1
egin p = tm - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 39 then
line 1495 "lib/parser/lexer.rl"
begin
te = p+1
egin
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 223 then
line 1509 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 224 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 235 then
line 1436 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 231 then
line 1458 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
diagnostic :warning, :ambiguous_prefix, { :prefix => tok(tm, @te) },
range(tm, @te)
p = tm - 1
begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 233 then
line 1474 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 227 then
line 1495 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 226 then
line 1500 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 244 then
line 1509 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 25 then
line 1500 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
end
hen 41 then
line 1509 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 23 then
line 1 "NONE"
begin
ase @act
hen 67 then
egin begin p = (( @te))-1; end
if tok(tm, tm + 1) == '/'.freeze
# Ambiguous regexp literal.
diagnostic :warning, :ambiguous_literal, nil, range(tm, tm + 1)
end
p = tm - 1
begin
@cs = 537
_goto_level = _again
next
nd
end
hen 68 then
egin begin p = (( @te))-1; end
diagnostic :warning, :ambiguous_prefix, { :prefix => tok(tm, @te) },
range(tm, @te)
p = tm - 1
begin
@cs = 537
_goto_level = _again
next
nd
end
hen 73 then
egin begin p = (( @te))-1; end
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
lse
egin begin p = (( @te))-1; end
d
d
end
hen 43 then
line 1545 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1
begin
@cs = 468
_goto_level = _again
next
nd
end
end
hen 249 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 250 then
line 1545 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 468
_goto_level = _again
next
nd
end
end
hen 44 then
line 1545 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = @ts - 1
begin
@cs = 468
_goto_level = _again
next
nd
end
end
hen 42 then
line 1 "NONE"
begin
ase @act
hen 80 then
egin begin p = (( @te))-1; end
if @cond.active?
emit(:kDO_COND, 'do'.freeze, @te - 2, @te)
else
emit(:kDO, 'do'.freeze, @te - 2, @te)
end
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
hen 81 then
egin begin p = (( @te))-1; end
= @ts - 1
begin
@cs = 468
_goto_level = _again
next
nd
nd
d
end
hen 260 then
line 1572 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_do(true)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 253 then
line 1578 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 254 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 255 then
line 1575 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 258 then
line 1578 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 264 then
line 1602 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 263 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 272 then
line 1594 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 266 then
line 1596 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 270 then
line 1602 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 265 then
line 1 "NONE"
begin
ase @act
hen 88 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
nd
hen 89 then
egin begin p = (( @te))-1; end
= @ts - 1; begin
@cs = 537
_goto_level = _again
next
nd
nd
d
end
hen 300 then
line 1619 "lib/parser/lexer.rl"
begin
te = p+1
egin
p = p - 1;
if tok.start_with? '-'.freeze
emit(:tUMINUS_NUM, '-'.freeze, @ts, @ts + 1)
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
end
hen 301 then
line 1639 "lib/parser/lexer.rl"
begin
te = p+1
egin
type = delimiter = tok[0].chr
p = p - 1; begin
@cs = (push_literal(type, delimiter, @ts))
_goto_level = _again
next
nd
end
end
hen 295 then
line 1646 "lib/parser/lexer.rl"
begin
te = p+1
egin
type, delimiter = @source_buffer.slice(@ts).chr, tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts))
_goto_level = _again
next
nd
end
end
hen 51 then
line 1653 "lib/parser/lexer.rl"
begin
te = p+1
egin
type, delimiter = tok[0..-2], tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts))
_goto_level = _again
next
nd
end
end
hen 302 then
line 1699 "lib/parser/lexer.rl"
begin
te = p+1
egin
type, delimiter = tok, tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts))
_goto_level = _again
next
nd
end
end
hen 54 then
line 1713 "lib/parser/lexer.rl"
begin
te = p+1
egin
emit(:tSYMBOL, tok(@ts + 1), @ts)
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 316 then
line 1744 "lib/parser/lexer.rl"
begin
te = p+1
egin
escape = { " " => '\s', "\r" => '\r', "\n" => '\n', "\t" => '\t',
"\v" => '\v', "\f" => '\f' }[@source_buffer.slice(@ts + 1)]
diagnostic :warning, :invalid_escape_use, { :escape => escape }, range
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 315 then
line 1754 "lib/parser/lexer.rl"
begin
te = p+1
egin
diagnostic :fatal, :incomplete_escape, nil, range(@ts, @ts + 1)
end
end
hen 303 then
line 1793 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION_BEGIN)
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 48 then
line 1813 "lib/parser/lexer.rl"
begin
te = p+1
egin
p = p - 1;
if version?(18)
ident = tok(@ts, @te - 2)
emit((@source_buffer.slice(@ts) =~ /[A-Z]/) ? :tCONSTANT : :tIDENTIFIER,
ident, @ts, @te - 2)
p = p - 1; # continue as a symbol
if !@static_env.nil? && @static_env.declared?(ident)
@cs = 766;
else
@cs = (arg_or_cmdarg);
end
else
emit(:tLABEL, tok(@ts, @te - 2), @ts, @te - 1)
@cs = 751;
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 289 then
line 1859 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1
begin
@cs = 165
_goto_level = _again
next
nd
end
end
hen 52 then
line 1872 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 275 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 299 then
line 1629 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tSTAR, '*'.freeze)
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 296 then
line 1653 "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))
_goto_level = _again
next
nd
end
end
hen 294 then
line 1659 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
diagnostic :fatal, :string_eof, nil, range(@ts, @ts + 1)
end
end
hen 304 then
line 1713 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1), @ts)
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 314 then
line 1754 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
diagnostic :fatal, :incomplete_escape, nil, range(@ts, @ts + 1)
end
end
hen 320 then
line 1760 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 297 then
line 1793 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION_BEGIN)
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 342 then
line 1216 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tIDENTIFIER)
if !@static_env.nil? && @static_env.declared?(tok)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
else
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
end
end
end
hen 286 then
line 1856 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 288 then
line 1859 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 165
_goto_level = _again
next
nd
end
end
hen 291 then
line 1872 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 50 then
line 1659 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
diagnostic :fatal, :string_eof, nil, range(@ts, @ts + 1)
end
end
hen 57 then
line 1727 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 49 then
line 1856 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
end
hen 53 then
line 1872 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = @ts - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 47 then
line 1 "NONE"
begin
ase @act
hen 111 then
egin begin p = (( @te))-1; end
mit_table(PUNCTUATION_BEGIN)
begin
p += 1
_goto_level = _out
next
nd
nd
hen 112 then
egin begin p = (( @te))-1; end
mit(:kRESCUE, 'rescue'.freeze, @ts, tm)
p = tm - 1
@cs = 513; begin
p += 1
_goto_level = _out
next
nd
nd
hen 113 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS_BEGIN)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
nd
hen 115 then
egin begin p = (( @te))-1; end
= @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
nd
hen 116 then
egin begin p = (( @te))-1; end
emit(:tIDENTIFIER)
if !@static_env.nil? && @static_env.declared?(tok)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
else
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
end
end
hen 119 then
egin begin p = (( @te))-1; end
= @ts - 1; begin
@cs = 766
_goto_level = _again
next
nd
nd
d
end
hen 350 then
line 1892 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 351 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 352 then
line 1880 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 356 then
line 1892 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 60 then
line 1902 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 360 then
line 1907 "lib/parser/lexer.rl"
begin
te = p+1
egin
begin
@cs = (push_literal(tok, tok, @ts))
_goto_level = _again
next
nd
end
end
hen 359 then
line 1917 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 358 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 362 then
line 1911 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 361 then
line 1917 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 59 then
line 1917 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 537
_goto_level = _again
next
nd
end
end
hen 392 then
line 1928 "lib/parser/lexer.rl"
begin
te = p+1
egin
emit(:tLAMBDA, '->'.freeze, @ts, @ts + 2)
@lambda_stack.push @paren_nest
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 74 then
line 1965 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:kCLASS, 'class'.freeze, @ts, @ts + 5)
emit(:tLSHFT, '<<'.freeze, @te - 2, @te)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 370 then
line 2100 "lib/parser/lexer.rl"
begin
te = p+1
egin
type, delimiter = tok, tok[-1].chr
begin
@cs = (push_literal(type, delimiter, @ts, nil, false, false, true))
_goto_level = _again
next
nd
end
end
hen 62 then
line 2118 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1; begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 389 then
line 2125 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 447; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 383 then
line 2152 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 376 then
line 2156 "lib/parser/lexer.rl"
begin
te = p+1
egin
emit_table(PUNCTUATION)
@cond.lexpop; @cmdarg.lexpop
if RBRACE_OR_RBRACK.include?(tok)
@cs = 505;
else # )
# fnext expr_endfn; ?
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 388 then
line 2170 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tOP_ASGN, tok(@ts, @te - 1))
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 374 then
line 2174 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tEH, '?'.freeze)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 371 then
line 2182 "lib/parser/lexer.rl"
begin
te = p+1
egin emit_table(PUNCTUATION)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 373 then
line 2195 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tSEMI, ';'.freeze)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 438 then
line 2198 "lib/parser/lexer.rl"
begin
te = p+1
egin
diagnostic :error, :bare_backslash, nil, range(@ts, @ts + 1)
p = p - 1;
end
end
hen 369 then
line 2204 "lib/parser/lexer.rl"
begin
te = p+1
egin
diagnostic :fatal, :unexpected, { :character => tok.inspect[1..-2] }
end
end
hen 368 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 448 then
line 1961 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(KEYWORDS)
@cs = 327; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 446 then
line 1965 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:kCLASS, 'class'.freeze, @ts, @ts + 5)
emit(:tLSHFT, '<<'.freeze, @te - 2, @te)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 445 then
line 1976 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(KEYWORDS)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 395 then
line 2050 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
diagnostic :error, :no_dot_digit_literal
end
end
hen 435 then
line 2110 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tCONSTANT)
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
end
end
hen 387 then
line 2118 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1; begin
@stack[ @top] = @cs
@top+= 1
@cs = 322
_goto_level = _again
next
nd
end
end
hen 393 then
line 2125 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 447; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 440 then
line 1216 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tIDENTIFIER)
if !@static_env.nil? && @static_env.declared?(tok)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
else
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
end
end
end
hen 382 then
line 2152 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 394 then
line 2182 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 380 then
line 2189 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 386 then
line 2204 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
diagnostic :fatal, :unexpected, { :character => tok.inspect[1..-2] }
end
end
hen 63 then
line 2050 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
diagnostic :error, :no_dot_digit_literal
end
end
hen 61 then
line 2204 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin
diagnostic :fatal, :unexpected, { :character => tok.inspect[1..-2] }
end
end
hen 64 then
line 1 "NONE"
begin
ase @act
hen 132 then
egin begin p = (( @te))-1; end
if @lambda_stack.last == @paren_nest
@lambda_stack.pop
if tok == '{'.freeze
emit(:tLAMBEG, '{'.freeze)
else # 'do'
emit(:kDO_LAMBDA, 'do'.freeze)
end
else
if tok == '{'.freeze
emit(:tLCURLY, '{'.freeze)
else # 'do'
emit_do
end
end
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
hen 133 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 327; begin
p += 1
_goto_level = _out
next
nd
nd
hen 134 then
egin begin p = (( @te))-1; end
mit(:kCLASS, 'class'.freeze, @ts, @ts + 5)
emit(:tLSHFT, '<<'.freeze, @te - 2, @te)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
nd
hen 135 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
nd
hen 136 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
nd
hen 137 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 513; begin
p += 1
_goto_level = _out
next
nd
nd
hen 138 then
egin begin p = (( @te))-1; end
emit_table(KEYWORDS)
if version?(18) && tok == 'not'.freeze
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
else
@cs = 468; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 139 then
egin begin p = (( @te))-1; end
if version?(18)
emit(:tIDENTIFIER)
unless !@static_env.nil? && @static_env.declared?(tok)
@cs = (arg_or_cmdarg);
end
else
emit(:k__ENCODING__, '__ENCODING__'.freeze)
end
begin
p += 1
_goto_level = _out
next
nd
end
hen 140 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
begin
p += 1
_goto_level = _out
next
nd
nd
hen 141 then
egin begin p = (( @te))-1; end
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
hen 143 then
egin begin p = (( @te))-1; end
if version?(18, 19, 20)
diagnostic :error,
:trailing_in_number, { :character => tok(@te - 1, @te) },
range(@te - 1, @te)
else
emit(:tINTEGER, tok(@ts, @te - 1).to_i, @ts, @te - 1)
p = p - 1; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 144 then
egin begin p = (( @te))-1; end
if version?(18, 19, 20)
diagnostic :error,
:trailing_in_number, { :character => tok(@te - 1, @te) },
range(@te - 1, @te)
else
emit(:tFLOAT, tok(@ts, @te - 1).to_f, @ts, @te - 1)
p = p - 1; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 145 then
egin begin p = (( @te))-1; end
digits = tok(@ts, @num_suffix_s)
if version?(18, 19, 20)
emit(:tFLOAT, Float(digits), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits)
end
begin
p += 1
_goto_level = _out
next
nd
end
hen 147 then
egin begin p = (( @te))-1; end
mit(:tCONSTANT)
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
nd
hen 151 then
egin begin p = (( @te))-1; end
emit(:tIDENTIFIER)
if !@static_env.nil? && @static_env.declared?(tok)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
else
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
end
end
hen 152 then
egin begin p = (( @te))-1; end
if tm == @te
# Suffix was consumed, e.g. foo!
emit(:tFID)
else
# Suffix was not consumed, e.g. foo!=
emit(:tIDENTIFIER, tok(@ts, tm), @ts, tm)
p = tm - 1
end
@cs = 468; begin
p += 1
_goto_level = _out
next
nd
end
d
end
hen 78 then
line 2216 "lib/parser/lexer.rl"
begin
te = p+1
egin p = tm - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 453 then
line 2219 "lib/parser/lexer.rl"
begin
te = p+1
egin emit(:tNL, nil, @newline_s, @newline_s + 1)
p = p - 1; @cs = 165; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 454 then
line 2219 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tNL, nil, @newline_s, @newline_s + 1)
p = p - 1; @cs = 165; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 75 then
line 2219 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin emit(:tNL, nil, @newline_s, @newline_s + 1)
p = p - 1; @cs = 165; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 457 then
line 2229 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit_comment(@eq_begin_s, @te)
begin
@cs = 165
_goto_level = _again
next
nd
end
end
hen 456 then
line 2237 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
diagnostic :fatal, :embedded_document, nil,
range(@eq_begin_s, @eq_begin_s + '=begin'.length)
end
end
hen 89 then
line 2247 "lib/parser/lexer.rl"
begin
te = p+1
egin @eq_begin_s = @ts
begin
@cs = 942
_goto_level = _again
next
nd
end
end
hen 2 then
line 2251 "lib/parser/lexer.rl"
begin
te = p+1
egin p = pe - 3 end
end
hen 81 then
line 2254 "lib/parser/lexer.rl"
begin
te = p+1
egin p = p - 1; begin
@cs = 758
_goto_level = _again
next
nd
end
end
hen 82 then
line 518 "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_heredoc_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
_goto_level = _out
next
nd
end
end
hen 83 then
line 2244 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 88 then
line 2247 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin @eq_begin_s = @ts
begin
@cs = 942
_goto_level = _again
next
nd
end
end
hen 87 then
line 2254 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 758
_goto_level = _again
next
nd
end
end
hen 1 then
line 2254 "lib/parser/lexer.rl"
begin
egin p = (( @te))-1; end
egin p = p - 1; begin
@cs = 758
_goto_level = _again
next
nd
end
end
hen 73 then
line 492 "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
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
hen 93 then
line 492 "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
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 121 then
line 492 "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
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 147 then
line 492 "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
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 153 then
line 492 "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
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 159 then
line 492 "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
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 165 then
line 492 "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
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 168 then
line 492 "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
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 175 then
line 492 "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
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
hen 246 then
line 492 "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
line 1427 "lib/parser/lexer.rl"
begin
te = p+1
egin
# Unlike expr_beg as invoked in the next rule, do not warn
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 237 then
line 492 "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
line 1486 "lib/parser/lexer.rl"
begin
te = p+1
egin p = tm - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 229 then
line 492 "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
line 1495 "lib/parser/lexer.rl"
begin
te = p+1
egin
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 317 then
line 492 "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
line 1744 "lib/parser/lexer.rl"
begin
te = p+1
egin
escape = { " " => '\s', "\r" => '\r', "\n" => '\n', "\t" => '\t',
"\v" => '\v', "\f" => '\f' }[@source_buffer.slice(@ts + 1)]
diagnostic :warning, :invalid_escape_use, { :escape => escape }, range
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 290 then
line 492 "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
line 1859 "lib/parser/lexer.rl"
begin
te = p+1
egin p = @ts - 1
begin
@cs = 165
_goto_level = _again
next
nd
end
end
hen 458 then
line 492 "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
line 2229 "lib/parser/lexer.rl"
begin
te = p+1
egin
emit_comment(@eq_begin_s, @te)
begin
@cs = 165
_goto_level = _again
next
nd
end
end
hen 455 then
line 492 "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
line 2234 "lib/parser/lexer.rl"
begin
te = p+1
end
hen 90 then
line 492 "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
line 2247 "lib/parser/lexer.rl"
begin
te = p+1
egin @eq_begin_s = @ts
begin
@cs = 942
_goto_level = _again
next
nd
end
end
hen 3 then
line 492 "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
line 2251 "lib/parser/lexer.rl"
begin
te = p+1
egin p = pe - 3 end
end
hen 412 then
line 626 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tRATIONAL, Rational(chars)) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 411 then
line 627 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tIMAGINARY, Complex(0, chars)) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 413 then
line 628 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tIMAGINARY, Complex(0, Rational(chars))) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 406 then
line 632 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tIMAGINARY, Complex(0, Float(chars))) } end
line 2082 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@ts, @num_suffix_s)
if version?(18, 19, 20)
emit(:tFLOAT, Float(digits), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits)
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 407 then
line 636 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tRATIONAL, Rational(chars)) } end
line 2082 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@ts, @num_suffix_s)
if version?(18, 19, 20)
emit(:tFLOAT, Float(digits), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits)
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 408 then
line 637 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tIMAGINARY, Complex(0, Rational(chars))) } end
line 2082 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@ts, @num_suffix_s)
if version?(18, 19, 20)
emit(:tFLOAT, Float(digits), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits)
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 116 then
line 652 "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
diagnostic :error, :unicode_point_too_large, nil,
range(codepoint_s, codepoint_s + codepoint_str.length)
break
end
@escape += codepoint.chr(Encoding::UTF_8)
codepoint_s += codepoint_str.length + 1
end
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 142 then
line 652 "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
diagnostic :error, :unicode_point_too_large, nil,
range(codepoint_s, codepoint_s + codepoint_str.length)
break
end
@escape += codepoint.chr(Encoding::UTF_8)
codepoint_s += codepoint_str.length + 1
end
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 338 then
line 652 "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
diagnostic :error, :unicode_point_too_large, nil,
range(codepoint_s, codepoint_s + codepoint_str.length)
break
end
@escape += codepoint.chr(Encoding::UTF_8)
codepoint_s += codepoint_str.length + 1
end
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 100 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 126 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 322 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 103 then
line 679 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_escape
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 129 then
line 679 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_escape
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 325 then
line 679 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_escape
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 105 then
line 698 "lib/parser/lexer.rl"
begin
escape = "\x7f" end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 131 then
line 698 "lib/parser/lexer.rl"
begin
escape = "\x7f" end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 327 then
line 698 "lib/parser/lexer.rl"
begin
escape = "\x7f" end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 102 then
line 705 "lib/parser/lexer.rl"
begin
escape = encode_escape(tok(@escape_s, p).to_i(8) % 0x100) end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 128 then
line 705 "lib/parser/lexer.rl"
begin
escape = encode_escape(tok(@escape_s, p).to_i(8) % 0x100) end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 324 then
line 705 "lib/parser/lexer.rl"
begin
escape = encode_escape(tok(@escape_s, p).to_i(8) % 0x100) end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 118 then
line 709 "lib/parser/lexer.rl"
begin
escape = encode_escape(tok(@escape_s + 1, p).to_i(16)) end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 144 then
line 709 "lib/parser/lexer.rl"
begin
escape = encode_escape(tok(@escape_s + 1, p).to_i(16)) end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 340 then
line 709 "lib/parser/lexer.rl"
begin
escape = encode_escape(tok(@escape_s + 1, p).to_i(16)) end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 113 then
line 713 "lib/parser/lexer.rl"
begin
escape = tok(@escape_s + 1, p).to_i(16).chr(Encoding::UTF_8) end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 139 then
line 713 "lib/parser/lexer.rl"
begin
escape = tok(@escape_s + 1, p).to_i(16).chr(Encoding::UTF_8) end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 335 then
line 713 "lib/parser/lexer.rl"
begin
escape = tok(@escape_s + 1, p).to_i(16).chr(Encoding::UTF_8) end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 117 then
line 717 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_hex_escape, nil, range(@escape_s - 1, p + 2)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 143 then
line 717 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_hex_escape, nil, range(@escape_s - 1, p + 2)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 339 then
line 717 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_hex_escape, nil, range(@escape_s - 1, p + 2)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 112 then
line 729 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_unicode_escape, nil, range(@escape_s - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 138 then
line 729 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_unicode_escape, nil, range(@escape_s - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 334 then
line 729 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_unicode_escape, nil, range(@escape_s - 1, p)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 115 then
line 740 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :unterminated_unicode, nil, range(p - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 141 then
line 740 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :unterminated_unicode, nil, range(p - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 337 then
line 740 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :unterminated_unicode, nil, range(p - 1, p)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 101 then
line 766 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :escape_eof, nil, range(p - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 127 then
line 766 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :escape_eof, nil, range(p - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 323 then
line 766 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :escape_eof, nil, range(p - 1, p)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 150 then
line 772 "lib/parser/lexer.rl"
begin
@escape_s = p
@escape = nil
end
line 845 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 155 then
line 772 "lib/parser/lexer.rl"
begin
@escape_s = p
@escape = nil
end
line 845 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 66 then
line 812 "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
line 492 "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
hen 30 then
line 812 "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
line 1441 "lib/parser/lexer.rl"
begin
m = p end
hen 32 then
line 812 "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
line 1457 "lib/parser/lexer.rl"
begin
m = p end
hen 34 then
line 812 "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
line 1485 "lib/parser/lexer.rl"
begin
m = p end
hen 190 then
line 812 "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
line 1316 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 209 then
line 812 "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
line 1334 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 217 then
line 812 "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
line 1366 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 33 then
line 812 "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
line 1495 "lib/parser/lexer.rl"
begin
te = p+1
egin
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 248 then
line 812 "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
line 1500 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 240 then
line 812 "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
line 1506 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 259 then
line 812 "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
line 1575 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 271 then
line 812 "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
line 1596 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 267 then
line 812 "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
line 1599 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 287 then
line 812 "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
line 1856 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 357 then
line 812 "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
line 1880 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 353 then
line 812 "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
line 1883 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if @in_kwarg
p = p - 1; begin
@cs = 766
_goto_level = _again
next
nd
else
begin
@cs = 165
_goto_level = _again
next
nd
end
end
end
hen 366 then
line 812 "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
line 1911 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 363 then
line 812 "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
line 1914 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin begin
@cs = 165
_goto_level = _again
next
nd
end
end
hen 439 then
line 812 "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
line 2189 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 381 then
line 812 "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
line 2192 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin begin
@cs = 939
_goto_level = _again
next
nd
end
end
hen 84 then
line 812 "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
line 2244 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 239 then
line 983 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
current_literal = literal
if current_literal
current_literal.start_interp_brace
end
end
line 1410 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if @lambda_stack.last == @paren_nest
p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
else
emit(:tLCURLY, '{'.freeze, @te - 1, @te)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
end
end
hen 261 then
line 983 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
current_literal = literal
if current_literal
current_literal.start_interp_brace
end
end
line 1568 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLBRACE_ARG, '{'.freeze)
@cs = 758; end
end
hen 349 then
line 983 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
current_literal = literal
if current_literal
current_literal.start_interp_brace
end
end
line 1771 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if @lambda_stack.last == @paren_nest
@lambda_stack.pop
emit(:tLAMBEG, '{'.freeze)
else
emit(:tLBRACE, '{'.freeze)
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 451 then
line 983 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
current_literal = literal
if current_literal
current_literal.start_interp_brace
end
end
line 1936 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if @lambda_stack.last == @paren_nest
@lambda_stack.pop
if tok == '{'.freeze
emit(:tLAMBEG, '{'.freeze)
else # 'do'
emit(:kDO_LAMBDA, 'do'.freeze)
end
else
if tok == '{'.freeze
emit(:tLCURLY, '{'.freeze)
else # 'do'
emit_do
end
end
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 452 then
line 992 "lib/parser/lexer.rl"
begin
current_literal = literal
if current_literal
if current_literal.end_interp_brace_and_try_closing
if version?(18, 19)
emit(:tRCURLY, '}'.freeze, p - 1, p)
else
emit(:tSTRING_DEND, '}'.freeze, p - 1, p)
end
if current_literal.saved_herebody_s
@herebody_s = current_literal.saved_herebody_s
end
p = p - 1;
@cs = (stack_pop);
begin
p += 1
_goto_level = _out
next
nd
end
end
end
line 2156 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit_table(PUNCTUATION)
@cond.lexpop; @cmdarg.lexpop
if RBRACE_OR_RBRACK.include?(tok)
@cs = 505;
else # )
# fnext expr_endfn; ?
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 68 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
hen 71 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 492 "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
hen 193 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1316 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 208 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1334 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 220 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1366 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 242 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1503 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 257 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1575 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 269 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1596 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 293 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1856 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 355 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1880 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 365 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1911 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 385 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 2189 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 86 then
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 2244 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 214 then
line 1172 "lib/parser/lexer.rl"
begin
m = p end
line 1356 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tFID, tok(@ts, tm), @ts, tm)
@cs = (arg_or_cmdarg); p = tm - 1; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 305 then
line 1172 "lib/parser/lexer.rl"
begin
m = p end
line 1705 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1, tm), @ts, tm)
p = tm - 1
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 278 then
line 1172 "lib/parser/lexer.rl"
begin
m = p end
line 1844 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 378 then
line 1172 "lib/parser/lexer.rl"
begin
m = p end
line 1 "NONE"
begin
ase @act
hen 132 then
egin begin p = (( @te))-1; end
if @lambda_stack.last == @paren_nest
@lambda_stack.pop
if tok == '{'.freeze
emit(:tLAMBEG, '{'.freeze)
else # 'do'
emit(:kDO_LAMBDA, 'do'.freeze)
end
else
if tok == '{'.freeze
emit(:tLCURLY, '{'.freeze)
else # 'do'
emit_do
end
end
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
end
hen 133 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 327; begin
p += 1
_goto_level = _out
next
nd
nd
hen 134 then
egin begin p = (( @te))-1; end
mit(:kCLASS, 'class'.freeze, @ts, @ts + 5)
emit(:tLSHFT, '<<'.freeze, @te - 2, @te)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
nd
hen 135 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
nd
hen 136 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
nd
hen 137 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
@cs = 513; begin
p += 1
_goto_level = _out
next
nd
nd
hen 138 then
egin begin p = (( @te))-1; end
emit_table(KEYWORDS)
if version?(18) && tok == 'not'.freeze
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
else
@cs = 468; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 139 then
egin begin p = (( @te))-1; end
if version?(18)
emit(:tIDENTIFIER)
unless !@static_env.nil? && @static_env.declared?(tok)
@cs = (arg_or_cmdarg);
end
else
emit(:k__ENCODING__, '__ENCODING__'.freeze)
end
begin
p += 1
_goto_level = _out
next
nd
end
hen 140 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS)
begin
p += 1
_goto_level = _out
next
nd
nd
hen 141 then
egin begin p = (( @te))-1; end
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
hen 143 then
egin begin p = (( @te))-1; end
if version?(18, 19, 20)
diagnostic :error,
:trailing_in_number, { :character => tok(@te - 1, @te) },
range(@te - 1, @te)
else
emit(:tINTEGER, tok(@ts, @te - 1).to_i, @ts, @te - 1)
p = p - 1; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 144 then
egin begin p = (( @te))-1; end
if version?(18, 19, 20)
diagnostic :error,
:trailing_in_number, { :character => tok(@te - 1, @te) },
range(@te - 1, @te)
else
emit(:tFLOAT, tok(@ts, @te - 1).to_f, @ts, @te - 1)
p = p - 1; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 145 then
egin begin p = (( @te))-1; end
digits = tok(@ts, @num_suffix_s)
if version?(18, 19, 20)
emit(:tFLOAT, Float(digits), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits)
end
begin
p += 1
_goto_level = _out
next
nd
end
hen 147 then
egin begin p = (( @te))-1; end
mit(:tCONSTANT)
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
nd
hen 151 then
egin begin p = (( @te))-1; end
emit(:tIDENTIFIER)
if !@static_env.nil? && @static_env.declared?(tok)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
else
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
end
end
hen 152 then
egin begin p = (( @te))-1; end
if tm == @te
# Suffix was consumed, e.g. foo!
emit(:tFID)
else
# Suffix was not consumed, e.g. foo!=
emit(:tIDENTIFIER, tok(@ts, tm), @ts, tm)
p = tm - 1
end
@cs = 468; begin
p += 1
_goto_level = _out
next
nd
end
d
end
hen 215 then
line 1173 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1356 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tFID, tok(@ts, tm), @ts, tm)
@cs = (arg_or_cmdarg); p = tm - 1; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 306 then
line 1173 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1705 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1, tm), @ts, tm)
p = tm - 1
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 280 then
line 1173 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1844 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 379 then
line 1173 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 2132 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if tm == @te
# Suffix was consumed, e.g. foo!
emit(:tFID)
else
# Suffix was not consumed, e.g. foo!=
emit(:tIDENTIFIER, tok(@ts, tm), @ts, tm)
p = tm - 1
end
@cs = 468; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 307 then
line 1178 "lib/parser/lexer.rl"
begin
m = p end
line 1705 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1, tm), @ts, tm)
p = tm - 1
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 281 then
line 1178 "lib/parser/lexer.rl"
begin
m = p end
line 1844 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 308 then
line 1179 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1705 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1, tm), @ts, tm)
p = tm - 1
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 282 then
line 1179 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1844 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 312 then
line 1180 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1705 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1, tm), @ts, tm)
p = tm - 1
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 285 then
line 1180 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1844 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 311 then
line 1181 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1705 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1, tm), @ts, tm)
p = tm - 1
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 284 then
line 1181 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1 "NONE"
begin
ase @act
hen 111 then
egin begin p = (( @te))-1; end
mit_table(PUNCTUATION_BEGIN)
begin
p += 1
_goto_level = _out
next
nd
nd
hen 112 then
egin begin p = (( @te))-1; end
mit(:kRESCUE, 'rescue'.freeze, @ts, tm)
p = tm - 1
@cs = 513; begin
p += 1
_goto_level = _out
next
nd
nd
hen 113 then
egin begin p = (( @te))-1; end
mit_table(KEYWORDS_BEGIN)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
nd
hen 115 then
egin begin p = (( @te))-1; end
= @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
nd
hen 116 then
egin begin p = (( @te))-1; end
emit(:tIDENTIFIER)
if !@static_env.nil? && @static_env.declared?(tok)
@cs = 440; begin
p += 1
_goto_level = _out
next
nd
else
@cs = (arg_or_cmdarg); begin
p += 1
_goto_level = _out
next
nd
end
end
hen 119 then
egin begin p = (( @te))-1; end
= @ts - 1; begin
@cs = 766
_goto_level = _again
next
nd
nd
d
end
hen 309 then
line 1182 "lib/parser/lexer.rl"
begin
m = p - 3 end
line 1705 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1, tm), @ts, tm)
p = tm - 1
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 283 then
line 1182 "lib/parser/lexer.rl"
begin
m = p - 3 end
line 1844 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin p = @ts - 1
begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 310 then
line 1187 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 1705 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tSYMBOL, tok(@ts + 1, tm), @ts, tm)
p = tm - 1
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 434 then
line 1192 "lib/parser/lexer.rl"
begin
m = p - 2 end
line 2114 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tCONSTANT, tok(@ts, tm), @ts, tm)
p = tm - 1; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 238 then
line 1198 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
end
line 1404 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLBRACK, '['.freeze, @te - 1, @te)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 341 then
line 1198 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
end
line 1783 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLBRACK, '['.freeze)
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 437 then
line 1198 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
end
line 2178 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLBRACK2, '['.freeze)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 230 then
line 1205 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
@paren_nest += 1
end
line 1385 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
if version?(18)
emit(:tLPAREN2, '('.freeze, @te - 1, @te)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
else
emit(:tLPAREN_ARG, '('.freeze, @te - 1, @te)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
end
hen 243 then
line 1205 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
@paren_nest += 1
end
line 1398 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLPAREN2, '('.freeze)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 251 then
line 1205 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
@paren_nest += 1
end
line 1522 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit(:tLPAREN_ARG, '('.freeze, @te - 1, @te)
if version?(18)
@cs = 758; begin
p += 1
_goto_level = _out
next
nd
else
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
end
hen 298 then
line 1205 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
@paren_nest += 1
end
line 1788 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:tLPAREN, '('.freeze)
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 390 then
line 1205 "lib/parser/lexer.rl"
begin
@cond.push(false); @cmdarg.push(false)
@paren_nest += 1
end
line 2152 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit_table(PUNCTUATION)
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 391 then
line 1211 "lib/parser/lexer.rl"
begin
@paren_nest -= 1
end
line 2156 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
emit_table(PUNCTUATION)
@cond.lexpop; @cmdarg.lexpop
if RBRACE_OR_RBRACK.include?(tok)
@cs = 505;
else # )
# fnext expr_endfn; ?
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 56 then
line 1671 "lib/parser/lexer.rl"
begin
eredoc_e = p end
line 492 "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
hen 313 then
line 1672 "lib/parser/lexer.rl"
begin
ew_herebody_s = p end
line 1673 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
tok(@ts, heredoc_e) =~ /^<<(-?)(~?)(["'`]?)(.*)\3$/
indent = !$1.empty? || !$2.empty?
dedent_body = !$2.empty?
type = $3.empty? ? '<<"'.freeze : ('<<'.freeze + $3)
delimiter = $4
if dedent_body && version?(18, 19, 20, 21, 22)
emit(:tLSHFT, '<<'.freeze, @ts, @ts + 2)
p = @ts + 1
@cs = 537; begin
p += 1
_goto_level = _out
next
nd
else
@cs = (push_literal(type, delimiter, @ts, heredoc_e, indent, dedent_body));
@herebody_s ||= new_herebody_s
p = @herebody_s - 1
end
end
end
hen 318 then
line 1725 "lib/parser/lexer.rl"
begin
escape = nil end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 345 then
line 1798 "lib/parser/lexer.rl"
begin
m = p end
line 1799 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin emit(:kRESCUE, 'rescue'.freeze, @ts, tm)
p = tm - 1
@cs = 513; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 425 then
line 2016 "lib/parser/lexer.rl"
begin
num_base = 16; @num_digits_s = p end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
hen 419 then
line 2017 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = p end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
hen 422 then
line 2018 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = p end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
hen 416 then
line 2019 "lib/parser/lexer.rl"
begin
num_base = 2; @num_digits_s = p end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
hen 431 then
line 2020 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = @ts end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
hen 400 then
line 2021 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = @ts end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
hen 432 then
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
hen 77 then
line 2215 "lib/parser/lexer.rl"
begin
m = p end
line 2216 "lib/parser/lexer.rl"
begin
te = p+1
egin p = tm - 1; begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 8 then
line 1 "NONE"
begin
te = p+1
end
line 492 "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
hen 199 then
line 1 "NONE"
begin
te = p+1
end
line 1275 "lib/parser/lexer.rl"
begin
act = 39; end
hen 186 then
line 1 "NONE"
begin
te = p+1
end
line 1279 "lib/parser/lexer.rl"
begin
act = 40; end
hen 182 then
line 1 "NONE"
begin
te = p+1
end
line 1283 "lib/parser/lexer.rl"
begin
act = 41; end
hen 26 then
line 1 "NONE"
begin
te = p+1
end
line 1445 "lib/parser/lexer.rl"
begin
act = 67; end
hen 232 then
line 1 "NONE"
begin
te = p+1
end
line 1458 "lib/parser/lexer.rl"
begin
act = 68; end
hen 27 then
line 1 "NONE"
begin
te = p+1
end
line 1495 "lib/parser/lexer.rl"
begin
act = 73; end
hen 225 then
line 1 "NONE"
begin
te = p+1
end
line 1500 "lib/parser/lexer.rl"
begin
act = 74; end
hen 252 then
line 1 "NONE"
begin
te = p+1
end
line 1532 "lib/parser/lexer.rl"
begin
act = 80; end
hen 45 then
line 1 "NONE"
begin
te = p+1
end
line 1545 "lib/parser/lexer.rl"
begin
act = 81; end
hen 273 then
line 1 "NONE"
begin
te = p+1
end
line 1590 "lib/parser/lexer.rl"
begin
act = 88; end
hen 262 then
line 1 "NONE"
begin
te = p+1
end
line 1594 "lib/parser/lexer.rl"
begin
act = 89; end
hen 276 then
line 1 "NONE"
begin
te = p+1
end
line 1793 "lib/parser/lexer.rl"
begin
act = 111; end
hen 344 then
line 1 "NONE"
begin
te = p+1
end
line 1799 "lib/parser/lexer.rl"
begin
act = 112; end
hen 343 then
line 1 "NONE"
begin
te = p+1
end
line 1805 "lib/parser/lexer.rl"
begin
act = 113; end
hen 58 then
line 1 "NONE"
begin
te = p+1
end
line 1844 "lib/parser/lexer.rl"
begin
act = 115; end
hen 274 then
line 1 "NONE"
begin
te = p+1
end
line 1216 "lib/parser/lexer.rl"
begin
act = 116; end
hen 277 then
line 1 "NONE"
begin
te = p+1
end
line 1872 "lib/parser/lexer.rl"
begin
act = 119; end
hen 447 then
line 1 "NONE"
begin
te = p+1
end
line 1936 "lib/parser/lexer.rl"
begin
act = 132; end
hen 442 then
line 1 "NONE"
begin
te = p+1
end
line 1961 "lib/parser/lexer.rl"
begin
act = 133; end
hen 450 then
line 1 "NONE"
begin
te = p+1
end
line 1971 "lib/parser/lexer.rl"
begin
act = 135; end
hen 443 then
line 1 "NONE"
begin
te = p+1
end
line 1976 "lib/parser/lexer.rl"
begin
act = 136; end
hen 444 then
line 1 "NONE"
begin
te = p+1
end
line 1980 "lib/parser/lexer.rl"
begin
act = 137; end
hen 449 then
line 1 "NONE"
begin
te = p+1
end
line 1984 "lib/parser/lexer.rl"
begin
act = 138; end
hen 441 then
line 1 "NONE"
begin
te = p+1
end
line 1995 "lib/parser/lexer.rl"
begin
act = 139; end
hen 436 then
line 1 "NONE"
begin
te = p+1
end
line 2009 "lib/parser/lexer.rl"
begin
act = 140; end
hen 372 then
line 1 "NONE"
begin
te = p+1
end
line 2023 "lib/parser/lexer.rl"
begin
act = 141; end
hen 402 then
line 1 "NONE"
begin
te = p+1
end
line 2067 "lib/parser/lexer.rl"
begin
act = 144; end
hen 65 then
line 1 "NONE"
begin
te = p+1
end
line 2082 "lib/parser/lexer.rl"
begin
act = 145; end
hen 375 then
line 1 "NONE"
begin
te = p+1
end
line 2110 "lib/parser/lexer.rl"
begin
act = 147; end
hen 367 then
line 1 "NONE"
begin
te = p+1
end
line 1216 "lib/parser/lexer.rl"
begin
act = 151; end
hen 377 then
line 1 "NONE"
begin
te = p+1
end
line 2132 "lib/parser/lexer.rl"
begin
act = 152; end
hen 156 then
line 492 "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
line 883 "lib/parser/lexer.rl"
begin
te = p+1
egin
current_literal = literal
if @te == pe
diagnostic :fatal, :string_eof, nil,
range(current_literal.str_s, current_literal.str_s + 1)
end
if current_literal.heredoc?
line = tok(@herebody_s, @ts).gsub(/\r+$/, ''.freeze)
if version?(18, 19, 20)
# See ruby:c48b4209c
line = line.gsub(/\r.*$/, ''.freeze)
end
# Try ending the heredoc with the complete most recently
# scanned line. @herebody_s always refers to the start of such line.
if current_literal.nest_and_try_closing(line, @herebody_s, @ts)
# Adjust @herebody_s to point to the next line.
@herebody_s = @te
# Continue regular lexing after the heredoc reference (<<END).
p = current_literal.heredoc_e - 1
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
else
# Calculate indentation level for <<~HEREDOCs.
current_literal.infer_indent_level(line)
# Ditto.
@herebody_s = @te
end
else
# Try ending the literal with a newline.
if current_literal.nest_and_try_closing(tok, @ts, @te)
@cs = (pop_literal); begin
p += 1
_goto_level = _out
next
nd
end
if @herebody_s
# This is a regular literal intertwined with a heredoc. Like:
#
# p <<-foo+"1
# bar
# foo
# 2"
#
# which, incidentally, evaluates to "bar\n1\n2".
p = @herebody_s - 1
@herebody_s = nil
end
end
if current_literal.words? && !eof_codepoint?(@source_pts[p])
current_literal.extend_space @ts, @te
else
# A literal newline is appended if the heredoc was _not_ closed
# this time (see fbreak above). See also Literal#nest_and_try_closing
# for rationale of calling #flush_string here.
current_literal.extend_string tok, @ts, @te
current_literal.flush_string
end
end
end
line 772 "lib/parser/lexer.rl"
begin
@escape_s = p
@escape = nil
end
hen 106 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 132 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 328 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 111 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 137 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 333 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 110 then
line 693 "lib/parser/lexer.rl"
begin
escape = @source_buffer.slice(p - 1).chr end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 136 then
line 693 "lib/parser/lexer.rl"
begin
escape = @source_buffer.slice(p - 1).chr end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 332 then
line 693 "lib/parser/lexer.rl"
begin
escape = @source_buffer.slice(p - 1).chr end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 108 then
line 698 "lib/parser/lexer.rl"
begin
escape = "\x7f" end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 134 then
line 698 "lib/parser/lexer.rl"
begin
escape = "\x7f" end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 330 then
line 698 "lib/parser/lexer.rl"
begin
escape = "\x7f" end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 104 then
line 699 "lib/parser/lexer.rl"
begin
escape = @source_buffer.slice(p - 1).chr end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 130 then
line 699 "lib/parser/lexer.rl"
begin
escape = @source_buffer.slice(p - 1).chr end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 326 then
line 699 "lib/parser/lexer.rl"
begin
escape = @source_buffer.slice(p - 1).chr end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 114 then
line 729 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_unicode_escape, nil, range(@escape_s - 1, p)
end
line 740 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :unterminated_unicode, nil, range(p - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 140 then
line 729 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_unicode_escape, nil, range(@escape_s - 1, p)
end
line 740 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :unterminated_unicode, nil, range(p - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 336 then
line 729 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :invalid_unicode_escape, nil, range(@escape_s - 1, p)
end
line 740 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :unterminated_unicode, nil, range(p - 1, p)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 98 then
line 772 "lib/parser/lexer.rl"
begin
@escape_s = p
@escape = nil
end
line 766 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :escape_eof, nil, range(p - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 125 then
line 772 "lib/parser/lexer.rl"
begin
@escape_s = p
@escape = nil
end
line 766 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :escape_eof, nil, range(p - 1, p)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 321 then
line 772 "lib/parser/lexer.rl"
begin
@escape_s = p
@escape = nil
end
line 766 "lib/parser/lexer.rl"
begin
diagnostic :fatal, :escape_eof, nil, range(p - 1, p)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 69 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 492 "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
hen 192 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1316 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 207 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1334 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 219 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1366 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 241 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1503 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin begin
@cs = 766
_goto_level = _again
next
nd
end
end
hen 256 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1575 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 268 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1596 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 292 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1856 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 354 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1880 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 364 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1911 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 384 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 2189 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 85 then
line 1128 "lib/parser/lexer.rl"
begin
sharp_s = p - 1 end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 2244 "lib/parser/lexer.rl"
begin
te = p
= p - 1; end
hen 427 then
line 2020 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = @ts end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
hen 397 then
line 2021 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = @ts end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
hen 409 then
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 404 then
line 2079 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 631 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tFLOAT, Float(chars)) } end
line 2082 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@ts, @num_suffix_s)
if version?(18, 19, 20)
emit(:tFLOAT, Float(digits), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits)
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 401 then
line 2080 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 631 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tFLOAT, Float(chars)) } end
line 2082 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@ts, @num_suffix_s)
if version?(18, 19, 20)
emit(:tFLOAT, Float(digits), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits)
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 247 then
line 1 "NONE"
begin
te = p+1
end
line 492 "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
line 1500 "lib/parser/lexer.rl"
begin
act = 74; end
hen 35 then
line 1 "NONE"
begin
te = p+1
end
line 812 "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
line 1495 "lib/parser/lexer.rl"
begin
act = 73; end
hen 46 then
line 1 "NONE"
begin
te = p+1
end
line 812 "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
line 1545 "lib/parser/lexer.rl"
begin
act = 81; end
hen 72 then
line 1 "NONE"
begin
te = p+1
end
line 1131 "lib/parser/lexer.rl"
begin
mit_comment(@sharp_s, p == pe ? p - 2 : p) end
line 1965 "lib/parser/lexer.rl"
begin
act = 134; end
hen 37 then
line 1 "NONE"
begin
te = p+1
end
line 1457 "lib/parser/lexer.rl"
begin
m = p end
line 1458 "lib/parser/lexer.rl"
begin
act = 68; end
hen 347 then
line 1 "NONE"
begin
te = p+1
end
line 1798 "lib/parser/lexer.rl"
begin
m = p end
line 1844 "lib/parser/lexer.rl"
begin
act = 115; end
hen 346 then
line 1 "NONE"
begin
te = p+1
end
line 1798 "lib/parser/lexer.rl"
begin
m = p end
line 1216 "lib/parser/lexer.rl"
begin
act = 116; end
hen 428 then
line 1 "NONE"
begin
te = p+1
end
line 2020 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = @ts end
line 2023 "lib/parser/lexer.rl"
begin
act = 141; end
hen 109 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 135 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 331 then
line 672 "lib/parser/lexer.rl"
begin
codepoint = @source_pts[p - 1]
if (@escape = ESCAPES[codepoint]).nil?
@escape = encode_escape(@source_buffer.slice(p - 1))
end
end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 107 then
line 699 "lib/parser/lexer.rl"
begin
escape = @source_buffer.slice(p - 1).chr end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 133 then
line 699 "lib/parser/lexer.rl"
begin
escape = @source_buffer.slice(p - 1).chr end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 845 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
current_literal = literal
# Get the first character after the backslash.
escaped_char = @source_buffer.slice(@escape_s).chr
if current_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 current_literal.regexp? && REGEXP_META_CHARACTERS.match(escaped_char)
# Regular expressions should include escaped delimiters in their
# escaped form, except when the escaped character is
# a closing delimiter but not a regexp metacharacter.
#
# The backslash itself cannot be used as a closing delimiter
# at the same time as an escape symbol, but it is always munged,
# so this branch also executes for the non-closing-delimiter case
# for the backslash.
current_literal.extend_string(tok, @ts, @te)
else
current_literal.extend_string(escaped_char, @ts, @te)
end
else
# It does not. So this is an actual escape sequence, yay!
if current_literal.regexp?
# Regular expressions should include escape sequences in their
# escaped form. On the other hand, escaped newlines are removed.
current_literal.extend_string(tok.gsub("\\\n".freeze, ''.freeze), @ts, @te)
else
current_literal.extend_string(@escape || tok, @ts, @te)
end
end
end
end
hen 329 then
line 699 "lib/parser/lexer.rl"
begin
escape = @source_buffer.slice(p - 1).chr end
line 683 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord & 0x9f)
end
line 687 "lib/parser/lexer.rl"
begin
@escape = encode_escape(@escape[0].ord | 0x80)
end
line 1727 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
value = @escape || tok(@ts + 1)
if version?(18)
if defined?(Encoding)
emit(:tINTEGER, value.dup.force_encoding(Encoding::BINARY)[0].ord)
else
emit(:tINTEGER, value[0].ord)
end
else
emit(:tCHARACTER, value)
end
@cs = 766; begin
p += 1
_goto_level = _out
next
nd
end
end
hen 423 then
line 2016 "lib/parser/lexer.rl"
begin
num_base = 16; @num_digits_s = p end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 417 then
line 2017 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = p end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 420 then
line 2018 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = p end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 414 then
line 2019 "lib/parser/lexer.rl"
begin
num_base = 2; @num_digits_s = p end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 426 then
line 2020 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = @ts end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 396 then
line 2021 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = @ts end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2023 "lib/parser/lexer.rl"
begin
te = p
= p - 1; begin
digits = tok(@num_digits_s, @num_suffix_s)
if digits.end_with? '_'.freeze
diagnostic :error, :trailing_in_number, { :character => '_'.freeze },
range(@te - 1, @te)
elsif digits.empty? && @num_base == 8 && version?(18)
# 1.8 did not raise an error on 0o.
digits = '0'.freeze
elsif digits.empty?
diagnostic :error, :empty_numeric
elsif @num_base == 8 && (invalid_idx = digits.index(/[89]/))
invalid_s = @num_digits_s + invalid_idx
diagnostic :error, :invalid_octal, nil,
range(invalid_s, invalid_s + 1)
end
if version?(18, 19, 20)
emit(:tINTEGER, digits.to_i(@num_base), @ts, @num_suffix_s)
p = @num_suffix_s - 1
else
@num_xfrm.call(digits.to_i(@num_base))
end
begin
p += 1
_goto_level = _out
next
nd
end
end
hen 31 then
line 1 "NONE"
begin
te = p+1
end
line 812 "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
line 1457 "lib/parser/lexer.rl"
begin
m = p end
line 1458 "lib/parser/lexer.rl"
begin
act = 68; end
hen 433 then
line 1 "NONE"
begin
te = p+1
end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2055 "lib/parser/lexer.rl"
begin
act = 143; end
hen 429 then
line 1 "NONE"
begin
te = p+1
end
line 2020 "lib/parser/lexer.rl"
begin
num_base = 10; @num_digits_s = @ts end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2055 "lib/parser/lexer.rl"
begin
act = 143; end
hen 399 then
line 1 "NONE"
begin
te = p+1
end
line 2021 "lib/parser/lexer.rl"
begin
num_base = 8; @num_digits_s = @ts end
line 2022 "lib/parser/lexer.rl"
begin
num_suffix_s = p end
line 625 "lib/parser/lexer.rl"
begin
num_xfrm = lambda { |chars| emit(:tINTEGER, chars) } end
line 2055 "lib/parser/lexer.rl"
begin
act = 143; end
line 21467 "lib/parser/lexer.rb"
nd
nd
nd
f _goto_level <= _again
ase _lex_to_state_actions[ @cs]
hen 79 then
line 1 "NONE"
begin
ts = nil; end
line 21477 "lib/parser/lexer.rb"
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
nd
nd
f _goto_level <= _out
break
nd
d
nd
line 282 "lib/parser/lexer.rl"
# %
@p = p
if @token_queue.any?
@token_queue.shift
elsif @cs == klass.lex_error
[ false, [ '$error'.freeze, range(p - 1, p) ] ]
else
eof = @source_pts.size
[ false, [ '$eof'.freeze, range(eof, eof) ] ]
end
end