-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathre_code.hpp
More file actions
30 lines (28 loc) · 865 Bytes
/
re_code.hpp
File metadata and controls
30 lines (28 loc) · 865 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
#ifndef MINI_REGEXP_CODE_H_
#define MINI_REGEXP_CODE_H_
namespace mini_regexp_code
{
/* addr is a current ip offset */
enum BYTE_CODE {
HALT = 0,
MATCH, /* match addr */
SPLIT, /* split addr1, addr2 if (addr1) else (addr2) */
JMP, /* jmp addr */
REPEAT, /* repeat n */
REPEND, /* repend */
ENTER, /* "(" */
LEAVE, /* ")" */
ZERO_WIDTH_ASSERT_ENTER, /* "(?" zwae type (type := : | = | ! | <= | <!) */
ZERO_WIDTH_ASSERT_LEAVE, /* ")" zwae */
RANGE, /* range _start, _end(_start < c < _end) */
ACCEPT,
};
struct ByteCode
{
BYTE_CODE op;
void *exp1, *exp2;
ByteCode():op(BYTE_CODE::HALT),exp1(0),exp2(0) {}
ByteCode(BYTE_CODE _op, void *_exp1, void *_exp2):op(_op),exp1(_exp1),exp2(_exp2) {}
};
}
#endif