parse.y: fix token

* parse.y (parser_parse_string): return proper token tREGEXP_END
  at unterminated regexp.  [Bug #13363]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-06-28 06:13:00 +00:00
parent 957d1ccdf9
commit f78d92c5ca
2 changed files with 15 additions and 5 deletions

View file

@ -1022,6 +1022,14 @@ x = __ENCODING__
assert_operator(line, :end_with?, "...\n")
end
def test_unterminated_regexp_error
e = assert_raise(SyntaxError) do
eval("/x")
end.message
assert_match(/unterminated regexp meets end of file/, e)
assert_not_match(/unexpected tSTRING_END/, e)
end
=begin
def test_past_scope_variable
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}