[Bug #19743] All but EOF can be read again after push-back
This commit is contained in:
parent
8142728b5a
commit
1344de5621
2
parse.y
2
parse.y
@ -7121,6 +7121,7 @@ static void
|
|||||||
pushback(struct parser_params *p, int c)
|
pushback(struct parser_params *p, int c)
|
||||||
{
|
{
|
||||||
if (c == -1) return;
|
if (c == -1) return;
|
||||||
|
p->eofp = 0;
|
||||||
p->lex.pcur--;
|
p->lex.pcur--;
|
||||||
if (p->lex.pcur > p->lex.pbeg && p->lex.pcur[0] == '\n' && p->lex.pcur[-1] == '\r') {
|
if (p->lex.pcur > p->lex.pbeg && p->lex.pcur[0] == '\n' && p->lex.pcur[-1] == '\r') {
|
||||||
p->lex.pcur--;
|
p->lex.pcur--;
|
||||||
@ -9164,6 +9165,7 @@ parse_numeric(struct parser_params *p, int c)
|
|||||||
c = nextc(p);
|
c = nextc(p);
|
||||||
if (c != '-' && c != '+' && !ISDIGIT(c)) {
|
if (c != '-' && c != '+' && !ISDIGIT(c)) {
|
||||||
pushback(p, c);
|
pushback(p, c);
|
||||||
|
c = nondigit;
|
||||||
nondigit = 0;
|
nondigit = 0;
|
||||||
goto decode_num;
|
goto decode_num;
|
||||||
}
|
}
|
||||||
|
@ -1138,6 +1138,8 @@ x = __ENCODING__
|
|||||||
assert_syntax_error('0000xyz', /^ \^~~\Z/)
|
assert_syntax_error('0000xyz', /^ \^~~\Z/)
|
||||||
assert_syntax_error('1.2i1.1', /^ \^~~\Z/)
|
assert_syntax_error('1.2i1.1', /^ \^~~\Z/)
|
||||||
assert_syntax_error('1.2.3', /^ \^~\Z/)
|
assert_syntax_error('1.2.3', /^ \^~\Z/)
|
||||||
|
assert_syntax_error('1.', /unexpected end-of-input/)
|
||||||
|
assert_syntax_error('1e', /expecting end-of-input/)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_truncated_source_line
|
def test_truncated_source_line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user