Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
CARGO_TERM_COLOR: always
MINIMUM_NOIR_VERSION: v0.37.0
MINIMUM_NOIR_VERSION: v1.0.0-beta.1

jobs:
noir-version-list:
Expand Down Expand Up @@ -84,4 +84,4 @@ jobs:
fi
env:
# We treat any cancelled, skipped or failing jobs as a failure for the workflow as a whole.
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
2 changes: 1 addition & 1 deletion Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "json_parser"
type = "lib"
authors = [""]
compiler_version = ">=0.37.0"
compiler_version = ">=1.0.0"

[dependencies]
noir_sort = {tag = "v0.2.2", git = "https://github.com/noir-lang/noir_sort"}
4 changes: 2 additions & 2 deletions src/_comparison_tools/mod.nr
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mod lt;
mod bounds_checker;
pub(crate) mod lt;
pub(crate) mod bounds_checker;
8 changes: 4 additions & 4 deletions src/_string_tools/mod.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod slice_field;
mod slice_packed_field;
mod string_chopper;
mod sum_bytes_into_field;
pub(crate) mod slice_field;
pub(crate) mod slice_packed_field;
pub(crate) mod string_chopper;
pub(crate) mod sum_bytes_into_field;
4 changes: 2 additions & 2 deletions src/_string_tools/string_chopper.nr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::_string_tools::slice_packed_field::slice_fields;

struct StringChopper<let NeedlePackedFields: u32> {}
pub(crate) struct StringChopper<let NeedlePackedFields: u32> {}

impl<let NeedlePackedFields: u32> StringChopper<NeedlePackedFields> {
fn slice_string<let StringBytes: u32, let HaystackPackedFields: u32>(
pub(crate) fn slice_string<let StringBytes: u32, let HaystackPackedFields: u32>(
_: Self,
haystack: [Field; HaystackPackedFields],
start_bytes: Field,
Expand Down
32 changes: 16 additions & 16 deletions src/_table_generation/make_tables.nr
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
//! 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: Field = 0;
global STRING_CAPTURE: Field = 1;
global NUMERIC_CAPTURE: Field = 2;
global LITERAL_CAPTURE: Field = 3;
global ERROR_CAPTURE: Field = 4;
pub(crate) mod CaptureMode {
pub(crate) global GRAMMAR_CAPTURE: Field = 0;
pub(crate) global STRING_CAPTURE: Field = 1;
pub(crate) global NUMERIC_CAPTURE: Field = 2;
pub(crate) global LITERAL_CAPTURE: Field = 3;
pub(crate) global ERROR_CAPTURE: Field = 4;
}
use crate::_table_generation::make_tables::CaptureMode::STRING_CAPTURE;
use crate::_table_generation::make_tables_subtables::{
GRAMMAR_CAPTURE_ERROR_FLAG, GRAMMAR_CAPTURE_INCREASE_LENGTH, GRAMMAR_CAPTURE_PUSH_TRANSCRIPT,
GRAMMAR_CAPTURE_TABLE, GRAMMAR_CAPTURE_TOKEN, LITERAL_CAPTURE_ERROR_FLAG,
LITERAL_CAPTURE_INCREASE_LENGTH, LITERAL_CAPTURE_PUSH_TRANSCRIPT, LITERAL_CAPTURE_TABLE,
LITERAL_CAPTURE_TOKEN, NUMERIC_CAPTURE_ERROR_FLAG, NUMERIC_CAPTURE_INCREASE_LENGTH,
NUMERIC_CAPTURE_PUSH_TRANSCRIPT, NUMERIC_CAPTURE_TABLE, NUMERIC_CAPTURE_TOKEN,
STRING_CAPTURE_ERROR_FLAG, STRING_CAPTURE_INCREASE_LENGTH, STRING_CAPTURE_PUSH_TRANSCRIPT,
STRING_CAPTURE_TABLE, STRING_CAPTURE_TOKEN, TOKEN_IS_NUMERIC_OR_LITERAL,
};
use crate::enums::Layer::{ARRAY_LAYER, OBJECT_LAYER, SINGLE_VALUE_LAYER};
use crate::enums::Token::{
BEGIN_ARRAY_TOKEN, BEGIN_OBJECT_TOKEN, END_ARRAY_TOKEN, END_OBJECT_TOKEN, KEY_SEPARATOR_TOKEN,
Expand All @@ -25,6 +15,16 @@ use crate::enums::Token::{
};
use crate::token_flags::TokenFlags;
use crate::transcript_entry::ValidationFlags;
use super::make_tables_subtables::{
GRAMMAR_CAPTURE_ERROR_FLAG, GRAMMAR_CAPTURE_INCREASE_LENGTH, GRAMMAR_CAPTURE_PUSH_TRANSCRIPT,
GRAMMAR_CAPTURE_TABLE, GRAMMAR_CAPTURE_TOKEN, LITERAL_CAPTURE_ERROR_FLAG,
LITERAL_CAPTURE_INCREASE_LENGTH, LITERAL_CAPTURE_PUSH_TRANSCRIPT, LITERAL_CAPTURE_TABLE,
LITERAL_CAPTURE_TOKEN, NUMERIC_CAPTURE_ERROR_FLAG, NUMERIC_CAPTURE_INCREASE_LENGTH,
NUMERIC_CAPTURE_PUSH_TRANSCRIPT, NUMERIC_CAPTURE_TABLE, NUMERIC_CAPTURE_TOKEN,
STRING_CAPTURE_ERROR_FLAG, STRING_CAPTURE_INCREASE_LENGTH, STRING_CAPTURE_PUSH_TRANSCRIPT,
STRING_CAPTURE_TABLE, STRING_CAPTURE_TOKEN, TOKEN_IS_NUMERIC_OR_LITERAL,
};
use CaptureMode::STRING_CAPTURE;

global CAPTURE_TABLE: [[Field; 128]; 4] =
[GRAMMAR_CAPTURE_TABLE, STRING_CAPTURE_TABLE, NUMERIC_CAPTURE_TABLE, LITERAL_CAPTURE_TABLE];
Expand Down
42 changes: 21 additions & 21 deletions src/_table_generation/make_tables_subtables.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use crate::enums::Token::{
KEY_TOKEN, LITERAL_TOKEN, NO_TOKEN, NUMERIC_TOKEN, STRING_TOKEN, VALUE_SEPARATOR_TOKEN,
};

global TOKEN_IS_NUMERIC_OR_LITERAL: [Field; 11] = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0];
pub(crate) global TOKEN_IS_NUMERIC_OR_LITERAL: [Field; 11] = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0];

global GRAMMAR_CAPTURE_TABLE: [Field; 128] = [
pub(crate) global GRAMMAR_CAPTURE_TABLE: [Field; 128] = [
/* NULL */ ERROR_CAPTURE,
/* SOH */ ERROR_CAPTURE,
/* TXT */ ERROR_CAPTURE,
Expand Down Expand Up @@ -142,7 +142,7 @@ global GRAMMAR_CAPTURE_TABLE: [Field; 128] = [
/*DEL*/ ERROR_CAPTURE,
];

global STRING_CAPTURE_TABLE: [Field; 128] = [
pub(crate) global STRING_CAPTURE_TABLE: [Field; 128] = [
/* NULL */ ERROR_CAPTURE,
/* SOH */ ERROR_CAPTURE,
/* TXT */ ERROR_CAPTURE,
Expand Down Expand Up @@ -273,7 +273,7 @@ global STRING_CAPTURE_TABLE: [Field; 128] = [
/*DEL*/ ERROR_CAPTURE,
];

global NUMERIC_CAPTURE_TABLE: [Field; 128] = [
pub(crate) global NUMERIC_CAPTURE_TABLE: [Field; 128] = [
/* NULL */ ERROR_CAPTURE,
/* SOH */ ERROR_CAPTURE,
/* TXT */ ERROR_CAPTURE,
Expand Down Expand Up @@ -404,7 +404,7 @@ global NUMERIC_CAPTURE_TABLE: [Field; 128] = [
/*DEL*/ ERROR_CAPTURE,
];

global LITERAL_CAPTURE_TABLE: [Field; 128] = [
pub(crate) global LITERAL_CAPTURE_TABLE: [Field; 128] = [
/* NULL */ ERROR_CAPTURE,
/* SOH */ ERROR_CAPTURE,
/* TXT */ ERROR_CAPTURE,
Expand Down Expand Up @@ -535,7 +535,7 @@ global LITERAL_CAPTURE_TABLE: [Field; 128] = [
/*DEL*/ ERROR_CAPTURE,
];

global GRAMMAR_CAPTURE_TOKEN: [Field; 128] = [
pub(crate) global GRAMMAR_CAPTURE_TOKEN: [Field; 128] = [
/* NULL */ NO_TOKEN,
/* SOH */ NO_TOKEN,
/* TXT */ NO_TOKEN,
Expand Down Expand Up @@ -677,7 +677,7 @@ global GRAMMAR_CAPTURE_TOKEN: [Field; 128] = [
/*DEL*/ NO_TOKEN,
];

global GRAMMAR_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
pub(crate) global GRAMMAR_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
/* NULL */ false,
/* SOH */ false,
/* TXT */ false,
Expand Down Expand Up @@ -819,7 +819,7 @@ global GRAMMAR_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
/*DEL*/ false,
];

global GRAMMAR_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
pub(crate) global GRAMMAR_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
/* NULL */ false,
/* SOH */ false,
/* TXT */ false,
Expand Down Expand Up @@ -961,7 +961,7 @@ global GRAMMAR_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
/*DEL*/ false,
];

global STRING_CAPTURE_TOKEN: [Field; 128] = [
pub(crate) global STRING_CAPTURE_TOKEN: [Field; 128] = [
/* NULL */ NO_TOKEN,
/* SOH */ NO_TOKEN,
/* TXT */ NO_TOKEN,
Expand Down Expand Up @@ -1103,7 +1103,7 @@ global STRING_CAPTURE_TOKEN: [Field; 128] = [
/*DEL*/ NO_TOKEN,
];

global STRING_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
pub(crate) global STRING_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
/* NULL */ false,
/* SOH */ false,
/* TXT */ false,
Expand Down Expand Up @@ -1245,7 +1245,7 @@ global STRING_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
/*DEL*/ false,
];

global STRING_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
pub(crate) global STRING_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
/* NULL */ false,
/* SOH */ false,
/* TXT */ false,
Expand Down Expand Up @@ -1387,7 +1387,7 @@ global STRING_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
/*DEL*/ false,
];

global NUMERIC_CAPTURE_TOKEN: [Field; 128] = [
pub(crate) global NUMERIC_CAPTURE_TOKEN: [Field; 128] = [
/* NULL */ NO_TOKEN,
/* SOH */ NO_TOKEN,
/* TXT */ NO_TOKEN,
Expand Down Expand Up @@ -1529,7 +1529,7 @@ global NUMERIC_CAPTURE_TOKEN: [Field; 128] = [
/*DEL*/ NO_TOKEN,
];

global NUMERIC_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
pub(crate) global NUMERIC_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
/* NULL */ false,
/* SOH */ false,
/* TXT */ false,
Expand Down Expand Up @@ -1671,7 +1671,7 @@ global NUMERIC_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
/*DEL*/ false,
];

global NUMERIC_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
pub(crate) global NUMERIC_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
/* NULL */ false,
/* SOH */ false,
/* TXT */ false,
Expand Down Expand Up @@ -1813,7 +1813,7 @@ global NUMERIC_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
/*DEL*/ false,
];

global LITERAL_CAPTURE_TOKEN: [Field; 128] = [
pub(crate) global LITERAL_CAPTURE_TOKEN: [Field; 128] = [
/* NULL */ NO_TOKEN,
/* SOH */ NO_TOKEN,
/* TXT */ NO_TOKEN,
Expand Down Expand Up @@ -1944,7 +1944,7 @@ global LITERAL_CAPTURE_TOKEN: [Field; 128] = [
/*DEL*/ NO_TOKEN,
];

global LITERAL_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
pub(crate) global LITERAL_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
/* NULL */ false,
/* SOH */ false,
/* TXT */ false,
Expand Down Expand Up @@ -2086,7 +2086,7 @@ global LITERAL_CAPTURE_PUSH_TRANSCRIPT: [bool; 128] = [
/*DEL*/ false,
];

global LITERAL_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
pub(crate) global LITERAL_CAPTURE_INCREASE_LENGTH: [bool; 128] = [
/* NULL */ false,
/* SOH */ false,
/* TXT */ false,
Expand Down Expand Up @@ -2230,7 +2230,7 @@ global LITERAL_CAPTURE_INCREASE_LENGTH: [bool; 128] = [

// ####

global GRAMMAR_CAPTURE_ERROR_FLAG: [bool; 128] = [
pub(crate) global GRAMMAR_CAPTURE_ERROR_FLAG: [bool; 128] = [
/* NULL */ true,
/* SOH */ true,
/* TXT */ true,
Expand Down Expand Up @@ -2364,7 +2364,7 @@ global GRAMMAR_CAPTURE_ERROR_FLAG: [bool; 128] = [
/*DEL*/ true,
];

global STRING_CAPTURE_ERROR_FLAG: [bool; 128] = [
pub(crate) global STRING_CAPTURE_ERROR_FLAG: [bool; 128] = [
/* NULL */ true,
/* SOH */ true,
/* TXT */ true,
Expand Down Expand Up @@ -2495,7 +2495,7 @@ global STRING_CAPTURE_ERROR_FLAG: [bool; 128] = [
/*DEL*/ true,
];

global NUMERIC_CAPTURE_ERROR_FLAG: [bool; 128] = [
pub(crate) global NUMERIC_CAPTURE_ERROR_FLAG: [bool; 128] = [
/* NULL */ true,
/* SOH */ true,
/* TXT */ true,
Expand Down Expand Up @@ -2626,7 +2626,7 @@ global NUMERIC_CAPTURE_ERROR_FLAG: [bool; 128] = [
/*DEL*/ true,
];

global LITERAL_CAPTURE_ERROR_FLAG: [bool; 128] = [
pub(crate) global LITERAL_CAPTURE_ERROR_FLAG: [bool; 128] = [
/* NULL */ true,
/* SOH */ true,
/* TXT */ true,
Expand Down
4 changes: 2 additions & 2 deletions src/_table_generation/mod.nr
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mod make_tables;
mod make_tables_subtables;
pub(crate) mod make_tables;
pub(crate) mod make_tables_subtables;
47 changes: 23 additions & 24 deletions src/enums.nr
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
mod ScanMode {
global GRAMMAR_SCAN: Field = 0;
global STRING_SCAN: Field = 1;
global NUMERIC_SCAN: Field = 2;
global LITERAL_SCAN: Field = 3;
pub(crate) mod ScanMode {
pub(crate) global GRAMMAR_SCAN: Field = 0;
pub(crate) global STRING_SCAN: Field = 1;
pub(crate) global NUMERIC_SCAN: Field = 2;
pub(crate) global LITERAL_SCAN: Field = 3;
}

mod Token {
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: 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;
pub(crate) mod Token {
pub(crate) global NO_TOKEN: Field = 0;
pub(crate) global BEGIN_OBJECT_TOKEN: Field = 1;
pub(crate) global END_OBJECT_TOKEN: Field = 2;
pub(crate) global BEGIN_ARRAY_TOKEN: Field = 3;
pub(crate) global END_ARRAY_TOKEN: Field = 4;
pub(crate) global KEY_SEPARATOR_TOKEN: Field = 5;
pub(crate) global VALUE_SEPARATOR_TOKEN: Field = 6;
pub(crate) global STRING_TOKEN: Field = 7;
pub(crate) global NUMERIC_TOKEN: Field = 8;
pub(crate) global LITERAL_TOKEN: Field = 9;
pub(crate) global KEY_TOKEN: Field = 10;
pub(crate) global NUM_TOKENS: u32 = 11;
pub(crate) global NUM_TOKENS_MUL_2: u32 = 22;
}

mod Layer {
global OBJECT_LAYER: Field = 0;
global ARRAY_LAYER: Field = 1;
global SINGLE_VALUE_LAYER: Field = 2;
pub(crate) mod Layer {
pub(crate) global OBJECT_LAYER: Field = 0;
pub(crate) global ARRAY_LAYER: Field = 1;
pub(crate) global SINGLE_VALUE_LAYER: Field = 2;
}

Loading