Debian Codegraph @

demo/kitchen-sink/docs/ion.ion

raw
1 // Comment
2 /*
3 Multi
4 Line
5 Comment
6 */
7 [1,2,3,45 /*TODO: should be 42, obviously*/, 2016-04-21T08:10:46Z, 2016-04-21T08:10:46-08:00, 2016-04-21, 2016, 0x5, 0b0110]
8 (5 7 1 3 [
9 'a', 'b',
10 null, null.int, null.bool, null.list,
11 true, false,
12 nan, -inf, +inf,
13 "str",
14 "str with embedded \" ",
15 '''str with embedded \''' ''',
16 {{"clob content"}},
17 {{ AB/ }}
18 ])
19
20 '''
21
22 multi
23 line
24 string
25
26 '''
27
28 states::{
29 // https://amzn.github.io/ion-docs/docs/spec.html
30 root: rules::[
31 include::'value'
32 ],
33
34 // https://amzn.github.io/ion-docs/docs/spec.html#string
35 string: rules::[
36 match :: {
37 regex: "(\\\")((?:\\\\\"|[^\"])*)(\\\")",
38 token: ['string.dblq.punc.start', 'string.dblq', 'string.dblq.punc.end']
39 },
40 push::{
41 regex: "\'{3}",
42 token: 'string.trpq.punc.start',
43 states: rules::[
44 pop :: {
45 regex: "\'{3}",
46 token: 'string.trpq.punc.end',
47 },
48 match::{
49 regex: "(?:\\\\'*|.|[^']*)",
50 token: 'string.trpq'
51 }
52 ]
53 },
54 ],
55
56 /*
57 ...
58 */
59 }
60 {
61 "json": {
62 "compatibility": true,
63 "open sourced": "2016-04-21T08:10:46Z",
64 "foo": 9,
65 "bar": 1.1,
66 "baz": [{"id": 1}, {"id":2}]
67 }
68 }