mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-27 02:24:15 +03:00
Removes unnecessary, reorders cargo toml members
This commit is contained in:
parent
1b99c42470
commit
4d5ff0b962
@ -26,6 +26,7 @@ path = "leo/main.rs"
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"asg",
|
||||
"ast",
|
||||
"compiler",
|
||||
"gadgets",
|
||||
@ -34,8 +35,7 @@ members = [
|
||||
"input",
|
||||
"linter",
|
||||
"package",
|
||||
"state",
|
||||
"asg"
|
||||
"state"
|
||||
]
|
||||
|
||||
[dependencies.leo-ast]
|
||||
|
@ -1,85 +0,0 @@
|
||||
{
|
||||
"definitions": [
|
||||
{
|
||||
"Function": {
|
||||
"identifier": {
|
||||
"value": "main",
|
||||
"span": {
|
||||
"input": "main",
|
||||
"start": 9,
|
||||
"end": 13
|
||||
}
|
||||
},
|
||||
"parameters": [],
|
||||
"returns": null,
|
||||
"block": {
|
||||
"statements": [
|
||||
{
|
||||
"Return": {
|
||||
"expression": {
|
||||
"Binary": {
|
||||
"operation": "Add",
|
||||
"left": {
|
||||
"Value": {
|
||||
"Implicit": {
|
||||
"Positive": {
|
||||
"value": "1",
|
||||
"span": {
|
||||
"input": "1",
|
||||
"start": 29,
|
||||
"end": 30
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"right": {
|
||||
"Value": {
|
||||
"Implicit": {
|
||||
"Positive": {
|
||||
"value": "1",
|
||||
"span": {
|
||||
"input": "1",
|
||||
"start": 33,
|
||||
"end": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"input": "1 + 1",
|
||||
"start": 29,
|
||||
"end": 34
|
||||
}
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"input": "return 1 + 1",
|
||||
"start": 22,
|
||||
"end": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"span": {
|
||||
"input": "{\n return 1 + 1\n}",
|
||||
"start": 16,
|
||||
"end": 36
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"input": "function main() {\n return 1 + 1\n}",
|
||||
"start": 0,
|
||||
"end": 36
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"eoi": null,
|
||||
"span": {
|
||||
"input": "function main() {\n return 1 + 1\n}\n",
|
||||
"start": 0,
|
||||
"end": 37
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
// The dummy 'pedersen-hash' main function.
|
||||
function main() -> u32 {
|
||||
return 1 + 1
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
{
|
||||
"definitions": [
|
||||
{
|
||||
"Function": {
|
||||
"identifier": {
|
||||
"value": "main",
|
||||
"span": {
|
||||
"input": "main",
|
||||
"start": 9,
|
||||
"end": 13
|
||||
}
|
||||
},
|
||||
"parameters": [],
|
||||
"returns": null,
|
||||
"block": {
|
||||
"statements": [
|
||||
{
|
||||
"Return": {
|
||||
"expression": {
|
||||
"Binary": {
|
||||
"operation": "Add",
|
||||
"left": {
|
||||
"Value": {
|
||||
"Implicit": {
|
||||
"Positive": {
|
||||
"value": "1",
|
||||
"span": {
|
||||
"input": "1",
|
||||
"start": 29,
|
||||
"end": 30
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"right": {
|
||||
"Value": {
|
||||
"Implicit": {
|
||||
"Positive": {
|
||||
"value": "1",
|
||||
"span": {
|
||||
"input": "1",
|
||||
"start": 33,
|
||||
"end": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"input": "1 + 1",
|
||||
"start": 29,
|
||||
"end": 34
|
||||
}
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"input": "return 1 + 1",
|
||||
"start": 22,
|
||||
"end": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"span": {
|
||||
"input": "{\n return 1 + 1\n}",
|
||||
"start": 16,
|
||||
"end": 36
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"input": "function main() {\n return 1 + 1\n}",
|
||||
"start": 0,
|
||||
"end": 36
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"eoi": null,
|
||||
"span": {
|
||||
"input": "function main() {\n return 1 + 1\n}\n",
|
||||
"start": 0,
|
||||
"end": 37
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
circuit PedersenHash {
|
||||
parameters: [group; 256],
|
||||
|
||||
// Instantiates a Pedersen hash circuit
|
||||
function new(self, parameters: [group; 256]) -> Self {
|
||||
return Self { parameters: parameters }
|
||||
}
|
||||
|
||||
function hash(bits: [bool; 256]) -> group {
|
||||
let mut digest: group = 0;
|
||||
for i in 0..256 {
|
||||
if bits[i] {
|
||||
digest += self.parameters[i];
|
||||
}
|
||||
}
|
||||
return digest
|
||||
}
|
||||
}
|
||||
|
||||
// The dummy 'pedersen-hash' main function.
|
||||
function main() -> group {
|
||||
const parameters = [1group; 256];
|
||||
const pedersen = PedersenHash::new(parameters);
|
||||
let hash_input: [bool; 256] = [true; 256];
|
||||
return pedersen.hash(hash_input)
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_ast::Ast as LeoAst;
|
||||
use leo_grammar::Grammar as LeoGrammar;
|
||||
|
||||
use std::path::Path;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct Ast(String);
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl Ast {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(filepath: &str, program_name: &str, program_string: &str) -> Self {
|
||||
let grammar = LeoGrammar::new(&Path::new(filepath), &program_string).unwrap();
|
||||
let ast = LeoAst::new(program_name, &grammar).unwrap();
|
||||
Self(ast.to_json_string().unwrap())
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn to_string(&self) -> String {
|
||||
self.0.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn ast_test() {
|
||||
let expected = include_str!("../.resources/basic/expected_ast.json");
|
||||
|
||||
let filepath = "../.resources/basic/main.leo";
|
||||
let program_name = "basic";
|
||||
let program_string = include_str!("../.resources/basic/main.leo");
|
||||
|
||||
let candidate = Ast::new(filepath, program_name, program_string).to_string();
|
||||
|
||||
let expected = JsValue::from_str(expected);
|
||||
let candidate = JsValue::from_serde(&candidate).unwrap();
|
||||
|
||||
assert_eq!(expected, candidate);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user