summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2025-05-04 03:59:00 +0000
committermidipix <writeonce@midipix.org>2025-05-04 03:59:00 +0000
commit1ceb4a294741967df7735ebe9e3e2d0606d2af64 (patch)
tree1e976fa9eab830a56b6ff2cafa2f9dc440fe3746
parent97d87d96ca3bb883754629802f210f487bb37781 (diff)
downloadtreebnf-1ceb4a294741967df7735ebe9e3e2d0606d2af64.tar.bz2
treebnf-1ceb4a294741967df7735ebe9e3e2d0606d2af64.tar.xz
regex module: scanner function semantics: retern zero upon no-match.HEADmain
-rw-r--r--src/regex/tbnf_regex_scanfns.h64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/regex/tbnf_regex_scanfns.h b/src/regex/tbnf_regex_scanfns.h
index c57a606..ee9ee89 100644
--- a/src/regex/tbnf_regex_scanfns.h
+++ b/src/regex/tbnf_regex_scanfns.h
@@ -15,7 +15,7 @@ static inline int tbnf_regex_scan_brace_rbrace(const struct tbnf_scan_ctx * sctx
if (sctx->tok_scan_mark[0] == '}')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_brace_digit(const struct tbnf_scan_ctx * sctx)
@@ -24,7 +24,7 @@ static inline int tbnf_regex_scan_brace_digit(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] <= '9')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_brace_comma(const struct tbnf_scan_ctx * sctx)
@@ -32,7 +32,7 @@ static inline int tbnf_regex_scan_brace_comma(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == ',')
return 1;
- return -1;
+ return 0;
}
@@ -44,7 +44,7 @@ static inline int tbnf_regex_scan_bracket_escaped_char(const struct tbnf_scan_ct
if (sctx->tok_scan_mark[1])
return 2;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_bracket_character_class(const struct tbnf_scan_ctx * sctx)
@@ -52,14 +52,14 @@ static inline int tbnf_regex_scan_bracket_character_class(const struct tbnf_scan
const char * ch = 0;
if (&sctx->tok_scan_mark[4] >= sctx->tok_scan_cap)
- return -1;
+ return 0;
if (sctx->tok_scan_mark[0] == '[')
if (sctx->tok_scan_mark[1] == ':')
ch = &sctx->tok_scan_mark[2];
if (!ch)
- return -1;
+ return 0;
for (; (*ch >= 'a') && (*ch <= 'z') && (&ch[2] < sctx->tok_scan_cap); )
ch++;
@@ -67,13 +67,13 @@ static inline int tbnf_regex_scan_bracket_character_class(const struct tbnf_scan
if ((*ch++ == ':') && (*ch++ == ']'))
return (ch - sctx->tok_scan_mark);
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_bracket_collation_symbol(const struct tbnf_scan_ctx * sctx)
{
if (&sctx->tok_scan_mark[4] >= sctx->tok_scan_cap)
- return -1;
+ return 0;
if (sctx->tok_scan_mark[0] == '[')
if (sctx->tok_scan_mark[1] == '.')
@@ -82,7 +82,7 @@ static inline int tbnf_regex_scan_bracket_collation_symbol(const struct tbnf_sca
if (sctx->tok_scan_mark[2])
return 5;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_bracket_equivalence_class(const struct tbnf_scan_ctx * sctx)
@@ -90,14 +90,14 @@ static inline int tbnf_regex_scan_bracket_equivalence_class(const struct tbnf_sc
const char * ch = 0;
if (&sctx->tok_scan_mark[4] >= sctx->tok_scan_cap)
- return -1;
+ return 0;
if (sctx->tok_scan_mark[0] == '[')
if (sctx->tok_scan_mark[1] == '=')
ch = &sctx->tok_scan_mark[2];
if (!ch)
- return -1;
+ return 0;
for (; (*ch >= 'a') && (*ch <= 'z') && (&ch[2] < sctx->tok_scan_cap); )
ch++;
@@ -105,7 +105,7 @@ static inline int tbnf_regex_scan_bracket_equivalence_class(const struct tbnf_sc
if ((*ch++ == '=') && (*ch++ == ']'))
return (ch - sctx->tok_scan_mark);
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_bracket_rbracket(const struct tbnf_scan_ctx * sctx)
@@ -113,7 +113,7 @@ static inline int tbnf_regex_scan_bracket_rbracket(const struct tbnf_scan_ctx *
if (sctx->tok_scan_mark[0] == ']')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_bracket_hyphen(const struct tbnf_scan_ctx * sctx)
@@ -121,7 +121,7 @@ static inline int tbnf_regex_scan_bracket_hyphen(const struct tbnf_scan_ctx * sc
if (sctx->tok_scan_mark[0] == '-')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_bracket_error(const struct tbnf_scan_ctx * sctx)
@@ -129,7 +129,7 @@ static inline int tbnf_regex_scan_bracket_error(const struct tbnf_scan_ctx * sct
if (sctx->tok_scan_mark[0] == '[')
return 1;
- return -1;
+ return 0;
}
@@ -143,7 +143,7 @@ static inline int tbnf_regex_scan_lbracket_circumflex_rbracket(const struct tbnf
if (sctx->tok_scan_mark[2] == ']')
return 3;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_lbracket_circumflex(const struct tbnf_scan_ctx * sctx)
@@ -153,7 +153,7 @@ static inline int tbnf_regex_scan_lbracket_circumflex(const struct tbnf_scan_ctx
if (sctx->tok_scan_mark[1] == '^')
return 2;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_lbracket_rbracket(const struct tbnf_scan_ctx * sctx)
@@ -163,7 +163,7 @@ static inline int tbnf_regex_scan_lbracket_rbracket(const struct tbnf_scan_ctx *
if (sctx->tok_scan_mark[1] == ']')
return 2;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_lbracket(const struct tbnf_scan_ctx * sctx)
@@ -171,7 +171,7 @@ static inline int tbnf_regex_scan_lbracket(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '[')
return 1;
- return -1;
+ return 0;
}
@@ -183,7 +183,7 @@ static inline int tbnf_regex_scan_escaped_char(const struct tbnf_scan_ctx * sctx
if (sctx->tok_scan_mark[1])
return 2;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_circumflex_asterisk(const struct tbnf_scan_ctx * sctx)
@@ -193,7 +193,7 @@ static inline int tbnf_regex_scan_circumflex_asterisk(const struct tbnf_scan_ctx
if (sctx->tok_scan_mark[1] == '*')
return 2;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_circumflex(const struct tbnf_scan_ctx * sctx)
@@ -201,7 +201,7 @@ static inline int tbnf_regex_scan_circumflex(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '^')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_lbrace(const struct tbnf_scan_ctx * sctx)
@@ -209,7 +209,7 @@ static inline int tbnf_regex_scan_lbrace(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '{')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_lparen(const struct tbnf_scan_ctx * sctx)
@@ -217,7 +217,7 @@ static inline int tbnf_regex_scan_lparen(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '(')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_rparen(const struct tbnf_scan_ctx * sctx)
@@ -225,7 +225,7 @@ static inline int tbnf_regex_scan_rparen(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == ')')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_asterisk(const struct tbnf_scan_ctx * sctx)
@@ -233,7 +233,7 @@ static inline int tbnf_regex_scan_asterisk(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '*')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_period(const struct tbnf_scan_ctx * sctx)
@@ -241,7 +241,7 @@ static inline int tbnf_regex_scan_period(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '.')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_dollar(const struct tbnf_scan_ctx * sctx)
@@ -249,7 +249,7 @@ static inline int tbnf_regex_scan_dollar(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '$')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_vline(const struct tbnf_scan_ctx * sctx)
@@ -257,7 +257,7 @@ static inline int tbnf_regex_scan_vline(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '|')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_qmark(const struct tbnf_scan_ctx * sctx)
@@ -265,7 +265,7 @@ static inline int tbnf_regex_scan_qmark(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '?')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_plus(const struct tbnf_scan_ctx * sctx)
@@ -273,7 +273,7 @@ static inline int tbnf_regex_scan_plus(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0] == '+')
return 1;
- return -1;
+ return 0;
}
static inline int tbnf_regex_scan_char(const struct tbnf_scan_ctx * sctx)
@@ -281,7 +281,7 @@ static inline int tbnf_regex_scan_char(const struct tbnf_scan_ctx * sctx)
if (sctx->tok_scan_mark[0])
return 1;
- return -1;
+ return 0;
}
#endif