merge dev
This commit is contained in:
commit
186a4f6511
25 changed files with 1281 additions and 310 deletions
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
name: Bug Report
|
||||
about: Bug reports about the ZoKrates toolbox.
|
||||
---
|
||||
|
||||
<!--## Prerequisites
|
||||
|
||||
- First, many thanks for taking part in the community. We really appreciate that.
|
||||
- Support questions are better asked on our [gitter channel](https://gitter.im/ZoKrates/ZoKrates)
|
||||
- Ensure the issue isn't already reported.
|
||||
- The issue should be reproducible with the latest ZoKrates version; however, this isn't a hard requirement and being reproducible with an older version is sufficient.
|
||||
|
||||
*Delete the above section and the instructions in the sections below before submitting*
|
||||
|
||||
-->
|
||||
|
||||
## Description
|
||||
|
||||
<!--Please shortly describe the bug you have found, and what you expect instead.-->
|
||||
|
||||
## Environment
|
||||
|
||||
- Compiler version:
|
||||
- Operating system:
|
||||
|
||||
## Steps to Reproduce
|
||||
|
||||
<!--
|
||||
Please provide a *minimal* source code example to trigger the bug you have found.
|
||||
Please also mention any command line flags that are necessary for triggering the bug.
|
||||
Provide as much information as necessary to reproduce the bug.
|
||||
|
||||
```zokrates
|
||||
// Some *minimal* ZoKrates source code to reproduce the bug.
|
||||
// ...
|
||||
```
|
||||
-->
|
43
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
43
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
name: Feature Request
|
||||
about: ZoKrates toolbox feature requests.
|
||||
---
|
||||
|
||||
<!--## Prerequisites
|
||||
|
||||
- First, many thanks for taking part in the community. We really appreciate that.
|
||||
- Support questions are better asked on our [gitter channel](https://gitter.im/ZoKrates/ZoKrates)
|
||||
- Ensure the issue isn't already reported.
|
||||
|
||||
*Delete the above section and the instructions in the sections below before submitting*
|
||||
|
||||
-->
|
||||
|
||||
## Abstract
|
||||
|
||||
<!--
|
||||
Please describe with an example what problem you see in the current ZoKrates toolbox.
|
||||
-->
|
||||
|
||||
## Motivation
|
||||
|
||||
<!--
|
||||
In this section you describe how you propose to address the problem you described earlier,
|
||||
including by giving one or more exemplary source code snippets for demonstration.
|
||||
-->
|
||||
|
||||
## Specification
|
||||
|
||||
<!--
|
||||
The technical specification should describe the syntax and semantics of any new feature. The
|
||||
specification should be detailed enough to allow any developer to implement the functionality.
|
||||
-->
|
||||
|
||||
## Backwards Compatibility
|
||||
|
||||
<!--
|
||||
All language changes that introduce backwards incompatibilities must include a section describing
|
||||
these incompatibilities and their severity.
|
||||
|
||||
Please describe how you propose to deal with these incompatibilities.
|
||||
-->
|
14
.github/workflows/pr-changelog-check.yml
vendored
Normal file
14
.github/workflows/pr-changelog-check.yml
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
name: Pull request changelog check
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, labeled, unlabeled, synchronize]
|
||||
jobs:
|
||||
build:
|
||||
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'changelog-not-required')) }}
|
||||
name: Run changelog check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the code
|
||||
uses: actions/checkout@v2
|
||||
- name: Changelog check
|
||||
run: ./scripts/changelog-check.sh
|
20
CHANGELOG.md
Normal file
20
CHANGELOG.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
https://github.com/Zokrates/ZoKrates/compare/master...develop
|
||||
|
||||
## [0.6.4] - 2021-03-19
|
||||
### Release
|
||||
- https://github.com/Zokrates/ZoKrates/releases/tag/0.6.4
|
||||
|
||||
### Changes
|
||||
- re-include embeds for a slightly cheaper sha256
|
||||
- remove array ssa
|
||||
- add flag to allow unconstrained variables
|
||||
- better flattening of conjunctions
|
||||
- put backends behind features
|
||||
- accept any assignee in multidef
|
||||
- minor performance and stability improvements
|
||||
|
||||
For older releases and changes, visit https://github.com/Zokrates/ZoKrates/releases.
|
665
Cargo.lock
generated
665
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
14
changelogs/README.md
Normal file
14
changelogs/README.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
## Adding a changelog
|
||||
|
||||
Pull request authors are expected to include a changelog file explaining the changes introduced by the pull request.
|
||||
The changelog file should be a new file created in the `changelogs/unreleased` folder.
|
||||
The file should follow the naming convention of `pr-username` and the contents of the file
|
||||
should be your text for the changelog.
|
||||
|
||||
### Example
|
||||
```
|
||||
changelogs/unreleased # folder to place changelogs
|
||||
101-username # your changelog file (pull request #101 by @username)
|
||||
```
|
||||
|
||||
Any user-facing change must have a changelog entry. If a pull request does not warrant a changelog, the CI check for a changelog can be skipped by applying a `changelog-not-required` label.
|
0
changelogs/unreleased/.gitkeep
Normal file
0
changelogs/unreleased/.gitkeep
Normal file
24
scripts/changelog-check.sh
Executable file
24
scripts/changelog-check.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
set +x
|
||||
|
||||
if [ -z "$CI" ]; then
|
||||
echo "This script is intended to be run only on Github Actions." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CHANGELOG_PATH='changelogs/unreleased'
|
||||
|
||||
pr_number=$(echo $GITHUB_REF | cut -d / -f 3)
|
||||
changelog="${CHANGELOG_PATH}/${pr_number}-*"
|
||||
|
||||
if [ ! -f "$changelog" ]; then
|
||||
echo "Pull request #${pr_number:-?} is missing a changelog. Please add a changelog to ${CHANGELOG_PATH}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cl_diff=$(git diff --exit-code $GITHUB_HEAD_REF CHANGELOG.md)
|
||||
if [ -n "$cl_diff" ]; then
|
||||
echo "Pull requests should not directly modify the main CHANGELOG.md file. For more information, please read changelogs/README.md"
|
||||
exit 1
|
||||
fi
|
47
scripts/changelog.sh
Executable file
47
scripts/changelog.sh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script is intended for maintainers only to generate changelog markdown before new releases.
|
||||
# The generated markdown can be added to the main CHANGELOG.md file located at the root of the repository.
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 TAG" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function join { local IFS="$1"; shift; echo "$*"; }
|
||||
function qdate
|
||||
{
|
||||
if type -p gdate > /dev/null; then
|
||||
gdate "$@";
|
||||
else
|
||||
date "$@";
|
||||
fi
|
||||
}
|
||||
|
||||
CHANGELOG_PATH='changelogs/unreleased'
|
||||
|
||||
tag=$1
|
||||
unreleased=$(ls -t ${CHANGELOG_PATH})
|
||||
|
||||
echo -e "Generating CHANGELOG markdown from ${CHANGELOG_PATH}\n"
|
||||
cat << EOT
|
||||
## [${tag}] - $(qdate '+%Y-%m-%d')
|
||||
|
||||
### Release
|
||||
- https://github.com/Zokrates/ZoKrates/releases/tag/${tag}
|
||||
|
||||
### Changes
|
||||
EOT
|
||||
|
||||
for file in $unreleased
|
||||
do
|
||||
IFS=$'-' read -ra entry <<< "$file"
|
||||
contents=$(cat ${CHANGELOG_PATH}/${file} | tr '\n' ' ')
|
||||
author=$(join '-' ${entry[@]:1})
|
||||
echo "- ${contents} (#${entry[0]}, @${author})"
|
||||
done
|
||||
|
||||
echo -e "\nCopy and paste the markdown above to the appropriate CHANGELOG file."
|
||||
echo "Be sure to run: git rm ${CHANGELOG_PATH}/*"
|
|
@ -29,7 +29,7 @@ echo "Published zokrates/zokrates:$TAG"
|
|||
|
||||
# Release on Github
|
||||
git tag -f latest
|
||||
git tag $TAG
|
||||
git tag -f $TAG
|
||||
git push origin -f latest
|
||||
git push origin $TAG
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_cli"
|
||||
version = "0.6.3"
|
||||
version = "0.6.4"
|
||||
authors = ["Jacob Eberhardt <jacob.eberhardt@tu-berlin.de>", "Dennis Kuhnert <mail@kyroy.com>", "Thibaut Schaeffer <thibaut@schaeff.fr>"]
|
||||
repository = "https://github.com/JacobEberhardt/ZoKrates.git"
|
||||
edition = "2018"
|
||||
|
|
|
@ -113,6 +113,8 @@ mod tests {
|
|||
assert_eq!(res.is_err(), should_error);
|
||||
}
|
||||
})
|
||||
.unwrap()
|
||||
.join()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_core"
|
||||
version = "0.5.3"
|
||||
version = "0.5.4"
|
||||
edition = "2018"
|
||||
authors = ["Jacob Eberhardt <jacob.eberhardt@tu-berlin.de>", "Dennis Kuhnert <mail@kyroy.com>"]
|
||||
repository = "https://github.com/JacobEberhardt/ZoKrates"
|
||||
|
@ -43,14 +43,14 @@ pairing_ce = { version = "^0.21", optional = true }
|
|||
ff_ce = { version = "^0.9", optional = true }
|
||||
|
||||
# ark
|
||||
ark-ff = { git = "https://github.com/arkworks-rs/algebra", default-features = false, optional = true }
|
||||
ark-ec = { git = "https://github.com/arkworks-rs/algebra", default-features = false, optional = true }
|
||||
ark-bn254 = { git = "https://github.com/arkworks-rs/curves", features = ["curve"], default-features = false, optional = true }
|
||||
ark-bls12-377 = { git = "https://github.com/arkworks-rs/curves", features = ["curve"], default-features = false, optional = true }
|
||||
ark-bw6-761 = { git = "https://github.com/arkworks-rs/curves", default-features = false, optional = true }
|
||||
ark-gm17 = { git = "https://github.com/arkworks-rs/gm17", default-features = false, optional = true }
|
||||
ark-serialize = { git = "https://github.com/arkworks-rs/algebra", default-features = false, optional = true }
|
||||
ark-relations = { git = "https://github.com/arkworks-rs/snark", default-features = false, optional = true }
|
||||
ark-ff = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-ec = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-bn254 = { version = "^0.2.0", features = ["curve"], default-features = false, optional = true }
|
||||
ark-bls12-377 = { version = "^0.2.0", features = ["curve"], default-features = false, optional = true }
|
||||
ark-bw6-761 = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-gm17 = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-serialize = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-relations = { version = "^0.2.0", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "^0.3.0"
|
||||
|
|
|
@ -777,7 +777,9 @@ impl<'ast, 'a, T: Field> ResultFolder<'ast, T> for Propagator<'ast, 'a, T> {
|
|||
match (e.into_inner(), by) {
|
||||
(UExpressionInner::Value(v), FieldElementExpression::Number(by)) => {
|
||||
let by_as_usize = by.to_dec_string().parse::<usize>().unwrap();
|
||||
UExpressionInner::Value((v << by_as_usize) & 0xffffffff)
|
||||
UExpressionInner::Value(
|
||||
(v << by_as_usize) & (2_u128.pow(bitwidth as u32) - 1),
|
||||
)
|
||||
}
|
||||
(e, FieldElementExpression::Number(by)) => UExpressionInner::LeftShift(
|
||||
box e.annotate(bitwidth),
|
||||
|
@ -832,7 +834,9 @@ impl<'ast, 'a, T: Field> ResultFolder<'ast, T> for Propagator<'ast, 'a, T> {
|
|||
UExpressionInner::Not(box e) => {
|
||||
let e = self.fold_uint_expression(e)?.into_inner();
|
||||
match e {
|
||||
UExpressionInner::Value(v) => UExpressionInner::Value((!v) & 0xffffffff),
|
||||
UExpressionInner::Value(v) => {
|
||||
UExpressionInner::Value((!v) & (2_u128.pow(bitwidth as u32) - 1))
|
||||
}
|
||||
e => UExpressionInner::Not(box e.annotate(bitwidth)),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_core_test"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
authors = ["schaeff <thibaut@schaeff.fr>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_field"
|
||||
version = "0.3.7"
|
||||
version = "0.3.8"
|
||||
authors = ["Thibaut Schaeffer <thibaut@schaeff.fr>", "Guillaume Ballet <gballet@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
@ -23,11 +23,11 @@ num-integer = { version = "0.1", default-features = false }
|
|||
bellman_ce = { version = "^0.3", default-features = false, optional = true }
|
||||
|
||||
# ark
|
||||
ark-ff = { git = "https://github.com/arkworks-rs/algebra", default-features = false, optional = true }
|
||||
ark-ec = { git = "https://github.com/arkworks-rs/algebra", default-features = false, optional = true }
|
||||
ark-bn254 = { git = "https://github.com/arkworks-rs/curves", features = ["curve"], default-features = false, optional = true }
|
||||
ark-bls12-377 = { git = "https://github.com/arkworks-rs/curves", features = ["curve"], default-features = false, optional = true }
|
||||
ark-bw6-761 = { git = "https://github.com/arkworks-rs/curves", default-features = false, optional = true }
|
||||
ark-ff = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-ec = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-bn254 = { version = "^0.2.0", features = ["curve"], default-features = false, optional = true }
|
||||
ark-bls12-377 = { version = "^0.2.0", features = ["curve"], default-features = false, optional = true }
|
||||
ark-bw6-761 = { version = "^0.2.0", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.4"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_js"
|
||||
version = "1.0.27"
|
||||
version = "1.0.28"
|
||||
authors = ["Darko Macesic"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
4
zokrates_parser/src/textmate/.vscodeignore
Normal file
4
zokrates_parser/src/textmate/.vscodeignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
.vscode/**
|
||||
.vscode-test/**
|
||||
.gitignore
|
||||
vsc-extension-quickstart.md
|
3
zokrates_parser/src/textmate/CHANGELOG.md
Normal file
3
zokrates_parser/src/textmate/CHANGELOG.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
## [0.0.1] - 2021-03-01
|
||||
|
||||
- Initial release
|
13
zokrates_parser/src/textmate/README.md
Normal file
13
zokrates_parser/src/textmate/README.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# ZoKrates Syntax Highlighter
|
||||
|
||||
This is a Textmate-based syntax highlighter for the [ZoKrates language](https://zokrates.github.io) in VSCode.
|
||||
|
||||
## Development
|
||||
|
||||
This project expect the syntax to be provided as a JSON file (see `syntaxes`).
|
||||
As working with a YAML file instead is easier, it can make sense to convert to that and back.
|
||||
VSCode offers a command `Convert to {JSON, YAML}-tmLanguage File` that achieves that.
|
||||
|
||||
## Release process
|
||||
|
||||
This extension is currently released manually to the VSCode extension marketplace.
|
28
zokrates_parser/src/textmate/language-configuration.json
Normal file
28
zokrates_parser/src/textmate/language-configuration.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"comments": {
|
||||
// symbol used for single line comment. Remove this entry if your language does not support line comments
|
||||
"lineComment": "//",
|
||||
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
|
||||
"blockComment": [ "/*", "*/" ]
|
||||
},
|
||||
// symbols used as brackets
|
||||
"brackets": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"]
|
||||
],
|
||||
// symbols that are auto closed when typing
|
||||
"autoClosingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""],
|
||||
],
|
||||
// symbols that can be used to surround a selection
|
||||
"surroundingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""],
|
||||
]
|
||||
}
|
27
zokrates_parser/src/textmate/package.json
Normal file
27
zokrates_parser/src/textmate/package.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "zokrates",
|
||||
"displayName": "zokrates",
|
||||
"description": "Syntax highlighting for the ZoKrates language",
|
||||
"publisher": "zokrates",
|
||||
"repository": "https://github.com/ZoKrates/ZoKrates",
|
||||
"version": "0.0.1",
|
||||
"engines": {
|
||||
"vscode": "^1.53.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [{
|
||||
"id": "zokrates",
|
||||
"aliases": ["ZoKrates", "zokrates"],
|
||||
"extensions": [".zok"],
|
||||
"configuration": "./language-configuration.json"
|
||||
}],
|
||||
"grammars": [{
|
||||
"language": "zokrates",
|
||||
"scopeName": "source.zok",
|
||||
"path": "./syntaxes/zokrates.tmLanguage.json"
|
||||
}]
|
||||
}
|
||||
}
|
600
zokrates_parser/src/textmate/syntaxes/zokrates.tmLanguage.json
Normal file
600
zokrates_parser/src/textmate/syntaxes/zokrates.tmLanguage.json
Normal file
|
@ -0,0 +1,600 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||
"name": "ZoKrates",
|
||||
"fileTypes": [
|
||||
"zok"
|
||||
],
|
||||
"scopeName": "source.zok",
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "attributes",
|
||||
"name": "meta.attribute.zokrates",
|
||||
"begin": "(#)(\\!?)(\\[)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.attribute.zokrates"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.operator.attribute.inner.zokrates"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.brackets.attribute.zokrates"
|
||||
}
|
||||
},
|
||||
"end": "\\]",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.brackets.attribute.zokrates"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block-comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#lifetimes"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#gtypes"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"include": "#block-comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"comments": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "line comments",
|
||||
"name": "comment.line.double-slash.zokrates",
|
||||
"match": "\\s*//.*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"block-comments": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "empty block comments",
|
||||
"name": "comment.block.zokrates",
|
||||
"match": "/\\*\\*/"
|
||||
},
|
||||
{
|
||||
"comment": "block comments",
|
||||
"name": "comment.block.zokrates",
|
||||
"begin": "/\\*(?!\\*)",
|
||||
"end": "\\*/",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block-comments"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"constants": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "ALL CAPS constants",
|
||||
"name": "constant.other.caps.zokrates",
|
||||
"match": "\\b[A-Z]{2}[A-Z0-9_]*\\b"
|
||||
},
|
||||
{
|
||||
"comment": "decimal integers and floats",
|
||||
"name": "constant.numeric.decimal.zokrates",
|
||||
"match": "\\b\\d[\\d_]*(u128|u16|u32|u64|u8|f)?\\b",
|
||||
"captures": {
|
||||
"5": {
|
||||
"name": "entity.name.type.numeric.zokrates"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "hexadecimal integers",
|
||||
"name": "constant.numeric.hex.zokrates",
|
||||
"match": "\\b0x[\\da-fA-F_]+\\b"
|
||||
},
|
||||
{
|
||||
"comment": "booleans",
|
||||
"name": "constant.language.bool.zokrates",
|
||||
"match": "\\b(true|false)\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"imports": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "explicit import statement",
|
||||
"name": "meta.import.explicit.zokrates",
|
||||
"match": "\\b(from)\\s+(\\\".*\\\")(import)\\s+([A-Za-z0-9_]+)\\s+((as)\\s+[A-Za-z0-9_]+)?\\b",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block-comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "main import statement",
|
||||
"name": "meta.import.explicit.zokrates",
|
||||
"match": "\\b(import)\\s+(\\\".*\\\")\\s+((as)\\s+[A-Za-z0-9_]+)?\\b",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block-comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"functions": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "function definition",
|
||||
"name": "meta.function.definition.zokrates",
|
||||
"begin": "\\b(def)\\s+([A-Za-z0-9_]+)((\\()|(<))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.other.def.zokrates"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.function.zokrates"
|
||||
},
|
||||
"4": {
|
||||
"name": "punctuation.brackets.round.zokrates"
|
||||
},
|
||||
"5": {
|
||||
"name": "punctuation.brackets.angle.zokrates"
|
||||
}
|
||||
},
|
||||
"end": "\\:|;",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "keyword.punctuation.colon.zokrates"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block-comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "function/method calls, chaining",
|
||||
"name": "meta.function.call.zokrates",
|
||||
"begin": "([A-Za-z0-9_]+)(\\()",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "entity.name.function.zokrates"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.brackets.round.zokrates"
|
||||
}
|
||||
},
|
||||
"end": "\\)",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.brackets.round.zokrates"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block-comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "function/method calls with turbofish",
|
||||
"name": "meta.function.call.zokrates",
|
||||
"begin": "([A-Za-z0-9_]+)(?=::<.*>\\()",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "entity.name.function.zokrates"
|
||||
}
|
||||
},
|
||||
"end": "\\)",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.brackets.round.zokrates"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block-comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"keywords": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "argument visibility",
|
||||
"name": "keyword.visibility.zokrates",
|
||||
"match": "\\b(public|private)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "control flow keywords",
|
||||
"name": "keyword.control.zokrates",
|
||||
"match": "\\b(do|else|for|do|endfor|if|then|fi|return|assert)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "storage keywords",
|
||||
"name": "storage.type.zokrates",
|
||||
"match": "\\b(struct)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "def",
|
||||
"name": "keyword.other.def.zokrates",
|
||||
"match": "\\bdef\\b"
|
||||
},
|
||||
{
|
||||
"comment": "import keywords",
|
||||
"name": "keyword.other.import.zokrates",
|
||||
"match": "\\b(import|from|as)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "logical operators",
|
||||
"name": "keyword.operator.logical.zokrates",
|
||||
"match": "(\\^|\\||\\|\\||&|&&|<<|>>|!)(?!=)"
|
||||
},
|
||||
{
|
||||
"comment": "single equal",
|
||||
"name": "keyword.operator.assignment.equal.zokrates",
|
||||
"match": "(?<![<>])=(?!=|>)"
|
||||
},
|
||||
{
|
||||
"comment": "comparison operators",
|
||||
"name": "keyword.operator.comparison.zokrates",
|
||||
"match": "(=(=)?(?!>)|!=|<=|(?<!=)>=)"
|
||||
},
|
||||
{
|
||||
"comment": "math operators",
|
||||
"name": "keyword.operator.math.zokrates",
|
||||
"match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))"
|
||||
},
|
||||
{
|
||||
"comment": "less than, greater than (special case)",
|
||||
"match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.brackets.round.zokrates"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.brackets.square.zokrates"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.brackets.curly.zokrates"
|
||||
},
|
||||
"4": {
|
||||
"name": "keyword.operator.comparison.zokrates"
|
||||
},
|
||||
"5": {
|
||||
"name": "punctuation.brackets.round.zokrates"
|
||||
},
|
||||
"6": {
|
||||
"name": "punctuation.brackets.square.zokrates"
|
||||
},
|
||||
"7": {
|
||||
"name": "punctuation.brackets.curly.zokrates"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "dot access",
|
||||
"name": "keyword.operator.access.dot.zokrates",
|
||||
"match": "\\.(?!\\.)"
|
||||
},
|
||||
{
|
||||
"comment": "ranges, range patterns",
|
||||
"name": "keyword.operator.range.zokrates",
|
||||
"match": "\\.{2}(=|\\.)?"
|
||||
},
|
||||
{
|
||||
"comment": "colon",
|
||||
"name": "keyword.operator.colon.zokrates",
|
||||
"match": ":(?!:)"
|
||||
},
|
||||
{
|
||||
"comment": "dashrocket, skinny arrow",
|
||||
"name": "keyword.operator.arrow.skinny.zokrates",
|
||||
"match": "->"
|
||||
}
|
||||
]
|
||||
},
|
||||
"types": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "numeric types",
|
||||
"match": "(?<![A-Za-z])(u128|u16|u32|u64|u8|field)\\b",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.type.numeric.zokrates"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "parameterized types",
|
||||
"begin": "\\b([A-Z][A-Za-z0-9]*)(<)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "entity.name.type.zokrates"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.brackets.angle.zokrates"
|
||||
}
|
||||
},
|
||||
"end": ">",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.brackets.angle.zokrates"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block-comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "primitive types",
|
||||
"name": "entity.name.type.primitive.zokrates",
|
||||
"match": "\\b(bool)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "struct declarations",
|
||||
"match": "\\b(struct)\\s+([A-Z][A-Za-z0-9]*)\\b",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "storage.type.zokrates"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.type.struct.zokrates"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "types",
|
||||
"name": "entity.name.type.zokrates",
|
||||
"match": "\\b[A-Z][A-Za-z0-9]*\\b(?!!)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"punctuation": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "comma",
|
||||
"name": "punctuation.comma.zokrates",
|
||||
"match": ","
|
||||
},
|
||||
{
|
||||
"comment": "parentheses, round brackets",
|
||||
"name": "punctuation.brackets.round.zokrates",
|
||||
"match": "[()]"
|
||||
},
|
||||
{
|
||||
"comment": "square brackets",
|
||||
"name": "punctuation.brackets.square.zokrates",
|
||||
"match": "[\\[\\]]"
|
||||
},
|
||||
{
|
||||
"comment": "angle brackets",
|
||||
"name": "punctuation.brackets.angle.zokrates",
|
||||
"match": "(?<!=)[<>]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"strings": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "double-quoted strings and byte strings",
|
||||
"name": "string.quoted.double.zokrates",
|
||||
"begin": "(b?)(\")",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "string.quoted.byte.raw.zokrates"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.definition.string.zokrates"
|
||||
}
|
||||
},
|
||||
"end": "\"",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.zokrates"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "double-quoted raw strings and raw byte strings",
|
||||
"name": "string.quoted.double.zokrates",
|
||||
"begin": "(b?r)(#*)(\")",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "string.quoted.byte.raw.zokrates"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.definition.string.raw.zokrates"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.definition.string.zokrates"
|
||||
}
|
||||
},
|
||||
"end": "(\")(\\2)",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.string.zokrates"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.definition.string.raw.zokrates"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"variables": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "variables",
|
||||
"name": "variable.other.zokrates",
|
||||
"match": "\\b(?<!(?<!\\.)\\.)[a-z0-9_]+\\b"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_stdlib"
|
||||
version = "0.1.7"
|
||||
version = "0.1.8"
|
||||
authors = ["Stefan Deml <stefandeml@gmail.com>", "schaeff <thibaut@schaeff.fr>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_test"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
authors = ["schaeff <thibaut@schaeff.fr>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
Loading…
Reference in a new issue