aboutsummaryrefslogtreecommitdiff
path: root/extmod/modure.c
AgeCommit message (Collapse)Author
2022-06-02all: Remove third argument to MP_REGISTER_MODULE.Damien George
It's no longer needed because this macro is now processed after preprocessing the source code via cpp (in the qstr extraction stage), which means unused MP_REGISTER_MODULE's are filtered out by the preprocessor. Signed-off-by: Damien George <damien@micropython.org>
2022-05-18extmod: Make extmod modules use MP_REGISTER_MODULE.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-03all: Use mp_obj_malloc everywhere it's applicable.Jim Mussared
This replaces occurences of foo_t *foo = m_new_obj(foo_t); foo->base.type = &foo_type; with foo_t *foo = mp_obj_malloc(foo_t, &foo_type); Excludes any places where base is a sub-field or when new0/memset is used. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-03-16extmod/modure: Set subject begin_line so ^ doesn't match interior.Damien George
Fixes issue #8402. Signed-off-by: Damien George <damien@micropython.org>
2021-12-09extmod/modure: Redirect regex debug printing to mp_printf.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-07-15py: Introduce and use mp_raise_type_arg helper.Damien George
To reduce code size. Signed-off-by: Damien George <damien@micropython.org>
2021-07-12extmod: Update for move of crypto-algorithms, re1.5, uzlib to lib.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-09-30extmod/modure: Allow \\ in re.sub replacements.Andrew Leech
2020-06-08extmod/ure: Use single function for match/search/sub.stijn
Saves about 500 bytes on unix x64 and enables CPython-conform usage of passing a re object to these functions.
2020-04-23all: Format code to add space after C++-style comment start.stijn
Note: the uncrustify configuration is explicitly set to 'add' instead of 'force' in order not to alter the comments which use extra spaces after // as a means of indenting text for clarity.
2020-04-13all: Clean up error strings to use lowercase and change cannot to can't.Damien George
Now that error string compression is supported it's more important to have consistent error string formatting (eg all lowercase English words, consistent contractions). This commit cleans up some of the strings to make them more consistent.
2020-04-05all: Use MP_ERROR_TEXT for all error messages.Jim Mussared
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2019-12-12extmod: Add dynamic-runtime guards to btree/framebuf/uheapq/ure/uzlib.Damien George
So they can be built as dynamic native modules, as well as existing static native modules.
2019-08-19extmod/modure: Make regex dump-code debugging feature optional.Damien George
Enabled via MICROPY_PY_URE_DEBUG, disabled by default (but enabled on unix coverage build). This is a rarely used feature that costs a lot of code (500-800 bytes flash). Debugging of regular expressions can be done offline with other tools.
2018-07-02extmod/modure: Add ure.sub() function and method, and tests.Damien George
This feature is controlled at compile time by MICROPY_PY_URE_SUB, disabled by default. Thanks to @dmazzella for the original patch for this feature; see #3770.
2018-07-02extmod/modure: Add match.span(), start() and end() methods, and tests.Damien George
This feature is controlled at compile time by MICROPY_PY_URE_MATCH_SPAN_START_END, disabled by default. Thanks to @dmazzella for the original patch for this feature; see #3770.
2018-07-02extmod/modure: Add match.groups() method, and tests.Damien George
This feature is controlled at compile time by MICROPY_PY_URE_MATCH_GROUPS, disabled by default. Thanks to @dmazzella for the original patch for this feature; see #3770.
2017-12-13extmod/modure: Add cast to workaround bug in MSVC.Damien George
2017-12-11extmod/modure: Convert alloca() to use new scoped allocation API.Damien George
2017-10-04all: Remove inclusion of internal py header files.Damien George
Header files that are considered internal to the py core and should not normally be included directly are: py/nlr.h - internal nlr configuration and declarations py/bc0.h - contains bytecode macro definitions py/runtime0.h - contains basic runtime enums Instead, the top-level header files to include are one of: py/obj.h - includes runtime0.h and defines everything to use the mp_obj_t type py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h, and defines everything to use the general runtime support functions Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-10-03extmod/modure: Add stack overflow checking when executing a regex.Paul Sokolovsky
2017-08-13all: Raise exceptions via mp_raise_XXXJavier Candeira
- Changed: ValueError, TypeError, NotImplementedError - OSError invocations unchanged, because the corresponding utility function takes ints, not strings like the long form invocation. - OverflowError, IndexError and RuntimeError etc. not changed for now until we decide whether to add new utility functions.
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-07-01extmod/modure: If input string is bytes, return bytes results too.Paul Sokolovsky
This applies to match.group() and split(). For ARM Thumb2, this increased code size by 12 bytes.
2017-03-29extmod: Update for changes to mp_obj_str_get_data.Damien George
2016-09-22all: Remove 'name' member from mp_obj_module_t struct.Damien George
One can instead lookup __name__ in the modules dict to get the value.
2016-04-08extmod/modure: re_exec() renamed to ure_exec() due to collison in 4.3BSD.Tom Sparks
Addresses issue #1972.
2016-01-11py: Change type signature of builtin funs that take variable or kw args.Damien George
With this patch the n_args parameter is changed type from mp_uint_t to size_t.
2015-11-29py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George
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.
2015-11-29py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George
2015-11-23extmod/modure: Use correct integer type for n_args argument.Damien George
2015-11-01extmod/modure: Make sure that errors in regexps are caught early.Paul Sokolovsky
2015-05-12py: Add mp_obj_get_int_truncated and use it where appropriate.Damien George
mp_obj_get_int_truncated will raise a TypeError if the argument is not an integral type. Use mp_obj_int_get_truncated only when you know the argument is a small or big int.
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
2015-03-17extmod/ure: Fix msvc warning resulting from memset on const char ** pointerstijn
2015-03-04extmod/ure: Correctly return None when a group has no match.Damien George
See issue #1122.
2015-02-18extmod/modure: Make num_matches store actual number of matches.Damien George
2015-01-20py, unix: Allow to compile with -Wunused-parameter.Damien George
See issue #699.
2015-01-01extmod: Prefix py/ for includes from py core directory.Damien George
2014-12-10py: Make functions static where appropriate.Damien George
2014-12-05py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.Damien George
mp_obj_int_get_truncated is used as a "fast path" int accessor that doesn't check for overflow and returns the int truncated to the machine word size, ie mp_int_t. Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word sized values. Addresses issues #779 and #998.
2014-11-29Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George
This is just a clean-up of the code. Generated code is exactly the same.
2014-11-21windows: Update config with latest featuresstijn
- update mpconfigport.h to reflect latest unix version - fix compilation error in modure due to msvc not allowing dynamic arrays
2014-10-15modure: Update to re1.5 v0.6, support for char sets/classes ([a-c]).Paul Sokolovsky
2014-10-12modure: Make sure that re1.5 compiled in only of modure itself is enabled.Paul Sokolovsky
This is achieved by including re1.5 *.c files straight from modure.c .
2014-10-11modure: Initial module, using re1.5 (which is based on re1 codebase).Paul Sokolovsky
https://github.com/pfalcon/re1.5