summaryrefslogtreecommitdiffstatshomepage
path: root/py/parsenum.c
Commit message (Collapse)AuthorAge
* all: Use the name MicroPython consistently in commentsAlexander Steffen2017-07-31
| | | | | There were several different spellings of MicroPython present in comments, when there should be only one.
* py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible.Damien George2017-03-28
| | | | Saves 168 bytes on bare-arm.
* py/parsenum: Fix warning for signed/unsigned comparison.Damien George2016-12-28
|
* py/parsenum: Simplify and generalise decoding of digit values.Damien George2016-12-28
| | | | | This function should be able to parse integers with any value for the base, because it is called by int('xxx', base).
* py: Add MICROPY_FLOAT_CONST macro for defining float constants.Damien George2016-11-03
| | | | | | All float constants in the core should use this macro to prevent unnecessary creation of double-precision floats, which makes code less efficient.
* py: Use mp_raise_msg helper function where appropriate.Damien George2016-10-17
| | | | | Saves the following number of bytes of code space: 176 for bare-arm, 352 for minimal, 272 for unix x86-64, 140 for stmhal, 120 for esp8266.
* py/parsenum: Use pow function to apply exponent to decimal number.Damien George2016-03-29
| | | | | | Pow is already a dependency when compiling with floats, so may as well use it here to reduce code size and speed up the conversion for most cases.
* py/parsenum: Fix compiler warnings for no decl and signed comparison.Damien George2016-03-14
|
* py/parsenum: Use size_t to count bytes, and int for type of base arg.Damien George2016-03-14
| | | | | size_t is the proper type to count number of bytes in a string. The base argument does not need to be a full mp_uint_t, int is enough.
* py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George2015-11-29
| | | | | | | | | This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
* py/parsenum: Provide detailed error for int parsing with escaped bytes.Damien George2015-10-01
| | | | | | | This patch adds more fine grained error message control for errors when parsing integers (now has terse, normal and detailed). When detailed is enabled, the error now escapes bytes when printing them so they can be more easily seen.
* py: Clarify comment in parsenum.c about ValueError vs SyntaxError.Damien George2015-06-23
|
* py: Change exception type to ValueError when error reporting is terse.Daniel Campora2015-06-23
| | | | Addresses issue #1347
* py/parsenum.c: Rename "raise" func to "raise_exc" to avoid name clash.Damien George2015-05-30
| | | | "raise" is a common word that was found to exist in a vendor's stdlib.
* py: Fix printing of error message when parsing malformed integer.Damien George2015-03-16
|
* py: Parse big-int/float/imag constants directly in parser.Damien George2015-02-08
| | | | | | | | | 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.
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* py: Use shorter, static error msgs when ERROR_REPORTING_TERSE enabled.Damien George2014-11-06
| | | | | | | | Going from MICROPY_ERROR_REPORTING_NORMAL to MICROPY_ERROR_REPORTING_TERSE now saves 2020 bytes ROM for ARM Thumb2, and 2200 bytes ROM for 32-bit x86. This is about a 2.5% code size reduction for bare-arm.
* parser: Convert (u)int to mp_(u)int_t.Damien George2014-07-03
|
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* py: Include mpconfig.h before all other includes.Paul Sokolovsky2014-06-21
| | | | | | It defines types used by all other headers. Fixes #691.
* py: Separate MICROPY_PY_BUILTINS_COMPLEX from MICROPY_PY_BUILTINS_FLOAT.Paul Sokolovsky2014-06-20
| | | | | One thing is wanting to do 1 / 2 and get something else but 0, and quite another - doing rocket science ;-).
* parsenum: Signedness issues.Paul Sokolovsky2014-06-14
| | | | | | char can be signedness, and using signedness types is dangerous - it can lead to negative offsets when doing table lookups. We apparently should just ban char usage.
* Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George2014-06-01
| | | | | | | | | | This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue #35 for discussion.
* py: Fix check of small-int overflow when parsing ints.Damien George2014-05-28
| | | | Also unifies use of SMALL_INT_FITS macro across parser and runtime.
* py: Implement long int parsing in int(...).Damien George2014-05-28
| | | | Addresses issue #627.
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
* Remove exception name from inside the exception messageAndrew Scheller2014-04-09
| | | | | This prevents micropython printing exception messages like ImportError: ImportError: No module named 'foo'
* py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George2014-04-05
| | | | | | This does not affect code size or performance when debugging turned off. To address issue #420.
* py: Put back proper ValueError for badly parsed integers.Damien George2014-03-21
|
* py: Improve mp_parse_num_integer; make it self contained.Damien George2014-03-21
|
* py: Allow 'complex()' to take a string as first argument.Damien George2014-03-21
|
* py: Implement parsing of infinity and nan for floats.Damien George2014-03-21
|
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* py: Implement bit-shift and not operations for mpz.Damien George2014-03-01
| | | | | | Implement not, shl and shr in mpz library. Add function to create mpzs on the stack, used for memory efficiency when rhs is a small int. Factor out code to parse base-prefix of number into a dedicated function.
* py: Put number parsing code together in parsenum.c.Damien George2014-02-22