-
Notifications
You must be signed in to change notification settings - Fork 1
/
range.h
executable file
·60 lines (51 loc) · 1.07 KB
/
range.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
/* range.h
*
* Struct for temporarily storing group captures.
*/
#ifndef __regex_range
#define __regex_range
/* group
*
* A simple struct which represents a substring of a string
* by keeping a pointer to the beginning of the string and
* a pointer to one after the end of the string.
*/
typedef struct {
char* begin;
char* end;
} group_t;
/* range
*
* A wrapper struct that holds an array of group_t, and the
* size of the array.
*/
typedef struct _range range_t;
/** group
*
* Get the group with the given index, or return null if the
* group doesn't exist.
*/
group_t* range_group(range_t*, int);
/** size
*
* Gives the size of the internal array, which is the number of
* groups in the regular expression including the overall match.
*/
int range_size(range_t*);
/** copy
*
* Copy the range struct.
*/
range_t* range_copy(range_t*);
/** new
*
* Create a new range; you need to give the constructor the size
* of the array.
*/
range_t* range_new(int);
/** free
*
* Free the range's memory.
*/
void range_free(range_t*);
#endif