diff options
author | Guido van Rossum <guido@python.org> | 1996-01-12 01:31:58 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-01-12 01:31:58 (GMT) |
commit | f595fde47b25df5ea029f127dedf437a5edbc07f (patch) | |
tree | 53daa17dae9a393b08bd7f787ee679be1d59b275 /Parser/tokenizer.c | |
parent | c7fea2feedd240127f7c8d7da6e5dde02688e56c (diff) | |
download | cpython-f595fde47b25df5ea029f127dedf437a5edbc07f.zip cpython-f595fde47b25df5ea029f127dedf437a5edbc07f.tar.gz cpython-f595fde47b25df5ea029f127dedf437a5edbc07f.tar.bz2 |
changes for pow(**) and complex
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r-- | Parser/tokenizer.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 645096a..ecc32d1 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -83,6 +83,7 @@ char *tok_name[] = { "CIRCUMFLEX", "LEFTSHIFT", "RIGHTSHIFT", + "DOUBLESTAR", /* This table must match the #defines in token.h! */ "OP", "<ERRORTOKEN>", @@ -394,6 +395,11 @@ tok_2char(c1, c2) case '>': return RIGHTSHIFT; } break; + case '*': + switch (c2) { + case '*': return DOUBLESTAR; + } + break; } return OP; } @@ -558,7 +564,7 @@ tok_get(tok, p_start, p_end) return DOT; } } - + /* Number */ if (isdigit(c)) { if (c == '0') { @@ -566,6 +572,10 @@ tok_get(tok, p_start, p_end) c = tok_nextc(tok); if (c == '.') goto fraction; +#ifndef WITHOUT_COMPLEX + if (c == 'i' || c == 'I' || c == 'j' || c == 'J') + goto imaginary; +#endif if (c == 'x' || c == 'X') { /* Hex */ do { @@ -611,6 +621,12 @@ tok_get(tok, p_start, p_end) c = tok_nextc(tok); } } +#ifndef WITHOUT_COMPLEX + if (c == 'i' || c == 'I' || c == 'j' || c == 'J') + /* Imaginary part */ + imaginary: + c = tok_nextc(tok); +#endif } } tok_backup(tok, c); |