py: Parse big-int/float/imag constants directly in parser.

Previous to this patch, a big-int, float or imag constant was interned
(made into a qstr) and then parsed at runtime to create an object each
time it was needed.  This is wasteful in RAM and not efficient.  Now,
these constants are parsed straight away in the parser and turned into
objects.  This allows constants with large numbers of digits (so
addresses issue #1103) and takes us a step closer to #722.
This commit is contained in:
Damien George
2015-02-08 01:57:40 +00:00
parent 5f97aaeca4
commit 7d414a1b52
30 changed files with 174 additions and 211 deletions

View File

@@ -76,7 +76,7 @@ STATIC mp_uint_t get_fmt_num(const char **p) {
while (unichar_isdigit(*++num)) {
len++;
}
mp_uint_t val = (mp_uint_t)MP_OBJ_SMALL_INT_VALUE(mp_parse_num_integer(*p, len, 10));
mp_uint_t val = (mp_uint_t)MP_OBJ_SMALL_INT_VALUE(mp_parse_num_integer(*p, len, 10, NULL));
*p = num;
return val;
}