merge develop, fix conflicts
This commit is contained in:
commit
dc68ac40b6
16 changed files with 91 additions and 45 deletions
|
@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
|
|||
## [Unreleased]
|
||||
https://github.com/Zokrates/ZoKrates/compare/latest...develop
|
||||
|
||||
## [0.8.3] - 2022-10-11
|
||||
|
||||
### Release
|
||||
- https://github.com/Zokrates/ZoKrates/releases/tag/0.8.3 <!-- markdown-link-check-disable-line -->
|
||||
|
||||
### Changes
|
||||
- Disallow the use of the `private` and `public` keywords on non-entrypoint functions (#1224, @dark64)
|
||||
- Fix duplicate constraint optimiser (#1226, @schaeff)
|
||||
|
||||
## [0.8.2] - 2022-09-05
|
||||
|
||||
### Release
|
||||
|
|
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -3049,7 +3049,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zokrates_ast"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
dependencies = [
|
||||
"ark-bls12-377",
|
||||
"cfg-if 0.1.10",
|
||||
|
@ -3096,7 +3096,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zokrates_cli"
|
||||
version = "0.8.2"
|
||||
version = "0.8.3"
|
||||
dependencies = [
|
||||
"assert_cli",
|
||||
"blake2 0.8.1",
|
||||
|
@ -3181,7 +3181,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zokrates_core_test"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
dependencies = [
|
||||
"zokrates_test",
|
||||
"zokrates_test_derive",
|
||||
|
@ -3255,7 +3255,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zokrates_js"
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"indexmap",
|
||||
|
@ -3333,7 +3333,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zokrates_stdlib"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"fs_extra",
|
||||
"zokrates_test",
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Disallow the use of the `private` and `public` keywords on non-entrypoint functions
|
|
@ -1 +0,0 @@
|
|||
Fix duplicate constraint optimiser
|
1
changelogs/unreleased/1232-dark64
Normal file
1
changelogs/unreleased/1232-dark64
Normal file
|
@ -0,0 +1 @@
|
|||
Loosen up whitespace restrictions to allow more formatting styles
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_ast"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
|
|
|
@ -23,7 +23,7 @@ fn import_directive_to_symbol_vec(
|
|||
match import {
|
||||
pest::ImportDirective::Main(import) => {
|
||||
let span = import.span;
|
||||
let source = Path::new(import.source.span.as_str());
|
||||
let source = Path::new(import.source.raw.span.as_str());
|
||||
let id = "main";
|
||||
let alias = import.alias.map(|a| a.span.as_str());
|
||||
|
||||
|
@ -41,7 +41,7 @@ fn import_directive_to_symbol_vec(
|
|||
}
|
||||
pest::ImportDirective::From(import) => {
|
||||
let span = import.span;
|
||||
let source = Path::new(import.source.span.as_str());
|
||||
let source = Path::new(import.source.raw.span.as_str());
|
||||
import
|
||||
.symbols
|
||||
.into_iter()
|
||||
|
@ -251,7 +251,7 @@ impl<'ast> From<pest::LogStatement<'ast>> for untyped::StatementNode<'ast> {
|
|||
.map(untyped::ExpressionNode::from)
|
||||
.collect();
|
||||
|
||||
untyped::Statement::Log(statement.format_string.span.as_str(), expressions)
|
||||
untyped::Statement::Log(statement.format_string.raw.span.as_str(), expressions)
|
||||
.span(statement.span)
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ impl<'ast> From<pest::AssertionStatement<'ast>> for untyped::StatementNode<'ast>
|
|||
|
||||
untyped::Statement::Assertion(
|
||||
untyped::ExpressionNode::from(statement.expression),
|
||||
statement.message.map(|m| m.value),
|
||||
statement.message.map(|m| m.raw.value),
|
||||
)
|
||||
.span(statement.span)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_cli"
|
||||
version = "0.8.2"
|
||||
version = "0.8.3"
|
||||
authors = ["Jacob Eberhardt <jacob.eberhardt@tu-berlin.de>", "Dennis Kuhnert <mail@kyroy.com>", "Thibaut Schaeffer <thibaut@schaeff.fr>"]
|
||||
repository = "https://github.com/Zokrates/ZoKrates.git"
|
||||
edition = "2018"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_core_test"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
authors = ["schaeff <thibaut@schaeff.fr>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
21
zokrates_core_test/tests/tests/whitespace.zok
Normal file
21
zokrates_core_test/tests/tests/whitespace.zok
Normal file
|
@ -0,0 +1,21 @@
|
|||
from "field" import FIELD_MIN,
|
||||
FIELD_MAX,
|
||||
FIELD_SIZE_IN_BITS;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
field a;
|
||||
field b;
|
||||
}
|
||||
|
||||
def main(
|
||||
private Foo foo,
|
||||
field c
|
||||
) -> bool
|
||||
{
|
||||
field[2] arr = [
|
||||
foo.a,
|
||||
foo.b
|
||||
];
|
||||
return arr[0] * arr[1] == c;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_js"
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
authors = ["Darko Macesic"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
2
zokrates_js/package-lock.json
generated
2
zokrates_js/package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "zokrates-js",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.4",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "zokrates-js",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"module": "index.js",
|
||||
"main": "node/index.js",
|
||||
"description": "JavaScript bindings for ZoKrates",
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
file = { SOI ~ NEWLINE* ~ pragma? ~ NEWLINE* ~ symbol_declaration* ~ EOI }
|
||||
file = { SOI ~ pragma? ~ symbol_declaration* ~ EOI }
|
||||
|
||||
pragma = { "#pragma" ~ "curve" ~ curve }
|
||||
curve = @{ (ASCII_ALPHANUMERIC | "_") * }
|
||||
string = @{(!"\"" ~ ANY)*}
|
||||
quoted_string = ${ "\"" ~ string ~ "\"" }
|
||||
semicolon = _{";"}
|
||||
quoted_string = _{ "\"" ~ string ~ "\"" }
|
||||
|
||||
symbol_declaration = { (((import_directive | const_definition | type_definition) ~ semicolon) | (ty_struct_definition | function_definition)) ~ NEWLINE* }
|
||||
symbol_declaration = { (((import_directive | const_definition | type_definition) ~ semicolon) | (ty_struct_definition | function_definition)) }
|
||||
|
||||
import_directive = { main_import_directive | from_import_directive }
|
||||
from_import_directive = { "from" ~ quoted_string ~ "import" ~ import_symbol_list }
|
||||
|
@ -41,8 +41,8 @@ ty_tuple_multiple_inner = _{ ty ~ ("," ~ ty)+ ~ ","? }
|
|||
// structs
|
||||
ty_struct = { identifier ~ explicit_generics? }
|
||||
// type definitions
|
||||
ty_struct_definition = { "struct" ~ identifier ~ constant_generics_declaration? ~ "{" ~ NEWLINE* ~ struct_field_list ~ NEWLINE* ~ "}" ~ NEWLINE* }
|
||||
struct_field_list = _{ (struct_field ~ semicolon ~ NEWLINE*)* }
|
||||
ty_struct_definition = { "struct" ~ identifier ~ constant_generics_declaration? ~ "{" ~ struct_field_list ~ "}" }
|
||||
struct_field_list = _{ (struct_field ~ semicolon)* }
|
||||
struct_field = { typed_identifier }
|
||||
|
||||
vis_private = {"private"}
|
||||
|
@ -57,10 +57,10 @@ statement = { (iteration_statement | asm_statement // does not require semicolon
|
|||
|return_statement
|
||||
| definition_statement
|
||||
| assertion_statement
|
||||
) ~ semicolon)) ~ NEWLINE* }
|
||||
) ~ semicolon)) }
|
||||
|
||||
log_statement = { "log" ~ "(" ~ quoted_string ~ "," ~ expression_list ~ ")"}
|
||||
block_statement = _{ "{" ~ NEWLINE* ~ statement* ~ NEWLINE* ~ "}" }
|
||||
block_statement = _{ "{" ~ statement* ~ "}" }
|
||||
iteration_statement = { "for" ~ typed_identifier ~ "in" ~ expression ~ ".." ~ expression ~ block_statement }
|
||||
return_statement = { "return" ~ expression? }
|
||||
definition_statement = { typed_identifier_or_assignee ~ "=" ~ expression }
|
||||
|
@ -95,7 +95,7 @@ inline_tuple_empty_expression_inner = _{ "" }
|
|||
inline_tuple_single_expression_inner = _{ expression ~ "," }
|
||||
inline_tuple_multiple_expression_inner = _{ expression ~ ("," ~ expression)+ ~ ","? }
|
||||
|
||||
block_expression = _{ "{" ~ NEWLINE* ~ statement* ~ expression ~ NEWLINE* ~ "}" }
|
||||
block_expression = _{ "{" ~ statement* ~ expression ~ "}" }
|
||||
if_else_expression = { "if" ~ expression ~ block_expression ~ "else" ~ block_expression }
|
||||
|
||||
access = { array_access | call_access | dot_access }
|
||||
|
@ -111,12 +111,12 @@ identifier_or_decimal = { identifier | decimal_number }
|
|||
|
||||
primary_expression = { identifier | literal }
|
||||
|
||||
inline_struct_expression = { identifier ~ "{" ~ NEWLINE* ~ inline_struct_member_list ~ NEWLINE* ~ "}" }
|
||||
inline_struct_member_list = _{(inline_struct_member ~ ("," ~ NEWLINE* ~ inline_struct_member)*)? ~ ","? }
|
||||
inline_struct_expression = { identifier ~ "{" ~ inline_struct_member_list ~ "}" }
|
||||
inline_struct_member_list = _{(inline_struct_member ~ ("," ~ inline_struct_member)*)? ~ ","? }
|
||||
inline_struct_member = { identifier ~ ":" ~ expression }
|
||||
|
||||
inline_array_expression = { "[" ~ NEWLINE* ~ inline_array_inner ~ NEWLINE* ~ "]" }
|
||||
inline_array_inner = _{(spread_or_expression ~ ("," ~ NEWLINE* ~ spread_or_expression)*)?}
|
||||
inline_array_expression = { "[" ~ inline_array_inner ~ "]" }
|
||||
inline_array_inner = _{(spread_or_expression ~ ("," ~ spread_or_expression)*)?}
|
||||
spread_or_expression = { spread | expression }
|
||||
range_or_expression = { range | expression }
|
||||
|
||||
|
@ -183,7 +183,7 @@ op_ternary = {"?" ~ expression ~ ":"}
|
|||
op_binary = _ { op_or | op_and | op_bit_xor | op_bit_and | op_bit_or | op_left_shift | op_right_shift | op_equal | op_not_equal | op_lte | op_lt | op_gte | op_gt | op_add | op_sub | op_mul | op_div | op_rem | op_ternary }
|
||||
op_unary = { op_pos | op_neg | op_not }
|
||||
|
||||
WHITESPACE = _{ " " | "\t" | "\\" ~ COMMENT? ~ NEWLINE}
|
||||
WHITESPACE = _{ " " | "\t" | "\\" | COMMENT | NEWLINE }
|
||||
COMMENT = _{ ("/*" ~ (!"*/" ~ ANY)* ~ "*/") | ("//" ~ (!NEWLINE ~ ANY)*) }
|
||||
|
||||
// the ordering of reserved keywords matters: if "as" is before "assert", then "assert" gets parsed as (as)(sert) and incorrectly
|
||||
|
|
|
@ -212,7 +212,7 @@ mod ast {
|
|||
#[derive(Debug, FromPest, PartialEq, Eq, Clone)]
|
||||
#[pest_ast(rule(Rule::main_import_directive))]
|
||||
pub struct MainImportDirective<'ast> {
|
||||
pub source: AnyString<'ast>,
|
||||
pub source: QString<'ast>,
|
||||
pub alias: Option<IdentifierExpression<'ast>>,
|
||||
#[pest_ast(outer())]
|
||||
pub span: Span<'ast>,
|
||||
|
@ -230,7 +230,7 @@ mod ast {
|
|||
#[derive(Debug, FromPest, PartialEq, Eq, Clone)]
|
||||
#[pest_ast(rule(Rule::from_import_directive))]
|
||||
pub struct FromImportDirective<'ast> {
|
||||
pub source: AnyString<'ast>,
|
||||
pub source: QString<'ast>,
|
||||
pub symbols: Vec<ImportSymbol<'ast>>,
|
||||
#[pest_ast(outer())]
|
||||
pub span: Span<'ast>,
|
||||
|
@ -373,7 +373,7 @@ mod ast {
|
|||
#[derive(Debug, FromPest, PartialEq, Clone)]
|
||||
#[pest_ast(rule(Rule::log_statement))]
|
||||
pub struct LogStatement<'ast> {
|
||||
pub format_string: AnyString<'ast>,
|
||||
pub format_string: QString<'ast>,
|
||||
pub expressions: Vec<Expression<'ast>>,
|
||||
#[pest_ast(outer())]
|
||||
pub span: Span<'ast>,
|
||||
|
@ -390,18 +390,26 @@ mod ast {
|
|||
|
||||
#[derive(Debug, FromPest, PartialEq, Eq, Clone)]
|
||||
#[pest_ast(rule(Rule::string))]
|
||||
pub struct AnyString<'ast> {
|
||||
pub struct RawString<'ast> {
|
||||
#[pest_ast(outer(with(span_into_str)))]
|
||||
pub value: String,
|
||||
#[pest_ast(outer())]
|
||||
pub span: Span<'ast>,
|
||||
}
|
||||
|
||||
#[derive(Debug, FromPest, PartialEq, Eq, Clone)]
|
||||
#[pest_ast(rule(Rule::quoted_string))]
|
||||
pub struct QString<'ast> {
|
||||
pub raw: RawString<'ast>,
|
||||
#[pest_ast(outer())]
|
||||
pub span: Span<'ast>,
|
||||
}
|
||||
|
||||
#[derive(Debug, FromPest, PartialEq, Clone)]
|
||||
#[pest_ast(rule(Rule::assertion_statement))]
|
||||
pub struct AssertionStatement<'ast> {
|
||||
pub expression: Expression<'ast>,
|
||||
pub message: Option<AnyString<'ast>>,
|
||||
pub message: Option<QString<'ast>>,
|
||||
#[pest_ast(outer())]
|
||||
pub span: Span<'ast>,
|
||||
}
|
||||
|
@ -1234,10 +1242,13 @@ mod tests {
|
|||
pragma: None,
|
||||
declarations: vec![
|
||||
SymbolDeclaration::Import(ImportDirective::Main(MainImportDirective {
|
||||
source: AnyString {
|
||||
source: QString {
|
||||
raw: RawString {
|
||||
value: String::from("foo"),
|
||||
span: Span::new(source, 17, 20).unwrap()
|
||||
},
|
||||
span: Span::new(source, 16, 21).unwrap()
|
||||
},
|
||||
alias: None,
|
||||
span: Span::new(source, 9, 21).unwrap()
|
||||
})),
|
||||
|
@ -1299,10 +1310,13 @@ mod tests {
|
|||
pragma: None,
|
||||
declarations: vec![
|
||||
SymbolDeclaration::Import(ImportDirective::Main(MainImportDirective {
|
||||
source: AnyString {
|
||||
source: QString {
|
||||
raw: RawString {
|
||||
value: String::from("foo"),
|
||||
span: Span::new(source, 17, 20).unwrap()
|
||||
},
|
||||
span: Span::new(source, 16, 21).unwrap()
|
||||
},
|
||||
alias: None,
|
||||
span: Span::new(source, 9, 21).unwrap()
|
||||
})),
|
||||
|
@ -1388,10 +1402,13 @@ mod tests {
|
|||
pragma: None,
|
||||
declarations: vec![
|
||||
SymbolDeclaration::Import(ImportDirective::Main(MainImportDirective {
|
||||
source: AnyString {
|
||||
source: QString {
|
||||
raw: RawString {
|
||||
value: String::from("foo"),
|
||||
span: Span::new(source, 17, 20).unwrap()
|
||||
},
|
||||
span: Span::new(source, 16, 21).unwrap()
|
||||
},
|
||||
alias: None,
|
||||
span: Span::new(source, 9, 21).unwrap()
|
||||
})),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_stdlib"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
authors = ["Stefan Deml <stefandeml@gmail.com>", "schaeff <thibaut@schaeff.fr>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
Loading…
Reference in a new issue