circuitpython/extmod
Damien George 1831034be1 py: Allow lexer to raise exceptions during construction.
This patch refactors the error handling in the lexer, to simplify it (ie
reduce code size).

A long time ago, when the lexer/parser/compiler were first written, the
lexer and parser were designed so they didn't use exceptions (ie nlr) to
report errors but rather returned an error code.  Over time that has
gradually changed, the parser in particular has more and more ways of
raising exceptions.  Also, the lexer never really handled all errors without
raising, eg there were some memory errors which could raise an exception
(and in these rare cases one would get a fatal nlr-not-handled fault).

This patch accepts the fact that the lexer can raise exceptions in some
cases and allows it to raise exceptions to handle all its errors, which are
for the most part just out-of-memory errors during construction of the
lexer.  This makes the lexer a bit simpler, and also the persistent code
stuff is simplified.

What this means for users of the lexer is that calls to it must be wrapped
in a nlr handler.  But all uses of the lexer already have such an nlr
handler for the parser (and compiler) so that doesn't put any extra burden
on the callers.
2017-03-14 11:52:05 +11:00
..
crypto-algorithms extmod/moduhashlib: Add namespace prefix for crypto-algorithms/sha256.h. 2015-12-20 23:14:47 +02:00
lwip-include extmod/lwip: Change void pointers to unions, include new mphal.h file 2015-11-04 23:24:04 +03:00
re1.5 extmod/re1.5: Workaround issue with mingw32-gcc 4.2.1. 2015-11-01 02:39:01 +03:00
uzlib extmod/uzlib: Update to upstream v2.1. 2016-10-11 07:13:23 +03:00
machine_i2c.c extmod/machine_i2c: Add hook to constructor to call port-specific code. 2016-11-24 00:12:51 +11:00
machine_i2c.h extmod/machine_i2c: Expose soft I2C obj and readfrom/writeto funcs. 2016-11-24 00:11:45 +11:00
machine_mem.c extmod/machine_mem: Typo fix in comment. 2016-11-21 01:09:17 +03:00
machine_mem.h unix: machine_mem improvements 2015-12-18 22:01:03 +02:00
machine_pinbase.c extmod/machine_pinbase: Fix nanbox build. 2016-06-19 00:26:57 +03:00
machine_pinbase.h extmod/machine_pinbase: Implementation of PinBase class. 2016-06-18 23:40:28 +03:00
machine_pulse.c extmod/machine_pulse: Make time_pulse_us() not throw exceptions. 2017-02-05 14:20:17 +03:00
machine_pulse.h py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros. 2016-10-21 16:26:01 +11:00
machine_signal.c extmod/machine_signal: Implement Signal .on() and .off() methods. 2017-02-08 11:14:23 +03:00
machine_signal.h extmod/machine_signal: Implement "signal" abstraction for machine module. 2017-01-29 18:57:36 +03:00
machine_spi.c extmod/machine_spi: Remove EVENT_POLL_HOOK from soft-SPI transfer func. 2017-02-06 14:38:33 +11:00
machine_spi.h extmod/machine_spi: Provide reusable software SPI class. 2016-12-08 13:47:01 +11:00
misc.h py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros. 2016-10-21 16:26:01 +11:00
modbtree.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
modframebuf.c extmod/modframebuf: Add GS4_HMSB format. 2017-01-25 23:19:28 +11:00
modlwip.c extmod/modlwip: Add my copyright. 2017-02-15 19:20:46 +03:00
modubinascii.c extmod/modubinascii: Fix crc32() function on 32-bit platforms. 2016-09-21 21:40:18 +03:00
modubinascii.h py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros. 2016-10-21 16:26:01 +11:00
moductypes.c extmod/uctypes: Allow full 32-bit address range. 2016-09-21 21:37:08 +03:00
moduhashlib.c all: Remove 'name' member from mp_obj_module_t struct. 2016-09-22 00:23:16 +10:00
moduheapq.c extmod/moduheapq: Revert change for adhoc relative-time queue support. 2016-12-22 06:37:49 +03:00
modujson.c extmod/modujson: Fix nanbox build. 2016-10-13 12:09:18 +11:00
modurandom.c extmod/modurandom: Use mp_raise_ValueError(). 2017-02-24 10:04:23 -05:00
modure.c all: Remove 'name' member from mp_obj_module_t struct. 2016-09-22 00:23:16 +10:00
moduselect.c extmod/moduselect: Use configurable EVENT_POLL_HOOK instead of WFI. 2016-12-02 16:40:39 +11:00
modussl_axtls.c all: Remove readall() method, which is equivalent to read() w/o args. 2016-11-14 00:24:22 +03:00
modussl_mbedtls.c all: Remove readall() method, which is equivalent to read() w/o args. 2016-11-14 00:24:22 +03:00
modutimeq.c extmod/modutimeq: Make scheduling fair (round-robin). 2017-03-07 09:34:09 +01:00
moduzlib.c all: Remove readall() method, which is equivalent to read() w/o args. 2016-11-14 00:24:22 +03:00
modwebrepl.c all: Remove 'name' member from mp_obj_module_t struct. 2016-09-22 00:23:16 +10:00
modwebsocket.c all: Remove 'name' member from mp_obj_module_t struct. 2016-09-22 00:23:16 +10:00
modwebsocket.h extmod/modwebsocket.h: Split websocket-related defines for reuse. 2016-04-10 13:42:51 +03:00
uos_dupterm.c extmod/moduos_dupterm: Renamed to uos_dupterm. 2016-10-26 02:08:37 +03:00
utime_mphal.c extmod/utime_mphal: ticks_diff/ticks_add: Don't hardcode 32-bit types. 2016-11-03 23:54:16 +03:00
utime_mphal.h extmod/utime_mphal: Implement ticks_add(), add to all maintained ports. 2016-10-29 17:30:05 +03:00
vfs.c extmod/vfs: Rewrite path lookup algo to support relative paths from root. 2017-03-13 21:37:21 +11:00
vfs.h extmod: Merge old fsusermount.h header into vfs.h and vfs_fat.h. 2017-01-30 12:26:08 +11:00
vfs_fat.c extmod/vfs_fat: Remove obsolete and unused str/len members. 2017-03-10 19:09:42 +11:00
vfs_fat.h extmod/vfs_fat: Remove obsolete and unused str/len members. 2017-03-10 19:09:42 +11:00
vfs_fat_diskio.c extmod/vfs_fat: Allow to compile with MICROPY_VFS_FAT disabled. 2017-03-13 21:23:31 +11:00
vfs_fat_file.c extmod/vfs_fat: Allow to compile with MICROPY_VFS_FAT disabled. 2017-03-13 21:23:31 +11:00
vfs_fat_misc.c extmod/vfs_fat: Remove unused function fat_vfs_listdir. 2017-01-30 12:26:08 +11:00
vfs_reader.c py: Allow lexer to raise exceptions during construction. 2017-03-14 11:52:05 +11:00
virtpin.c all: Rename mp_obj_type_t::stream_p to protocol. 2016-06-18 18:44:57 +03:00
virtpin.h extmod/virtpin: Initial implementation of open-ended C-level Pin interface. 2016-05-27 01:08:43 +03:00