@@ -65,27 +65,27 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
65
65
// output is layer type
66
66
// 11 tokens , 3 layers = 11 * 11 * 3 = 121 * 3 = 343
67
67
// object contexts
68
- let no_change = ValidationFlags { push_layer : 0 , push_layer_type_of_root : 0 , pop_layer : 0 };
69
- let error_flags =
70
- ValidationFlags { push_layer : 0x1000000 , push_layer_type_of_root : 0 , pop_layer : 0 } ;
68
+ let no_change =
69
+ ValidationFlags { push_layer : false , push_layer_type_of_root : false , pop_layer : false };
70
+ let error_flags_field = 0x1000000 ;
71
71
let begin_new_object_flags = ValidationFlags {
72
- push_layer : 1 ,
73
- push_layer_type_of_root : OBJECT_LAYER as Field ,
74
- pop_layer : 0 ,
72
+ push_layer : true ,
73
+ push_layer_type_of_root : OBJECT_LAYER as bool ,
74
+ pop_layer : false ,
75
75
};
76
76
let begin_new_array_flags = ValidationFlags {
77
- push_layer : 1 ,
78
- push_layer_type_of_root : ARRAY_LAYER as Field ,
79
- pop_layer : 0 ,
77
+ push_layer : true ,
78
+ push_layer_type_of_root : ARRAY_LAYER as bool ,
79
+ pop_layer : false ,
80
80
};
81
81
let end_object_or_array_flags : ValidationFlags =
82
- ValidationFlags { push_layer : 0 , push_layer_type_of_root : 0 , pop_layer : 1 };
82
+ ValidationFlags { push_layer : false , push_layer_type_of_root : false , pop_layer : true };
83
83
84
84
let token_ids : [u32 ; NUM_TOKENS ] = [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ];
85
85
86
- let error_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|_ | error_flags . to_field () );
86
+ let error_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|_ | error_flags_field );
87
87
let object_layer_begin_object_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
88
- let mut result = error_flags . to_field () ;
88
+ let mut result = error_flags_field ;
89
89
if (token == KEY_TOKEN ) {
90
90
result = no_change .to_field ();
91
91
}
@@ -98,13 +98,13 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
98
98
let object_layer_key_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
99
99
let mut result = no_change .to_field ();
100
100
if (token != KEY_SEPARATOR_TOKEN ) {
101
- result = error_flags . to_field () ;
101
+ result = error_flags_field ;
102
102
}
103
103
result
104
104
});
105
105
106
106
let object_layer_key_separator_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
107
- let mut result = error_flags . to_field () ;
107
+ let mut result = error_flags_field ;
108
108
if (token == STRING_TOKEN ) | (token == LITERAL_TOKEN ) | (token == NUMERIC_TOKEN ) {
109
109
result = no_change .to_field ();
110
110
}
@@ -118,7 +118,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
118
118
});
119
119
120
120
let object_layer_value_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
121
- let mut result = error_flags . to_field () ;
121
+ let mut result = error_flags_field ;
122
122
if (token == VALUE_SEPARATOR_TOKEN ) {
123
123
result = no_change .to_field ();
124
124
}
@@ -129,7 +129,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
129
129
});
130
130
131
131
let object_layer_end_object_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
132
- let mut result = error_flags . to_field () ;
132
+ let mut result = error_flags_field ;
133
133
if (token == VALUE_SEPARATOR_TOKEN ) {
134
134
result = no_change .to_field ();
135
135
}
@@ -144,7 +144,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
144
144
});
145
145
146
146
let object_layer_value_separator_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
147
- let mut result = error_flags . to_field () ;
147
+ let mut result = error_flags_field ;
148
148
if (token == KEY_TOKEN ) {
149
149
result = no_change .to_field ();
150
150
}
@@ -157,7 +157,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
157
157
[[0 ; NUM_TOKENS ]; NUM_TOKENS ];
158
158
159
159
let no_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
160
- let mut result = error_flags . to_field () ;
160
+ let mut result = error_flags_field ;
161
161
if (token == NO_TOKEN ) {
162
162
result = no_change .to_field ();
163
163
}
@@ -177,7 +177,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
177
177
object_layer_flags [KEY_TOKEN ] = object_layer_key_token_outcomes ;
178
178
179
179
let array_layer_begin_array_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token : u32 | {
180
- let mut result = error_flags . to_field () ;
180
+ let mut result = error_flags_field ;
181
181
if (token == STRING_TOKEN ) | (token == LITERAL_TOKEN ) | (token == NUMERIC_TOKEN ) {
182
182
result = no_change .to_field ();
183
183
}
@@ -194,7 +194,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
194
194
});
195
195
196
196
let array_layer_value_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
197
- let mut result = error_flags . to_field () ;
197
+ let mut result = error_flags_field ;
198
198
if (token == VALUE_SEPARATOR_TOKEN ) {
199
199
result = no_change .to_field ();
200
200
}
@@ -205,7 +205,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
205
205
});
206
206
207
207
let array_layer_value_separator_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
208
- let mut result = error_flags . to_field () ;
208
+ let mut result = error_flags_field ;
209
209
if (token == STRING_TOKEN ) | (token == LITERAL_TOKEN ) | (token == NUMERIC_TOKEN ) {
210
210
result = no_change .to_field ();
211
211
}
@@ -219,7 +219,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
219
219
});
220
220
221
221
let array_layer_value_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
222
- let mut result = error_flags . to_field () ;
222
+ let mut result = error_flags_field ;
223
223
if (token == VALUE_SEPARATOR_TOKEN ) {
224
224
result = no_change .to_field ();
225
225
}
@@ -229,7 +229,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
229
229
result
230
230
});
231
231
let array_layer_end_array_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
232
- let mut result = error_flags . to_field () ;
232
+ let mut result = error_flags_field ;
233
233
if (token == VALUE_SEPARATOR_TOKEN ) {
234
234
result = no_change .to_field ();
235
235
}
@@ -243,7 +243,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
243
243
result
244
244
});
245
245
let array_layer_end_object_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
246
- let mut result = error_flags . to_field () ;
246
+ let mut result = error_flags_field ;
247
247
if (token == VALUE_SEPARATOR_TOKEN ) {
248
248
result = no_change .to_field ();
249
249
}
@@ -266,7 +266,7 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
266
266
array_layer_flags [KEY_TOKEN ] = error_token_outcomes ;
267
267
268
268
let single_value_layer_value_token_outcomes : [Field ; NUM_TOKENS ] = token_ids .map (|token | {
269
- let mut result = error_flags . to_field () ;
269
+ let mut result = error_flags_field ;
270
270
// we have reached the end of json
271
271
if (token == NO_TOKEN ) {
272
272
result = no_change .to_field ();
0 commit comments