summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-02-08 21:25:51 +0100
committerTyge Løvset <[email protected]>2022-02-08 21:25:51 +0100
commit00cc6351fd4a0cdf216eba3cc4918aa3c7aa0704 (patch)
treed1b96b42f1c8be419869caf337ced21e84404ba0
parentc52878b498e56339ac98ab27537040dc13215043 (diff)
downloadSTC-modified-00cc6351fd4a0cdf216eba3cc4918aa3c7aa0704.tar.gz
STC-modified-00cc6351fd4a0cdf216eba3cc4918aa3c7aa0704.zip
Small fix.
-rw-r--r--include/stc/cregex.h13
-rw-r--r--src/cregex.c11
2 files changed, 13 insertions, 11 deletions
diff --git a/include/stc/cregex.h b/include/stc/cregex.h
index 38d7042c..4b9bde51 100644
--- a/include/stc/cregex.h
+++ b/include/stc/cregex.h
@@ -52,12 +52,13 @@ typedef enum {
} cregex_error_t;
enum {
- /* flags */
- creg_dotall = 1<<0, /* compile */
- creg_caseless = 1<<1, /* compile+match */
- creg_fullmatch = 1<<2, /* match */
- creg_next = 1<<3, /* match */
- creg_startend = 1<<4, /* match */
+ /* compile flags */
+ creg_dotall = 1<<0,
+ creg_caseless = 1<<1,
+ /* execution flags */
+ creg_fullmatch = 1<<2,
+ creg_next = 1<<3,
+ creg_startend = 1<<4,
/* limits */
creg_max_classes = 16,
creg_max_captures = 32,
diff --git a/src/cregex.c b/src/cregex.c
index b07f9bfd..6d48e696 100644
--- a/src/cregex.c
+++ b/src/cregex.c
@@ -166,7 +166,7 @@ typedef struct Reljunk
{
Relist* relist[2];
Relist* reliste[2];
- Token starttype;
+ int starttype;
Rune startchar;
const char* starts;
const char* eol;
@@ -326,8 +326,8 @@ typedef struct Parser
short cursubid; /* id of current subexpression */
int errors;
Reflags flags;
- Token dot_type;
- Token rune_type;
+ int dot_type;
+ int rune_type;
bool lastwasand; /* Last token was operand */
bool lexdone;
short nbra;
@@ -1078,8 +1078,9 @@ regexec9(const Reprog *progp, /* program to run */
j.starttype = 0;
j.startchar = 0;
- if (progp->startinst->type == RUNE && progp->startinst->r.rune < 128) {
- j.starttype = RUNE;
+ int rune_type = progp->flags.caseless ? IRUNE : RUNE;
+ if (progp->startinst->type == rune_type && progp->startinst->r.rune < 128) {
+ j.starttype = rune_type;
j.startchar = progp->startinst->r.rune;
}
if (progp->startinst->type == BOL)