Skip to content

Commit

Permalink
changed the issue with the global types not being defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Khashayar Barooti committed Nov 25, 2024
1 parent b31c3a7 commit 5c39fe1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/_string_tools/slice_field.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ global PHI: Field = 0x30644E72E131A029B85045B68181585D;

global PLO_200_felt: Field = 0x29B85045B68181585D2833E84879B9709143E1F593F0000001;
global PHI_54_felt: Field = 0x30644E72E131A0;
global TWO_POW_200 = 0x100000000000000000000000000000000000000000000000000;
global TWO_POW_200: Field = 0x100000000000000000000000000000000000000000000000000;
struct Slice200 {
hihi: u64, // 7 bytes
hilo: u64, // 7 bytes
Expand Down
8 changes: 4 additions & 4 deletions src/_string_tools/slice_packed_field.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// #############################################################
// ### GLOBAL VARIABLES AND LOOKUP TABLES
// #############################################################
global two_pow_128 = 0x100000000000000000000000000000000;
global two_pow_64 = 0x10000000000000000;
global two_pow_32 = 0x100000000;
global two_pow_16 = 0x10000;
global two_pow_128: Field = 0x100000000000000000000000000000000;
global two_pow_64: Field = 0x10000000000000000;
global two_pow_32: Field = 0x100000000;
global two_pow_16: Field = 0x10000;

global path_multipliers_chunk4: [Field; 32] = [
/* 0 (00000) */ 0,
Expand Down
10 changes: 5 additions & 5 deletions src/_table_generation/make_tables.nr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! Contains methods used to generate tables in `json_tables.nr`. These table generation methods shouldn't be used inside of actual circuits.

mod CaptureMode {
global GRAMMAR_CAPTURE = 0;
global STRING_CAPTURE = 1;
global NUMERIC_CAPTURE = 2;
global LITERAL_CAPTURE = 3;
global ERROR_CAPTURE = 4;
global GRAMMAR_CAPTURE: Field = 0;
global STRING_CAPTURE: Field = 1;
global NUMERIC_CAPTURE: Field = 2;
global LITERAL_CAPTURE: Field = 3;
global ERROR_CAPTURE: Field = 4;
}
use crate::_table_generation::make_tables::CaptureMode::STRING_CAPTURE;
use crate::_table_generation::make_tables_subtables::{
Expand Down
36 changes: 18 additions & 18 deletions src/enums.nr
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
mod ScanMode {
global GRAMMAR_SCAN = 0;
global STRING_SCAN = 1;
global NUMERIC_SCAN = 2;
global GRAMMAR_SCAN: Field = 0;
global STRING_SCAN: Field = 1;
global NUMERIC_SCAN: Field = 2;
global LITERAL_SCAN: Field = 3;
}

mod Token {
global NO_TOKEN = 0;
global BEGIN_OBJECT_TOKEN = 1;
global END_OBJECT_TOKEN = 2;
global BEGIN_ARRAY_TOKEN = 3;
global NO_TOKEN: Field = 0;
global BEGIN_OBJECT_TOKEN: Field = 1;
global END_OBJECT_TOKEN: Field = 2;
global BEGIN_ARRAY_TOKEN: Field = 3;
global END_ARRAY_TOKEN: Field = 4;
global KEY_SEPARATOR_TOKEN = 5;
global VALUE_SEPARATOR_TOKEN = 6;
global STRING_TOKEN = 7;
global NUMERIC_TOKEN = 8;
global LITERAL_TOKEN = 9;
global KEY_TOKEN = 10;
global NUM_TOKENS = 11;
global NUM_TOKENS_MUL_2 = 22;
global KEY_SEPARATOR_TOKEN: Field = 5;
global VALUE_SEPARATOR_TOKEN: Field = 6;
global STRING_TOKEN: Field = 7;
global NUMERIC_TOKEN: Field = 8;
global LITERAL_TOKEN: Field = 9;
global KEY_TOKEN: Field = 10;
global NUM_TOKENS: u32 = 11;
global NUM_TOKENS_MUL_2: u32 = 22;
}

mod Layer {
global OBJECT_LAYER = 0;
global ARRAY_LAYER = 1;
global SINGLE_VALUE_LAYER = 2;
global OBJECT_LAYER: Field = 0;
global ARRAY_LAYER: Field = 1;
global SINGLE_VALUE_LAYER: Field = 2;
}

2 changes: 1 addition & 1 deletion src/get_literal.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::getters::JSONValue;
use crate::json::JSON;
use crate::json_entry::JSONEntry;

global MAX_LITERAL_LENGTH_AS_STRING = 5;
global MAX_LITERAL_LENGTH_AS_STRING : u32= 5;
global LITERAL_OFFSET_SHIFT: [Field; 6] =
[0x10000000000, 0x100000000, 0x1000000, 0x10000, 0x100, 1];

Expand Down
2 changes: 1 addition & 1 deletion src/get_number.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::json::JSON;
use crate::json_entry::JSONEntry;
use crate::json_tables::ASCII_TO_NUMBER;

global U64_LENGTH_AS_BASE10_STRING = 20;
global U64_LENGTH_AS_BASE10_STRING: u32 = 20;
global NUMBER_OFFSET_SHIFT: [Field; 21] = [
100000000000000000000,
10000000000000000000,
Expand Down

0 comments on commit 5c39fe1

Please sign in to comment.