diff options
| author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-10-16 13:56:13 +0300 |
|---|---|---|
| committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-10-17 22:25:18 +0300 |
| commit | 297d8469b8fcaa072630c9561695edb001d96232 (patch) | |
| tree | 04e7bfb9ddb60a8a8b84feb59c95c9d7cf4627b4 /extmod/re1.5/charclass.c | |
| parent | 391db8669b77e50eebe4d1583749430a3549fab7 (diff) | |
modure: Update to re1.5 v0.6.1, fixed and extended character class support.
Diffstat (limited to 'extmod/re1.5/charclass.c')
| -rw-r--r-- | extmod/re1.5/charclass.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/extmod/re1.5/charclass.c b/extmod/re1.5/charclass.c index c9f617592..c9df40375 100644 --- a/extmod/re1.5/charclass.c +++ b/extmod/re1.5/charclass.c @@ -3,9 +3,11 @@ int _re1_5_classmatch(const char *pc, const char *sp) { // pc points to "cnt" byte after opcode + int is_positive = (pc[-1] == Class); int cnt = *pc++; while (cnt--) { - if (!(*sp >= *pc && *sp <= pc[1])) return 0; + if (*sp >= *pc && *sp <= pc[1]) return is_positive; + pc += 2; } - return 1; -}
\ No newline at end of file + return !is_positive; +} |
