parse.y: refine invalid Unicode escape message

* parse.y (literal_flush): rename from numeric_literal_flush, as
  it is not just for numerics now.

* parse.y (parser_tokadd_codepoint): show invalid character
  position, but not the start of Unicode escape.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-07-16 23:45:48 +00:00
parent 26888a8ee7
commit b17efb6874
2 changed files with 13 additions and 11 deletions

View file

@ -490,7 +490,10 @@ class TestParse < Test::Unit::TestCase
assert_equal(' ^', e.message.lines.last, mesg)
e = assert_syntax_error('"\u{1234"', 'Unicode escape')
assert_match(' ^~~~~~~', e.message.lines.last, mesg)
assert_match(' ^', e.message.lines.last, mesg)
e = assert_syntax_error('"\u{xxxx}"', 'invalid Unicode escape')
assert_match(' ^', e.message.lines.last, mesg)
e = assert_syntax_error('"\M1"', /escape character syntax/)
assert_equal(' ^~~', e.message.lines.last, mesg)