1 classmap JsonClassMap;
2
3 tokens JsonTokens
4 {
5 (STRING, "'string'"), (NUMBER, "'number'"), (LBRACKET, "'['"), (RBRACKET, "']"), (LBRACE, "{'"), (RBRACE, "'}'"), (COMMA, "','"), (COLON, "':'"), (TRUE, "'true'"), (FALSE, "'false'"), (NULL, "'null'")
6 }
7
8 expressions
9 {
10 ws = "[\n\r\t ]+";
11 hexdigit = "[0-9a-fA-F]";
12 hex4 = "{hexdigit}{hexdigit}{hexdigit}{hexdigit}";
13 escape = "\\([\"\\/bfnrt]|u{hex4})";
14 string = "\"([^\"\\]|{escape})*\"";
15 digit = "[0-9]";
16 number = "-?{digit}+(\.{digit}+)?([eE][+-]?{digit}+)?";
17 }
18
19 lexer JsonLexer
20 {
21 "{ws}" {}
22 "{string}" { return STRING; }
23 "{number}" { return NUMBER; }
24 "\[" { return LBRACKET; }
25 "\]" { return RBRACKET; }
26 "\{" { return LBRACE; }
27 "\}" { return RBRACE; }
28 "," { return COMMA; }
29 ":"{ return COLON; }
30 "true" { return TRUE; }
31 "false" { return FALSE; }
32 "null" { return NULL; }
33 }