From c41616230211822e838634b84b445f8a124add08 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 7 Jun 2014 12:36:39 -0700 Subject: allow the keyword else immediately after (no space) an integer (closes #21642) --- Parser/tokenizer.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'Parser') diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 7283058fc88..22accd1061a 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1597,15 +1597,24 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end) } while (isdigit(c)); } if (c == 'e' || c == 'E') { - exponent: + int e; + exponent: + e = c; /* Exponent part */ c = tok_nextc(tok); - if (c == '+' || c == '-') + if (c == '+' || c == '-') { c = tok_nextc(tok); - if (!isdigit(c)) { - tok->done = E_TOKEN; + if (!isdigit(c)) { + tok->done = E_TOKEN; + tok_backup(tok, c); + return ERRORTOKEN; + } + } else if (!isdigit(c)) { tok_backup(tok, c); - return ERRORTOKEN; + tok_backup(tok, e); + *p_start = tok->start; + *p_end = tok->cur; + return NUMBER; } do { c = tok_nextc(tok); -- cgit v1.2.3-65-gdbad