mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
merge revision(s) 58080,58138: [Backport #13363]
keep line number after unterminated string literal * parse.y (parser_parse_string): keep line number even after an unterminated string literal. it does not matter in the parser, ripper needs this value after this error. parse.y: unterminated content token * parse.y (parser_parse_string): defer the end token to next reading, to yield tSTRING_CONTENT with the unterminated content. [Bug #13363] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
410c048a3a
commit
c884cbd810
4 changed files with 26 additions and 9 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
Sun Apr 30 22:55:41 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
keep line number after unterminated string literal
|
||||
|
||||
* parse.y (parser_parse_string): keep line number even after an
|
||||
unterminated string literal. it does not matter in the parser,
|
||||
ripper needs this value after this error.
|
||||
|
||||
parse.y: unterminated content token
|
||||
|
||||
* parse.y (parser_parse_string): defer the end token to next
|
||||
reading, to yield tSTRING_CONTENT with the unterminated content.
|
||||
[Bug #13363]
|
||||
|
||||
Sun Apr 30 22:52:38 2017 Marcus Stollsteimer <sto.mar@web.de>
|
||||
|
||||
* io.c: [DOC] expand docs for IO#puts
|
||||
|
|
14
parse.y
14
parse.y
|
@ -6502,16 +6502,14 @@ parser_parse_string(struct parser_params *parser, NODE *quote)
|
|||
pushback(c);
|
||||
if (tokadd_string(func, term, paren, "e->nd_nest,
|
||||
&enc) == -1) {
|
||||
ruby_sourceline = nd_line(quote);
|
||||
if (func & STR_FUNC_REGEXP) {
|
||||
if (parser->eofp)
|
||||
if (parser->eofp) {
|
||||
if (func & STR_FUNC_REGEXP) {
|
||||
compile_error(PARSER_ARG "unterminated regexp meets end of file");
|
||||
return tREGEXP_END;
|
||||
}
|
||||
else {
|
||||
if (parser->eofp)
|
||||
}
|
||||
else {
|
||||
compile_error(PARSER_ARG "unterminated string meets end of file");
|
||||
return tSTRING_END;
|
||||
}
|
||||
quote->u2.id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,9 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
|
|||
[[3, 0], :on_heredoc_end, "EOS"]
|
||||
],
|
||||
Ripper.lex("<<~EOS\n heredoc\nEOS")
|
||||
assert_equal [[[1, 0], :on_tstring_beg, "'"],
|
||||
[[1, 1], :on_tstring_content, "foo"]],
|
||||
Ripper.lex("'foo")
|
||||
end
|
||||
|
||||
def test_location
|
||||
|
@ -131,6 +134,8 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
|
|||
assert_location %Q["a\nb\r\nc"]
|
||||
assert_location "print(<<""EOS)\nheredoc\nEOS\n"
|
||||
assert_location "print(<<-\"EOS\")\nheredoc\n EOS\n"
|
||||
assert_location "'foo'"
|
||||
assert_location "'foo"
|
||||
end
|
||||
|
||||
def assert_location(src)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.3.5"
|
||||
#define RUBY_RELEASE_DATE "2017-04-30"
|
||||
#define RUBY_PATCHLEVEL 307
|
||||
#define RUBY_PATCHLEVEL 308
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2017
|
||||
#define RUBY_RELEASE_MONTH 4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue