summaryrefslogtreecommitdiff
path: root/sys/src/libregexp/regimpl.h
diff options
context:
space:
mode:
authorspew <devnull@localhost>2017-02-02 21:21:34 -0600
committerspew <devnull@localhost>2017-02-02 21:21:34 -0600
commit9ae083d81642be3a3ee7ff1e8d28fb9381bb1abf (patch)
tree54315ed3ffb0d4797e8b06b667b25c047accc697 /sys/src/libregexp/regimpl.h
parentf94167ebeebc108f393b3b2ec279cee2afae56e7 (diff)
libregexp: simplify regular expression vm implementation
Make the logic around who has priority over the final match simpler by merging the priority generation and match fields in a smarter way. Move the creation of new thread matches up to the top to avoid jumping all over the place.
Diffstat (limited to 'sys/src/libregexp/regimpl.h')
-rw-r--r--sys/src/libregexp/regimpl.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/sys/src/libregexp/regimpl.h b/sys/src/libregexp/regimpl.h
index f173a970c..8785a27f0 100644
--- a/sys/src/libregexp/regimpl.h
+++ b/sys/src/libregexp/regimpl.h
@@ -1,5 +1,4 @@
-enum
-{
+enum {
LANY = 0,
LBOL,
LCLASS,
@@ -30,8 +29,7 @@ enum
typedef struct Parselex Parselex;
typedef struct Renode Renode;
-struct Parselex
-{
+struct Parselex {
/* Parse */
Renode *next;
Renode *nodes;
@@ -50,8 +48,8 @@ struct Parselex
Rune cpairs[400+2];
int nc;
};
-struct Renode
-{
+
+struct Renode {
int op;
Renode *left;
Rune r;
@@ -63,15 +61,15 @@ struct Renode
};
int nclass;
};
-struct Rethread
-{
- Reinst *pc;
+
+struct Rethread {
+ Reinst *i;
Resub sem[NSUBEXPM];
- int pri;
Rethread *next;
+ int gen;
};
-struct Reinst
-{
+
+struct Reinst {
char op;
int gen;
Reinst *a;