Fixed error message when % at EOF
This commit is contained in:
parent
68c2fc4cc0
commit
35c3a24c8c
4
parse.y
4
parse.y
@ -8659,7 +8659,8 @@ parse_percent(struct parser_params *p, const int space_seen, const enum lex_stat
|
|||||||
|
|
||||||
c = nextc(p);
|
c = nextc(p);
|
||||||
quotation:
|
quotation:
|
||||||
if (c == -1 || !ISALNUM(c)) {
|
if (c == -1) goto unterminated;
|
||||||
|
if (!ISALNUM(c)) {
|
||||||
term = c;
|
term = c;
|
||||||
if (!ISASCII(c)) goto unknown;
|
if (!ISASCII(c)) goto unknown;
|
||||||
c = 'Q';
|
c = 'Q';
|
||||||
@ -8677,6 +8678,7 @@ parse_percent(struct parser_params *p, const int space_seen, const enum lex_stat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (term == -1) {
|
if (term == -1) {
|
||||||
|
unterminated:
|
||||||
compile_error(p, "unterminated quoted string meets end of file");
|
compile_error(p, "unterminated quoted string meets end of file");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -601,6 +601,7 @@ class TestParse < Test::Unit::TestCase
|
|||||||
assert_syntax_error('%z()', /unknown type/)
|
assert_syntax_error('%z()', /unknown type/)
|
||||||
assert_syntax_error("%\u3042", /unknown type/)
|
assert_syntax_error("%\u3042", /unknown type/)
|
||||||
assert_syntax_error("%q\u3042", /unknown type/)
|
assert_syntax_error("%q\u3042", /unknown type/)
|
||||||
|
assert_syntax_error("%", /unterminated quoted string/)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_symbol
|
def test_symbol
|
||||||
|
Loading…
x
Reference in New Issue
Block a user