Commit f595fde4 authored by Guido van Rossum's avatar Guido van Rossum

changes for pow(**) and complex

parent c7fea2fe
...@@ -83,6 +83,7 @@ char *tok_name[] = { ...@@ -83,6 +83,7 @@ char *tok_name[] = {
"CIRCUMFLEX", "CIRCUMFLEX",
"LEFTSHIFT", "LEFTSHIFT",
"RIGHTSHIFT", "RIGHTSHIFT",
"DOUBLESTAR",
/* This table must match the #defines in token.h! */ /* This table must match the #defines in token.h! */
"OP", "OP",
"<ERRORTOKEN>", "<ERRORTOKEN>",
...@@ -394,6 +395,11 @@ tok_2char(c1, c2) ...@@ -394,6 +395,11 @@ tok_2char(c1, c2)
case '>': return RIGHTSHIFT; case '>': return RIGHTSHIFT;
} }
break; break;
case '*':
switch (c2) {
case '*': return DOUBLESTAR;
}
break;
} }
return OP; return OP;
} }
...@@ -566,6 +572,10 @@ tok_get(tok, p_start, p_end) ...@@ -566,6 +572,10 @@ tok_get(tok, p_start, p_end)
c = tok_nextc(tok); c = tok_nextc(tok);
if (c == '.') if (c == '.')
goto fraction; goto fraction;
#ifndef WITHOUT_COMPLEX
if (c == 'i' || c == 'I' || c == 'j' || c == 'J')
goto imaginary;
#endif
if (c == 'x' || c == 'X') { if (c == 'x' || c == 'X') {
/* Hex */ /* Hex */
do { do {
...@@ -611,6 +621,12 @@ tok_get(tok, p_start, p_end) ...@@ -611,6 +621,12 @@ tok_get(tok, p_start, p_end)
c = tok_nextc(tok); 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); tok_backup(tok, c);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment