-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRE_Suite.txt
33 lines (30 loc) · 1.65 KB
/
RE_Suite.txt
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
//
// Building Blocks
//
oct_digit = [0-7]
dec_digit = [0-9]
hex_digit = [0-9a-fA-F]
lcase = [a-z]
ucase = [A-Z]
alpha = lcase | ucase | '_'
c_alphabet = [^"\"\'\\",'\x0'-'\x1f'] | '\\' [abfnrtv,"\\\'\""] | "\\x" hex_digit {hex_digit} | "\\u" hex_digit 4 | "\\U" hex_digit 8
symbol = [^0-9a-zA-Z_,'\x0'-' ',"\'\""]
//
// Predefined Tokens
//
dec_num = [1-9] dec_digit* | [0] >>bux::createDecNum<TID_LEX_Num,CHAR_TYPE>
oct_num = [0] oct_digit+ >>bux::createOctNum<TID_LEX_Num,CHAR_TYPE>
hex_num = [0] [xX] hex_digit+ >>bux::createHexNum<TID_LEX_Num,CHAR_TYPE>
identifier = alpha (alpha|dec_digit)* >>bux::createPlainString<TID_LEX_Id,CHAR_TYPE>
spaces = [" \r\t\v\f"]+ >>bux::createNothing<TID_LEX_Spaces,CHAR_TYPE>
c_char = '\'' (c_alphabet|'\"') '\'' >>bux::createCharLiteral<TID_LEX_Key,CHAR_TYPE>
c_str = '\"' (c_alphabet|'\'')* '\"' >>bux::createEscapeString<TID_LEX_String,CHAR_TYPE,1,1>
cpp_comment = "//" [^'\n']* '\n' >>bux::createNothing<'\n',CHAR_TYPE>
bracketed = "[[" []* "]]" >>bux::createPlainString<TID_LEX_Bracketed,CHAR_TYPE,2,2> @if bux::bracketsMatched
c_comment = "/*" []* "*/" >>bux::createNothing<TID_LEX_Spaces,CHAR_TYPE>
win32_newline = "\r\n" >>bux::createNothing<'\n',CHAR_TYPE>
CompoundSymbol = symbol (symbol|["\'\""])* symbol >>bux::createPlainString<TID_LEX_Operator,CHAR_TYPE> @-1
//
// The Target
//
//all = dec_num | oct_num | hex_num | identifier | spaces | c_char | c_str