1 classmap MdbClassMap;
2
3 tokens MdbTokens
4 {
5 (SEG, "seg"), (REG, "reg"), (HEX, "hex"), (DEC, "dec"), (ID, "identifier"), (PLUS, "'+'"), (MINUS, "'-'"), (BAR, "'|'"), (CARET, "'^'"), (AST, "'*'"), (SLASH, "'/'"), (PERCENT, "'%'"),
6 (SHIFT_LEFT, "'<<'"), (SHIFT_RIGHT, "'>>'"), (AMP, "'&'"), (TILDE, "'~'"), (DOT, "'.'"), (LPAREN, "'()"), (RPAREN, "')'"), (PRINT, "print"), (TRACE, "trace")
7 }
8
9 keywords MdbKeywords
10 {
11 ("print", PRINT), ("trace", TRACE), ("p", PRINT), ("t", TRACE)
12 }
13
14 expressions
15 {
16 ws = "[\t\r\n ]+";
17 digit = "[0-9]";
18 seg = "$[tdpsk]";
19 reg ="${digit}+";
20 hexdigit = "[0-9a-fA-F]";
21 hex = "#{hexdigit}+";
22 dec = "{digit}+";
23 id = "{idstart}{idcont}*";
24 }
25
26 lexer MdbLexer
27 {
28 "{ws}" {}
29 "{seg}" { return SEG; }
30 "{reg}" { return REG; }
31 "{hex}" { return HEX; }
32 "{dec}" { return DEC; }
33 "{id}" { int kw = GetKeywordToken(token.match); if (kw == INVALID_TOKEN) return ID; else return kw; }
34 "\+" { return PLUS; }
35 "-" { return MINUS; }
36 "\|" { return BAR; }
37 "^" { return CARET; }
38 "\*" { return AST; }
39 "/" { return SLASH; }
40 "%" { return PERCENT; }
41 "<<" { return SHIFT_LEFT; }
42 ">>" { return SHIFT_RIGHT; }
43 "&" { return AMP; }
44 "~" { return TILDE; }
45 "\." { return DOT; }
46 "\(" { return LPAREN; }
47 "\)" { return RPAREN; }
48 }