mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: end of script at newline
* parse.y (parser_yylex): deal with end of script chars just after ignored newline as other places. [ruby-core:84349] [Bug #14206] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b37fc5aa7e
commit
032e8fdf40
2 changed files with 8 additions and 2 deletions
4
parse.y
4
parse.y
|
@ -8341,8 +8341,8 @@ parser_yylex(struct parser_params *parser)
|
|||
}
|
||||
goto retry;
|
||||
}
|
||||
while ((c = nextc())) {
|
||||
switch (c) {
|
||||
while (1) {
|
||||
switch (c = nextc()) {
|
||||
case ' ': case '\t': case '\f': case '\r':
|
||||
case '\13': /* '\v' */
|
||||
space_seen = 1;
|
||||
|
|
|
@ -1087,6 +1087,12 @@ x = __ENCODING__
|
|||
end
|
||||
end
|
||||
|
||||
def test_eof_in_def
|
||||
assert_raise(SyntaxError) { eval("def m\n\0""end") }
|
||||
assert_raise(SyntaxError) { eval("def m\n\C-d""end") }
|
||||
assert_raise(SyntaxError) { eval("def m\n\C-z""end") }
|
||||
end
|
||||
|
||||
=begin
|
||||
def test_past_scope_variable
|
||||
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}
|
||||
|
|
Loading…
Add table
Reference in a new issue