1
2
3
4
5
6 classmap RexClassMap;
7
8 tokens RexTokens
9 {
10 (LPAREN, "'('"), (RPAREN, "')'"), (LBRACKET, "'['"), (RBRACKET, "']'"),
11 (ALT, "'|'"), (STAR, "'*'"), (PLUS, "'+'"), (QUEST, "'?'"), (DOT, "'.'"), (ESCAPE, "escape"), (INVERSE, "'^'"), (MINUS, "'-'"), (CHAR, "character")
12 }
13
14 expressions
15 {
16 decdigit="[0-9]";
17 octaldigit="[0-7]";
18 hexdigit="[0-9a-fA-F]";
19 hex4 = "{hexdigit}{hexdigit}{hexdigit}{hexdigit}";
20 hex8 = "{hex4}{hex4}";
21 escape = "\\((x|X){hexdigit}+|(d|D){decdigit}+|{octaldigit}+|u{hex4}|U{hex8}|(a|b|f|n|r|t|v|.))";
22 }
23
24 lexer RexLexer
25 {
26 "\(" { return LPAREN; }
27 "\)" { return RPAREN; }
28 "\[" { return LBRACKET; }
29 "\]" { return RBRACKET; }
30 "\|" { return ALT; }
31 "\*" { return STAR; }
32 "\+" { return PLUS; }
33 "\?" { return QUEST; }
34 "\." { return DOT; }
35 "{escape}" { return ESCAPE; }
36 "^" { return INVERSE; }
37 "-" { return MINUS; }
38 "[^\x0\r\n{}\\()[\]|*+?.^-]" { return CHAR; }
39 }