summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/regexp/regcomp.h
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/ape/lib/regexp/regcomp.h
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/ape/lib/regexp/regcomp.h')
-rwxr-xr-xsys/src/ape/lib/regexp/regcomp.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/sys/src/ape/lib/regexp/regcomp.h b/sys/src/ape/lib/regexp/regcomp.h
new file mode 100755
index 000000000..082e6137e
--- /dev/null
+++ b/sys/src/ape/lib/regexp/regcomp.h
@@ -0,0 +1,61 @@
+/*
+ * substitution list
+ */
+typedef struct Resublist Resublist;
+struct Resublist
+{
+ Resub m[32];
+};
+
+/* max subexpressions per program */
+Resublist ReSuBlIsT;
+#define NSUBEXP (sizeof(ReSuBlIsT.m)/sizeof(Resub))
+
+/* max character classes per program */
+Reprog RePrOg;
+#define NCLASS (sizeof(RePrOg.class)/sizeof(Reclass))
+
+/* max rune ranges per character class */
+#define NCCRUNE (sizeof(Reclass)/sizeof(wchar_t))
+
+/*
+ * Actions and Tokens (Reinst types)
+ *
+ * 02xx are operators, value == precedence
+ * 03xx are tokens, i.e. operands for operators
+ */
+#define RUNE 0177
+#define OPERATOR 0200 /* Bitmask of all operators */
+#define START 0200 /* Start, used for marker on stack */
+#define RBRA 0201 /* Right bracket, ) */
+#define LBRA 0202 /* Left bracket, ( */
+#define OR 0203 /* Alternation, | */
+#define CAT 0204 /* Concatentation, implicit operator */
+#define STAR 0205 /* Closure, * */
+#define PLUS 0206 /* a+ == aa* */
+#define QUEST 0207 /* a? == a|nothing, i.e. 0 or 1 a's */
+#define ANY 0300 /* Any character except newline, . */
+#define ANYNL 0301 /* Any character including newline, . */
+#define NOP 0302 /* No operation, internal use only */
+#define BOL 0303 /* Beginning of line, ^ */
+#define EOL 0304 /* End of line, $ */
+#define CCLASS 0305 /* Character class, [] */
+#define NCCLASS 0306 /* Negated character class, [] */
+#define END 0377 /* Terminate: match found */
+
+/*
+ * regexec execution lists
+ */
+#define LISTINCREMENT 8
+typedef struct Relist Relist;
+struct Relist
+{
+ Reinst *inst; /* Reinstruction of the thread */
+ Resublist se; /* matched subexpressions in this thread */
+};
+extern Relist* _relist[2];
+extern Relist* _reliste[2];
+extern int _relistsize;
+
+extern Relist* _renewthread(Relist*, Reinst*, Resublist*);
+extern void _renewmatch(Resub*, int, Resublist*);