1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub enum JsonItemType {
11 Null,
13 False,
15 True,
17 String,
19 Number,
21 Object,
23 Array,
25 BlankLine,
27 LineComment,
29 BlockComment,
31}
32
33#[derive(Debug, Clone, Copy, PartialEq, Eq)]
34pub enum TokenType {
35 BeginArray,
36 EndArray,
37 BeginObject,
38 EndObject,
39 String,
40 Number,
41 Null,
42 True,
43 False,
44 BlockComment,
45 LineComment,
46 BlankLine,
47 Comma,
48 Colon,
49}
50
51#[derive(Debug, Clone, Copy, PartialEq, Eq)]
52pub enum BracketPaddingType {
53 Empty = 0,
54 Simple = 1,
55 Complex = 2,
56}
57
58#[derive(Debug, Clone, Copy, PartialEq, Eq)]
59pub enum TableColumnType {
60 Unknown,
61 Simple,
62 Number,
63 Array,
64 Object,
65 Mixed,
66}
67
68#[derive(Debug, Clone, Copy, PartialEq, Eq)]
82pub struct InputPosition {
83 pub index: usize,
85 pub row: usize,
87 pub column: usize,
89}
90
91#[derive(Debug, Clone, PartialEq, Eq)]
92pub struct JsonToken {
93 pub token_type: TokenType,
94 pub text: String,
95 pub input_position: InputPosition,
96}
97
98#[derive(Debug, Clone)]
99pub struct JsonItem {
100 pub item_type: JsonItemType,
101 pub input_position: InputPosition,
102 pub complexity: usize,
103 pub name: String,
104 pub value: String,
105 pub prefix_comment: String,
106 pub middle_comment: String,
107 pub middle_comment_has_new_line: bool,
108 pub postfix_comment: String,
109 pub is_post_comment_line_style: bool,
110 pub name_length: usize,
111 pub value_length: usize,
112 pub prefix_comment_length: usize,
113 pub middle_comment_length: usize,
114 pub postfix_comment_length: usize,
115 pub minimum_total_length: usize,
116 pub requires_multiple_lines: bool,
117 pub children: Vec<JsonItem>,
118}
119
120impl Default for JsonItem {
121 fn default() -> Self {
122 Self {
123 item_type: JsonItemType::Null,
124 input_position: InputPosition {
125 index: 0,
126 row: 0,
127 column: 0,
128 },
129 complexity: 0,
130 name: String::new(),
131 value: String::new(),
132 prefix_comment: String::new(),
133 middle_comment: String::new(),
134 middle_comment_has_new_line: false,
135 postfix_comment: String::new(),
136 is_post_comment_line_style: false,
137 name_length: 0,
138 value_length: 0,
139 prefix_comment_length: 0,
140 middle_comment_length: 0,
141 postfix_comment_length: 0,
142 minimum_total_length: 0,
143 requires_multiple_lines: false,
144 children: Vec::new(),
145 }
146 }
147}