зеркало из https://github.com/github/ruby.git
parse.y: refine error messages
* parse.y: refine error messages for tSYMBEG and tSTRING_BEG, which can appear at invalid places. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
56a6dd66d4
Коммит
59f59f82d4
4
parse.y
4
parse.y
|
@ -900,7 +900,9 @@ static void token_info_warn(struct parser_params *p, const char *token, token_in
|
|||
%token tDSTAR "**arg"
|
||||
%token tAMPER "&"
|
||||
%token tLAMBDA "->"
|
||||
%token tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG tWORDS_BEG tQWORDS_BEG tSYMBOLS_BEG tQSYMBOLS_BEG
|
||||
%token tSYMBEG "symbol literal"
|
||||
%token tSTRING_BEG "string literal"
|
||||
%token tXSTRING_BEG tREGEXP_BEG tWORDS_BEG tQWORDS_BEG tSYMBOLS_BEG tQSYMBOLS_BEG
|
||||
%token tSTRING_DBEG tSTRING_DEND tSTRING_DVAR tSTRING_END tLAMBEG tLABEL_END
|
||||
|
||||
/*
|
||||
|
|
|
@ -905,6 +905,11 @@ eom
|
|||
assert_syntax_error(":#\n foo", /unexpected ':'/)
|
||||
end
|
||||
|
||||
def test_invalid_literal_message
|
||||
assert_syntax_error("def :foo", /unexpected symbol literal/)
|
||||
assert_syntax_error("def 'foo'", /unexpected string literal/)
|
||||
end
|
||||
|
||||
def test_fluent_dot
|
||||
assert_valid_syntax("a\n.foo")
|
||||
assert_valid_syntax("a\n&.foo")
|
||||
|
|
Загрузка…
Ссылка в новой задаче