micropython/py
Damien George cfc4c33801 py/compile: Give more precise line number for compile errors.
Previous to this patch there were some cases where line numbers for
errors were 0 (unknown).  Now the compiler attempts to give a better
line number where possible, in some cases giving the line number of the
closest statement, and other cases the line number of the inner-most
scope of the error (eg the line number of the start of the function).
This helps to give good (and sometimes exact) line numbers for
ViperTypeError exceptions.

This patch also makes sure that the first compile error (eg SyntaxError)
that is encountered is reported (previously it was the last one that was
reported).
2015-07-29 22:16:01 +00:00
..
argcheck.c py: Add %q format support to mp_[v]printf, and use it. 2015-04-16 14:30:16 +00:00
asmarm.c py: Implement native multiply operation in viper emitter. 2015-06-04 14:00:29 +00:00
asmarm.h py: Implement native multiply operation in viper emitter. 2015-06-04 14:00:29 +00:00
asmthumb.c py: Implement full func arg passing for native emitter. 2015-04-07 22:43:28 +01:00
asmthumb.h py: Implement full func arg passing for native emitter. 2015-04-07 22:43:28 +01:00
asmx64.c py: Implement native multiply operation in viper emitter. 2015-06-04 14:00:29 +00:00
asmx64.h py: Implement native multiply operation in viper emitter. 2015-06-04 14:00:29 +00:00
asmx86.c py: Implement native multiply operation in viper emitter. 2015-06-04 14:00:29 +00:00
asmx86.h py: Implement native multiply operation in viper emitter. 2015-06-04 14:00:29 +00:00
bc.c py: Add %q format support to mp_[v]printf, and use it. 2015-04-16 14:30:16 +00:00
bc.h vm: Initial support for calling bytecode functions w/o C stack ("stackless"). 2015-04-03 00:03:07 +03:00
bc0.h py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
binary.c py/binary: Make return type of mp_binary_get_size size_t instead of int. 2015-05-17 18:12:19 +01:00
binary.h py/binary: Make return type of mp_binary_get_size size_t instead of int. 2015-05-17 18:12:19 +01:00
builtin.h modstruct: Rename module to "ustruct", to allow full Python-level impl. 2015-05-04 16:53:52 +03:00
builtinevex.c py: Check for valid file when creating lexer for execfile. 2015-02-15 00:02:27 +00:00
builtinimport.c builtinimport: Fix running package submodule with -m. 2015-06-29 00:26:45 +03:00
compile.c py/compile: Give more precise line number for compile errors. 2015-07-29 22:16:01 +00:00
compile.h py: Protect mp_parse and mp_compile with nlr push/pop block. 2015-02-07 18:33:58 +00:00
emit.h py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
emitbc.c py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
emitcommon.c py, compiler: Refactor load/store/delete_id logic to reduce code size. 2015-03-26 16:52:45 +00:00
emitcpy.c py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
emitglue.c py: Implement full func arg passing for native emitter. 2015-04-07 22:43:28 +01:00
emitglue.h py: Implement full func arg passing for native emitter. 2015-04-07 22:43:28 +01:00
emitinlinethumb.c py/inlinethumb: Support for core floating point instructions. 2015-04-19 15:47:05 +01:00
emitnative.c py: For viper compile errors, add traceback with function and filename. 2015-07-27 22:20:00 +01:00
formatfloat.c py: Implement mp_format_float for doubles and use where appropriate 2015-05-17 21:47:11 +01:00
formatfloat.h py: Implement mp_format_float for doubles and use where appropriate 2015-05-17 21:47:11 +01:00
frozenmod.c frozenmod: Include header with function prototypes. 2015-05-31 23:02:04 +03:00
frozenmod.h py: Implement very simple frozen modules support. 2015-01-20 11:52:12 +02:00
gc.c py: Improve allocation policy of qstr data. 2015-07-14 22:56:32 +01:00
gc.h py: Improve allocation policy of qstr data. 2015-07-14 22:56:32 +01:00
grammar.h py/parse: Fix handling of empty input so it raises an exception. 2015-07-24 15:05:56 +00:00
lexer.c py/lexer: Raise SyntaxError when str hex escape sequence is malformed. 2015-07-23 23:20:37 +01:00
lexer.h unix: Allow to cat a script into stdin from the command line. 2015-06-04 23:42:45 +01:00
lexerstr.c py: Use m_{new,renew,del} consistently. 2015-02-27 09:34:51 +00:00
lexerunix.c unix: Allow to cat a script into stdin from the command line. 2015-06-04 23:42:45 +01:00
makeqstrdata.py py: Make qstr hash size configurable, defaults to 2 bytes. 2015-07-20 11:03:13 +00:00
makeversionhdr.py py: Get makeqstrdata.py and makeversionhdr.py running under Python 2.6. 2015-05-30 23:11:16 +01:00
malloc.c py: Improve allocation policy of qstr data. 2015-07-14 22:56:32 +01:00
map.c py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function. 2015-05-12 22:46:02 +01:00
misc.h py: Improve allocation policy of qstr data. 2015-07-14 22:56:32 +01:00
mkenv.mk py, mk: Revert change where build variables set with ?=. 2014-06-07 13:14:45 +01:00
mkrules.mk mkrules.mk: Add comment why dependency parsing regex was tweaked. 2015-05-06 15:34:33 +03:00
modarray.c py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
modbuiltins.c modbuiltins: Implement round() to precision. 2015-07-19 21:49:44 +03:00
modcmath.c py: Fix cmath.log10; fix printing of complex number with negative imag. 2015-02-02 12:52:14 +00:00
modcollections.c py: Implement core of OrderedDict type. 2015-03-20 17:26:10 +00:00
modgc.c py: Put mp_sys_path, mp_sys_argv and gc_collected in mp_state_ctx_t. 2015-02-07 17:24:10 +00:00
modio.c py: Use TextIOWrapper only if PY_IO_FILEIO def'd; cast size_t for print. 2015-02-15 13:17:11 +00:00
modmath.c py: Implement second arg for math.log (optional value for base). 2015-06-13 22:35:25 +01:00
modmicropython.c py: Convert occurrences of non-debug printf to mp_printf. 2015-04-16 14:30:16 +00:00
modstruct.c modstruct: Raise NotImplementedError for unsupported repeat specification. 2015-07-05 22:44:14 +03:00
modsys.c py: Replace py-version.sh with makeversionhdr.py, written in Python. 2015-04-28 23:52:36 +01:00
mpconfig.h py: Disable REPL EMACS key bindings by default. 2015-07-26 15:49:13 +01:00
mpprint.c py: Remove unnecessary extra handling of padding of nan/inf. 2015-05-28 14:22:12 +00:00
mpprint.h py: Remove unnecessary extra handling of padding of nan/inf. 2015-05-28 14:22:12 +00:00
mpstate.c py: Put all global state together in state structures. 2015-01-07 20:33:00 +00:00
mpstate.h py: Improve allocation policy of qstr data. 2015-07-14 22:56:32 +01:00
mpz.c py: Fix handling of negative numbers in struct.pack of q/Q. 2015-04-25 23:51:14 +01:00
mpz.h py: Support conversion of bignum to bytes. 2015-04-25 23:16:39 +01:00
nativeglue.c py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
nlr.h py: Guard against redef of nlr_push with DEBUG + MICROPY_NLR_SETJMP. 2015-03-03 14:34:40 +00:00
nlrsetjmp.c py: Put all global state together in state structures. 2015-01-07 20:33:00 +00:00
nlrthumb.S py: Put all global state together in state structures. 2015-01-07 20:33:00 +00:00
nlrx64.S py: Fix nlr mp_state_ctx symbol error for Mac. 2015-01-08 16:24:44 +00:00
nlrx86.S py: Put all global state together in state structures. 2015-01-07 20:33:00 +00:00
nlrxtensa.S py: Put all global state together in state structures. 2015-01-07 20:33:00 +00:00
obj.c py: Add mp_obj_get_int_truncated and use it where appropriate. 2015-05-12 23:05:53 +01:00
obj.h py: Add TimeoutError exception subclassed from OSError. 2015-07-02 11:53:08 +02:00
objarray.c py: Small code space optimisations for memoryview slice assigment. 2015-07-20 16:12:26 +01:00
objattrtuple.c py: Fix attrtuple array length in print and creation. 2015-04-29 00:17:48 +01:00
objbool.c py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function. 2015-05-12 22:46:02 +01:00
objboundmeth.c py: Overhaul and simplify printf/pfenv mechanism. 2015-04-16 14:30:16 +00:00
objcell.c py: Overhaul and simplify printf/pfenv mechanism. 2015-04-16 14:30:16 +00:00
objclosure.c py: Overhaul and simplify printf/pfenv mechanism. 2015-04-16 14:30:16 +00:00
objcomplex.c py: Implement mp_format_float for doubles and use where appropriate 2015-05-17 21:47:11 +01:00
objdict.c py: Add %q format support to mp_[v]printf, and use it. 2015-04-16 14:30:16 +00:00
objenumerate.c py: Add MICROPY_PY_BUILTINS_ENUMERATE, disable for minimal ports. 2015-04-06 23:51:29 +03:00
objexcept.c py: Improve allocation policy of qstr data. 2015-07-14 22:56:32 +01:00
objexcept.h py: Fix adding of traceback so that it appends to existing info. 2015-02-27 00:36:39 +00:00
objfilter.c py: Use mp_arg_check_num in some _make_new functions. 2015-01-20 14:11:27 +00:00
objfloat.c py: Add MP_BINARY_OP_DIVMOD to simplify and consolidate divmod builtin. 2015-06-13 23:36:30 +01:00
objfun.c py: Allow viper functions to take up to 4 arguments. 2015-07-23 14:11:29 +01:00
objfun.h py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
objgenerator.c objgenerator: Can optimize StopIteration to STOP_ITERATION only if arg is None. 2015-05-11 23:57:42 +01:00
objgenerator.h py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
objgetitemiter.c py: Some trivial cosmetic changes, for code style consistency. 2015-04-04 15:53:11 +01:00
objint.c py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function. 2015-05-12 22:46:02 +01:00
objint.h py: Support conversion of bignum to bytes. 2015-04-25 23:16:39 +01:00
objint_longlong.c py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function. 2015-05-12 22:46:02 +01:00
objint_mpz.c py: Implement divmod for mpz bignum. 2015-06-13 23:38:28 +01:00
objlist.c py: Overhaul and simplify printf/pfenv mechanism. 2015-04-16 14:30:16 +00:00
objlist.h py: Fix adding of traceback so that it appends to existing info. 2015-02-27 00:36:39 +00:00
objmap.c py: Use mp_arg_check_num in some _make_new functions. 2015-01-20 14:11:27 +00:00
objmodule.c modstruct: Rename module to "ustruct", to allow full Python-level impl. 2015-05-04 16:53:52 +03:00
objmodule.h py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
objnamedtuple.c py: Add attrtuple object, for space-efficient tuples with attr access. 2015-04-21 14:14:24 +00:00
objnone.c py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function. 2015-05-12 22:46:02 +01:00
objobject.c py/objobject: Don't make locals_dict if there's nothing to go in it. 2015-05-17 17:48:47 +01:00
objproperty.c py, unix: Allow to compile with -Wunused-parameter. 2015-01-20 12:47:20 +00:00
objrange.c py: Overhaul and simplify printf/pfenv mechanism. 2015-04-16 14:30:16 +00:00
objreversed.c py: Add MICROPY_PY_BUILTINS_REVERSED, disable for minimal ports. 2015-04-07 00:17:11 +03:00
objset.c py: Overhaul and simplify printf/pfenv mechanism. 2015-04-16 14:30:16 +00:00
objsingleton.c objsingleton: New home for Ellipsis and NotImplemented. 2015-05-05 22:18:07 +03:00
objslice.c objsingleton: New home for Ellipsis and NotImplemented. 2015-05-05 22:18:07 +03:00
objstr.c py: Prevent many extra vstr allocations. 2015-07-06 17:29:27 +01:00
objstr.h py: Overhaul and simplify printf/pfenv mechanism. 2015-04-16 14:30:16 +00:00
objstringio.c py: Overhaul and simplify printf/pfenv mechanism. 2015-04-16 14:30:16 +00:00
objstrunicode.c py: Clean up declarations of str type/funcs that are also in unicode. 2015-05-17 16:44:24 +01:00
objtuple.c py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function. 2015-05-12 22:46:02 +01:00
objtuple.h py: Add attrtuple object, for space-efficient tuples with attr access. 2015-04-21 14:14:24 +00:00
objtype.c py: Add MP_BINARY_OP_DIVMOD to simplify and consolidate divmod builtin. 2015-06-13 23:36:30 +01:00
objtype.h py: Check that arg to object.__new__ is a user-defined type. 2015-05-04 11:08:40 +01:00
objzip.c py, unix: Allow to compile with -Wunused-parameter. 2015-01-20 12:47:20 +00:00
opmethods.c py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
parse.c py/parse: Fix handling of empty input so it raises an exception. 2015-07-24 15:05:56 +00:00
parse.h py: Expose compile.c:list_get as mp_parse_node_extract_list. 2015-02-13 02:29:46 +00:00
parsenum.c py: Clarify comment in parsenum.c about ValueError vs SyntaxError. 2015-06-23 16:08:51 +00:00
parsenum.h py: Parse big-int/float/imag constants directly in parser. 2015-02-08 01:57:40 +00:00
parsenumbase.c py: Parse big-int/float/imag constants directly in parser. 2015-02-08 01:57:40 +00:00
parsenumbase.h py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
py.mk py: Rebuild port if mpconfigport.mk changed (if any). 2015-06-11 11:08:39 +03:00
qstr.c py: Make qstr hash size configurable, defaults to 2 bytes. 2015-07-20 11:03:13 +00:00
qstr.h py: Adjust some spaces in code style/format, purely for consistency. 2015-04-09 15:29:54 +00:00
qstrdefs.h py: Make qstr hash size configurable, defaults to 2 bytes. 2015-07-20 11:03:13 +00:00
repl.c py/repl: Don't look inside strings for unmatched brackets/quotes. 2015-07-29 15:21:42 +00:00
repl.h py, readline: Add tab autocompletion for REPL. 2015-04-29 00:46:26 +01:00
runtime.c runtime: Improve mp_import_name() debug logging. 2015-06-27 00:40:21 +03:00
runtime.h py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
runtime0.h py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
scope.c py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
scope.h py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
sequence.c py, unix: Allow to compile with -Wunused-parameter. 2015-01-20 12:47:20 +00:00
showbc.c py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
smallint.c py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
smallint.h py: Allow configurable object representation, with 2 different options. 2015-04-03 14:11:13 +01:00
stackctrl.c vm: Support strict stackless mode, with proper exception reporting. 2015-04-03 00:26:47 +03:00
stackctrl.h py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
stream.c py: Add mp_obj_get_int_truncated and use it where appropriate. 2015-05-12 23:05:53 +01:00
stream.h py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
unicode.c py: Minor improvement to unichar_isxdigit 2015-05-20 09:31:22 +01:00
unicode.h py: Move to guarded includes, everywhere in py/ core. 2015-01-01 20:32:09 +00:00
vm.c py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
vmentrytable.h py: Remove mp_load_const_bytes and instead load precreated bytes object. 2015-06-25 14:42:13 +00:00
vstr.c py: Prevent many extra vstr allocations. 2015-07-06 17:29:27 +01:00
warning.c py: Convert occurrences of non-debug printf to mp_printf. 2015-04-16 14:30:16 +00:00