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