1use oak_core::language::Language;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub struct JsonLanguage {
6 pub trailing_comma: bool,
8 pub bare_keys: bool,
10 pub single_quotes: bool,
12 pub comments: bool,
14 pub hex_numbers: bool,
16 pub infinity_and_nan: bool,
18}
19
20impl JsonLanguage {
21 pub fn standard() -> Self {
23 Self::default()
24 }
25
26 pub fn json5() -> Self {
28 Self {
29 trailing_comma: true,
30 bare_keys: true,
31 single_quotes: true,
32 comments: true,
33 hex_numbers: true,
34 infinity_and_nan: true,
35 }
36 }
37
38 pub fn relaxed() -> Self {
40 Self {
41 trailing_comma: true,
42 bare_keys: true,
43 single_quotes: true,
44 comments: true,
45 hex_numbers: true,
46 infinity_and_nan: true,
47 }
48 }
49}
50
51impl Default for JsonLanguage {
52 fn default() -> Self {
53 Self {
54 trailing_comma: false,
55 bare_keys: false,
56 single_quotes: false,
57 comments: false,
58 hex_numbers: false,
59 infinity_and_nan: false,
60 }
61 }
62}
63
64impl Language for JsonLanguage {
65 type SyntaxKind = crate::kind::JsonSyntaxKind;
66 type TypedRoot = (); }