-
Notifications
You must be signed in to change notification settings - Fork 2
/
tree-sitter-json5.ebnf
55 lines (41 loc) · 1 KB
/
tree-sitter-json5.ebnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// From tree-sitter-json5/src/grammar.json
//
//
// EBNF to generate railroad diagram at
// (IPV6) https://www.bottlecaps.de/rr/ui
// (IPV4) https://rr.red-dove.com/ui
//
file ::=
object | array
comment ::=
( '//' [^#x0A]* | '/*' '.'* '*/' )
object ::=
'{' ( member ( ',' member )* ','? )? '}'
member ::=
name ':' _value
name ::=
string
| identifier
identifier ::=
( [\$_\p{L}] ( [\$_\p{L}] | [0-9] )* )
array ::=
'[' ( _value ( ',' _value )* ','? )? ']'
string ::=
( '"' ( '\\' ( '"' | '\\' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' ) | [^"\] )* '"' | "'" ( '\\' ( "'" | '\\' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' ) | [^'\] )* "'" )
number ::=
( [+-]? ( '0' [xX] [0-9a-fA-F]+ | ( '0' | [1-9] [0-9]* ) '.' [0-9]* ( [eE] [+-]? [0-9]+ )? | '.' [0-9]* ( [eE] [+-]? [0-9]+ )? | ( '0' | [1-9] [0-9]* ) ( [eE] [+-]? [0-9]+ )? | 'Infinity' | 'NaN' ) )
null ::=
'null'
true ::=
'true'
false ::=
'false'
_value ::=
object
| array
| number
| string
| null
| true
| false