Commit Graph

19 Commits

Author SHA1 Message Date
Scott Shawcroft e02a26453c
Merge MicroPython 1.14 into CircuitPython 2021-05-11 15:07:40 -07:00
Scott Shawcroft b35fa44c8a
Merge MicroPython 1.12 into CircuitPython 2021-05-03 14:01:18 -07:00
Jeff Epler 2fb5eb3b11 extmod/re1.5: Check and report byte overflow errors in _compilecode.
The generated regex code is limited in the range of jumps and counts, and
this commit checks all cases which can overflow given the right kind of
input regex, and returns an error in such a case.

This change assumes that the results that overflow an int8_t do not
overflow a platform int.

Closes: #7078

Signed-off-by: Jeff Epler <jepler@gmail.com>

# Conflicts:
#	extmod/re1.5/compilecode.c
2021-04-06 19:11:40 -05:00
Emil Renner Berthing ccd92335a1 py, extmod: Introduce and use MP_FALLTHROUGH macro.
Newer GCC versions are able to warn about switch cases that fall
through.  This is usually a sign of a forgotten break statement, but in
the few cases where a fall through is intended we annotate it with this
macro to avoid the warning.
2020-10-22 11:53:16 +02:00
Jeff Epler 12d826d941 Add FALLTHROUGH comments as needed
I investigated these cases and confirmed that the fallthrough behavior
was intentional.
2020-09-12 15:11:29 -05:00
Jim Mussared ebf8332104 extmod/re1.5: Support escaping within RE classes.
Fixes issues #3178 and #5220.

Tests are added, including all the cases mentioned in both bugs.
2019-10-18 12:20:32 +11:00
Radomir Dopieralski 20a787adb4 extmod/ure: Handle some escape sequences.
Fix MicroPython #3176

Handle escape sequences inside regular expressions. This adds
handling for \a, \b, \f, \n, \r, \v and \\.
2019-02-14 15:42:25 +01:00
armink 6a693db71d extmod/re1.5: Fix compilecode.c compile problem on IAR tool chain.
The 2nd and 3rd args of the ternary operator are treated like they are in
the same expression and must have similar types.  void is not compatible
with int so that's why the compiler is complaining.
2018-04-10 13:54:22 +10:00
Paul Sokolovsky c9a0b2a818 extmod/re1.5: Upgrade to v0.8.2, adds hook for stack overflow checking. 2017-10-02 21:20:47 +03:00
Paul Sokolovsky 4a314a6f63 extmod/re1.5: Update to 0.8.1.
Allow literal minus in char classes to be in trailing position, e.g. [a-c-].
(Previously, minus was allowed only at the start.)

This increases ARM Thumb2 code size by 8 bytes.
2017-09-24 10:19:24 +03:00
Paul Sokolovsky d0601b0a1f extmod/re1.5: Workaround issue with mingw32-gcc 4.2.1. 2015-11-01 02:39:01 +03:00
Paul Sokolovsky 7cce2f664c extmod/re1.5: Update to 0.8.
Contains implementation of ?: (non-capturing groups), ?? (non-greedy ?),
as well as much improved robustness, and edge cases and error handling by
Amir Plivatsky (@ampli).
2015-11-01 00:38:00 +03:00
Paul Sokolovsky d7194f1b8e extmod: Update re1.5 to 0.7.
Includes static function fix and all the previous improvements and fixes
by @dpgeorge.
2015-03-18 23:42:17 +02:00
Damien George 8dead2a6c6 extmod: Pull in upstream changes to re1.5; fixes bugs with regex errors. 2015-03-10 17:47:13 +00:00
Damien George d09a5b51c2 extmod: Pull in upstream changes to re1.5; fixes bug, adds named class. 2015-02-21 10:33:20 +00:00
Paul Sokolovsky 297d8469b8 modure: Update to re1.5 v0.6.1, fixed and extended character class support. 2014-10-17 22:25:18 +03:00
Paul Sokolovsky 95908b0f50 modure: Update to re1.5 v0.6, support for char sets/classes ([a-c]). 2014-10-15 04:44:07 +03:00
Paul Sokolovsky 457c0a606c modure: Upgrade re1.5 to 0.5.1
Changes include:

regexp.h: Add double-include protection.
2014-10-12 03:12:19 +03:00
Paul Sokolovsky 5edbadefc1 modure: Import needed files from re1.5 v0.5.
https://github.com/pfalcon/re1.5
2014-10-11 14:36:32 +03:00