summaryrefslogtreecommitdiff
path: root/extmod/re1.5/charclass.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/re1.5/charclass.c')
-rw-r--r--extmod/re1.5/charclass.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/extmod/re1.5/charclass.c b/extmod/re1.5/charclass.c
new file mode 100644
index 000000000..c9f617592
--- /dev/null
+++ b/extmod/re1.5/charclass.c
@@ -0,0 +1,11 @@
+#include "re1.5.h"
+
+int _re1_5_classmatch(const char *pc, const char *sp)
+{
+ // pc points to "cnt" byte after opcode
+ int cnt = *pc++;
+ while (cnt--) {
+ if (!(*sp >= *pc && *sp <= pc[1])) return 0;
+ }
+ return 1;
+} \ No newline at end of file