-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassertions.c
More file actions
48 lines (38 loc) · 818 Bytes
/
assertions.c
File metadata and controls
48 lines (38 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <ctype.h>
#include "rxpriv.h"
int
isword (int c) {
return isalnum(c) || c == '_' || c == '-';
}
int
bos (const char *str, const char *pos) {
return pos == str;
}
int
bol (const char *str, const char *pos) {
return bos(str, pos) || pos[-1] == '\n';
}
int
eos (const char *str, const char *pos) {
return !*pos;
}
int
eol (const char *str, const char *pos) {
return eos(str, pos) || *pos == '\n';
}
int
lwb (const char *str, const char *pos) {
return (bos(str, pos) || !isword(pos[-1])) && isword(*pos);
}
int
rwb (const char *str, const char *pos) {
return !bos(str, pos) && isword(pos[-1]) && !isword(*pos);
}
int
wb (const char *str, const char *pos) {
return lwb(str, pos) || rwb(str, pos);
}
int
nwb (const char *str, const char *pos) {
return !wb(str, pos);
}