@@ -288,8 +288,8 @@ unconstrained fn make_token_validation_table() -> [Field; NUM_TOKENS * NUM_TOKEN
288
288
let mut flattened_flags : [Field ; NUM_TOKENS * NUM_TOKENS * 3 ] =
289
289
[0 ; NUM_TOKENS * NUM_TOKENS * 3 ];
290
290
let NN = (NUM_TOKENS * NUM_TOKENS );
291
- for j in 0 ..NUM_TOKENS as u32 {
292
- for k in 0 ..NUM_TOKENS as u32 {
291
+ for j in 0 ..NUM_TOKENS {
292
+ for k in 0 ..NUM_TOKENS {
293
293
flattened_flags [OBJECT_LAYER * NN + j * NUM_TOKENS + k ] = object_layer_flags [j ][k ];
294
294
flattened_flags [ARRAY_LAYER * NN + j * NUM_TOKENS + k ] = array_layer_flags [j ][k ];
295
295
flattened_flags [SINGLE_VALUE_LAYER * NN + j * NUM_TOKENS + k ] =
@@ -359,94 +359,94 @@ unconstrained fn make_process_raw_transcript_table() -> [Field; 1024] {
359
359
}
360
360
361
361
unconstrained fn generate_token_flags_table () -> [Field ; NUM_TOKENS * 2 ] {
362
- let mut flags : [TokenFlags ; NUM_TOKENS * 2 ] = [ TokenFlags :: default (); NUM_TOKENS * 2 ] ;
362
+ let mut flags : [TokenFlags ; NUM_TOKENS * 2 ] = std::mem:: zeroed () ;
363
363
364
364
let mut no_token_flags : TokenFlags = TokenFlags {
365
365
create_json_entry : false ,
366
- is_end_of_object_or_array : 0 ,
367
- is_start_of_object_or_array : 0 ,
368
- new_context : OBJECT_LAYER as Field ,
369
- is_key_token : 0 ,
370
- is_value_token : 0 ,
371
- preserve_num_entries : 1 ,
366
+ is_end_of_object_or_array : false ,
367
+ is_start_of_object_or_array : false ,
368
+ new_context : OBJECT_LAYER != 0 ,
369
+ is_key_token : false ,
370
+ is_value_token : false ,
371
+ preserve_num_entries : true ,
372
372
};
373
373
let mut key_token_flags : TokenFlags = TokenFlags {
374
374
create_json_entry : false ,
375
- is_end_of_object_or_array : 0 ,
376
- is_start_of_object_or_array : 0 ,
377
- new_context : OBJECT_LAYER as Field ,
378
- is_key_token : 1 ,
379
- is_value_token : 0 ,
380
- preserve_num_entries : 1 ,
375
+ is_end_of_object_or_array : false ,
376
+ is_start_of_object_or_array : false ,
377
+ new_context : OBJECT_LAYER != 0 ,
378
+ is_key_token : true ,
379
+ is_value_token : false ,
380
+ preserve_num_entries : true ,
381
381
};
382
382
let begin_object_flags = TokenFlags {
383
383
create_json_entry : false ,
384
- is_end_of_object_or_array : 0 ,
385
- is_start_of_object_or_array : 1 ,
386
- new_context : OBJECT_LAYER as Field ,
387
- is_key_token : 0 ,
388
- is_value_token : 0 ,
389
- preserve_num_entries : 0 ,
384
+ is_end_of_object_or_array : false ,
385
+ is_start_of_object_or_array : true ,
386
+ new_context : OBJECT_LAYER != 0 ,
387
+ is_key_token : false ,
388
+ is_value_token : false ,
389
+ preserve_num_entries : false ,
390
390
};
391
391
392
392
let begin_array_flags = TokenFlags {
393
393
create_json_entry : false ,
394
- is_end_of_object_or_array : 0 ,
395
- is_start_of_object_or_array : 1 ,
396
- new_context : ARRAY_LAYER as Field ,
397
- is_key_token : 0 ,
398
- is_value_token : 0 ,
399
- preserve_num_entries : 0 ,
394
+ is_end_of_object_or_array : false ,
395
+ is_start_of_object_or_array : true ,
396
+ new_context : ARRAY_LAYER != 0 ,
397
+ is_key_token : false ,
398
+ is_value_token : false ,
399
+ preserve_num_entries : false ,
400
400
};
401
401
402
402
let mut end_object_flags = TokenFlags {
403
403
create_json_entry : true ,
404
- is_end_of_object_or_array : 1 ,
405
- is_start_of_object_or_array : 0 ,
406
- new_context : 0 ,
407
- is_key_token : 0 ,
408
- is_value_token : 0 ,
409
- preserve_num_entries : 0 ,
404
+ is_end_of_object_or_array : true ,
405
+ is_start_of_object_or_array : false ,
406
+ new_context : false ,
407
+ is_key_token : false ,
408
+ is_value_token : false ,
409
+ preserve_num_entries : false ,
410
410
};
411
411
412
412
let mut end_array_flags = TokenFlags {
413
413
create_json_entry : true ,
414
- is_end_of_object_or_array : 1 ,
415
- is_start_of_object_or_array : 0 ,
416
- new_context : 0 ,
417
- is_key_token : 0 ,
418
- is_value_token : 0 ,
419
- preserve_num_entries : 0 ,
414
+ is_end_of_object_or_array : true ,
415
+ is_start_of_object_or_array : false ,
416
+ new_context : false ,
417
+ is_key_token : false ,
418
+ is_value_token : false ,
419
+ preserve_num_entries : false ,
420
420
};
421
421
422
422
let mut string_flags = TokenFlags {
423
423
create_json_entry : true ,
424
- is_end_of_object_or_array : 0 ,
425
- is_start_of_object_or_array : 0 ,
426
- new_context : OBJECT_LAYER as Field ,
427
- is_key_token : 0 ,
428
- is_value_token : 1 ,
429
- preserve_num_entries : 1 ,
424
+ is_end_of_object_or_array : false ,
425
+ is_start_of_object_or_array : false ,
426
+ new_context : OBJECT_LAYER != 0 ,
427
+ is_key_token : false ,
428
+ is_value_token : true ,
429
+ preserve_num_entries : true ,
430
430
};
431
431
432
432
let mut numeric_flags = TokenFlags {
433
433
create_json_entry : true ,
434
- is_end_of_object_or_array : 0 ,
435
- is_start_of_object_or_array : 0 ,
436
- new_context : OBJECT_LAYER as Field ,
437
- is_key_token : 0 ,
438
- is_value_token : 1 ,
439
- preserve_num_entries : 1 ,
434
+ is_end_of_object_or_array : false ,
435
+ is_start_of_object_or_array : false ,
436
+ new_context : OBJECT_LAYER != 0 ,
437
+ is_key_token : false ,
438
+ is_value_token : true ,
439
+ preserve_num_entries : true ,
440
440
};
441
441
442
442
let mut literal_flags = TokenFlags {
443
443
create_json_entry : true ,
444
- is_end_of_object_or_array : 0 ,
445
- is_start_of_object_or_array : 0 ,
446
- new_context : OBJECT_LAYER as Field ,
447
- is_key_token : 0 ,
448
- is_value_token : 1 ,
449
- preserve_num_entries : 1 ,
444
+ is_end_of_object_or_array : false ,
445
+ is_start_of_object_or_array : false ,
446
+ new_context : OBJECT_LAYER != 0 ,
447
+ is_key_token : false ,
448
+ is_value_token : true ,
449
+ preserve_num_entries : true ,
450
450
};
451
451
452
452
flags [NO_TOKEN ] = no_token_flags ;
@@ -461,26 +461,26 @@ unconstrained fn generate_token_flags_table() -> [Field; NUM_TOKENS * 2] {
461
461
flags [LITERAL_TOKEN ] = literal_flags ;
462
462
flags [KEY_TOKEN ] = key_token_flags ;
463
463
464
- no_token_flags .new_context = ARRAY_LAYER as Field ;
465
- key_token_flags .new_context = ARRAY_LAYER as Field ;
466
- string_flags .new_context = ARRAY_LAYER as Field ;
467
- numeric_flags .new_context = ARRAY_LAYER as Field ;
468
- literal_flags .new_context = ARRAY_LAYER as Field ;
469
-
470
- flags [NUM_TOKENS + ( NO_TOKEN as u32 ) ] = no_token_flags ;
471
- flags [NUM_TOKENS + ( BEGIN_OBJECT_TOKEN as u32 ) ] = begin_object_flags ;
472
- flags [NUM_TOKENS + ( END_OBJECT_TOKEN as u32 ) ] = end_object_flags ;
473
- flags [NUM_TOKENS + ( BEGIN_ARRAY_TOKEN as u32 ) ] = begin_array_flags ;
474
- flags [NUM_TOKENS + ( END_ARRAY_TOKEN as u32 ) ] = end_array_flags ;
475
- flags [NUM_TOKENS + ( KEY_SEPARATOR_TOKEN as u32 ) ] = no_token_flags ;
476
- flags [NUM_TOKENS + ( VALUE_SEPARATOR_TOKEN as u32 ) ] = no_token_flags ;
477
- flags [NUM_TOKENS + ( STRING_TOKEN as u32 ) ] = string_flags ;
478
- flags [NUM_TOKENS + ( NUMERIC_TOKEN as u32 ) ] = numeric_flags ;
479
- flags [NUM_TOKENS + ( LITERAL_TOKEN as u32 ) ] = literal_flags ;
480
- flags [NUM_TOKENS + ( KEY_TOKEN as u32 ) ] = key_token_flags ;
464
+ no_token_flags .new_context = ARRAY_LAYER != 0 ;
465
+ key_token_flags .new_context = ARRAY_LAYER != 0 ;
466
+ string_flags .new_context = ARRAY_LAYER != 0 ;
467
+ numeric_flags .new_context = ARRAY_LAYER != 0 ;
468
+ literal_flags .new_context = ARRAY_LAYER != 0 ;
469
+
470
+ flags [NUM_TOKENS + NO_TOKEN ] = no_token_flags ;
471
+ flags [NUM_TOKENS + BEGIN_OBJECT_TOKEN ] = begin_object_flags ;
472
+ flags [NUM_TOKENS + END_OBJECT_TOKEN ] = end_object_flags ;
473
+ flags [NUM_TOKENS + BEGIN_ARRAY_TOKEN ] = begin_array_flags ;
474
+ flags [NUM_TOKENS + END_ARRAY_TOKEN ] = end_array_flags ;
475
+ flags [NUM_TOKENS + KEY_SEPARATOR_TOKEN ] = no_token_flags ;
476
+ flags [NUM_TOKENS + VALUE_SEPARATOR_TOKEN ] = no_token_flags ;
477
+ flags [NUM_TOKENS + STRING_TOKEN ] = string_flags ;
478
+ flags [NUM_TOKENS + NUMERIC_TOKEN ] = numeric_flags ;
479
+ flags [NUM_TOKENS + LITERAL_TOKEN ] = literal_flags ;
480
+ flags [NUM_TOKENS + KEY_TOKEN ] = key_token_flags ;
481
481
482
482
let mut result : [Field ; NUM_TOKENS * 2 ] = [0 ; NUM_TOKENS * 2 ];
483
- for i in 0 ..(NUM_TOKENS as u32 * 2 ) {
483
+ for i in 0 ..(NUM_TOKENS * 2 ) {
484
484
result [i ] = flags [i ].to_field ();
485
485
}
486
486
result
0 commit comments