Merge branch 'master' into feature/input-kebab

This commit is contained in:
damirka 2021-04-26 22:25:10 +03:00
commit 5d359f23f5
608 changed files with 7271 additions and 8043 deletions

View File

@ -158,6 +158,19 @@ jobs:
export LEO=/home/circleci/project/project/bin/leo export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-add-remove.sh ./project/.circleci/leo-add-remove.sh
leo-check-constraints:
docker:
- image: cimg/rust:1.50.0
resource_class: xlarge
steps:
- attach_workspace:
at: /home/circleci/project/
- run:
name: leo check constraints for Pedersen Hash
command: |
export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-check-constraints.sh
leo-login-logout: leo-login-logout:
docker: docker:
- image: cimg/rust:1.51.0 - image: cimg/rust:1.51.0
@ -171,18 +184,18 @@ jobs:
export LEO=/home/circleci/project/project/bin/leo export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-login-logout.sh ./project/.circleci/leo-login-logout.sh
# leo-clone: leo-clone:
# docker: docker:
# - image: cimg/rust:1.51.0 - image: cimg/rust:1.51.0
# resource_class: xlarge resource_class: xlarge
# steps: steps:
# - attach_workspace: - attach_workspace:
# at: /home/circleci/project/ at: /home/circleci/project/
# - run: - run:
# name: leo clone name: leo clone
# command: | command: |
# export LEO=/home/circleci/project/project/bin/leo export LEO=/home/circleci/project/project/bin/leo
# ./project/.circleci/leo-clone.sh ./project/.circleci/leo-clone.sh
leo-publish: leo-publish:
docker: docker:
@ -219,12 +232,15 @@ workflows:
- leo-add-remove: - leo-add-remove:
requires: requires:
- leo-executable - leo-executable
- leo-check-constraints:
requires:
- leo-executable
- leo-login-logout: - leo-login-logout:
requires: requires:
- leo-executable - leo-executable
# - leo-clone: - leo-clone:
# requires: requires:
# - leo-executable - leo-executable
- leo-publish: - leo-publish:
requires: requires:
- leo-executable - leo-executable

View File

@ -0,0 +1,16 @@
# leo new hello-world
cd ./project/examples/pedersen-hash
export PEDERSEN_HASH_CONSTRAINTS=1539;
# line that we're searching for is:
# `Build Number of constraints - 1539`
export ACTUAL_CONSTRAINTS=$($LEO build | grep constraints | awk '{print $NF}')
# if else expression with only else block
[[ PEDERSEN_HASH_CONSTRAINTS -eq ACTUAL_CONSTRAINTS ]] || {
echo >&2 "Number of constraints for Pedersen Hash is not $PEDERSEN_HASH_CONSTRAINTS";
echo >&2 "Real number of constraints is $ACTUAL_CONSTRAINTS";
exit 1;
}

176
Cargo.lock generated
View File

@ -87,6 +87,20 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "assert_cmd"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2475b58cd94eb4f70159f4fd8844ba3b807532fe3131b3373fae060bbe30396"
dependencies = [
"bstr",
"doc-comment",
"predicates",
"predicates-core",
"predicates-tree",
"wait-timeout",
]
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -601,6 +615,12 @@ dependencies = [
"syn 1.0.64", "syn 1.0.64",
] ]
[[package]]
name = "difference"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
[[package]] [[package]]
name = "digest" name = "digest"
version = "0.8.1" version = "0.8.1"
@ -639,6 +659,12 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "doc-comment"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]] [[package]]
name = "dtoa" name = "dtoa"
version = "0.4.8" version = "0.4.8"
@ -1307,8 +1333,8 @@ dependencies = [
"leo-state", "leo-state",
"num-bigint", "num-bigint",
"pest", "pest",
"rand", "rand 0.8.3",
"rand_core", "rand_core 0.6.2",
"rand_xorshift", "rand_xorshift",
"serde", "serde",
"sha2", "sha2",
@ -1320,6 +1346,7 @@ dependencies = [
"snarkvm-r1cs", "snarkvm-r1cs",
"snarkvm-utilities", "snarkvm-utilities",
"tempfile", "tempfile",
"tendril",
"thiserror", "thiserror",
"tracing", "tracing",
] ]
@ -1354,6 +1381,7 @@ version = "1.4.0"
dependencies = [ dependencies = [
"ansi_term 0.12.1", "ansi_term 0.12.1",
"anyhow", "anyhow",
"assert_cmd",
"clap", "clap",
"colored", "colored",
"console", "console",
@ -1368,8 +1396,8 @@ dependencies = [
"leo-state", "leo-state",
"leo-synthesizer", "leo-synthesizer",
"notify", "notify",
"rand", "rand 0.8.3",
"rand_core", "rand_core 0.6.2",
"reqwest", "reqwest",
"rusty-hook", "rusty-hook",
"self_update", "self_update",
@ -1381,6 +1409,7 @@ dependencies = [
"snarkvm-r1cs", "snarkvm-r1cs",
"snarkvm-utilities", "snarkvm-utilities",
"structopt", "structopt",
"test_dir",
"thiserror", "thiserror",
"toml", "toml",
"tracing", "tracing",
@ -1413,6 +1442,7 @@ dependencies = [
"indexmap", "indexmap",
"lazy_static", "lazy_static",
"leo-ast", "leo-ast",
"leo-test-framework",
"serde", "serde",
"serde_json", "serde_json",
"serde_yaml", "serde_yaml",
@ -1428,8 +1458,8 @@ dependencies = [
"indexmap", "indexmap",
"leo-ast", "leo-ast",
"leo-input", "leo-input",
"rand", "rand 0.8.3",
"rand_core", "rand_core 0.6.2",
"rand_xorshift", "rand_xorshift",
"snarkvm-algorithms", "snarkvm-algorithms",
"snarkvm-curves", "snarkvm-curves",
@ -1452,6 +1482,15 @@ dependencies = [
"snarkvm-r1cs", "snarkvm-r1cs",
] ]
[[package]]
name = "leo-test-framework"
version = "1.4.0"
dependencies = [
"serde",
"serde_json",
"serde_yaml",
]
[[package]] [[package]]
name = "lexical-core" name = "lexical-core"
version = "0.7.5" version = "0.7.5"
@ -2037,6 +2076,32 @@ version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
[[package]]
name = "predicates"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eeb433456c1a57cc93554dea3ce40b4c19c4057e41c55d4a0f3d84ea71c325aa"
dependencies = [
"difference",
"predicates-core",
]
[[package]]
name = "predicates-core"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451"
[[package]]
name = "predicates-tree"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2"
dependencies = [
"predicates-core",
"treeline",
]
[[package]] [[package]]
name = "proc-macro-crate" name = "proc-macro-crate"
version = "0.1.5" version = "0.1.5"
@ -2127,6 +2192,19 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom 0.1.16",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc 0.2.0",
]
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.8.3" version = "0.8.3"
@ -2134,9 +2212,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha", "rand_chacha 0.3.0",
"rand_core", "rand_core 0.6.2",
"rand_hc", "rand_hc 0.3.0",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core 0.5.1",
] ]
[[package]] [[package]]
@ -2146,7 +2234,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core", "rand_core 0.6.2",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom 0.1.16",
] ]
[[package]] [[package]]
@ -2158,13 +2255,22 @@ dependencies = [
"getrandom 0.2.2", "getrandom 0.2.2",
] ]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.5.1",
]
[[package]] [[package]]
name = "rand_hc" name = "rand_hc"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [ dependencies = [
"rand_core", "rand_core 0.6.2",
] ]
[[package]] [[package]]
@ -2173,7 +2279,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
dependencies = [ dependencies = [
"rand_core", "rand_core 0.6.2",
] ]
[[package]] [[package]]
@ -2604,8 +2710,8 @@ dependencies = [
"derivative", "derivative",
"digest 0.9.0", "digest 0.9.0",
"itertools 0.10.0", "itertools 0.10.0",
"rand", "rand 0.8.3",
"rand_chacha", "rand_chacha 0.3.0",
"rayon", "rayon",
"sha2", "sha2",
"smallvec", "smallvec",
@ -2624,7 +2730,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64610b135b8b1152439d5dfa4f745515933366082f08651961344aa0bb5abfca" checksum = "64610b135b8b1152439d5dfa4f745515933366082f08651961344aa0bb5abfca"
dependencies = [ dependencies = [
"derivative", "derivative",
"rand", "rand 0.8.3",
"rand_xorshift", "rand_xorshift",
"rustc_version 0.3.3", "rustc_version 0.3.3",
"serde", "serde",
@ -2659,7 +2765,7 @@ dependencies = [
"derivative", "derivative",
"hex", "hex",
"itertools 0.10.0", "itertools 0.10.0",
"rand", "rand 0.8.3",
"snarkvm-algorithms", "snarkvm-algorithms",
"snarkvm-curves", "snarkvm-curves",
"snarkvm-fields", "snarkvm-fields",
@ -2680,7 +2786,7 @@ checksum = "8c49c69d02df11be58e07f626c9d6f5804c6dd4ccf42e425f2be8d79fe6e5bb7"
dependencies = [ dependencies = [
"bincode", "bincode",
"derivative", "derivative",
"rand", "rand 0.8.3",
"rand_xorshift", "rand_xorshift",
"serde", "serde",
"snarkvm-utilities", "snarkvm-utilities",
@ -2715,7 +2821,7 @@ dependencies = [
"chrono", "chrono",
"hex", "hex",
"once_cell", "once_cell",
"rand", "rand 0.8.3",
"serde", "serde",
"sha2", "sha2",
"snarkvm-algorithms", "snarkvm-algorithms",
@ -2769,7 +2875,7 @@ dependencies = [
"bincode", "bincode",
"hex", "hex",
"parking_lot", "parking_lot",
"rand", "rand 0.8.3",
"rocksdb", "rocksdb",
"serde", "serde",
"snarkvm-algorithms", "snarkvm-algorithms",
@ -2787,7 +2893,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c763843fa67a3aa4ce68173c8cd96b4f04aaa135a5792bc051c36eec0fe1cd73" checksum = "c763843fa67a3aa4ce68173c8cd96b4f04aaa135a5792bc051c36eec0fe1cd73"
dependencies = [ dependencies = [
"bincode", "bincode",
"rand", "rand 0.8.3",
"snarkvm-derives", "snarkvm-derives",
"thiserror", "thiserror",
] ]
@ -2893,7 +2999,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"rand", "rand 0.8.3",
"redox_syscall 0.2.5", "redox_syscall 0.2.5",
"remove_dir_all", "remove_dir_all",
"winapi 0.3.9", "winapi 0.3.9",
@ -2929,6 +3035,15 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "test_dir"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e571ebf9127a9da821890a9fa8a8ef777fce3e0f959ff6949cf06ca8b736381d"
dependencies = [
"rand 0.7.3",
]
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.11.0" version = "0.11.0"
@ -3141,6 +3256,12 @@ dependencies = [
"tracing-serde", "tracing-serde",
] ]
[[package]]
name = "treeline"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
[[package]] [[package]]
name = "try-lock" name = "try-lock"
version = "0.2.3" version = "0.2.3"
@ -3258,6 +3379,15 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "wait-timeout"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.3.2" version = "2.3.2"
@ -3457,9 +3587,9 @@ dependencies = [
[[package]] [[package]]
name = "zip" name = "zip"
version = "0.5.10" version = "0.5.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a8977234acab718eb2820494b2f96cbb16004c19dddf88b7445b27381450997" checksum = "9c83dc9b784d252127720168abd71ea82bf8c3d96b17dc565b5e2a02854f2b27"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"bzip2", "bzip2",

View File

@ -37,7 +37,8 @@ members = [
"package", "package",
"parser", "parser",
"state", "state",
"synthesizer" "synthesizer",
"test-framework"
] ]
[dependencies.leo-ast] [dependencies.leo-ast]
@ -156,6 +157,12 @@ version = "0.12.1"
[dev-dependencies.rusty-hook] [dev-dependencies.rusty-hook]
version = "0.11.2" version = "0.11.2"
[dev-dependencies.assert_cmd]
version = "1.0.3"
[dev-dependencies.test_dir]
version = "0.1.0"
[features] [features]
default = [ ] default = [ ]
ci_skip = [ "leo-compiler/ci_skip" ] ci_skip = [ "leo-compiler/ci_skip" ]

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // 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/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{FormattedError, Span}; use crate::{FormattedError, LeoError, Span};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum CanonicalizeError { pub enum CanonicalizeError {
@ -22,6 +22,8 @@ pub enum CanonicalizeError {
Error(#[from] FormattedError), Error(#[from] FormattedError),
} }
impl LeoError for CanonicalizeError {}
impl CanonicalizeError { impl CanonicalizeError {
fn new_from_span(message: String, span: &Span) -> Self { fn new_from_span(message: String, span: &Span) -> Self {
CanonicalizeError::Error(FormattedError::new_from_span(message, span)) CanonicalizeError::Error(FormattedError::new_from_span(message, span))

View File

@ -0,0 +1,43 @@
// 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 crate::{FormattedError, LeoError, Span};
#[derive(Debug, Error)]
pub enum CombinerError {
#[error("{}", _0)]
Error(#[from] FormattedError),
}
impl LeoError for CombinerError {}
impl CombinerError {
fn new_from_span(message: String, span: &Span) -> Self {
CombinerError::Error(FormattedError::new_from_span(message, span))
}
pub fn asg_statement_not_block(span: &Span) -> Self {
let message = "AstStatement should be be a block".to_string();
Self::new_from_span(message, span)
}
pub fn illegal_compound_array_range(span: &Span) -> Self {
let message = "Illegal compound assignement with array range".to_string();
Self::new_from_span(message, span)
}
}

View File

@ -14,7 +14,16 @@
// You should have received a copy of the GNU General Public License // 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/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
pub mod canonicalization;
pub use canonicalization::*;
pub mod combiner;
pub use combiner::*;
pub mod error; pub mod error;
pub use error::*; pub use error::*;
pub mod reducer;
pub use reducer::*;
pub trait LeoError {} pub trait LeoError {}

43
ast/src/errors/reducer.rs Normal file
View File

@ -0,0 +1,43 @@
// 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 crate::{CanonicalizeError, CombinerError, FormattedError, LeoError, Span};
#[derive(Debug, Error)]
pub enum ReducerError {
#[error("{}", _0)]
Error(#[from] FormattedError),
#[error("{}", _0)]
CanonicalizeError(#[from] CanonicalizeError),
#[error("{}", _0)]
CombinerError(#[from] CombinerError),
}
impl LeoError for ReducerError {}
impl ReducerError {
fn new_from_span(message: String, span: &Span) -> Self {
ReducerError::Error(FormattedError::new_from_span(message, span))
}
pub fn impossible_console_assert_call(span: &Span) -> Self {
let message = "Console::Assert cannot be matched here, its handled in another case.".to_string();
Self::new_from_span(message, span)
}
}

View File

@ -71,7 +71,7 @@ pub use node::*;
/// These data types form a tree that begins from a [`Program`] type root. /// These data types form a tree that begins from a [`Program`] type root.
/// ///
/// A new [`Ast`] can be created from a [`Grammar`] generated by the pest parser in the `grammar` module. /// A new [`Ast`] can be created from a [`Grammar`] generated by the pest parser in the `grammar` module.
#[derive(Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, PartialEq)]
pub struct Ast { pub struct Ast {
ast: Program, ast: Program,
} }
@ -83,7 +83,7 @@ impl Ast {
} }
/// Mutates the program ast by preforming canonicalization on it. /// Mutates the program ast by preforming canonicalization on it.
pub fn canonicalize(&mut self) -> Result<(), CanonicalizeError> { pub fn canonicalize(&mut self) -> Result<(), ReducerError> {
self.ast = ReconstructingDirector::new(Canonicalizer::default()).reduce_program(self.as_repr())?; self.ast = ReconstructingDirector::new(Canonicalizer::default()).reduce_program(self.as_repr())?;
Ok(()) Ok(())
} }

View File

@ -25,11 +25,78 @@ use crate::*;
pub struct Canonicalizer { pub struct Canonicalizer {
// If we are in a circuit keep track of the circuit name. // If we are in a circuit keep track of the circuit name.
circuit_name: Option<Identifier>, circuit_name: Option<Identifier>,
in_circuit: bool,
}
impl Default for Canonicalizer {
fn default() -> Self {
Self {
circuit_name: None,
in_circuit: false,
}
}
} }
impl Canonicalizer { impl Canonicalizer {
pub fn default() -> Self { pub fn canonicalize_accesses(
Self { circuit_name: None } &mut self,
start: Expression,
accesses: &[AssigneeAccess],
span: &Span,
) -> Result<Box<Expression>, ReducerError> {
let mut left = Box::new(start);
for access in accesses.iter() {
match self.canonicalize_assignee_access(&access) {
AssigneeAccess::ArrayIndex(index) => {
left = Box::new(Expression::ArrayAccess(ArrayAccessExpression {
array: left,
index: Box::new(index),
span: span.clone(),
}));
}
AssigneeAccess::Tuple(positive_number, _) => {
left = Box::new(Expression::TupleAccess(TupleAccessExpression {
tuple: left,
index: positive_number,
span: span.clone(),
}));
}
AssigneeAccess::Member(identifier) => {
left = Box::new(Expression::CircuitMemberAccess(CircuitMemberAccessExpression {
circuit: left,
name: identifier,
span: span.clone(),
}));
}
_ => return Err(ReducerError::from(CombinerError::illegal_compound_array_range(&span))),
}
}
Ok(left)
}
pub fn compound_operation_converstion(
&mut self,
operation: &AssignOperation,
) -> Result<BinaryOperation, ReducerError> {
match operation {
AssignOperation::Assign => unreachable!(),
AssignOperation::Add => Ok(BinaryOperation::Add),
AssignOperation::Sub => Ok(BinaryOperation::Sub),
AssignOperation::Mul => Ok(BinaryOperation::Mul),
AssignOperation::Div => Ok(BinaryOperation::Div),
AssignOperation::Pow => Ok(BinaryOperation::Pow),
AssignOperation::Or => Ok(BinaryOperation::Or),
AssignOperation::And => Ok(BinaryOperation::And),
AssignOperation::BitOr => Ok(BinaryOperation::BitOr),
AssignOperation::BitAnd => Ok(BinaryOperation::BitAnd),
AssignOperation::BitXor => Ok(BinaryOperation::BitXor),
AssignOperation::Shr => Ok(BinaryOperation::Shr),
AssignOperation::ShrSigned => Ok(BinaryOperation::ShrSigned),
AssignOperation::Shl => Ok(BinaryOperation::Shl),
AssignOperation::Mod => Ok(BinaryOperation::Mod),
}
} }
fn is_self_type(&mut self, type_option: Option<&Type>) -> bool { fn is_self_type(&mut self, type_option: Option<&Type>) -> bool {
@ -380,17 +447,21 @@ impl Canonicalizer {
} }
impl ReconstructingReducer for Canonicalizer { impl ReconstructingReducer for Canonicalizer {
fn reduce_type( fn in_circuit(&self) -> bool {
&mut self, self.in_circuit
_type_: &Type, }
new: Type,
in_circuit: bool, fn swap_in_circuit(&mut self) {
span: &Span, self.in_circuit = !self.in_circuit;
) -> Result<Type, CanonicalizeError> { }
fn reduce_type(&mut self, _type_: &Type, new: Type, span: &Span) -> Result<Type, ReducerError> {
match new { match new {
Type::Array(type_, mut dimensions) => { Type::Array(type_, mut dimensions) => {
if dimensions.is_zero() { if dimensions.is_zero() {
return Err(CanonicalizeError::invalid_array_dimension_size(span)); return Err(ReducerError::from(CanonicalizeError::invalid_array_dimension_size(
span,
)));
} }
let mut next = Type::Array(type_, ArrayDimensions(vec![dimensions.remove_last().unwrap()])); let mut next = Type::Array(type_, ArrayDimensions(vec![dimensions.remove_last().unwrap()]));
@ -407,7 +478,9 @@ impl ReconstructingReducer for Canonicalizer {
Ok(array) Ok(array)
} }
Type::SelfType if !in_circuit => Err(CanonicalizeError::big_self_outside_of_circuit(span)), Type::SelfType if !self.in_circuit => {
Err(ReducerError::from(CanonicalizeError::big_self_outside_of_circuit(span)))
}
_ => Ok(new.clone()), _ => Ok(new.clone()),
} }
} }
@ -416,10 +489,11 @@ impl ReconstructingReducer for Canonicalizer {
&mut self, &mut self,
array_init: &ArrayInitExpression, array_init: &ArrayInitExpression,
element: Expression, element: Expression,
_in_circuit: bool, ) -> Result<ArrayInitExpression, ReducerError> {
) -> Result<ArrayInitExpression, CanonicalizeError> {
if array_init.dimensions.is_zero() { if array_init.dimensions.is_zero() {
return Err(CanonicalizeError::invalid_array_dimension_size(&array_init.span)); return Err(ReducerError::from(CanonicalizeError::invalid_array_dimension_size(
&array_init.span,
)));
} }
let element = Box::new(element); let element = Box::new(element);
@ -466,58 +540,39 @@ impl ReconstructingReducer for Canonicalizer {
assign: &AssignStatement, assign: &AssignStatement,
assignee: Assignee, assignee: Assignee,
value: Expression, value: Expression,
_in_circuit: bool, ) -> Result<AssignStatement, ReducerError> {
) -> Result<AssignStatement, CanonicalizeError> {
match value { match value {
Expression::Binary(binary_expr) if assign.operation != AssignOperation::Assign => {
let left = self.canonicalize_accesses(
Expression::Identifier(assignee.identifier.clone()),
&assignee.accesses,
&assign.span,
)?;
let right = Box::new(Expression::Binary(binary_expr));
let op = self.compound_operation_converstion(&assign.operation)?;
let new_value = Expression::Binary(BinaryExpression {
left,
right,
op,
span: assign.span.clone(),
});
Ok(AssignStatement {
operation: AssignOperation::Assign,
assignee,
value: new_value,
span: assign.span.clone(),
})
}
Expression::Value(value_expr) if assign.operation != AssignOperation::Assign => { Expression::Value(value_expr) if assign.operation != AssignOperation::Assign => {
let mut left = Box::new(Expression::Identifier(assignee.identifier.clone())); let left = self.canonicalize_accesses(
Expression::Identifier(assignee.identifier.clone()),
for access in assignee.accesses.iter() { &assignee.accesses,
match self.canonicalize_assignee_access(&access) { &assign.span,
AssigneeAccess::ArrayIndex(index) => { )?;
left = Box::new(Expression::ArrayAccess(ArrayAccessExpression {
array: left,
index: Box::new(index),
span: assign.span.clone(),
}));
}
AssigneeAccess::Tuple(positive_number, _) => {
left = Box::new(Expression::TupleAccess(TupleAccessExpression {
tuple: left,
index: positive_number,
span: assign.span.clone(),
}));
}
AssigneeAccess::Member(identifier) => {
left = Box::new(Expression::CircuitMemberAccess(CircuitMemberAccessExpression {
circuit: left,
name: identifier,
span: assign.span.clone(),
}));
}
_ => unimplemented!(), // No reason for someone to compute ArrayRanges.
}
}
let right = Box::new(Expression::Value(value_expr)); let right = Box::new(Expression::Value(value_expr));
let op = self.compound_operation_converstion(&assign.operation)?;
let op = match assign.operation {
AssignOperation::Assign => unimplemented!(), // Imposible
AssignOperation::Add => BinaryOperation::Add,
AssignOperation::Sub => BinaryOperation::Sub,
AssignOperation::Mul => BinaryOperation::Mul,
AssignOperation::Div => BinaryOperation::Div,
AssignOperation::Pow => BinaryOperation::Pow,
AssignOperation::Or => BinaryOperation::Or,
AssignOperation::And => BinaryOperation::And,
AssignOperation::BitOr => BinaryOperation::BitOr,
AssignOperation::BitAnd => BinaryOperation::BitAnd,
AssignOperation::BitXor => BinaryOperation::BitXor,
AssignOperation::Shr => BinaryOperation::Shr,
AssignOperation::ShrSigned => BinaryOperation::ShrSigned,
AssignOperation::Shl => BinaryOperation::Shl,
AssignOperation::Mod => BinaryOperation::Mod,
};
let new_value = Expression::Binary(BinaryExpression { let new_value = Expression::Binary(BinaryExpression {
left, left,
@ -545,8 +600,7 @@ impl ReconstructingReducer for Canonicalizer {
input: Vec<FunctionInput>, input: Vec<FunctionInput>,
output: Option<Type>, output: Option<Type>,
block: Block, block: Block,
_in_circuit: bool, ) -> Result<Function, ReducerError> {
) -> Result<Function, CanonicalizeError> {
let new_output = match output { let new_output = match output {
None => Some(Type::Tuple(vec![])), None => Some(Type::Tuple(vec![])),
_ => output, _ => output,
@ -567,7 +621,7 @@ impl ReconstructingReducer for Canonicalizer {
_circuit: &Circuit, _circuit: &Circuit,
circuit_name: Identifier, circuit_name: Identifier,
members: Vec<CircuitMember>, members: Vec<CircuitMember>,
) -> Result<Circuit, CanonicalizeError> { ) -> Result<Circuit, ReducerError> {
self.circuit_name = Some(circuit_name.clone()); self.circuit_name = Some(circuit_name.clone());
let circ = Circuit { let circ = Circuit {
circuit_name, circuit_name,

View File

@ -17,9 +17,6 @@
mod canonicalization; mod canonicalization;
pub use canonicalization::*; pub use canonicalization::*;
mod errors;
pub use errors::*;
mod reconstructing_reducer; mod reconstructing_reducer;
pub use reconstructing_reducer::*; pub use reconstructing_reducer::*;

View File

@ -22,18 +22,14 @@ use indexmap::IndexMap;
pub struct ReconstructingDirector<R: ReconstructingReducer> { pub struct ReconstructingDirector<R: ReconstructingReducer> {
reducer: R, reducer: R,
in_circuit: bool,
} }
impl<R: ReconstructingReducer> ReconstructingDirector<R> { impl<R: ReconstructingReducer> ReconstructingDirector<R> {
pub fn new(reducer: R) -> Self { pub fn new(reducer: R) -> Self {
Self { Self { reducer }
reducer,
in_circuit: false,
}
} }
pub fn reduce_type(&mut self, type_: &Type, span: &Span) -> Result<Type, CanonicalizeError> { pub fn reduce_type(&mut self, type_: &Type, span: &Span) -> Result<Type, ReducerError> {
let new = match type_ { let new = match type_ {
Type::Array(type_, dimensions) => Type::Array(Box::new(self.reduce_type(type_, span)?), dimensions.clone()), Type::Array(type_, dimensions) => Type::Array(Box::new(self.reduce_type(type_, span)?), dimensions.clone()),
Type::Tuple(types) => { Type::Tuple(types) => {
@ -48,11 +44,11 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
_ => type_.clone(), _ => type_.clone(),
}; };
self.reducer.reduce_type(type_, new, self.in_circuit, span) self.reducer.reduce_type(type_, new, span)
} }
// Expressions // Expressions
pub fn reduce_expression(&mut self, expression: &Expression) -> Result<Expression, CanonicalizeError> { pub fn reduce_expression(&mut self, expression: &Expression) -> Result<Expression, ReducerError> {
let new = match expression { let new = match expression {
Expression::Identifier(identifier) => Expression::Identifier(self.reduce_identifier(&identifier)?), Expression::Identifier(identifier) => Expression::Identifier(self.reduce_identifier(&identifier)?),
Expression::Value(value) => Expression::Value(self.reduce_value(&value)?), Expression::Value(value) => Expression::Value(self.reduce_value(&value)?),
@ -84,18 +80,18 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
Expression::Call(call) => Expression::Call(self.reduce_call(&call)?), Expression::Call(call) => Expression::Call(self.reduce_call(&call)?),
}; };
self.reducer.reduce_expression(expression, new, self.in_circuit) self.reducer.reduce_expression(expression, new)
} }
pub fn reduce_identifier(&mut self, identifier: &Identifier) -> Result<Identifier, CanonicalizeError> { pub fn reduce_identifier(&mut self, identifier: &Identifier) -> Result<Identifier, ReducerError> {
self.reducer.reduce_identifier(identifier) self.reducer.reduce_identifier(identifier)
} }
pub fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result<GroupTuple, CanonicalizeError> { pub fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result<GroupTuple, ReducerError> {
self.reducer.reduce_group_tuple(group_tuple) self.reducer.reduce_group_tuple(group_tuple)
} }
pub fn reduce_group_value(&mut self, group_value: &GroupValue) -> Result<GroupValue, CanonicalizeError> { pub fn reduce_group_value(&mut self, group_value: &GroupValue) -> Result<GroupValue, ReducerError> {
let new = match group_value { let new = match group_value {
GroupValue::Tuple(group_tuple) => GroupValue::Tuple(self.reduce_group_tuple(&group_tuple)?), GroupValue::Tuple(group_tuple) => GroupValue::Tuple(self.reduce_group_tuple(&group_tuple)?),
_ => group_value.clone(), _ => group_value.clone(),
@ -104,7 +100,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
self.reducer.reduce_group_value(group_value, new) self.reducer.reduce_group_value(group_value, new)
} }
pub fn reduce_value(&mut self, value: &ValueExpression) -> Result<ValueExpression, CanonicalizeError> { pub fn reduce_value(&mut self, value: &ValueExpression) -> Result<ValueExpression, ReducerError> {
let new = match value { let new = match value {
ValueExpression::Group(group_value) => { ValueExpression::Group(group_value) => {
ValueExpression::Group(Box::new(self.reduce_group_value(&group_value)?)) ValueExpression::Group(Box::new(self.reduce_group_value(&group_value)?))
@ -115,41 +111,38 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
self.reducer.reduce_value(value, new) self.reducer.reduce_value(value, new)
} }
pub fn reduce_binary(&mut self, binary: &BinaryExpression) -> Result<BinaryExpression, CanonicalizeError> { pub fn reduce_binary(&mut self, binary: &BinaryExpression) -> Result<BinaryExpression, ReducerError> {
let left = self.reduce_expression(&binary.left)?; let left = self.reduce_expression(&binary.left)?;
let right = self.reduce_expression(&binary.right)?; let right = self.reduce_expression(&binary.right)?;
self.reducer self.reducer.reduce_binary(binary, left, right, binary.op.clone())
.reduce_binary(binary, left, right, binary.op.clone(), self.in_circuit)
} }
pub fn reduce_unary(&mut self, unary: &UnaryExpression) -> Result<UnaryExpression, CanonicalizeError> { pub fn reduce_unary(&mut self, unary: &UnaryExpression) -> Result<UnaryExpression, ReducerError> {
let inner = self.reduce_expression(&unary.inner)?; let inner = self.reduce_expression(&unary.inner)?;
self.reducer self.reducer.reduce_unary(unary, inner, unary.op.clone())
.reduce_unary(unary, inner, unary.op.clone(), self.in_circuit)
} }
pub fn reduce_ternary(&mut self, ternary: &TernaryExpression) -> Result<TernaryExpression, CanonicalizeError> { pub fn reduce_ternary(&mut self, ternary: &TernaryExpression) -> Result<TernaryExpression, ReducerError> {
let condition = self.reduce_expression(&ternary.condition)?; let condition = self.reduce_expression(&ternary.condition)?;
let if_true = self.reduce_expression(&ternary.if_true)?; let if_true = self.reduce_expression(&ternary.if_true)?;
let if_false = self.reduce_expression(&ternary.if_false)?; let if_false = self.reduce_expression(&ternary.if_false)?;
self.reducer self.reducer.reduce_ternary(ternary, condition, if_true, if_false)
.reduce_ternary(ternary, condition, if_true, if_false, self.in_circuit)
} }
pub fn reduce_cast(&mut self, cast: &CastExpression) -> Result<CastExpression, CanonicalizeError> { pub fn reduce_cast(&mut self, cast: &CastExpression) -> Result<CastExpression, ReducerError> {
let inner = self.reduce_expression(&cast.inner)?; let inner = self.reduce_expression(&cast.inner)?;
let target_type = self.reduce_type(&cast.target_type, &cast.span)?; let target_type = self.reduce_type(&cast.target_type, &cast.span)?;
self.reducer.reduce_cast(cast, inner, target_type, self.in_circuit) self.reducer.reduce_cast(cast, inner, target_type)
} }
pub fn reduce_array_inline( pub fn reduce_array_inline(
&mut self, &mut self,
array_inline: &ArrayInlineExpression, array_inline: &ArrayInlineExpression,
) -> Result<ArrayInlineExpression, CanonicalizeError> { ) -> Result<ArrayInlineExpression, ReducerError> {
let mut elements = vec![]; let mut elements = vec![];
for element in array_inline.elements.iter() { for element in array_inline.elements.iter() {
let reduced_element = match element { let reduced_element = match element {
@ -164,34 +157,29 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
elements.push(reduced_element); elements.push(reduced_element);
} }
self.reducer self.reducer.reduce_array_inline(array_inline, elements)
.reduce_array_inline(array_inline, elements, self.in_circuit)
} }
pub fn reduce_array_init( pub fn reduce_array_init(&mut self, array_init: &ArrayInitExpression) -> Result<ArrayInitExpression, ReducerError> {
&mut self,
array_init: &ArrayInitExpression,
) -> Result<ArrayInitExpression, CanonicalizeError> {
let element = self.reduce_expression(&array_init.element)?; let element = self.reduce_expression(&array_init.element)?;
self.reducer.reduce_array_init(array_init, element, self.in_circuit) self.reducer.reduce_array_init(array_init, element)
} }
pub fn reduce_array_access( pub fn reduce_array_access(
&mut self, &mut self,
array_access: &ArrayAccessExpression, array_access: &ArrayAccessExpression,
) -> Result<ArrayAccessExpression, CanonicalizeError> { ) -> Result<ArrayAccessExpression, ReducerError> {
let array = self.reduce_expression(&array_access.array)?; let array = self.reduce_expression(&array_access.array)?;
let index = self.reduce_expression(&array_access.index)?; let index = self.reduce_expression(&array_access.index)?;
self.reducer self.reducer.reduce_array_access(array_access, array, index)
.reduce_array_access(array_access, array, index, self.in_circuit)
} }
pub fn reduce_array_range_access( pub fn reduce_array_range_access(
&mut self, &mut self,
array_range_access: &ArrayRangeAccessExpression, array_range_access: &ArrayRangeAccessExpression,
) -> Result<ArrayRangeAccessExpression, CanonicalizeError> { ) -> Result<ArrayRangeAccessExpression, ReducerError> {
let array = self.reduce_expression(&array_range_access.array)?; let array = self.reduce_expression(&array_range_access.array)?;
let left = array_range_access let left = array_range_access
.left .left
@ -205,34 +193,31 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
.transpose()?; .transpose()?;
self.reducer self.reducer
.reduce_array_range_access(array_range_access, array, left, right, self.in_circuit) .reduce_array_range_access(array_range_access, array, left, right)
} }
pub fn reduce_tuple_init( pub fn reduce_tuple_init(&mut self, tuple_init: &TupleInitExpression) -> Result<TupleInitExpression, ReducerError> {
&mut self,
tuple_init: &TupleInitExpression,
) -> Result<TupleInitExpression, CanonicalizeError> {
let mut elements = vec![]; let mut elements = vec![];
for element in tuple_init.elements.iter() { for element in tuple_init.elements.iter() {
elements.push(self.reduce_expression(element)?); elements.push(self.reduce_expression(element)?);
} }
self.reducer.reduce_tuple_init(tuple_init, elements, self.in_circuit) self.reducer.reduce_tuple_init(tuple_init, elements)
} }
pub fn reduce_tuple_access( pub fn reduce_tuple_access(
&mut self, &mut self,
tuple_access: &TupleAccessExpression, tuple_access: &TupleAccessExpression,
) -> Result<TupleAccessExpression, CanonicalizeError> { ) -> Result<TupleAccessExpression, ReducerError> {
let tuple = self.reduce_expression(&tuple_access.tuple)?; let tuple = self.reduce_expression(&tuple_access.tuple)?;
self.reducer.reduce_tuple_access(tuple_access, tuple, self.in_circuit) self.reducer.reduce_tuple_access(tuple_access, tuple)
} }
pub fn reduce_circuit_implied_variable_definition( pub fn reduce_circuit_implied_variable_definition(
&mut self, &mut self,
variable: &CircuitImpliedVariableDefinition, variable: &CircuitImpliedVariableDefinition,
) -> Result<CircuitImpliedVariableDefinition, CanonicalizeError> { ) -> Result<CircuitImpliedVariableDefinition, ReducerError> {
let identifier = self.reduce_identifier(&variable.identifier)?; let identifier = self.reduce_identifier(&variable.identifier)?;
let expression = variable let expression = variable
.expression .expression
@ -241,13 +226,13 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
.transpose()?; .transpose()?;
self.reducer self.reducer
.reduce_circuit_implied_variable_definition(variable, identifier, expression, self.in_circuit) .reduce_circuit_implied_variable_definition(variable, identifier, expression)
} }
pub fn reduce_circuit_init( pub fn reduce_circuit_init(
&mut self, &mut self,
circuit_init: &CircuitInitExpression, circuit_init: &CircuitInitExpression,
) -> Result<CircuitInitExpression, CanonicalizeError> { ) -> Result<CircuitInitExpression, ReducerError> {
let name = self.reduce_identifier(&circuit_init.name)?; let name = self.reduce_identifier(&circuit_init.name)?;
let mut members = vec![]; let mut members = vec![];
@ -255,33 +240,32 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
members.push(self.reduce_circuit_implied_variable_definition(member)?); members.push(self.reduce_circuit_implied_variable_definition(member)?);
} }
self.reducer self.reducer.reduce_circuit_init(circuit_init, name, members)
.reduce_circuit_init(circuit_init, name, members, self.in_circuit)
} }
pub fn reduce_circuit_member_access( pub fn reduce_circuit_member_access(
&mut self, &mut self,
circuit_member_access: &CircuitMemberAccessExpression, circuit_member_access: &CircuitMemberAccessExpression,
) -> Result<CircuitMemberAccessExpression, CanonicalizeError> { ) -> Result<CircuitMemberAccessExpression, ReducerError> {
let circuit = self.reduce_expression(&circuit_member_access.circuit)?; let circuit = self.reduce_expression(&circuit_member_access.circuit)?;
let name = self.reduce_identifier(&circuit_member_access.name)?; let name = self.reduce_identifier(&circuit_member_access.name)?;
self.reducer self.reducer
.reduce_circuit_member_access(circuit_member_access, circuit, name, self.in_circuit) .reduce_circuit_member_access(circuit_member_access, circuit, name)
} }
pub fn reduce_circuit_static_fn_access( pub fn reduce_circuit_static_fn_access(
&mut self, &mut self,
circuit_static_fn_access: &CircuitStaticFunctionAccessExpression, circuit_static_fn_access: &CircuitStaticFunctionAccessExpression,
) -> Result<CircuitStaticFunctionAccessExpression, CanonicalizeError> { ) -> Result<CircuitStaticFunctionAccessExpression, ReducerError> {
let circuit = self.reduce_expression(&circuit_static_fn_access.circuit)?; let circuit = self.reduce_expression(&circuit_static_fn_access.circuit)?;
let name = self.reduce_identifier(&circuit_static_fn_access.name)?; let name = self.reduce_identifier(&circuit_static_fn_access.name)?;
self.reducer self.reducer
.reduce_circuit_static_fn_access(circuit_static_fn_access, circuit, name, self.in_circuit) .reduce_circuit_static_fn_access(circuit_static_fn_access, circuit, name)
} }
pub fn reduce_call(&mut self, call: &CallExpression) -> Result<CallExpression, CanonicalizeError> { pub fn reduce_call(&mut self, call: &CallExpression) -> Result<CallExpression, ReducerError> {
let function = self.reduce_expression(&call.function)?; let function = self.reduce_expression(&call.function)?;
let mut arguments = vec![]; let mut arguments = vec![];
@ -289,11 +273,11 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
arguments.push(self.reduce_expression(argument)?); arguments.push(self.reduce_expression(argument)?);
} }
self.reducer.reduce_call(call, function, arguments, self.in_circuit) self.reducer.reduce_call(call, function, arguments)
} }
// Statements // Statements
pub fn reduce_statement(&mut self, statement: &Statement) -> Result<Statement, CanonicalizeError> { pub fn reduce_statement(&mut self, statement: &Statement) -> Result<Statement, ReducerError> {
let new = match statement { let new = match statement {
Statement::Return(return_statement) => Statement::Return(self.reduce_return(&return_statement)?), Statement::Return(return_statement) => Statement::Return(self.reduce_return(&return_statement)?),
Statement::Definition(definition) => Statement::Definition(self.reduce_definition(&definition)?), Statement::Definition(definition) => Statement::Definition(self.reduce_definition(&definition)?),
@ -305,26 +289,22 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
Statement::Block(block) => Statement::Block(self.reduce_block(&block)?), Statement::Block(block) => Statement::Block(self.reduce_block(&block)?),
}; };
self.reducer.reduce_statement(statement, new, self.in_circuit) self.reducer.reduce_statement(statement, new)
} }
pub fn reduce_return(&mut self, return_statement: &ReturnStatement) -> Result<ReturnStatement, CanonicalizeError> { pub fn reduce_return(&mut self, return_statement: &ReturnStatement) -> Result<ReturnStatement, ReducerError> {
let expression = self.reduce_expression(&return_statement.expression)?; let expression = self.reduce_expression(&return_statement.expression)?;
self.reducer self.reducer.reduce_return(return_statement, expression)
.reduce_return(return_statement, expression, self.in_circuit)
} }
pub fn reduce_variable_name(&mut self, variable_name: &VariableName) -> Result<VariableName, CanonicalizeError> { pub fn reduce_variable_name(&mut self, variable_name: &VariableName) -> Result<VariableName, ReducerError> {
let identifier = self.reduce_identifier(&variable_name.identifier)?; let identifier = self.reduce_identifier(&variable_name.identifier)?;
self.reducer.reduce_variable_name(variable_name, identifier) self.reducer.reduce_variable_name(variable_name, identifier)
} }
pub fn reduce_definition( pub fn reduce_definition(&mut self, definition: &DefinitionStatement) -> Result<DefinitionStatement, ReducerError> {
&mut self,
definition: &DefinitionStatement,
) -> Result<DefinitionStatement, CanonicalizeError> {
let mut variable_names = vec![]; let mut variable_names = vec![];
for variable_name in definition.variable_names.iter() { for variable_name in definition.variable_names.iter() {
variable_names.push(self.reduce_variable_name(variable_name)?); variable_names.push(self.reduce_variable_name(variable_name)?);
@ -338,11 +318,10 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
let value = self.reduce_expression(&definition.value)?; let value = self.reduce_expression(&definition.value)?;
self.reducer self.reducer.reduce_definition(definition, variable_names, type_, value)
.reduce_definition(definition, variable_names, type_, value, self.in_circuit)
} }
pub fn reduce_assignee_access(&mut self, access: &AssigneeAccess) -> Result<AssigneeAccess, CanonicalizeError> { pub fn reduce_assignee_access(&mut self, access: &AssigneeAccess) -> Result<AssigneeAccess, ReducerError> {
let new = match access { let new = match access {
AssigneeAccess::ArrayRange(left, right) => { AssigneeAccess::ArrayRange(left, right) => {
let left = left.as_ref().map(|left| self.reduce_expression(left)).transpose()?; let left = left.as_ref().map(|left| self.reduce_expression(left)).transpose()?;
@ -355,10 +334,10 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
_ => access.clone(), _ => access.clone(),
}; };
self.reducer.reduce_assignee_access(access, new, self.in_circuit) self.reducer.reduce_assignee_access(access, new)
} }
pub fn reduce_assignee(&mut self, assignee: &Assignee) -> Result<Assignee, CanonicalizeError> { pub fn reduce_assignee(&mut self, assignee: &Assignee) -> Result<Assignee, ReducerError> {
let identifier = self.reduce_identifier(&assignee.identifier)?; let identifier = self.reduce_identifier(&assignee.identifier)?;
let mut accesses = vec![]; let mut accesses = vec![];
@ -366,21 +345,20 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
accesses.push(self.reduce_assignee_access(access)?); accesses.push(self.reduce_assignee_access(access)?);
} }
self.reducer self.reducer.reduce_assignee(assignee, identifier, accesses)
.reduce_assignee(assignee, identifier, accesses, self.in_circuit)
} }
pub fn reduce_assign(&mut self, assign: &AssignStatement) -> Result<AssignStatement, CanonicalizeError> { pub fn reduce_assign(&mut self, assign: &AssignStatement) -> Result<AssignStatement, ReducerError> {
let assignee = self.reduce_assignee(&assign.assignee)?; let assignee = self.reduce_assignee(&assign.assignee)?;
let value = self.reduce_expression(&assign.value)?; let value = self.reduce_expression(&assign.value)?;
self.reducer.reduce_assign(assign, assignee, value, self.in_circuit) self.reducer.reduce_assign(assign, assignee, value)
} }
pub fn reduce_conditional( pub fn reduce_conditional(
&mut self, &mut self,
conditional: &ConditionalStatement, conditional: &ConditionalStatement,
) -> Result<ConditionalStatement, CanonicalizeError> { ) -> Result<ConditionalStatement, ReducerError> {
let condition = self.reduce_expression(&conditional.condition)?; let condition = self.reduce_expression(&conditional.condition)?;
let block = self.reduce_block(&conditional.block)?; let block = self.reduce_block(&conditional.block)?;
let next = conditional let next = conditional
@ -389,27 +367,22 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
.map(|condition| self.reduce_statement(condition)) .map(|condition| self.reduce_statement(condition))
.transpose()?; .transpose()?;
self.reducer self.reducer.reduce_conditional(conditional, condition, block, next)
.reduce_conditional(conditional, condition, block, next, self.in_circuit)
} }
pub fn reduce_iteration( pub fn reduce_iteration(&mut self, iteration: &IterationStatement) -> Result<IterationStatement, ReducerError> {
&mut self,
iteration: &IterationStatement,
) -> Result<IterationStatement, CanonicalizeError> {
let variable = self.reduce_identifier(&iteration.variable)?; let variable = self.reduce_identifier(&iteration.variable)?;
let start = self.reduce_expression(&iteration.start)?; let start = self.reduce_expression(&iteration.start)?;
let stop = self.reduce_expression(&iteration.stop)?; let stop = self.reduce_expression(&iteration.stop)?;
let block = self.reduce_block(&iteration.block)?; let block = self.reduce_block(&iteration.block)?;
self.reducer self.reducer.reduce_iteration(iteration, variable, start, stop, block)
.reduce_iteration(iteration, variable, start, stop, block, self.in_circuit)
} }
pub fn reduce_console( pub fn reduce_console(
&mut self, &mut self,
console_function_call: &ConsoleStatement, console_function_call: &ConsoleStatement,
) -> Result<ConsoleStatement, CanonicalizeError> { ) -> Result<ConsoleStatement, ReducerError> {
let function = match &console_function_call.function { let function = match &console_function_call.function {
ConsoleFunction::Assert(expression) => ConsoleFunction::Assert(self.reduce_expression(expression)?), ConsoleFunction::Assert(expression) => ConsoleFunction::Assert(self.reduce_expression(expression)?),
ConsoleFunction::Debug(format) | ConsoleFunction::Error(format) | ConsoleFunction::Log(format) => { ConsoleFunction::Debug(format) | ConsoleFunction::Error(format) | ConsoleFunction::Log(format) => {
@ -428,35 +401,33 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
ConsoleFunction::Debug(_) => ConsoleFunction::Debug(formatted), ConsoleFunction::Debug(_) => ConsoleFunction::Debug(formatted),
ConsoleFunction::Error(_) => ConsoleFunction::Error(formatted), ConsoleFunction::Error(_) => ConsoleFunction::Error(formatted),
ConsoleFunction::Log(_) => ConsoleFunction::Log(formatted), ConsoleFunction::Log(_) => ConsoleFunction::Log(formatted),
_ => unimplemented!(), // impossible _ => return Err(ReducerError::impossible_console_assert_call(&format.span)),
} }
} }
}; };
self.reducer self.reducer.reduce_console(console_function_call, function)
.reduce_console(console_function_call, function, self.in_circuit)
} }
pub fn reduce_expression_statement( pub fn reduce_expression_statement(
&mut self, &mut self,
expression: &ExpressionStatement, expression: &ExpressionStatement,
) -> Result<ExpressionStatement, CanonicalizeError> { ) -> Result<ExpressionStatement, ReducerError> {
let inner_expression = self.reduce_expression(&expression.expression)?; let inner_expression = self.reduce_expression(&expression.expression)?;
self.reducer self.reducer.reduce_expression_statement(expression, inner_expression)
.reduce_expression_statement(expression, inner_expression, self.in_circuit)
} }
pub fn reduce_block(&mut self, block: &Block) -> Result<Block, CanonicalizeError> { pub fn reduce_block(&mut self, block: &Block) -> Result<Block, ReducerError> {
let mut statements = vec![]; let mut statements = vec![];
for statement in block.statements.iter() { for statement in block.statements.iter() {
statements.push(self.reduce_statement(statement)?); statements.push(self.reduce_statement(statement)?);
} }
self.reducer.reduce_block(block, statements, self.in_circuit) self.reducer.reduce_block(block, statements)
} }
// Program // Program
pub fn reduce_program(&mut self, program: &Program) -> Result<Program, CanonicalizeError> { pub fn reduce_program(&mut self, program: &Program) -> Result<Program, ReducerError> {
let mut inputs = vec![]; let mut inputs = vec![];
for input in program.expected_input.iter() { for input in program.expected_input.iter() {
inputs.push(self.reduce_function_input(input)?); inputs.push(self.reduce_function_input(input)?);
@ -468,9 +439,11 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
} }
let mut circuits = IndexMap::new(); let mut circuits = IndexMap::new();
self.reducer.swap_in_circuit();
for (identifier, circuit) in program.circuits.iter() { for (identifier, circuit) in program.circuits.iter() {
circuits.insert(self.reduce_identifier(identifier)?, self.reduce_circuit(circuit)?); circuits.insert(self.reduce_identifier(identifier)?, self.reduce_circuit(circuit)?);
} }
self.reducer.swap_in_circuit();
let mut functions = IndexMap::new(); let mut functions = IndexMap::new();
for (identifier, function) in program.functions.iter() { for (identifier, function) in program.functions.iter() {
@ -484,15 +457,14 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
pub fn reduce_function_input_variable( pub fn reduce_function_input_variable(
&mut self, &mut self,
variable: &FunctionInputVariable, variable: &FunctionInputVariable,
) -> Result<FunctionInputVariable, CanonicalizeError> { ) -> Result<FunctionInputVariable, ReducerError> {
let identifier = self.reduce_identifier(&variable.identifier)?; let identifier = self.reduce_identifier(&variable.identifier)?;
let type_ = self.reduce_type(&variable.type_, &variable.span)?; let type_ = self.reduce_type(&variable.type_, &variable.span)?;
self.reducer self.reducer.reduce_function_input_variable(variable, identifier, type_)
.reduce_function_input_variable(variable, identifier, type_, self.in_circuit)
} }
pub fn reduce_function_input(&mut self, input: &FunctionInput) -> Result<FunctionInput, CanonicalizeError> { pub fn reduce_function_input(&mut self, input: &FunctionInput) -> Result<FunctionInput, ReducerError> {
let new = match input { let new = match input {
FunctionInput::Variable(function_input_variable) => { FunctionInput::Variable(function_input_variable) => {
FunctionInput::Variable(self.reduce_function_input_variable(function_input_variable)?) FunctionInput::Variable(self.reduce_function_input_variable(function_input_variable)?)
@ -500,13 +472,13 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
_ => input.clone(), _ => input.clone(),
}; };
self.reducer.reduce_function_input(input, new, self.in_circuit) self.reducer.reduce_function_input(input, new)
} }
pub fn reduce_package_or_packages( pub fn reduce_package_or_packages(
&mut self, &mut self,
package_or_packages: &PackageOrPackages, package_or_packages: &PackageOrPackages,
) -> Result<PackageOrPackages, CanonicalizeError> { ) -> Result<PackageOrPackages, ReducerError> {
let new = match package_or_packages { let new = match package_or_packages {
PackageOrPackages::Package(package) => PackageOrPackages::Package(Package { PackageOrPackages::Package(package) => PackageOrPackages::Package(Package {
name: self.reduce_identifier(&package.name)?, name: self.reduce_identifier(&package.name)?,
@ -523,17 +495,13 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
self.reducer.reduce_package_or_packages(package_or_packages, new) self.reducer.reduce_package_or_packages(package_or_packages, new)
} }
pub fn reduce_import(&mut self, import: &ImportStatement) -> Result<ImportStatement, CanonicalizeError> { pub fn reduce_import(&mut self, import: &ImportStatement) -> Result<ImportStatement, ReducerError> {
let package_or_packages = self.reduce_package_or_packages(&import.package_or_packages)?; let package_or_packages = self.reduce_package_or_packages(&import.package_or_packages)?;
self.reducer.reduce_import(import, package_or_packages) self.reducer.reduce_import(import, package_or_packages)
} }
pub fn reduce_circuit_member( pub fn reduce_circuit_member(&mut self, circuit_member: &CircuitMember) -> Result<CircuitMember, ReducerError> {
&mut self,
circuit_member: &CircuitMember,
) -> Result<CircuitMember, CanonicalizeError> {
self.in_circuit = !self.in_circuit;
let new = match circuit_member { let new = match circuit_member {
CircuitMember::CircuitVariable(identifier, type_) => CircuitMember::CircuitVariable( CircuitMember::CircuitVariable(identifier, type_) => CircuitMember::CircuitVariable(
self.reduce_identifier(&identifier)?, self.reduce_identifier(&identifier)?,
@ -543,12 +511,11 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
CircuitMember::CircuitFunction(self.reduce_function(&function)?) CircuitMember::CircuitFunction(self.reduce_function(&function)?)
} }
}; };
self.in_circuit = !self.in_circuit;
self.reducer.reduce_circuit_member(circuit_member, new) self.reducer.reduce_circuit_member(circuit_member, new)
} }
pub fn reduce_circuit(&mut self, circuit: &Circuit) -> Result<Circuit, CanonicalizeError> { pub fn reduce_circuit(&mut self, circuit: &Circuit) -> Result<Circuit, ReducerError> {
let circuit_name = self.reduce_identifier(&circuit.circuit_name)?; let circuit_name = self.reduce_identifier(&circuit.circuit_name)?;
let mut members = vec![]; let mut members = vec![];
@ -559,13 +526,13 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
self.reducer.reduce_circuit(circuit, circuit_name, members) self.reducer.reduce_circuit(circuit, circuit_name, members)
} }
fn reduce_annotation(&mut self, annotation: &Annotation) -> Result<Annotation, CanonicalizeError> { fn reduce_annotation(&mut self, annotation: &Annotation) -> Result<Annotation, ReducerError> {
let name = self.reduce_identifier(&annotation.name)?; let name = self.reduce_identifier(&annotation.name)?;
self.reducer.reduce_annotation(annotation, name) self.reducer.reduce_annotation(annotation, name)
} }
pub fn reduce_function(&mut self, function: &Function) -> Result<Function, CanonicalizeError> { pub fn reduce_function(&mut self, function: &Function) -> Result<Function, ReducerError> {
let identifier = self.reduce_identifier(&function.identifier)?; let identifier = self.reduce_identifier(&function.identifier)?;
let mut annotations = vec![]; let mut annotations = vec![];
@ -586,14 +553,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
let block = self.reduce_block(&function.block)?; let block = self.reduce_block(&function.block)?;
self.reducer.reduce_function( self.reducer
function, .reduce_function(function, identifier, annotations, inputs, output, block)
identifier,
annotations,
inputs,
output,
block,
self.in_circuit,
)
} }
} }

View File

@ -20,34 +20,26 @@ use indexmap::IndexMap;
// Needed to fix clippy bug. // Needed to fix clippy bug.
#[allow(clippy::redundant_closure)] #[allow(clippy::redundant_closure)]
pub trait ReconstructingReducer { pub trait ReconstructingReducer {
fn reduce_type( fn in_circuit(&self) -> bool;
&mut self, fn swap_in_circuit(&mut self);
_type_: &Type,
new: Type, fn reduce_type(&mut self, _type_: &Type, new: Type, _span: &Span) -> Result<Type, ReducerError> {
_in_circuit: bool,
_span: &Span,
) -> Result<Type, CanonicalizeError> {
Ok(new) Ok(new)
} }
// Expressions // Expressions
fn reduce_expression( fn reduce_expression(&mut self, _expression: &Expression, new: Expression) -> Result<Expression, ReducerError> {
&mut self,
_expression: &Expression,
new: Expression,
_in_circuit: bool,
) -> Result<Expression, CanonicalizeError> {
Ok(new) Ok(new)
} }
fn reduce_identifier(&mut self, identifier: &Identifier) -> Result<Identifier, CanonicalizeError> { fn reduce_identifier(&mut self, identifier: &Identifier) -> Result<Identifier, ReducerError> {
Ok(Identifier { Ok(Identifier {
name: identifier.name.clone(), name: identifier.name.clone(),
span: identifier.span.clone(), span: identifier.span.clone(),
}) })
} }
fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result<GroupTuple, CanonicalizeError> { fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result<GroupTuple, ReducerError> {
Ok(GroupTuple { Ok(GroupTuple {
x: group_tuple.x.clone(), x: group_tuple.x.clone(),
y: group_tuple.y.clone(), y: group_tuple.y.clone(),
@ -55,11 +47,7 @@ pub trait ReconstructingReducer {
}) })
} }
fn reduce_group_value( fn reduce_group_value(&mut self, _group_value: &GroupValue, new: GroupValue) -> Result<GroupValue, ReducerError> {
&mut self,
_group_value: &GroupValue,
new: GroupValue,
) -> Result<GroupValue, CanonicalizeError> {
Ok(new) Ok(new)
} }
@ -67,7 +55,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
_value: &ValueExpression, _value: &ValueExpression,
new: ValueExpression, new: ValueExpression,
) -> Result<ValueExpression, CanonicalizeError> { ) -> Result<ValueExpression, ReducerError> {
Ok(new) Ok(new)
} }
@ -77,8 +65,7 @@ pub trait ReconstructingReducer {
left: Expression, left: Expression,
right: Expression, right: Expression,
op: BinaryOperation, op: BinaryOperation,
_in_circuit: bool, ) -> Result<BinaryExpression, ReducerError> {
) -> Result<BinaryExpression, CanonicalizeError> {
Ok(BinaryExpression { Ok(BinaryExpression {
left: Box::new(left), left: Box::new(left),
right: Box::new(right), right: Box::new(right),
@ -92,8 +79,7 @@ pub trait ReconstructingReducer {
unary: &UnaryExpression, unary: &UnaryExpression,
inner: Expression, inner: Expression,
op: UnaryOperation, op: UnaryOperation,
_in_circuit: bool, ) -> Result<UnaryExpression, ReducerError> {
) -> Result<UnaryExpression, CanonicalizeError> {
Ok(UnaryExpression { Ok(UnaryExpression {
inner: Box::new(inner), inner: Box::new(inner),
op, op,
@ -107,8 +93,7 @@ pub trait ReconstructingReducer {
condition: Expression, condition: Expression,
if_true: Expression, if_true: Expression,
if_false: Expression, if_false: Expression,
_in_circuit: bool, ) -> Result<TernaryExpression, ReducerError> {
) -> Result<TernaryExpression, CanonicalizeError> {
Ok(TernaryExpression { Ok(TernaryExpression {
condition: Box::new(condition), condition: Box::new(condition),
if_true: Box::new(if_true), if_true: Box::new(if_true),
@ -122,8 +107,7 @@ pub trait ReconstructingReducer {
cast: &CastExpression, cast: &CastExpression,
inner: Expression, inner: Expression,
target_type: Type, target_type: Type,
_in_circuit: bool, ) -> Result<CastExpression, ReducerError> {
) -> Result<CastExpression, CanonicalizeError> {
Ok(CastExpression { Ok(CastExpression {
inner: Box::new(inner), inner: Box::new(inner),
target_type, target_type,
@ -135,8 +119,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
array_inline: &ArrayInlineExpression, array_inline: &ArrayInlineExpression,
elements: Vec<SpreadOrExpression>, elements: Vec<SpreadOrExpression>,
_in_circuit: bool, ) -> Result<ArrayInlineExpression, ReducerError> {
) -> Result<ArrayInlineExpression, CanonicalizeError> {
Ok(ArrayInlineExpression { Ok(ArrayInlineExpression {
elements, elements,
span: array_inline.span.clone(), span: array_inline.span.clone(),
@ -147,8 +130,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
array_init: &ArrayInitExpression, array_init: &ArrayInitExpression,
element: Expression, element: Expression,
_in_circuit: bool, ) -> Result<ArrayInitExpression, ReducerError> {
) -> Result<ArrayInitExpression, CanonicalizeError> {
Ok(ArrayInitExpression { Ok(ArrayInitExpression {
element: Box::new(element), element: Box::new(element),
dimensions: array_init.dimensions.clone(), dimensions: array_init.dimensions.clone(),
@ -161,8 +143,7 @@ pub trait ReconstructingReducer {
array_access: &ArrayAccessExpression, array_access: &ArrayAccessExpression,
array: Expression, array: Expression,
index: Expression, index: Expression,
_in_circuit: bool, ) -> Result<ArrayAccessExpression, ReducerError> {
) -> Result<ArrayAccessExpression, CanonicalizeError> {
Ok(ArrayAccessExpression { Ok(ArrayAccessExpression {
array: Box::new(array), array: Box::new(array),
index: Box::new(index), index: Box::new(index),
@ -176,8 +157,7 @@ pub trait ReconstructingReducer {
array: Expression, array: Expression,
left: Option<Expression>, left: Option<Expression>,
right: Option<Expression>, right: Option<Expression>,
_in_circuit: bool, ) -> Result<ArrayRangeAccessExpression, ReducerError> {
) -> Result<ArrayRangeAccessExpression, CanonicalizeError> {
Ok(ArrayRangeAccessExpression { Ok(ArrayRangeAccessExpression {
array: Box::new(array), array: Box::new(array),
left: left.map(|expr| Box::new(expr)), left: left.map(|expr| Box::new(expr)),
@ -190,8 +170,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
tuple_init: &TupleInitExpression, tuple_init: &TupleInitExpression,
elements: Vec<Expression>, elements: Vec<Expression>,
_in_circuit: bool, ) -> Result<TupleInitExpression, ReducerError> {
) -> Result<TupleInitExpression, CanonicalizeError> {
Ok(TupleInitExpression { Ok(TupleInitExpression {
elements, elements,
span: tuple_init.span.clone(), span: tuple_init.span.clone(),
@ -202,8 +181,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
tuple_access: &TupleAccessExpression, tuple_access: &TupleAccessExpression,
tuple: Expression, tuple: Expression,
_in_circuit: bool, ) -> Result<TupleAccessExpression, ReducerError> {
) -> Result<TupleAccessExpression, CanonicalizeError> {
Ok(TupleAccessExpression { Ok(TupleAccessExpression {
tuple: Box::new(tuple), tuple: Box::new(tuple),
index: tuple_access.index.clone(), index: tuple_access.index.clone(),
@ -216,8 +194,7 @@ pub trait ReconstructingReducer {
_variable: &CircuitImpliedVariableDefinition, _variable: &CircuitImpliedVariableDefinition,
identifier: Identifier, identifier: Identifier,
expression: Option<Expression>, expression: Option<Expression>,
_in_circuit: bool, ) -> Result<CircuitImpliedVariableDefinition, ReducerError> {
) -> Result<CircuitImpliedVariableDefinition, CanonicalizeError> {
Ok(CircuitImpliedVariableDefinition { identifier, expression }) Ok(CircuitImpliedVariableDefinition { identifier, expression })
} }
@ -226,8 +203,7 @@ pub trait ReconstructingReducer {
circuit_init: &CircuitInitExpression, circuit_init: &CircuitInitExpression,
name: Identifier, name: Identifier,
members: Vec<CircuitImpliedVariableDefinition>, members: Vec<CircuitImpliedVariableDefinition>,
_in_circuit: bool, ) -> Result<CircuitInitExpression, ReducerError> {
) -> Result<CircuitInitExpression, CanonicalizeError> {
Ok(CircuitInitExpression { Ok(CircuitInitExpression {
name, name,
members, members,
@ -240,8 +216,7 @@ pub trait ReconstructingReducer {
circuit_member_access: &CircuitMemberAccessExpression, circuit_member_access: &CircuitMemberAccessExpression,
circuit: Expression, circuit: Expression,
name: Identifier, name: Identifier,
_in_circuit: bool, ) -> Result<CircuitMemberAccessExpression, ReducerError> {
) -> Result<CircuitMemberAccessExpression, CanonicalizeError> {
Ok(CircuitMemberAccessExpression { Ok(CircuitMemberAccessExpression {
circuit: Box::new(circuit), circuit: Box::new(circuit),
name, name,
@ -254,8 +229,7 @@ pub trait ReconstructingReducer {
circuit_static_fn_access: &CircuitStaticFunctionAccessExpression, circuit_static_fn_access: &CircuitStaticFunctionAccessExpression,
circuit: Expression, circuit: Expression,
name: Identifier, name: Identifier,
_in_circuit: bool, ) -> Result<CircuitStaticFunctionAccessExpression, ReducerError> {
) -> Result<CircuitStaticFunctionAccessExpression, CanonicalizeError> {
Ok(CircuitStaticFunctionAccessExpression { Ok(CircuitStaticFunctionAccessExpression {
circuit: Box::new(circuit), circuit: Box::new(circuit),
name, name,
@ -268,8 +242,7 @@ pub trait ReconstructingReducer {
call: &CallExpression, call: &CallExpression,
function: Expression, function: Expression,
arguments: Vec<Expression>, arguments: Vec<Expression>,
_in_circuit: bool, ) -> Result<CallExpression, ReducerError> {
) -> Result<CallExpression, CanonicalizeError> {
Ok(CallExpression { Ok(CallExpression {
function: Box::new(function), function: Box::new(function),
arguments, arguments,
@ -278,12 +251,7 @@ pub trait ReconstructingReducer {
} }
// Statements // Statements
fn reduce_statement( fn reduce_statement(&mut self, _statement: &Statement, new: Statement) -> Result<Statement, ReducerError> {
&mut self,
_statement: &Statement,
new: Statement,
_in_circuit: bool,
) -> Result<Statement, CanonicalizeError> {
Ok(new) Ok(new)
} }
@ -291,8 +259,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
return_statement: &ReturnStatement, return_statement: &ReturnStatement,
expression: Expression, expression: Expression,
_in_circuit: bool, ) -> Result<ReturnStatement, ReducerError> {
) -> Result<ReturnStatement, CanonicalizeError> {
Ok(ReturnStatement { Ok(ReturnStatement {
expression, expression,
span: return_statement.span.clone(), span: return_statement.span.clone(),
@ -303,7 +270,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
variable_name: &VariableName, variable_name: &VariableName,
identifier: Identifier, identifier: Identifier,
) -> Result<VariableName, CanonicalizeError> { ) -> Result<VariableName, ReducerError> {
Ok(VariableName { Ok(VariableName {
mutable: variable_name.mutable, mutable: variable_name.mutable,
identifier, identifier,
@ -317,8 +284,7 @@ pub trait ReconstructingReducer {
variable_names: Vec<VariableName>, variable_names: Vec<VariableName>,
type_: Option<Type>, type_: Option<Type>,
value: Expression, value: Expression,
_in_circuit: bool, ) -> Result<DefinitionStatement, ReducerError> {
) -> Result<DefinitionStatement, CanonicalizeError> {
Ok(DefinitionStatement { Ok(DefinitionStatement {
declaration_type: definition.declaration_type.clone(), declaration_type: definition.declaration_type.clone(),
variable_names, variable_names,
@ -332,8 +298,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
_access: &AssigneeAccess, _access: &AssigneeAccess,
new: AssigneeAccess, new: AssigneeAccess,
_in_circuit: bool, ) -> Result<AssigneeAccess, ReducerError> {
) -> Result<AssigneeAccess, CanonicalizeError> {
Ok(new) Ok(new)
} }
@ -342,8 +307,7 @@ pub trait ReconstructingReducer {
assignee: &Assignee, assignee: &Assignee,
identifier: Identifier, identifier: Identifier,
accesses: Vec<AssigneeAccess>, accesses: Vec<AssigneeAccess>,
_in_circuit: bool, ) -> Result<Assignee, ReducerError> {
) -> Result<Assignee, CanonicalizeError> {
Ok(Assignee { Ok(Assignee {
identifier, identifier,
accesses, accesses,
@ -356,8 +320,7 @@ pub trait ReconstructingReducer {
assign: &AssignStatement, assign: &AssignStatement,
assignee: Assignee, assignee: Assignee,
value: Expression, value: Expression,
_in_circuit: bool, ) -> Result<AssignStatement, ReducerError> {
) -> Result<AssignStatement, CanonicalizeError> {
Ok(AssignStatement { Ok(AssignStatement {
operation: assign.operation.clone(), operation: assign.operation.clone(),
assignee, assignee,
@ -372,8 +335,7 @@ pub trait ReconstructingReducer {
condition: Expression, condition: Expression,
block: Block, block: Block,
statement: Option<Statement>, statement: Option<Statement>,
_in_circuit: bool, ) -> Result<ConditionalStatement, ReducerError> {
) -> Result<ConditionalStatement, CanonicalizeError> {
Ok(ConditionalStatement { Ok(ConditionalStatement {
condition, condition,
block, block,
@ -389,8 +351,7 @@ pub trait ReconstructingReducer {
start: Expression, start: Expression,
stop: Expression, stop: Expression,
block: Block, block: Block,
_in_circuit: bool, ) -> Result<IterationStatement, ReducerError> {
) -> Result<IterationStatement, CanonicalizeError> {
Ok(IterationStatement { Ok(IterationStatement {
variable, variable,
start, start,
@ -404,8 +365,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
console: &ConsoleStatement, console: &ConsoleStatement,
function: ConsoleFunction, function: ConsoleFunction,
_in_circuit: bool, ) -> Result<ConsoleStatement, ReducerError> {
) -> Result<ConsoleStatement, CanonicalizeError> {
Ok(ConsoleStatement { Ok(ConsoleStatement {
function, function,
span: console.span.clone(), span: console.span.clone(),
@ -416,20 +376,14 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
expression_statement: &ExpressionStatement, expression_statement: &ExpressionStatement,
expression: Expression, expression: Expression,
_in_circuit: bool, ) -> Result<ExpressionStatement, ReducerError> {
) -> Result<ExpressionStatement, CanonicalizeError> {
Ok(ExpressionStatement { Ok(ExpressionStatement {
expression, expression,
span: expression_statement.span.clone(), span: expression_statement.span.clone(),
}) })
} }
fn reduce_block( fn reduce_block(&mut self, block: &Block, statements: Vec<Statement>) -> Result<Block, ReducerError> {
&mut self,
block: &Block,
statements: Vec<Statement>,
_in_circuit: bool,
) -> Result<Block, CanonicalizeError> {
Ok(Block { Ok(Block {
statements, statements,
span: block.span.clone(), span: block.span.clone(),
@ -444,7 +398,7 @@ pub trait ReconstructingReducer {
imports: Vec<ImportStatement>, imports: Vec<ImportStatement>,
circuits: IndexMap<Identifier, Circuit>, circuits: IndexMap<Identifier, Circuit>,
functions: IndexMap<Identifier, Function>, functions: IndexMap<Identifier, Function>,
) -> Result<Program, CanonicalizeError> { ) -> Result<Program, ReducerError> {
Ok(Program { Ok(Program {
name: program.name.clone(), name: program.name.clone(),
expected_input, expected_input,
@ -459,8 +413,7 @@ pub trait ReconstructingReducer {
variable: &FunctionInputVariable, variable: &FunctionInputVariable,
identifier: Identifier, identifier: Identifier,
type_: Type, type_: Type,
_in_circuit: bool, ) -> Result<FunctionInputVariable, ReducerError> {
) -> Result<FunctionInputVariable, CanonicalizeError> {
Ok(FunctionInputVariable { Ok(FunctionInputVariable {
identifier, identifier,
const_: variable.const_, const_: variable.const_,
@ -474,8 +427,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
_input: &FunctionInput, _input: &FunctionInput,
new: FunctionInput, new: FunctionInput,
_in_circuit: bool, ) -> Result<FunctionInput, ReducerError> {
) -> Result<FunctionInput, CanonicalizeError> {
Ok(new) Ok(new)
} }
@ -483,7 +435,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
_package_or_packages: &PackageOrPackages, _package_or_packages: &PackageOrPackages,
new: PackageOrPackages, new: PackageOrPackages,
) -> Result<PackageOrPackages, CanonicalizeError> { ) -> Result<PackageOrPackages, ReducerError> {
Ok(new) Ok(new)
} }
@ -491,7 +443,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
import: &ImportStatement, import: &ImportStatement,
package_or_packages: PackageOrPackages, package_or_packages: PackageOrPackages,
) -> Result<ImportStatement, CanonicalizeError> { ) -> Result<ImportStatement, ReducerError> {
Ok(ImportStatement { Ok(ImportStatement {
package_or_packages, package_or_packages,
span: import.span.clone(), span: import.span.clone(),
@ -502,7 +454,7 @@ pub trait ReconstructingReducer {
&mut self, &mut self,
_circuit_member: &CircuitMember, _circuit_member: &CircuitMember,
new: CircuitMember, new: CircuitMember,
) -> Result<CircuitMember, CanonicalizeError> { ) -> Result<CircuitMember, ReducerError> {
Ok(new) Ok(new)
} }
@ -511,15 +463,11 @@ pub trait ReconstructingReducer {
_circuit: &Circuit, _circuit: &Circuit,
circuit_name: Identifier, circuit_name: Identifier,
members: Vec<CircuitMember>, members: Vec<CircuitMember>,
) -> Result<Circuit, CanonicalizeError> { ) -> Result<Circuit, ReducerError> {
Ok(Circuit { circuit_name, members }) Ok(Circuit { circuit_name, members })
} }
fn reduce_annotation( fn reduce_annotation(&mut self, annotation: &Annotation, name: Identifier) -> Result<Annotation, ReducerError> {
&mut self,
annotation: &Annotation,
name: Identifier,
) -> Result<Annotation, CanonicalizeError> {
Ok(Annotation { Ok(Annotation {
span: annotation.span.clone(), span: annotation.span.clone(),
name, name,
@ -536,8 +484,7 @@ pub trait ReconstructingReducer {
input: Vec<FunctionInput>, input: Vec<FunctionInput>,
output: Option<Type>, output: Option<Type>,
block: Block, block: Block,
_in_circuit: bool, ) -> Result<Function, ReducerError> {
) -> Result<Function, CanonicalizeError> {
Ok(Function { Ok(Function {
identifier, identifier,
annotations, annotations,

View File

@ -49,6 +49,9 @@ version = "1.4.0"
path = "../asg-passes" path = "../asg-passes"
version = "1.4.0" version = "1.4.0"
[dependencies.tendril]
version = "0.4"
[dependencies.snarkvm-curves] [dependencies.snarkvm-curves]
version = "0.2.2" version = "0.2.2"
default-features = false default-features = false

View File

@ -216,6 +216,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> Compiler<'a, F, G> {
// Use the parser to construct the abstract syntax tree (ast). // Use the parser to construct the abstract syntax tree (ast).
let mut ast = parse_ast(self.main_file_path.to_str().unwrap_or_default(), program_string)?; let mut ast = parse_ast(self.main_file_path.to_str().unwrap_or_default(), program_string)?;
// Preform compiler optimization via canonicalizing AST if its enabled. // Preform compiler optimization via canonicalizing AST if its enabled.
if self.options.canonicalization_enabled { if self.options.canonicalization_enabled {
ast.canonicalize()?; ast.canonicalize()?;

View File

@ -16,7 +16,7 @@
use crate::errors::FunctionError; use crate::errors::FunctionError;
use leo_asg::{AsgConvertError, FormattedError}; use leo_asg::{AsgConvertError, FormattedError};
use leo_ast::{CanonicalizeError, LeoError}; use leo_ast::{LeoError, ReducerError};
use leo_input::InputParserError; use leo_input::InputParserError;
use leo_parser::SyntaxError; use leo_parser::SyntaxError;
use leo_state::LocalDataVerificationError; use leo_state::LocalDataVerificationError;
@ -56,7 +56,7 @@ pub enum CompilerError {
AsgConvertError(#[from] AsgConvertError), AsgConvertError(#[from] AsgConvertError),
#[error("{}", _0)] #[error("{}", _0)]
CanonicalizeError(#[from] CanonicalizeError), ReducerError(#[from] ReducerError),
} }
impl LeoError for CompilerError {} impl LeoError for CompilerError {}

View File

@ -57,8 +57,11 @@ pub use prelude::*;
pub mod value; pub mod value;
pub use value::*; pub use value::*;
pub mod stage; pub mod phase;
pub use stage::*; pub use phase::*;
pub mod phases;
pub use phases::*;
pub mod option; pub mod option;
pub use option::*; pub use option::*;

View File

@ -16,6 +16,6 @@
use leo_asg::Program; use leo_asg::Program;
pub trait ASGStage { pub trait ASGPhase {
fn apply(asg: &mut Program); fn apply(asg: &mut Program);
} }

View File

@ -0,0 +1,23 @@
// 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/>.
//! Compiles a Leo program from a file path.
pub mod reducing_director;
pub use reducing_director::*;
pub mod phase;
pub use phase::*;

View File

@ -0,0 +1,65 @@
// 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/>.
//! Compiles a Leo program from a file path.
use crate::{CombineAstAsgDirector, CombinerOptions};
use leo_asg::Program as AsgProgram;
use leo_ast::{Ast, Program as AstProgram, ReconstructingReducer, ReducerError};
macro_rules! phase {
($phase_name:ident, $function:item) => {
pub struct $phase_name {
in_circuit: bool,
}
pub struct Options;
impl CombinerOptions for Options {
$function
}
impl ReconstructingReducer for $phase_name {
fn in_circuit(&self) -> bool {
self.in_circuit
}
fn swap_in_circuit(&mut self) {
self.in_circuit = !self.in_circuit;
}
}
impl Default for $phase_name {
fn default() -> Self {
Self { in_circuit: false }
}
}
impl $phase_name {
pub fn phase_ast(&self, ast: &AstProgram, asg: &AsgProgram) -> Result<Ast, ReducerError> {
Ok(Ast::new(CombineAstAsgDirector::new(Self::default(), Options{})
.reduce_program(ast, asg)?))
}
}
};
}
phase!(
TypeInferencePhase,
fn type_inference_enabled(&self) -> bool {
true
}
);

View File

@ -0,0 +1,775 @@
// 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/>.
//! Compiles a Leo program from a file path.
use indexmap::IndexMap;
use leo_asg::{
ArrayAccessExpression as AsgArrayAccessExpression,
ArrayInitExpression as AsgArrayInitExpression,
ArrayInlineExpression as AsgArrayInlineExpression,
ArrayRangeAccessExpression as AsgArrayRangeAccessExpression,
AssignAccess as AsgAssignAccess,
AssignStatement as AsgAssignStatement,
BinaryExpression as AsgBinaryExpression,
BlockStatement as AsgBlockStatement,
CallExpression as AsgCallExpression,
CastExpression as AsgCastExpression,
Circuit as AsgCircuit,
CircuitAccessExpression as AsgCircuitAccessExpression,
CircuitInitExpression as AsgCircuitInitExpression,
CircuitMember as AsgCircuitMember,
ConditionalStatement as AsgConditionalStatement,
ConsoleFunction as AsgConsoleFunction,
ConsoleStatement as AsgConsoleStatement,
ConstValue,
Constant as AsgConstant,
DefinitionStatement as AsgDefinitionStatement,
Expression as AsgExpression,
ExpressionStatement as AsgExpressionStatement,
Function as AsgFunction,
GroupValue as AsgGroupValue,
IterationStatement as AsgIterationStatement,
ReturnStatement as AsgReturnStatement,
Statement as AsgStatement,
TernaryExpression as AsgTernaryExpression,
TupleAccessExpression as AsgTupleAccessExpression,
TupleInitExpression as AsgTupleInitExpression,
Type as AsgType,
UnaryExpression as AsgUnaryExpression,
VariableRef as AsgVariableRef,
};
use leo_ast::{
ArrayAccessExpression as AstArrayAccessExpression,
ArrayDimensions,
ArrayInitExpression as AstArrayInitExpression,
ArrayInlineExpression as AstArrayInlineExpression,
ArrayRangeAccessExpression as AstArrayRangeAccessExpression,
AssignStatement as AstAssignStatement,
Assignee,
AssigneeAccess as AstAssignAccess,
BinaryExpression as AstBinaryExpression,
Block as AstBlockStatement,
CallExpression as AstCallExpression,
CastExpression as AstCastExpression,
Circuit as AstCircuit,
CircuitImpliedVariableDefinition,
CircuitInitExpression as AstCircuitInitExpression,
CircuitMember as AstCircuitMember,
CircuitMemberAccessExpression,
CircuitStaticFunctionAccessExpression,
CombinerError,
ConditionalStatement as AstConditionalStatement,
ConsoleFunction as AstConsoleFunction,
ConsoleStatement as AstConsoleStatement,
DefinitionStatement as AstDefinitionStatement,
Expression as AstExpression,
ExpressionStatement as AstExpressionStatement,
FormatString,
Function as AstFunction,
GroupTuple,
GroupValue as AstGroupValue,
IterationStatement as AstIterationStatement,
PositiveNumber,
ReconstructingReducer,
ReducerError,
ReturnStatement as AstReturnStatement,
Span,
SpreadOrExpression,
Statement as AstStatement,
TernaryExpression as AstTernaryExpression,
TupleAccessExpression as AstTupleAccessExpression,
TupleInitExpression as AstTupleInitExpression,
Type as AstType,
UnaryExpression as AstUnaryExpression,
ValueExpression,
};
use tendril::StrTendril;
pub trait CombinerOptions {
fn type_inference_enabled(&self) -> bool {
false
}
}
pub struct CombineAstAsgDirector<R: ReconstructingReducer, O: CombinerOptions> {
ast_reducer: R,
options: O,
}
impl<R: ReconstructingReducer, O: CombinerOptions> CombineAstAsgDirector<R, O> {
pub fn new(ast_reducer: R, options: O) -> Self {
Self { ast_reducer, options }
}
pub fn reduce_type(&mut self, ast: &AstType, asg: &AsgType, span: &Span) -> Result<AstType, ReducerError> {
let new = match (ast, asg) {
(AstType::Array(ast_type, ast_dimensions), AsgType::Array(asg_type, asg_dimensions)) => {
if self.options.type_inference_enabled() {
AstType::Array(
Box::new(self.reduce_type(ast_type, asg_type, span)?),
ArrayDimensions(vec![PositiveNumber {
value: StrTendril::from(format!("{}", asg_dimensions)),
}]),
)
} else {
AstType::Array(
Box::new(self.reduce_type(ast_type, asg_type, span)?),
ast_dimensions.clone(),
)
}
}
(AstType::Tuple(ast_types), AsgType::Tuple(asg_types)) => {
let mut reduced_types = vec![];
for (ast_type, asg_type) in ast_types.iter().zip(asg_types) {
reduced_types.push(self.reduce_type(ast_type, asg_type, span)?);
}
AstType::Tuple(reduced_types)
}
_ => ast.clone(),
};
self.ast_reducer.reduce_type(ast, new, span)
}
pub fn reduce_expression(
&mut self,
ast: &AstExpression,
asg: &AsgExpression,
) -> Result<AstExpression, ReducerError> {
let new = match (ast, asg) {
(AstExpression::Value(value), AsgExpression::Constant(const_)) => {
AstExpression::Value(self.reduce_value(&value, &const_)?)
}
(AstExpression::Binary(ast), AsgExpression::Binary(asg)) => {
AstExpression::Binary(self.reduce_binary(&ast, &asg)?)
}
(AstExpression::Unary(ast), AsgExpression::Unary(asg)) => {
AstExpression::Unary(self.reduce_unary(&ast, &asg)?)
}
(AstExpression::Ternary(ast), AsgExpression::Ternary(asg)) => {
AstExpression::Ternary(self.reduce_ternary(&ast, &asg)?)
}
(AstExpression::Cast(ast), AsgExpression::Cast(asg)) => AstExpression::Cast(self.reduce_cast(&ast, &asg)?),
(AstExpression::ArrayInline(ast), AsgExpression::ArrayInline(asg)) => {
AstExpression::ArrayInline(self.reduce_array_inline(&ast, &asg)?)
}
(AstExpression::ArrayInit(ast), AsgExpression::ArrayInit(asg)) => {
AstExpression::ArrayInit(self.reduce_array_init(&ast, &asg)?)
}
(AstExpression::ArrayAccess(ast), AsgExpression::ArrayAccess(asg)) => {
AstExpression::ArrayAccess(self.reduce_array_access(&ast, &asg)?)
}
(AstExpression::ArrayRangeAccess(ast), AsgExpression::ArrayRangeAccess(asg)) => {
AstExpression::ArrayRangeAccess(self.reduce_array_range_access(&ast, &asg)?)
}
(AstExpression::TupleInit(ast), AsgExpression::TupleInit(asg)) => {
AstExpression::TupleInit(self.reduce_tuple_init(&ast, &asg)?)
}
(AstExpression::TupleAccess(ast), AsgExpression::TupleAccess(asg)) => {
AstExpression::TupleAccess(self.reduce_tuple_access(&ast, &asg)?)
}
(AstExpression::CircuitInit(ast), AsgExpression::CircuitInit(asg)) => {
AstExpression::CircuitInit(self.reduce_circuit_init(&ast, &asg)?)
}
(AstExpression::CircuitMemberAccess(ast), AsgExpression::CircuitAccess(asg)) => {
AstExpression::CircuitMemberAccess(self.reduce_circuit_member_access(&ast, &asg)?)
}
(AstExpression::CircuitStaticFunctionAccess(ast), AsgExpression::CircuitAccess(asg)) => {
AstExpression::CircuitStaticFunctionAccess(self.reduce_circuit_static_fn_access(&ast, &asg)?)
}
(AstExpression::Call(ast), AsgExpression::Call(asg)) => AstExpression::Call(self.reduce_call(&ast, &asg)?),
_ => ast.clone(),
};
self.ast_reducer.reduce_expression(ast, new)
}
pub fn reduce_array_access(
&mut self,
ast: &AstArrayAccessExpression,
asg: &AsgArrayAccessExpression,
) -> Result<AstArrayAccessExpression, ReducerError> {
let array = self.reduce_expression(&ast.array, asg.array.get())?;
let index = self.reduce_expression(&ast.index, asg.index.get())?;
self.ast_reducer.reduce_array_access(ast, array, index)
}
pub fn reduce_array_init(
&mut self,
ast: &AstArrayInitExpression,
asg: &AsgArrayInitExpression,
) -> Result<AstArrayInitExpression, ReducerError> {
let element = self.reduce_expression(&ast.element, asg.element.get())?;
self.ast_reducer.reduce_array_init(ast, element)
}
pub fn reduce_array_inline(
&mut self,
ast: &AstArrayInlineExpression,
asg: &AsgArrayInlineExpression,
) -> Result<AstArrayInlineExpression, ReducerError> {
let mut elements = vec![];
for (ast_element, asg_element) in ast.elements.iter().zip(asg.elements.iter()) {
let reduced_element = match ast_element {
SpreadOrExpression::Expression(ast_expression) => {
SpreadOrExpression::Expression(self.reduce_expression(ast_expression, asg_element.0.get())?)
}
SpreadOrExpression::Spread(ast_expression) => {
SpreadOrExpression::Spread(self.reduce_expression(ast_expression, asg_element.0.get())?)
}
};
elements.push(reduced_element);
}
self.ast_reducer.reduce_array_inline(ast, elements)
}
pub fn reduce_array_range_access(
&mut self,
ast: &AstArrayRangeAccessExpression,
asg: &AsgArrayRangeAccessExpression,
) -> Result<AstArrayRangeAccessExpression, ReducerError> {
let array = self.reduce_expression(&ast.array, asg.array.get())?;
let left = match (ast.left.as_ref(), asg.left.get()) {
(Some(ast_left), Some(asg_left)) => Some(self.reduce_expression(ast_left, asg_left)?),
_ => None,
};
let right = match (ast.right.as_ref(), asg.right.get()) {
(Some(ast_right), Some(asg_right)) => Some(self.reduce_expression(ast_right, asg_right)?),
_ => None,
};
self.ast_reducer.reduce_array_range_access(ast, array, left, right)
}
pub fn reduce_binary(
&mut self,
ast: &AstBinaryExpression,
asg: &AsgBinaryExpression,
) -> Result<AstBinaryExpression, ReducerError> {
let left = self.reduce_expression(&ast.left, asg.left.get())?;
let right = self.reduce_expression(&ast.right, asg.right.get())?;
self.ast_reducer.reduce_binary(ast, left, right, ast.op.clone())
}
pub fn reduce_call(
&mut self,
ast: &AstCallExpression,
asg: &AsgCallExpression,
) -> Result<AstCallExpression, ReducerError> {
// TODO FIGURE IT OUT
// let function = self.reduce_expression(&ast.function, asg.function.get())?;
// let target = asg.target.get().map(|exp| self.reduce_expression())
// Is this needed?
let mut arguments = vec![];
for (ast_arg, asg_arg) in ast.arguments.iter().zip(asg.arguments.iter()) {
arguments.push(self.reduce_expression(ast_arg, asg_arg.get())?);
}
self.ast_reducer.reduce_call(ast, *ast.function.clone(), arguments)
}
pub fn reduce_cast(
&mut self,
ast: &AstCastExpression,
asg: &AsgCastExpression,
) -> Result<AstCastExpression, ReducerError> {
let inner = self.reduce_expression(&ast.inner, &asg.inner.get())?;
let target_type = self.reduce_type(&ast.target_type, &asg.target_type, &ast.span)?;
self.ast_reducer.reduce_cast(ast, inner, target_type)
}
pub fn reduce_circuit_member_access(
&mut self,
ast: &CircuitMemberAccessExpression,
_asg: &AsgCircuitAccessExpression,
) -> Result<CircuitMemberAccessExpression, ReducerError> {
// let circuit = self.reduce_expression(&circuit_member_access.circuit)?;
// let name = self.reduce_identifier(&circuit_member_access.name)?;
// let target = input.target.get().map(|e| self.reduce_expression(e));
self.ast_reducer
.reduce_circuit_member_access(ast, *ast.circuit.clone(), ast.name.clone())
}
pub fn reduce_circuit_static_fn_access(
&mut self,
ast: &CircuitStaticFunctionAccessExpression,
_asg: &AsgCircuitAccessExpression,
) -> Result<CircuitStaticFunctionAccessExpression, ReducerError> {
// let circuit = self.reduce_expression(&circuit_member_access.circuit)?;
// let name = self.reduce_identifier(&circuit_member_access.name)?;
// let target = input.target.get().map(|e| self.reduce_expression(e));
self.ast_reducer
.reduce_circuit_static_fn_access(ast, *ast.circuit.clone(), ast.name.clone())
}
pub fn reduce_circuit_implied_variable_definition(
&mut self,
ast: &CircuitImpliedVariableDefinition,
asg: &AsgExpression,
) -> Result<CircuitImpliedVariableDefinition, ReducerError> {
let expression = ast
.expression
.as_ref()
.map(|ast_expr| self.reduce_expression(ast_expr, asg))
.transpose()?;
self.ast_reducer
.reduce_circuit_implied_variable_definition(ast, ast.identifier.clone(), expression)
}
pub fn reduce_circuit_init(
&mut self,
ast: &AstCircuitInitExpression,
asg: &AsgCircuitInitExpression,
) -> Result<AstCircuitInitExpression, ReducerError> {
let mut members = vec![];
for (ast_member, asg_member) in ast.members.iter().zip(asg.values.iter()) {
members.push(self.reduce_circuit_implied_variable_definition(ast_member, asg_member.1.get())?);
}
self.ast_reducer.reduce_circuit_init(ast, ast.name.clone(), members)
}
pub fn reduce_ternary(
&mut self,
ast: &AstTernaryExpression,
asg: &AsgTernaryExpression,
) -> Result<AstTernaryExpression, ReducerError> {
let condition = self.reduce_expression(&ast.condition, asg.condition.get())?;
let if_true = self.reduce_expression(&ast.if_true, asg.if_true.get())?;
let if_false = self.reduce_expression(&ast.if_false, asg.if_false.get())?;
self.ast_reducer.reduce_ternary(ast, condition, if_true, if_false)
}
pub fn reduce_tuple_access(
&mut self,
ast: &AstTupleAccessExpression,
asg: &AsgTupleAccessExpression,
) -> Result<AstTupleAccessExpression, ReducerError> {
let tuple = self.reduce_expression(&ast.tuple, asg.tuple_ref.get())?;
self.ast_reducer.reduce_tuple_access(ast, tuple)
}
pub fn reduce_tuple_init(
&mut self,
ast: &AstTupleInitExpression,
asg: &AsgTupleInitExpression,
) -> Result<AstTupleInitExpression, ReducerError> {
let mut elements = vec![];
for (ast_element, asg_element) in ast.elements.iter().zip(asg.elements.iter()) {
let element = self.reduce_expression(ast_element, asg_element.get())?;
elements.push(element);
}
self.ast_reducer.reduce_tuple_init(ast, elements)
}
pub fn reduce_unary(
&mut self,
ast: &AstUnaryExpression,
asg: &AsgUnaryExpression,
) -> Result<AstUnaryExpression, ReducerError> {
let inner = self.reduce_expression(&ast.inner, asg.inner.get())?;
self.ast_reducer.reduce_unary(ast, inner, ast.op.clone())
}
pub fn reduce_value(&mut self, ast: &ValueExpression, asg: &AsgConstant) -> Result<ValueExpression, ReducerError> {
let mut new = ast.clone();
if self.options.type_inference_enabled() {
if let ValueExpression::Implicit(tendril, span) = ast {
match &asg.value {
ConstValue::Int(int) => {
new = ValueExpression::Integer(int.get_int_type(), tendril.clone(), span.clone());
}
ConstValue::Group(group) => {
let group_value = match group {
AsgGroupValue::Single(_) => AstGroupValue::Single(tendril.clone(), span.clone()),
AsgGroupValue::Tuple(x, y) => AstGroupValue::Tuple(GroupTuple {
x: x.into(),
y: y.into(),
span: span.clone(),
}),
};
new = ValueExpression::Group(Box::new(group_value));
}
ConstValue::Field(_) => {
new = ValueExpression::Field(tendril.clone(), span.clone());
}
ConstValue::Address(_) => {
new = ValueExpression::Address(tendril.clone(), span.clone());
}
ConstValue::Boolean(_) => {
new = ValueExpression::Boolean(tendril.clone(), span.clone());
}
_ => unimplemented!(), // impossible?
}
}
}
self.ast_reducer.reduce_value(ast, new)
}
pub fn reduce_variable_ref(
&mut self,
ast: &ValueExpression,
_asg: &AsgVariableRef,
) -> Result<ValueExpression, ReducerError> {
// TODO FIGURE IT OUT
let new = match ast {
// ValueExpression::Group(group_value) => {
// ValueExpression::Group(Box::new(self.reduce_group_value(&group_value)?))
// }
_ => ast.clone(),
};
Ok(new)
// self.ast_reducer.reduce_value(value, new)
}
pub fn reduce_statement(
&mut self,
ast_statement: &AstStatement,
asg_statement: &AsgStatement,
) -> Result<AstStatement, ReducerError> {
let new = match (ast_statement, asg_statement) {
(AstStatement::Assign(ast), AsgStatement::Assign(asg)) => {
AstStatement::Assign(self.reduce_assign(ast, asg)?)
}
(AstStatement::Block(ast), AsgStatement::Block(asg)) => AstStatement::Block(self.reduce_block(ast, asg)?),
(AstStatement::Conditional(ast), AsgStatement::Conditional(asg)) => {
AstStatement::Conditional(self.reduce_conditional(ast, asg)?)
}
(AstStatement::Console(ast), AsgStatement::Console(asg)) => {
AstStatement::Console(self.reduce_console(ast, asg)?)
}
(AstStatement::Definition(ast), AsgStatement::Definition(asg)) => {
AstStatement::Definition(self.reduce_definition(ast, asg)?)
}
(AstStatement::Expression(ast), AsgStatement::Expression(asg)) => {
AstStatement::Expression(self.reduce_expression_statement(ast, asg)?)
}
(AstStatement::Iteration(ast), AsgStatement::Iteration(asg)) => {
AstStatement::Iteration(self.reduce_iteration(ast, asg)?)
}
(AstStatement::Return(ast), AsgStatement::Return(asg)) => {
AstStatement::Return(self.reduce_return(ast, asg)?)
}
_ => ast_statement.clone(),
};
self.ast_reducer.reduce_statement(ast_statement, new)
}
pub fn reduce_assign_access(
&mut self,
ast: &AstAssignAccess,
asg: &AsgAssignAccess,
) -> Result<AstAssignAccess, ReducerError> {
let new = match (ast, asg) {
(AstAssignAccess::ArrayRange(ast_left, ast_right), AsgAssignAccess::ArrayRange(asg_left, asg_right)) => {
let left = match (ast_left.as_ref(), asg_left.get()) {
(Some(ast_left), Some(asg_left)) => Some(self.reduce_expression(ast_left, asg_left)?),
_ => None,
};
let right = match (ast_right.as_ref(), asg_right.get()) {
(Some(ast_right), Some(asg_right)) => Some(self.reduce_expression(ast_right, asg_right)?),
_ => None,
};
AstAssignAccess::ArrayRange(left, right)
}
(AstAssignAccess::ArrayIndex(ast_index), AsgAssignAccess::ArrayIndex(asg_index)) => {
let index = self.reduce_expression(&ast_index, asg_index.get())?;
AstAssignAccess::ArrayIndex(index)
}
_ => ast.clone(),
};
self.ast_reducer.reduce_assignee_access(ast, new)
}
pub fn reduce_assignee(&mut self, ast: &Assignee, asg: &[AsgAssignAccess]) -> Result<Assignee, ReducerError> {
let mut accesses = vec![];
for (ast_access, asg_access) in ast.accesses.iter().zip(asg) {
accesses.push(self.reduce_assign_access(ast_access, asg_access)?);
}
self.ast_reducer.reduce_assignee(ast, ast.identifier.clone(), accesses)
}
pub fn reduce_assign(
&mut self,
ast: &AstAssignStatement,
asg: &AsgAssignStatement,
) -> Result<AstAssignStatement, ReducerError> {
let assignee = self.reduce_assignee(&ast.assignee, &asg.target_accesses)?;
let value = self.reduce_expression(&ast.value, asg.value.get())?;
self.ast_reducer.reduce_assign(ast, assignee, value)
}
pub fn reduce_block(
&mut self,
ast: &AstBlockStatement,
asg: &AsgBlockStatement,
) -> Result<AstBlockStatement, ReducerError> {
let mut statements = vec![];
for (ast_statement, asg_statement) in ast.statements.iter().zip(asg.statements.iter()) {
statements.push(self.reduce_statement(ast_statement, asg_statement.get())?);
}
self.ast_reducer.reduce_block(ast, statements)
}
pub fn reduce_conditional(
&mut self,
ast: &AstConditionalStatement,
asg: &AsgConditionalStatement,
) -> Result<AstConditionalStatement, ReducerError> {
let condition = self.reduce_expression(&ast.condition, asg.condition.get())?;
let block;
if let AsgStatement::Block(asg_block) = asg.result.get() {
block = self.reduce_block(&ast.block, asg_block)?;
} else {
return Err(ReducerError::from(CombinerError::asg_statement_not_block(
&asg.span.as_ref().unwrap(),
)));
}
let next = match (ast.next.as_ref(), asg.next.get()) {
(Some(ast_next), Some(asg_next)) => Some(self.reduce_statement(ast_next, asg_next)?),
_ => None,
};
self.ast_reducer.reduce_conditional(ast, condition, block, next)
}
pub fn reduce_console(
&mut self,
ast: &AstConsoleStatement,
asg: &AsgConsoleStatement,
) -> Result<AstConsoleStatement, ReducerError> {
let function = match (&ast.function, &asg.function) {
(AstConsoleFunction::Assert(ast_expression), AsgConsoleFunction::Assert(asg_expression)) => {
AstConsoleFunction::Assert(self.reduce_expression(&ast_expression, asg_expression.get())?)
}
(AstConsoleFunction::Debug(ast_format), AsgConsoleFunction::Debug(asg_format))
| (AstConsoleFunction::Error(ast_format), AsgConsoleFunction::Error(asg_format))
| (AstConsoleFunction::Log(ast_format), AsgConsoleFunction::Log(asg_format)) => {
let mut parameters = vec![];
for (ast_parameter, asg_parameter) in ast_format.parameters.iter().zip(asg_format.parameters.iter()) {
parameters.push(self.reduce_expression(&ast_parameter, asg_parameter.get())?);
}
let formatted = FormatString {
parts: ast_format.parts.clone(),
parameters,
span: ast_format.span.clone(),
};
match &ast.function {
AstConsoleFunction::Debug(_) => AstConsoleFunction::Debug(formatted),
AstConsoleFunction::Error(_) => AstConsoleFunction::Error(formatted),
AstConsoleFunction::Log(_) => AstConsoleFunction::Log(formatted),
_ => return Err(ReducerError::impossible_console_assert_call(&ast_format.span)),
}
}
_ => ast.function.clone(),
};
self.ast_reducer.reduce_console(ast, function)
}
pub fn reduce_definition(
&mut self,
ast: &AstDefinitionStatement,
asg: &AsgDefinitionStatement,
) -> Result<AstDefinitionStatement, ReducerError> {
let type_;
if asg.variables.len() > 1 {
let mut types = vec![];
for variable in asg.variables.iter() {
types.push(variable.borrow().type_.clone());
}
let asg_type = AsgType::Tuple(types);
type_ = match &ast.type_ {
Some(ast_type) => Some(self.reduce_type(&ast_type, &asg_type, &ast.span)?),
None if self.options.type_inference_enabled() => Some((&asg_type).into()),
_ => None,
};
} else {
type_ = match &ast.type_ {
Some(ast_type) => {
Some(self.reduce_type(&ast_type, &asg.variables.first().unwrap().borrow().type_, &ast.span)?)
}
None if self.options.type_inference_enabled() => {
Some((&asg.variables.first().unwrap().borrow().type_).into())
}
_ => None,
};
}
let value = self.reduce_expression(&ast.value, asg.value.get())?;
self.ast_reducer
.reduce_definition(ast, ast.variable_names.clone(), type_, value)
}
pub fn reduce_expression_statement(
&mut self,
ast: &AstExpressionStatement,
asg: &AsgExpressionStatement,
) -> Result<AstExpressionStatement, ReducerError> {
let inner_expression = self.reduce_expression(&ast.expression, asg.expression.get())?;
self.ast_reducer.reduce_expression_statement(ast, inner_expression)
}
pub fn reduce_iteration(
&mut self,
ast: &AstIterationStatement,
asg: &AsgIterationStatement,
) -> Result<AstIterationStatement, ReducerError> {
let start = self.reduce_expression(&ast.start, asg.start.get())?;
let stop = self.reduce_expression(&ast.stop, asg.stop.get())?;
let block;
if let AsgStatement::Block(asg_block) = asg.body.get() {
block = self.reduce_block(&ast.block, asg_block)?;
} else {
return Err(ReducerError::from(CombinerError::asg_statement_not_block(
&asg.span.as_ref().unwrap(),
)));
}
self.ast_reducer
.reduce_iteration(ast, ast.variable.clone(), start, stop, block)
}
pub fn reduce_return(
&mut self,
ast: &AstReturnStatement,
asg: &AsgReturnStatement,
) -> Result<AstReturnStatement, ReducerError> {
let expression = self.reduce_expression(&ast.expression, asg.expression.get())?;
self.ast_reducer.reduce_return(ast, expression)
}
pub fn reduce_program(
&mut self,
ast: &leo_ast::Program,
asg: &leo_asg::Program,
) -> Result<leo_ast::Program, leo_ast::ReducerError> {
self.ast_reducer.swap_in_circuit();
let mut circuits = IndexMap::new();
for ((ast_ident, ast_circuit), (_asg_ident, asg_circuit)) in ast.circuits.iter().zip(&asg.circuits) {
circuits.insert(ast_ident.clone(), self.reduce_circuit(ast_circuit, asg_circuit)?);
}
self.ast_reducer.swap_in_circuit();
let mut functions = IndexMap::new();
for ((ast_ident, ast_function), (_asg_ident, asg_function)) in ast.functions.iter().zip(&asg.functions) {
functions.insert(ast_ident.clone(), self.reduce_function(ast_function, asg_function)?);
}
self.ast_reducer.reduce_program(
ast,
ast.expected_input.clone(),
ast.imports.clone(),
circuits,
functions,
)
}
pub fn reduce_function(&mut self, ast: &AstFunction, asg: &AsgFunction) -> Result<AstFunction, ReducerError> {
let output = ast
.output
.as_ref()
.map(|type_| self.reduce_type(type_, &asg.output, &ast.span))
.transpose()?;
let mut statements = vec![];
if let Some(AsgStatement::Block(asg_block)) = asg.body.get() {
for (ast_statement, asg_statement) in ast.block.statements.iter().zip(asg_block.statements.iter()) {
statements.push(self.reduce_statement(ast_statement, asg_statement.get())?);
}
}
let block = AstBlockStatement {
statements,
span: ast.block.span.clone(),
};
self.ast_reducer.reduce_function(
ast,
ast.identifier.clone(),
ast.annotations.clone(),
ast.input.clone(),
output,
block,
)
}
pub fn reduce_circuit_member(
&mut self,
ast: &AstCircuitMember,
asg: &AsgCircuitMember,
) -> Result<AstCircuitMember, ReducerError> {
let new = match (ast, asg) {
(AstCircuitMember::CircuitVariable(identifier, ast_type), AsgCircuitMember::Variable(asg_type)) => {
AstCircuitMember::CircuitVariable(
identifier.clone(),
self.reduce_type(ast_type, asg_type, &identifier.span)?,
)
}
(AstCircuitMember::CircuitFunction(ast_function), AsgCircuitMember::Function(asg_function)) => {
AstCircuitMember::CircuitFunction(self.reduce_function(ast_function, asg_function)?)
}
_ => ast.clone(),
};
self.ast_reducer.reduce_circuit_member(ast, new)
}
pub fn reduce_circuit(&mut self, ast: &AstCircuit, asg: &AsgCircuit) -> Result<AstCircuit, ReducerError> {
let mut members = vec![];
for (ast_member, asg_member) in ast.members.iter().zip(asg.members.borrow().iter()) {
members.push(self.reduce_circuit_member(ast_member, asg_member.1)?);
}
self.ast_reducer.reduce_circuit(ast, ast.circuit_name.clone(), members)
}
}

View File

@ -225,7 +225,9 @@
} }
} }
], ],
"type_": null, "type_": {
"IntegerType": "U32"
},
"value": { "value": {
"Value": { "Value": {
"Integer": [ "Integer": [
@ -274,7 +276,8 @@
}, },
"right": { "right": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"20", "20",
{ {
"line_start": 12, "line_start": 12,
@ -371,7 +374,18 @@
} }
} }
], ],
"type_": null, "type_": {
"Array": [
{
"IntegerType": "U8"
},
[
{
"value": "2"
}
]
]
},
"value": { "value": {
"ArrayInline": { "ArrayInline": {
"elements": [ "elements": [
@ -441,7 +455,8 @@
{ {
"ArrayIndex": { "ArrayIndex": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"0", "0",
{ {
"line_start": 16, "line_start": 16,
@ -474,7 +489,8 @@
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"0", "0",
{ {
"line_start": 16, "line_start": 16,
@ -546,7 +562,8 @@
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"0", "0",
{ {
"line_start": 17, "line_start": 17,
@ -624,7 +641,16 @@
} }
} }
], ],
"type_": null, "type_": {
"Tuple": [
{
"IntegerType": "U8"
},
{
"IntegerType": "U8"
}
]
},
"value": { "value": {
"TupleInit": { "TupleInit": {
"elements": [ "elements": [
@ -847,7 +873,9 @@
} }
} }
], ],
"type_": null, "type_": {
"Circuit": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Foo {\\\"}\"}"
},
"value": { "value": {
"CircuitInit": { "CircuitInit": {
"name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", "name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}",
@ -1080,18 +1108,245 @@
"variable_names": [ "variable_names": [
{ {
"mutable": true, "mutable": true,
"identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let a = [[0u8; 1]; 4];\\\"}\"}", "identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":7,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let complex = 2u8;\\\"}\"}",
"span": { "span": {
"line_start": 27, "line_start": 27,
"line_stop": 27, "line_stop": 27,
"col_start": 7, "col_start": 7,
"col_stop": 14,
"path": "",
"content": " let complex = 2u8;"
}
}
],
"type_": {
"IntegerType": "U8"
},
"value": {
"Value": {
"Integer": [
"U8",
"2",
{
"line_start": 27,
"line_stop": 27,
"col_start": 17,
"col_stop": 20,
"path": "",
"content": " let complex = 2u8;"
}
]
}
},
"span": {
"line_start": 27,
"line_stop": 27,
"col_start": 3,
"col_stop": 20,
"path": "",
"content": " let complex = 2u8;"
}
}
},
{
"Assign": {
"operation": "Assign",
"assignee": {
"identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":3,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" complex += 22u8 - 2u8+ 1u8;\\\"}\"}",
"accesses": [],
"span": {
"line_start": 28,
"line_stop": 28,
"col_start": 3,
"col_stop": 10,
"path": "",
"content": " complex += 22u8 - 2u8+ 1u8;"
}
},
"value": {
"Binary": {
"left": {
"Identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":3,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" complex += 22u8 - 2u8+ 1u8;\\\"}\"}"
},
"right": {
"Binary": {
"left": {
"Binary": {
"left": {
"Value": {
"Integer": [
"U8",
"22",
{
"line_start": 28,
"line_stop": 28,
"col_start": 14,
"col_stop": 18,
"path": "",
"content": " complex += 22u8 - 2u8+ 1u8;"
}
]
}
},
"right": {
"Value": {
"Integer": [
"U8",
"2",
{
"line_start": 28,
"line_stop": 28,
"col_start": 21,
"col_stop": 24,
"path": "",
"content": " complex += 22u8 - 2u8+ 1u8;"
}
]
}
},
"op": "Sub",
"span": {
"line_start": 28,
"line_stop": 28,
"col_start": 14,
"col_stop": 24,
"path": "",
"content": " complex += 22u8 - 2u8+ 1u8;"
}
}
},
"right": {
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 28,
"line_stop": 28,
"col_start": 26,
"col_stop": 29,
"path": "",
"content": " complex += 22u8 - 2u8+ 1u8;"
}
]
}
},
"op": "Add",
"span": {
"line_start": 28,
"line_stop": 28,
"col_start": 14,
"col_stop": 29,
"path": "",
"content": " complex += 22u8 - 2u8+ 1u8;"
}
}
},
"op": "Add",
"span": {
"line_start": 28,
"line_stop": 28,
"col_start": 3,
"col_stop": 29,
"path": "",
"content": " complex += 22u8 - 2u8+ 1u8;"
}
}
},
"span": {
"line_start": 28,
"line_stop": 28,
"col_start": 3,
"col_stop": 29,
"path": "",
"content": " complex += 22u8 - 2u8+ 1u8;"
}
}
},
{
"Console": {
"function": {
"Assert": {
"Binary": {
"left": {
"Identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":18,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(complex == 23u8);\\\"}\"}"
},
"right": {
"Value": {
"Integer": [
"U8",
"23",
{
"line_start": 29,
"line_stop": 29,
"col_start": 29,
"col_stop": 33,
"path": "",
"content": " console.assert(complex == 23u8);"
}
]
}
},
"op": "Eq",
"span": {
"line_start": 29,
"line_stop": 29,
"col_start": 18,
"col_stop": 33,
"path": "",
"content": " console.assert(complex == 23u8);"
}
}
}
},
"span": {
"line_start": 29,
"line_stop": 29,
"col_start": 3,
"col_stop": 33,
"path": "",
"content": " console.assert(complex == 23u8);"
}
}
},
{
"Definition": {
"declaration_type": "Let",
"variable_names": [
{
"mutable": true,
"identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let a = [[0u8; 1]; 4];\\\"}\"}",
"span": {
"line_start": 30,
"line_stop": 30,
"col_start": 7,
"col_stop": 8, "col_stop": 8,
"path": "", "path": "",
"content": " let a = [[0u8; 1]; 4];" "content": " let a = [[0u8; 1]; 4];"
} }
} }
], ],
"type_": null, "type_": {
"Array": [
{
"Array": [
{
"IntegerType": "U8"
},
[
{
"value": "1"
}
]
]
},
[
{
"value": "4"
}
]
]
},
"value": { "value": {
"ArrayInit": { "ArrayInit": {
"element": { "element": {
@ -1102,8 +1357,8 @@
"U8", "U8",
"0", "0",
{ {
"line_start": 27, "line_start": 30,
"line_stop": 27, "line_stop": 30,
"col_start": 13, "col_start": 13,
"col_stop": 16, "col_stop": 16,
"path": "", "path": "",
@ -1118,8 +1373,8 @@
} }
], ],
"span": { "span": {
"line_start": 27, "line_start": 30,
"line_stop": 27, "line_stop": 30,
"col_start": 12, "col_start": 12,
"col_stop": 20, "col_stop": 20,
"path": "", "path": "",
@ -1133,8 +1388,8 @@
} }
], ],
"span": { "span": {
"line_start": 27, "line_start": 30,
"line_stop": 27, "line_stop": 30,
"col_start": 11, "col_start": 11,
"col_stop": 24, "col_stop": 24,
"path": "", "path": "",
@ -1143,8 +1398,8 @@
} }
}, },
"span": { "span": {
"line_start": 27, "line_start": 30,
"line_stop": 27, "line_stop": 30,
"col_start": 3, "col_start": 3,
"col_stop": 24, "col_stop": 24,
"path": "", "path": "",
@ -1156,16 +1411,17 @@
"Assign": { "Assign": {
"operation": "Assign", "operation": "Assign",
"assignee": { "assignee": {
"identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}", "identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}",
"accesses": [ "accesses": [
{ {
"ArrayIndex": { "ArrayIndex": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"2", "2",
{ {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 5, "col_start": 5,
"col_stop": 6, "col_stop": 6,
"path": "", "path": "",
@ -1178,11 +1434,12 @@
{ {
"ArrayIndex": { "ArrayIndex": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"0", "0",
{ {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 8, "col_start": 8,
"col_stop": 9, "col_stop": 9,
"path": "", "path": "",
@ -1194,8 +1451,8 @@
} }
], ],
"span": { "span": {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 3, "col_start": 3,
"col_stop": 10, "col_stop": 10,
"path": "", "path": "",
@ -1209,15 +1466,16 @@
"array": { "array": {
"ArrayAccess": { "ArrayAccess": {
"array": { "array": {
"Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}" "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}"
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"2", "2",
{ {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 5, "col_start": 5,
"col_stop": 6, "col_stop": 6,
"path": "", "path": "",
@ -1227,8 +1485,8 @@
} }
}, },
"span": { "span": {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 3, "col_start": 3,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1238,11 +1496,12 @@
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"0", "0",
{ {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 8, "col_start": 8,
"col_stop": 9, "col_stop": 9,
"path": "", "path": "",
@ -1252,8 +1511,8 @@
} }
}, },
"span": { "span": {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 3, "col_start": 3,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1267,8 +1526,8 @@
"U8", "U8",
"1", "1",
{ {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 14, "col_start": 14,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1279,8 +1538,8 @@
}, },
"op": "Add", "op": "Add",
"span": { "span": {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 3, "col_start": 3,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1289,8 +1548,8 @@
} }
}, },
"span": { "span": {
"line_start": 28, "line_start": 31,
"line_stop": 28, "line_stop": 31,
"col_start": 3, "col_start": 3,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1308,15 +1567,16 @@
"array": { "array": {
"ArrayAccess": { "ArrayAccess": {
"array": { "array": {
"Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}" "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}"
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"2", "2",
{ {
"line_start": 29, "line_start": 32,
"line_stop": 29, "line_stop": 32,
"col_start": 20, "col_start": 20,
"col_stop": 21, "col_stop": 21,
"path": "", "path": "",
@ -1326,8 +1586,8 @@
} }
}, },
"span": { "span": {
"line_start": 29, "line_start": 32,
"line_stop": 29, "line_stop": 32,
"col_start": 18, "col_start": 18,
"col_stop": 22, "col_stop": 22,
"path": "", "path": "",
@ -1337,11 +1597,12 @@
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"0", "0",
{ {
"line_start": 29, "line_start": 32,
"line_stop": 29, "line_stop": 32,
"col_start": 23, "col_start": 23,
"col_stop": 24, "col_stop": 24,
"path": "", "path": "",
@ -1351,8 +1612,8 @@
} }
}, },
"span": { "span": {
"line_start": 29, "line_start": 32,
"line_stop": 29, "line_stop": 32,
"col_start": 18, "col_start": 18,
"col_stop": 25, "col_stop": 25,
"path": "", "path": "",
@ -1366,8 +1627,8 @@
"U8", "U8",
"1", "1",
{ {
"line_start": 29, "line_start": 32,
"line_stop": 29, "line_stop": 32,
"col_start": 29, "col_start": 29,
"col_stop": 32, "col_stop": 32,
"path": "", "path": "",
@ -1378,8 +1639,8 @@
}, },
"op": "Eq", "op": "Eq",
"span": { "span": {
"line_start": 29, "line_start": 32,
"line_stop": 29, "line_stop": 32,
"col_start": 18, "col_start": 18,
"col_stop": 32, "col_stop": 32,
"path": "", "path": "",
@ -1389,8 +1650,8 @@
} }
}, },
"span": { "span": {
"line_start": 29, "line_start": 32,
"line_stop": 29, "line_stop": 32,
"col_start": 3, "col_start": 3,
"col_stop": 32, "col_stop": 32,
"path": "", "path": "",
@ -1404,10 +1665,10 @@
"variable_names": [ "variable_names": [
{ {
"mutable": true, "mutable": true,
"identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let b = [0u8; (4, 1)];\\\"}\"}", "identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":34,\\\"line_stop\\\":34,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let b = [0u8; (4, 1)];\\\"}\"}",
"span": { "span": {
"line_start": 31, "line_start": 34,
"line_stop": 31, "line_stop": 34,
"col_start": 7, "col_start": 7,
"col_stop": 8, "col_stop": 8,
"path": "", "path": "",
@ -1415,7 +1676,27 @@
} }
} }
], ],
"type_": null, "type_": {
"Array": [
{
"Array": [
{
"IntegerType": "U8"
},
[
{
"value": "1"
}
]
]
},
[
{
"value": "4"
}
]
]
},
"value": { "value": {
"ArrayInit": { "ArrayInit": {
"element": { "element": {
@ -1426,8 +1707,8 @@
"U8", "U8",
"0", "0",
{ {
"line_start": 31, "line_start": 34,
"line_stop": 31, "line_stop": 34,
"col_start": 12, "col_start": 12,
"col_stop": 15, "col_stop": 15,
"path": "", "path": "",
@ -1442,8 +1723,8 @@
} }
], ],
"span": { "span": {
"line_start": 31, "line_start": 34,
"line_stop": 31, "line_stop": 34,
"col_start": 11, "col_start": 11,
"col_stop": 24, "col_stop": 24,
"path": "", "path": "",
@ -1457,8 +1738,8 @@
} }
], ],
"span": { "span": {
"line_start": 31, "line_start": 34,
"line_stop": 31, "line_stop": 34,
"col_start": 11, "col_start": 11,
"col_stop": 24, "col_stop": 24,
"path": "", "path": "",
@ -1467,8 +1748,8 @@
} }
}, },
"span": { "span": {
"line_start": 31, "line_start": 34,
"line_stop": 31, "line_stop": 34,
"col_start": 3, "col_start": 3,
"col_stop": 24, "col_stop": 24,
"path": "", "path": "",
@ -1480,16 +1761,17 @@
"Assign": { "Assign": {
"operation": "Assign", "operation": "Assign",
"assignee": { "assignee": {
"identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}", "identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}",
"accesses": [ "accesses": [
{ {
"ArrayIndex": { "ArrayIndex": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"2", "2",
{ {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 5, "col_start": 5,
"col_stop": 6, "col_stop": 6,
"path": "", "path": "",
@ -1502,11 +1784,12 @@
{ {
"ArrayIndex": { "ArrayIndex": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"0", "0",
{ {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 8, "col_start": 8,
"col_stop": 9, "col_stop": 9,
"path": "", "path": "",
@ -1518,8 +1801,8 @@
} }
], ],
"span": { "span": {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 3, "col_start": 3,
"col_stop": 10, "col_stop": 10,
"path": "", "path": "",
@ -1533,15 +1816,16 @@
"array": { "array": {
"ArrayAccess": { "ArrayAccess": {
"array": { "array": {
"Identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}" "Identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}"
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"2", "2",
{ {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 5, "col_start": 5,
"col_stop": 6, "col_stop": 6,
"path": "", "path": "",
@ -1551,8 +1835,8 @@
} }
}, },
"span": { "span": {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 3, "col_start": 3,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1562,11 +1846,12 @@
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"0", "0",
{ {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 8, "col_start": 8,
"col_stop": 9, "col_stop": 9,
"path": "", "path": "",
@ -1576,8 +1861,8 @@
} }
}, },
"span": { "span": {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 3, "col_start": 3,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1591,8 +1876,8 @@
"U8", "U8",
"1", "1",
{ {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 14, "col_start": 14,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1603,8 +1888,8 @@
}, },
"op": "Add", "op": "Add",
"span": { "span": {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 3, "col_start": 3,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1613,8 +1898,8 @@
} }
}, },
"span": { "span": {
"line_start": 32, "line_start": 35,
"line_stop": 32, "line_stop": 35,
"col_start": 3, "col_start": 3,
"col_stop": 17, "col_stop": 17,
"path": "", "path": "",
@ -1632,15 +1917,16 @@
"array": { "array": {
"ArrayAccess": { "ArrayAccess": {
"array": { "array": {
"Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}" "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}"
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"2", "2",
{ {
"line_start": 33, "line_start": 36,
"line_stop": 33, "line_stop": 36,
"col_start": 20, "col_start": 20,
"col_stop": 21, "col_stop": 21,
"path": "", "path": "",
@ -1650,8 +1936,8 @@
} }
}, },
"span": { "span": {
"line_start": 33, "line_start": 36,
"line_stop": 33, "line_stop": 36,
"col_start": 18, "col_start": 18,
"col_stop": 22, "col_stop": 22,
"path": "", "path": "",
@ -1661,11 +1947,12 @@
}, },
"index": { "index": {
"Value": { "Value": {
"Implicit": [ "Integer": [
"U32",
"0", "0",
{ {
"line_start": 33, "line_start": 36,
"line_stop": 33, "line_stop": 36,
"col_start": 23, "col_start": 23,
"col_stop": 24, "col_stop": 24,
"path": "", "path": "",
@ -1675,8 +1962,8 @@
} }
}, },
"span": { "span": {
"line_start": 33, "line_start": 36,
"line_stop": 33, "line_stop": 36,
"col_start": 18, "col_start": 18,
"col_stop": 25, "col_stop": 25,
"path": "", "path": "",
@ -1690,8 +1977,8 @@
"U8", "U8",
"1", "1",
{ {
"line_start": 33, "line_start": 36,
"line_stop": 33, "line_stop": 36,
"col_start": 29, "col_start": 29,
"col_stop": 32, "col_stop": 32,
"path": "", "path": "",
@ -1702,8 +1989,8 @@
}, },
"op": "Eq", "op": "Eq",
"span": { "span": {
"line_start": 33, "line_start": 36,
"line_stop": 33, "line_stop": 36,
"col_start": 18, "col_start": 18,
"col_stop": 32, "col_stop": 32,
"path": "", "path": "",
@ -1713,8 +2000,8 @@
} }
}, },
"span": { "span": {
"line_start": 33, "line_start": 36,
"line_stop": 33, "line_stop": 36,
"col_start": 3, "col_start": 3,
"col_stop": 32, "col_stop": 32,
"path": "", "path": "",
@ -1725,7 +2012,7 @@
], ],
"span": { "span": {
"line_start": 10, "line_start": 10,
"line_stop": 34, "line_stop": 37,
"col_start": 17, "col_start": 17,
"col_stop": 2, "col_stop": 2,
"path": "", "path": "",
@ -1734,12 +2021,12 @@
}, },
"span": { "span": {
"line_start": 10, "line_start": 10,
"line_stop": 34, "line_stop": 37,
"col_start": 1, "col_start": 1,
"col_stop": 2, "col_stop": 2,
"path": "", "path": "",
"content": "function main() {\n...\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" "content": "function main() {\n...\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
} }
} }
} }
} }

View File

@ -24,6 +24,9 @@ function main() {
foo.f += 2u8; foo.f += 2u8;
console.assert(foo.f == 8u8); console.assert(foo.f == 8u8);
let complex = 2u8;
complex += 22u8 - 2u8+ 1u8;
console.assert(complex == 23u8);
let a = [[0u8; 1]; 4]; let a = [[0u8; 1]; 4];
a[2][0] += 1u8; a[2][0] += 1u8;
console.assert(a[2][0] == 1u8); console.assert(a[2][0] == 1u8);

View File

@ -0,0 +1,4 @@
function main () {
let x = [1u32; 5];
x[..2] += 1;
}

View File

@ -87,3 +87,11 @@ fn test_compound_assignment() {
assert_eq!(expected_ast, ast); assert_eq!(expected_ast, ast);
} }
#[test]
fn test_illegal_array_range_fail() {
// Check program is invalid.
let program_string = include_str!("illegal_array_range_fail.leo");
let program = parse_program(program_string);
assert!(program.is_err());
}

View File

@ -37,6 +37,7 @@ pub mod mutability;
pub mod statements; pub mod statements;
pub mod syntax; pub mod syntax;
pub mod tuples; pub mod tuples;
pub mod type_inference;
use leo_asg::{new_alloc_context, new_context, AsgContext}; use leo_asg::{new_alloc_context, new_context, AsgContext};
use leo_ast::{InputValue, MainInput}; use leo_ast::{InputValue, MainInput};

View File

@ -0,0 +1,962 @@
{
"name": "",
"expected_input": [],
"imports": [],
"circuits": {
"{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Foo {}\\\"}\"}": {
"circuit_name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Foo {}\\\"}\"}",
"members": []
}
},
"functions": {
"{\"name\":\"two\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function two() -> u8 {\\\"}\"}": {
"annotations": [],
"identifier": "{\"name\":\"two\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function two() -> u8 {\\\"}\"}",
"input": [],
"output": {
"IntegerType": "U8"
},
"block": {
"statements": [
{
"Return": {
"expression": {
"Value": {
"Integer": [
"U8",
"2",
{
"line_start": 4,
"line_stop": 4,
"col_start": 10,
"col_stop": 13,
"path": "",
"content": " return 2u8"
}
]
}
},
"span": {
"line_start": 4,
"line_stop": 4,
"col_start": 3,
"col_stop": 13,
"path": "",
"content": " return 2u8"
}
}
}
],
"span": {
"line_start": 3,
"line_stop": 5,
"col_start": 22,
"col_stop": 2,
"path": "",
"content": "function two() -> u8 {\n...\n}"
}
},
"span": {
"line_start": 3,
"line_stop": 5,
"col_start": 1,
"col_stop": 2,
"path": "",
"content": "function two() -> u8 {\n...\n}"
}
},
"{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}": {
"annotations": [],
"identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}",
"input": [],
"output": {
"Tuple": []
},
"block": {
"statements": [
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const a = 1u8;\\\"}\"}",
"span": {
"line_start": 8,
"line_stop": 8,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const a = 1u8;"
}
}
],
"type_": {
"IntegerType": "U8"
},
"value": {
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 8,
"line_stop": 8,
"col_start": 13,
"col_stop": 16,
"path": "",
"content": " const a = 1u8;"
}
]
}
},
"span": {
"line_start": 8,
"line_stop": 8,
"col_start": 3,
"col_stop": 16,
"path": "",
"content": " const a = 1u8;"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const b = 1field;\\\"}\"}",
"span": {
"line_start": 9,
"line_stop": 9,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const b = 1field;"
}
}
],
"type_": "Field",
"value": {
"Value": {
"Field": [
"1",
{
"line_start": 9,
"line_stop": 9,
"col_start": 13,
"col_stop": 19,
"path": "",
"content": " const b = 1field;"
}
]
}
},
"span": {
"line_start": 9,
"line_stop": 9,
"col_start": 3,
"col_stop": 19,
"path": "",
"content": " const b = 1field;"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const c = 1group;\\\"}\"}",
"span": {
"line_start": 10,
"line_stop": 10,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const c = 1group;"
}
}
],
"type_": "Group",
"value": {
"Value": {
"Group": {
"Single": [
"1",
{
"line_start": 10,
"line_stop": 10,
"col_start": 13,
"col_stop": 19,
"path": "",
"content": " const c = 1group;"
}
]
}
}
},
"span": {
"line_start": 10,
"line_stop": 10,
"col_start": 3,
"col_stop": 19,
"path": "",
"content": " const c = 1group;"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const d = (0, 1)group;\\\"}\"}",
"span": {
"line_start": 11,
"line_stop": 11,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const d = (0, 1)group;"
}
}
],
"type_": "Group",
"value": {
"Value": {
"Group": {
"Tuple": {
"x": {
"Number": [
"0",
{
"line_start": 11,
"line_stop": 11,
"col_start": 14,
"col_stop": 15,
"path": "",
"content": " const d = (0, 1)group;"
}
]
},
"y": {
"Number": [
"1",
{
"line_start": 11,
"line_stop": 11,
"col_start": 17,
"col_stop": 18,
"path": "",
"content": " const d = (0, 1)group;"
}
]
},
"span": {
"line_start": 11,
"line_stop": 11,
"col_start": 14,
"col_stop": 24,
"path": "",
"content": " const d = (0, 1)group;"
}
}
}
}
},
"span": {
"line_start": 11,
"line_stop": 11,
"col_start": 3,
"col_stop": 24,
"path": "",
"content": " const d = (0, 1)group;"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const e = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);\\\"}\"}",
"span": {
"line_start": 12,
"line_stop": 12,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const e = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);"
}
}
],
"type_": "Address",
"value": {
"Value": {
"Address": [
"aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8",
{
"line_start": 12,
"line_stop": 12,
"col_start": 13,
"col_stop": 85,
"path": "",
"content": " const e = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);"
}
]
}
},
"span": {
"line_start": 12,
"line_stop": 12,
"col_start": 3,
"col_stop": 85,
"path": "",
"content": " const e = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const f = two();\\\"}\"}",
"span": {
"line_start": 13,
"line_stop": 13,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const f = two();"
}
}
],
"type_": {
"IntegerType": "U8"
},
"value": {
"Call": {
"function": {
"Identifier": "{\"name\":\"two\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const f = two();\\\"}\"}"
},
"arguments": [],
"span": {
"line_start": 13,
"line_stop": 13,
"col_start": 13,
"col_stop": 18,
"path": "",
"content": " const f = two();"
}
}
},
"span": {
"line_start": 13,
"line_stop": 13,
"col_start": 3,
"col_stop": 18,
"path": "",
"content": " const f = two();"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"g\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const g = [0u8; (3, 2)];\\\"}\"}",
"span": {
"line_start": 14,
"line_stop": 14,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const g = [0u8; (3, 2)];"
}
}
],
"type_": {
"Array": [
{
"Array": [
{
"IntegerType": "U8"
},
[
{
"value": "2"
}
]
]
},
[
{
"value": "3"
}
]
]
},
"value": {
"ArrayInit": {
"element": {
"ArrayInit": {
"element": {
"Value": {
"Integer": [
"U8",
"0",
{
"line_start": 14,
"line_stop": 14,
"col_start": 14,
"col_stop": 17,
"path": "",
"content": " const g = [0u8; (3, 2)];"
}
]
}
},
"dimensions": [
{
"value": "2"
}
],
"span": {
"line_start": 14,
"line_stop": 14,
"col_start": 13,
"col_stop": 26,
"path": "",
"content": " const g = [0u8; (3, 2)];"
}
}
},
"dimensions": [
{
"value": "3"
}
],
"span": {
"line_start": 14,
"line_stop": 14,
"col_start": 13,
"col_stop": 26,
"path": "",
"content": " const g = [0u8; (3, 2)];"
}
}
},
"span": {
"line_start": 14,
"line_stop": 14,
"col_start": 3,
"col_stop": 26,
"path": "",
"content": " const g = [0u8; (3, 2)];"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"h\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const h = [[0u8; 3]; 2];\\\"}\"}",
"span": {
"line_start": 15,
"line_stop": 15,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const h = [[0u8; 3]; 2];"
}
}
],
"type_": {
"Array": [
{
"Array": [
{
"IntegerType": "U8"
},
[
{
"value": "3"
}
]
]
},
[
{
"value": "2"
}
]
]
},
"value": {
"ArrayInit": {
"element": {
"ArrayInit": {
"element": {
"Value": {
"Integer": [
"U8",
"0",
{
"line_start": 15,
"line_stop": 15,
"col_start": 15,
"col_stop": 18,
"path": "",
"content": " const h = [[0u8; 3]; 2];"
}
]
}
},
"dimensions": [
{
"value": "3"
}
],
"span": {
"line_start": 15,
"line_stop": 15,
"col_start": 14,
"col_stop": 22,
"path": "",
"content": " const h = [[0u8; 3]; 2];"
}
}
},
"dimensions": [
{
"value": "2"
}
],
"span": {
"line_start": 15,
"line_stop": 15,
"col_start": 13,
"col_stop": 26,
"path": "",
"content": " const h = [[0u8; 3]; 2];"
}
}
},
"span": {
"line_start": 15,
"line_stop": 15,
"col_start": 3,
"col_stop": 26,
"path": "",
"content": " const h = [[0u8; 3]; 2];"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const i = [1u8, 1u8, 1u8];\\\"}\"}",
"span": {
"line_start": 16,
"line_stop": 16,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const i = [1u8, 1u8, 1u8];"
}
}
],
"type_": {
"Array": [
{
"IntegerType": "U8"
},
[
{
"value": "3"
}
]
]
},
"value": {
"ArrayInline": {
"elements": [
{
"Expression": {
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 16,
"line_stop": 16,
"col_start": 14,
"col_stop": 17,
"path": "",
"content": " const i = [1u8, 1u8, 1u8];"
}
]
}
}
},
{
"Expression": {
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 16,
"line_stop": 16,
"col_start": 19,
"col_stop": 22,
"path": "",
"content": " const i = [1u8, 1u8, 1u8];"
}
]
}
}
},
{
"Expression": {
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 16,
"line_stop": 16,
"col_start": 24,
"col_stop": 27,
"path": "",
"content": " const i = [1u8, 1u8, 1u8];"
}
]
}
}
}
],
"span": {
"line_start": 16,
"line_stop": 16,
"col_start": 13,
"col_stop": 28,
"path": "",
"content": " const i = [1u8, 1u8, 1u8];"
}
}
},
"span": {
"line_start": 16,
"line_stop": 16,
"col_start": 3,
"col_stop": 28,
"path": "",
"content": " const i = [1u8, 1u8, 1u8];"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"j\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const j = true;\\\"}\"}",
"span": {
"line_start": 17,
"line_stop": 17,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const j = true;"
}
}
],
"type_": "Boolean",
"value": {
"Value": {
"Boolean": [
"true",
{
"line_start": 17,
"line_stop": 17,
"col_start": 13,
"col_stop": 17,
"path": "",
"content": " const j = true;"
}
]
}
},
"span": {
"line_start": 17,
"line_stop": 17,
"col_start": 3,
"col_stop": 17,
"path": "",
"content": " const j = true;"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"k\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const k = (1u8, 1u8);\\\"}\"}",
"span": {
"line_start": 18,
"line_stop": 18,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const k = (1u8, 1u8);"
}
}
],
"type_": {
"Tuple": [
{
"IntegerType": "U8"
},
{
"IntegerType": "U8"
}
]
},
"value": {
"TupleInit": {
"elements": [
{
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 18,
"line_stop": 18,
"col_start": 14,
"col_stop": 17,
"path": "",
"content": " const k = (1u8, 1u8);"
}
]
}
},
{
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 18,
"line_stop": 18,
"col_start": 19,
"col_stop": 22,
"path": "",
"content": " const k = (1u8, 1u8);"
}
]
}
}
],
"span": {
"line_start": 18,
"line_stop": 18,
"col_start": 13,
"col_stop": 23,
"path": "",
"content": " const k = (1u8, 1u8);"
}
}
},
"span": {
"line_start": 18,
"line_stop": 18,
"col_start": 3,
"col_stop": 23,
"path": "",
"content": " const k = (1u8, 1u8);"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"l\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const l = (1u8, 1u8, true);\\\"}\"}",
"span": {
"line_start": 19,
"line_stop": 19,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const l = (1u8, 1u8, true);"
}
}
],
"type_": {
"Tuple": [
{
"IntegerType": "U8"
},
{
"IntegerType": "U8"
},
"Boolean"
]
},
"value": {
"TupleInit": {
"elements": [
{
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 19,
"line_stop": 19,
"col_start": 14,
"col_stop": 17,
"path": "",
"content": " const l = (1u8, 1u8, true);"
}
]
}
},
{
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 19,
"line_stop": 19,
"col_start": 19,
"col_stop": 22,
"path": "",
"content": " const l = (1u8, 1u8, true);"
}
]
}
},
{
"Value": {
"Boolean": [
"true",
{
"line_start": 19,
"line_stop": 19,
"col_start": 24,
"col_stop": 28,
"path": "",
"content": " const l = (1u8, 1u8, true);"
}
]
}
}
],
"span": {
"line_start": 19,
"line_stop": 19,
"col_start": 13,
"col_stop": 29,
"path": "",
"content": " const l = (1u8, 1u8, true);"
}
}
},
"span": {
"line_start": 19,
"line_stop": 19,
"col_start": 3,
"col_stop": 29,
"path": "",
"content": " const l = (1u8, 1u8, true);"
}
}
},
{
"Definition": {
"declaration_type": "Const",
"variable_names": [
{
"mutable": false,
"identifier": "{\"name\":\"m\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const m = Foo {};\\\"}\"}",
"span": {
"line_start": 20,
"line_stop": 20,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " const m = Foo {};"
}
}
],
"type_": {
"Circuit": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Foo {}\\\"}\"}"
},
"value": {
"CircuitInit": {
"name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const m = Foo {};\\\"}\"}",
"members": [],
"span": {
"line_start": 20,
"line_stop": 20,
"col_start": 13,
"col_stop": 19,
"path": "",
"content": " const m = Foo {};"
}
}
},
"span": {
"line_start": 20,
"line_stop": 20,
"col_start": 3,
"col_stop": 19,
"path": "",
"content": " const m = Foo {};"
}
}
}
],
"span": {
"line_start": 7,
"line_stop": 21,
"col_start": 17,
"col_stop": 2,
"path": "",
"content": "function main() {\n...\n}"
}
},
"span": {
"line_start": 7,
"line_stop": 21,
"col_start": 1,
"col_stop": 2,
"path": "",
"content": "function main() {\n...\n}\n\n\n\n\n\n\n\n\n\n\n\n"
}
}
}
}

View File

@ -0,0 +1,21 @@
circuit Foo {}
function two() -> u8 {
return 2u8;
}
function main() {
const a = 1u8;
const b = 1field;
const c = 1group;
const d = (0, 1)group;
const e = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
const f = two();
const g = [0u8; (3, 2)];
const h = [[0u8; 3]; 2];
const i = [1u8, 1u8, 1u8];
const j = true;
const k = (1u8, 1u8);
const l = (1u8, 1u8, true);
const m = Foo {};
}

View File

@ -0,0 +1,242 @@
{
"name": "",
"expected_input": [],
"imports": [],
"circuits": {},
"functions": {
"{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}": {
"annotations": [],
"identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}",
"input": [],
"output": {
"Tuple": []
},
"block": {
"statements": [
{
"Definition": {
"declaration_type": "Let",
"variable_names": [
{
"mutable": true,
"identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":2,\\\"line_stop\\\":2,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let x = 10u16;\\\"}\"}",
"span": {
"line_start": 2,
"line_stop": 2,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " let x = 10u16;"
}
}
],
"type_": {
"IntegerType": "U16"
},
"value": {
"Value": {
"Integer": [
"U16",
"10",
{
"line_start": 2,
"line_stop": 2,
"col_start": 13,
"col_stop": 18,
"path": "",
"content": " let x = 10u16;"
}
]
}
},
"span": {
"line_start": 2,
"line_stop": 2,
"col_start": 5,
"col_stop": 18,
"path": "",
"content": " let x = 10u16;"
}
}
},
{
"Iteration": {
"variable": "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for i in 0..3 {\\\"}\"}",
"start": {
"Value": {
"Integer": [
"U32",
"0",
{
"line_start": 3,
"line_stop": 3,
"col_start": 14,
"col_stop": 15,
"path": "",
"content": " for i in 0..3 {"
}
]
}
},
"stop": {
"Value": {
"Integer": [
"U32",
"3",
{
"line_start": 3,
"line_stop": 3,
"col_start": 17,
"col_stop": 18,
"path": "",
"content": " for i in 0..3 {"
}
]
}
},
"block": {
"statements": [
{
"Assign": {
"operation": "Assign",
"assignee": {
"identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x -= 1;\\\"}\"}",
"accesses": [],
"span": {
"line_start": 4,
"line_stop": 4,
"col_start": 9,
"col_stop": 10,
"path": "",
"content": " x -= 1;"
}
},
"value": {
"Binary": {
"left": {
"Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x -= 1;\\\"}\"}"
},
"right": {
"Value": {
"Integer": [
"U16",
"1",
{
"line_start": 4,
"line_stop": 4,
"col_start": 14,
"col_stop": 15,
"path": "",
"content": " x -= 1;"
}
]
}
},
"op": "Sub",
"span": {
"line_start": 4,
"line_stop": 4,
"col_start": 9,
"col_stop": 15,
"path": "",
"content": " x -= 1;"
}
}
},
"span": {
"line_start": 4,
"line_stop": 4,
"col_start": 9,
"col_stop": 15,
"path": "",
"content": " x -= 1;"
}
}
}
],
"span": {
"line_start": 3,
"line_stop": 5,
"col_start": 19,
"col_stop": 6,
"path": "",
"content": " for i in 0..3 {\n...\n }"
}
},
"span": {
"line_start": 3,
"line_stop": 5,
"col_start": 5,
"col_stop": 6,
"path": "",
"content": " for i in 0..3 {\n...\n }"
}
}
},
{
"Console": {
"function": {
"Assert": {
"Binary": {
"left": {
"Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(x == 7u16);\\\"}\"}"
},
"right": {
"Value": {
"Integer": [
"U16",
"7",
{
"line_start": 6,
"line_stop": 6,
"col_start": 25,
"col_stop": 29,
"path": "",
"content": " console.assert(x == 7u16);"
}
]
}
},
"op": "Eq",
"span": {
"line_start": 6,
"line_stop": 6,
"col_start": 20,
"col_stop": 29,
"path": "",
"content": " console.assert(x == 7u16);"
}
}
}
},
"span": {
"line_start": 6,
"line_stop": 6,
"col_start": 5,
"col_stop": 29,
"path": "",
"content": " console.assert(x == 7u16);"
}
}
}
],
"span": {
"line_start": 1,
"line_stop": 7,
"col_start": 17,
"col_stop": 2,
"path": "",
"content": "function main() {\n...\n}"
}
},
"span": {
"line_start": 1,
"line_stop": 7,
"col_start": 1,
"col_stop": 2,
"path": "",
"content": "function main() {\n...\n}\n\n\n\n"
}
}
}
}

View File

@ -1,8 +1,7 @@
function main() { function main() {
let x = 4u32; let x = 10u16;
for i in 0..3 { for i in 0..3 {
x -= 1; x -= 1;
} }
console.assert(x == 7u16);
console.assert(x == 1u32);
} }

View File

@ -0,0 +1,85 @@
// 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 crate::{assert_satisfied, parse_program};
#[allow(unused)]
use leo_asg::{new_context, Asg, AsgContext};
use leo_ast::Ast;
use leo_compiler::TypeInferencePhase;
use leo_imports::ImportParser;
use leo_parser::parser;
thread_local! {
static THREAD_GLOBAL_CONTEXT: AsgContext<'static> = {
let leaked = Box::leak(Box::new(leo_asg::new_alloc_context()));
leo_asg::new_context(leaked)
}
}
pub fn thread_leaked_context() -> AsgContext<'static> {
THREAD_GLOBAL_CONTEXT.with(|f| *f)
}
pub fn parse_program_ast(file_string: &str) -> Ast {
const TEST_PROGRAM_PATH: &str = "";
let test_program_file_path = std::path::PathBuf::from(TEST_PROGRAM_PATH);
let mut ast = Ast::new(
parser::parse(test_program_file_path.to_str().expect("unwrap fail"), &file_string)
.expect("Failed to parse file."),
);
ast.canonicalize().expect("Failed to canonicalize program.");
let program = ast.clone().into_repr();
let asg = Asg::new(thread_leaked_context(), &program, &mut ImportParser::default())
.expect("Failed to create ASG from AST");
let new_ast = TypeInferencePhase::default()
.phase_ast(&program, &asg.into_repr())
.expect("Failed to produce type inference ast.");
new_ast
}
#[test]
fn test_basic() {
// Check program is valid.
let program_string = include_str!("basic.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
// Check we get expected ast.
let ast = parse_program_ast(program_string);
let expected_json = include_str!("basic.json");
let expected_ast: Ast = Ast::from_json_string(expected_json).expect("Unable to parse json.");
assert_eq!(expected_ast, ast);
}
#[test]
fn test_for_loop_and_compound() {
// Check program is valid.
let program_string = include_str!("for_loop_and_compound.leo");
let program = parse_program(program_string).unwrap();
assert_satisfied(program);
// Check we get expected ast.
let ast = parse_program_ast(program_string);
let expected_json = include_str!("for_loop_and_compound.json");
let expected_ast: Ast = Ast::from_json_string(expected_json).expect("Unable to parse json.");
assert_eq!(expected_ast, ast);
}

View File

@ -0,0 +1,14 @@
// The program input for tmp-test/src/main.leo
[main]
puzzle: [u8; (3, 3)] = [[1, 0, 5],
[0, 2, 0],
[7, 0, 0]];
answer: [u8; (3, 3)] = [[1, 4, 5],
[3, 2, 6],
[7, 8, 9]];
expected: bool = true;
[registers]
r: bool = false;

View File

@ -57,59 +57,59 @@ without going beyond context-free grammars.
Instead of BNF's angle-bracket notation for nonterminals, Instead of BNF's angle-bracket notation for nonterminals,
ABNF uses case-insensitive names consisting of letters, digits, and dashes, ABNF uses case-insensitive names consisting of letters, digits, and dashes,
e.g. HTTP-message and IPv6address. e.g. `HTTP-message` and `IPv6address`.
ABNF includes an angle-bracket notation for prose descriptions, ABNF includes an angle-bracket notation for prose descriptions,
e.g. <host, see [RFC3986], Section 3.2.2>, e.g. `<host, see [RFC3986], Section 3.2.2>`,
usable as last resort in the definiens of a nonterminal. usable as last resort in the definiens of a nonterminal.
While BNF allows arbitrary terminals, While BNF allows arbitrary terminals,
ABNF uses only natural numbers as terminals, ABNF uses only natural numbers as terminals,
and denotes them via: and denotes them via:
(i) binary, decimal, or hexadecimal sequences, (i) binary, decimal, or hexadecimal sequences,
e.g. %b1.11.1010, %d1.3.10, and %x.1.3.A e.g. `%b1.11.1010`, `%d1.3.10`, and `%x.1.3.A`
all denote the sequence of terminals '1 3 10'; all denote the sequence of terminals [1, 3, 10];
(ii) binary, decimal, or hexadecimal ranges, (ii) binary, decimal, or hexadecimal ranges,
e.g. %x30-39 denotes any singleton sequence of terminals e.g. `%x30-39` denotes any singleton sequence of terminals
'n' with 48 <= n <= 57 (an ASCII digit); [_n_] with 48 <= _n_ <= 57 (an ASCII digit);
(iii) case-sensitive ASCII strings, (iii) case-sensitive ASCII strings,
e.g. %s"Ab" denotes the sequence of terminals '65 98'; e.g. `%s"Ab"` denotes the sequence of terminals [65, 98];
and (iv) case-insensitive ASCII strings, and (iv) case-insensitive ASCII strings,
e.g. %i"ab", or just "ab", denotes e.g. `%i"ab"`, or just `"ab"`, denotes
any sequence of terminals among any sequence of terminals among
'65 66', [65, 66],
'65 98', [65, 98],
'97 66', and [97, 66], and
'97 98'. [97, 98].
ABNF terminals in suitable sets represent ASCII or Unicode characters. ABNF terminals in suitable sets represent ASCII or Unicode characters.
ABNF allows repetition prefixes n*m, ABNF allows repetition prefixes `n*m`,
where n and m are natural numbers in decimal notation; where `n` and `m` are natural numbers in decimal notation;
if absent, if absent,
n defaults to 0, and `n` defaults to 0, and
m defaults to infinity. `m` defaults to infinity.
For example, For example,
1*4HEXDIG denotes one to four HEXDIGs, `1*4HEXDIG` denotes one to four `HEXDIG`s,
*3DIGIT denotes up to three DIGITs, and `*3DIGIT` denotes up to three `DIGIT`s, and
1*OCTET denotes one or more OCTETs. `1*OCTET` denotes one or more `OCTET`s.
A single n prefix A single `n` prefix
abbreviates n*n, abbreviates `n*n`,
e.g. 3DIGIT denotes three DIGITs. e.g. `3DIGIT` denotes three `DIGIT`s.
Instead of BNF's |, ABNF uses / to separate alternatives. Instead of BNF's `|`, ABNF uses `/` to separate alternatives.
Repetition prefixes have precedence over juxtapositions, Repetition prefixes have precedence over juxtapositions,
which have precedence over /. which have precedence over `/`.
Round brackets group things and override the aforementioned precedence rules, Round brackets group things and override the aforementioned precedence rules,
e.g. *(WSP / CRLF WSP) denotes sequences of terminals e.g. `*(WSP / CRLF WSP)` denotes sequences of terminals
obtained by repeating, zero or more times, obtained by repeating, zero or more times,
either (i) a WSP or (ii) a CRLF followed by a WSP. either (i) a `WSP` or (ii) a `CRLF` followed by a `WSP`.
Square brackets also group things but make them optional, Square brackets also group things but make them optional,
e.g. [":" port] is equivalent to 0*1(":" port). e.g. `[":" port]` is equivalent to `0*1(":" port)`.
Instead of BNF's ::=, ABNF uses = to define nonterminals, Instead of BNF's `::=`, ABNF uses `=` to define nonterminals,
and =/ to incrementally add alternatives and `=/` to incrementally add alternatives
to previously defined nonterminals. to previously defined nonterminals.
For example, the rule BIT = "0" / "1" For example, the rule `BIT = "0" / "1"`
is equivalent to BIT = "0" followed by BIT =/ "1". is equivalent to `BIT = "0"` followed by `BIT =/ "1"`.
The syntax of ABNF itself is formally specified in ABNF The syntax of ABNF itself is formally specified in ABNF
(in Section 4 of the aforementioned RFC 5234, (in Section 4 of the aforementioned RFC 5234,
@ -131,7 +131,7 @@ Structure
This ABNF grammar consists of two (sub-)grammars: This ABNF grammar consists of two (sub-)grammars:
(i) a lexical grammar that describes how (i) a lexical grammar that describes how
sequence of characters are parsed into tokens, and sequence of characters are parsed into tokens, and
(ii) a syntactic grammar that described how (ii) a syntactic grammar that describes how
tokens are parsed into expressions, statements, etc. tokens are parsed into expressions, statements, etc.
The adjectives 'lexical' and 'syntactic' are The adjectives 'lexical' and 'syntactic' are
the same ones used in the Java language reference, the same ones used in the Java language reference,
@ -198,8 +198,8 @@ additive-expression =
These rules tell us These rules tell us
that the additive operators '+' and '-' have lower precedence that the additive operators `+` and `-` have lower precedence
than the multiplicative operators '*' and '/', than the multiplicative operators `*` and `/`,
and that both the additive and multiplicative operators associate to the left. and that both the additive and multiplicative operators associate to the left.
This may be best understood via the examples given below. This may be best understood via the examples given below.
@ -295,7 +295,7 @@ Naming Convention
This ABNF grammar uses nonterminal names This ABNF grammar uses nonterminal names
that consist of complete English words, separated by dashes, that consist of complete English words, separated by dashes,
and that describe the construct the way it is in English. and that describe the construct the way it is in English.
For instance, we use the name 'conditional-statement' For instance, we use the name `conditional-statement`
to describe conditional statements. to describe conditional statements.
At the same time, this grammar establishes At the same time, this grammar establishes
@ -354,8 +354,8 @@ Lexical Grammar
A Leo file is a finite sequence of Unicode characters, A Leo file is a finite sequence of Unicode characters,
represented as Unicode code points, represented as Unicode code points,
which are numbers in the range form 0 to 10FFFFh. which are numbers in the range from 0 to 10FFFFh.
These are captured by the ABNF rule 'character' below. These are captured by the ABNF rule `character` below.
The lexical grammar defines how, at least conceptually, The lexical grammar defines how, at least conceptually,
the sequence of characters is turned into the sequence of characters is turned into
@ -363,20 +363,20 @@ a sequence of tokens, comments, and whitespaces:
these entities are all defined by the grammar rules below. these entities are all defined by the grammar rules below.
As stated, the lexical grammar alone is ambiguous. As stated, the lexical grammar alone is ambiguous.
For example, the sequence of characters '**' (i.e. two stars) For example, the sequence of characters `**` (i.e. two stars)
could be equally parsed as two '*' symbol tokens or one '**' symbol token could be equally parsed as two `*` symbol tokens or one `**` symbol token
(see rule for 'symbol' below). (see rule for `symbol` below).
As another example, the sequence or characters '<CR><LF>' As another example, the sequence or characters `<CR><LF>`
(i.e. carriage return followed by line feed) (i.e. carriage return followed by line feed)
could be equally parsed as two line terminators or one could be equally parsed as two line terminators or one
(see rule for 'newline'). (see rule for `newline`).
Thus, as often done in language syntax definitions, Thus, as often done in language syntax definitions,
the lexical grammar is disambiguated by the lexical grammar is disambiguated by
the extra-grammatical requirement that the extra-grammatical requirement that
the longest possible sequence of characters is always parsed. the longest possible sequence of characters is always parsed.
This way, '**' must be parsed as one '**' symbol token, This way, `**` must be parsed as one `**` symbol token,
and '<CR><LF>' must be parsed as one line terminator. and `<CR><LF>` must be parsed as one line terminator.
As mentioned above, a character is any Unicode code point. As mentioned above, a character is any Unicode code point.
This grammar does not say how those are encoded in files (e.g. UTF-8): This grammar does not say how those are encoded in files (e.g. UTF-8):
@ -393,27 +393,27 @@ We give names to certain ASCII characters.
<a name="horizontal-tab"></a> <a name="horizontal-tab"></a>
```abnf ```abnf
horizontal-tab = %x9 horizontal-tab = %x9 ; <HT>
``` ```
<a name="line-feed"></a> <a name="line-feed"></a>
```abnf ```abnf
line-feed = %xA line-feed = %xA ; <LF>
``` ```
<a name="carriage-return"></a> <a name="carriage-return"></a>
```abnf ```abnf
carriage-return = %xD carriage-return = %xD ; <CR>
``` ```
<a name="space"></a> <a name="space"></a>
```abnf ```abnf
space = %x20 space = %x20 ; <SP>
``` ```
<a name="double-quote"></a> <a name="double-quote"></a>
```abnf ```abnf
double-quote = %x22 double-quote = %x22 ; "
``` ```
We give names to complements of certain ASCII characters. We give names to complements of certain ASCII characters.
@ -432,12 +432,25 @@ not-star = %x0-29 / %x2B-10FFFF ; anything but *
<a name="not-line-feed-or-carriage-return"></a> <a name="not-line-feed-or-carriage-return"></a>
```abnf ```abnf
not-line-feed-or-carriage-return = %x0-9 / %xB-C / %xE-10FFFF not-line-feed-or-carriage-return = %x0-9 / %xB-C / %xE-10FFFF
; anything but LF or CR ; anything but <LF> or <CR>
```
<a name="not-double-quote-or-open-brace"></a>
```abnf
not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF
; anything but " or {
```
<a name="not-double-quote-or-close-brace"></a>
```abnf
not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF
; anything but " or }
``` ```
<a name="not-star-or-slash"></a> <a name="not-star-or-slash"></a>
```abnf ```abnf
not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF ; anything but * or / not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF
; anything but * or /
``` ```
Lines in Leo may be terminated via Lines in Leo may be terminated via
@ -453,7 +466,7 @@ described above.
newline = line-feed / carriage-return / carriage-return line-feed newline = line-feed / carriage-return / carriage-return line-feed
``` ```
Go to: _[carriage-return](#user-content-carriage-return), [line-feed](#user-content-line-feed)_; Go to: _[line-feed](#user-content-line-feed), [carriage-return](#user-content-carriage-return)_;
Line terminators form whitespace, along with spaces and horizontal tabs. Line terminators form whitespace, along with spaces and horizontal tabs.
@ -463,16 +476,16 @@ Line terminators form whitespace, along with spaces and horizontal tabs.
whitespace = space / horizontal-tab / newline whitespace = space / horizontal-tab / newline
``` ```
Go to: _[space](#user-content-space), [horizontal-tab](#user-content-horizontal-tab), [newline](#user-content-newline)_; Go to: _[horizontal-tab](#user-content-horizontal-tab), [space](#user-content-space), [newline](#user-content-newline)_;
There are two kinds of comments in Leo, as in other languages. There are two kinds of comments in Leo, as in other languages.
One is block comments of the form '/* ... */', One is block comments of the form `/* ... */`,
and the other is end-of-line comments of the form '// ...'. and the other is end-of-line comments of the form `// ...`.
The first kind start at '/*' and end at the first '*/', The first kind start at `/*` and end at the first `*/`,
possibly spanning multiple (partial) lines; possibly spanning multiple (partial) lines;
these do no nest. these do no nest.
The second kind start at '//' and extend till the end of the line. The second kind start at `//` and extend till the end of the line.
The rules about comments given below are similar to The rules about comments given below are similar to
the ones used in the Java language reference. the ones used in the Java language reference.
@ -481,7 +494,7 @@ the ones used in the Java language reference.
comment = block-comment / end-of-line-comment comment = block-comment / end-of-line-comment
``` ```
Go to: _[block-comment](#user-content-block-comment), [end-of-line-comment](#user-content-end-of-line-comment)_; Go to: _[end-of-line-comment](#user-content-end-of-line-comment), [block-comment](#user-content-block-comment)_;
<a name="block-comment"></a> <a name="block-comment"></a>
@ -498,7 +511,7 @@ rest-of-block-comment = "*" rest-of-block-comment-after-star
/ not-star rest-of-block-comment / not-star rest-of-block-comment
``` ```
Go to: _[rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [not-star](#user-content-not-star), [rest-of-block-comment](#user-content-rest-of-block-comment)_; Go to: _[not-star](#user-content-not-star), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [rest-of-block-comment](#user-content-rest-of-block-comment)_;
<a name="rest-of-block-comment-after-star"></a> <a name="rest-of-block-comment-after-star"></a>
@ -609,31 +622,16 @@ package-name = 1*( lowercase-letter / digit )
A format string is a sequence of characters, other than double quote, A format string is a sequence of characters, other than double quote,
surrounded by double quotes. surrounded by double quotes.
Within a format string, sub-strings '{}' are distinguished as containers Within a format string, sub-strings `{}` are distinguished as containers
(these are the ones that may be matched with values (these are the ones that may be matched with values
whose textual representation replaces the containers whose textual representation replaces the containers
in the printed string). in the printed string).
There is an implicit extra-grammatical requirements that
the explicit 'format-string-container' instances include
all the occurrences of '{}' in the parsed character sequence:
that is, there may not be two contiguous 'not-double-quote' instances
that are '{' and '}'.
<a name="format-string-container"></a> <a name="format-string-container"></a>
```abnf ```abnf
format-string-container = "{}" format-string-container = "{}"
``` ```
<a name="not-double-quote-or-open-brace"></a>
```abnf
not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF
```
<a name="not-double-quote-or-close-brace"></a>
```abnf
not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF
```
<a name="format-string-element"></a> <a name="format-string-element"></a>
```abnf ```abnf
format-string-element = not-double-quote-or-open-brace format-string-element = not-double-quote-or-open-brace
@ -641,7 +639,7 @@ format-string-element = not-double-quote-or-open-brace
/ format-string-container / format-string-container
``` ```
Go to: _[not-double-quote-or-open-brace](#user-content-not-double-quote-or-open-brace), [not-double-quote-or-close-brace](#user-content-not-double-quote-or-close-brace), [format-string-container](#user-content-format-string-container)_; Go to: _[not-double-quote-or-close-brace](#user-content-not-double-quote-or-close-brace), [format-string-container](#user-content-format-string-container), [not-double-quote-or-open-brace](#user-content-not-double-quote-or-open-brace)_;
<a name="format-string"></a> <a name="format-string"></a>
@ -652,43 +650,7 @@ format-string = double-quote *format-string-element double-quote
Go to: _[double-quote](#user-content-double-quote)_; Go to: _[double-quote](#user-content-double-quote)_;
Here is (part of this ABNF comment), Annotations have names, which are identifiers immediately preceded by `@`.
an alternative way to specify format strings,
which captures the extra-grammatical requirement above in the grammar,
but is more complicated:
```
not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF
```
```
not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF
```
```
format-string-element = not-double-quote-or-open-brace
/ "{" not-double-quote-or-close-brace
/ format-string-container
```
```
format-string = double-quote *format-string-element double-quote
```
It is not immediately clear which approach is better; there are tradeoffs.
We may choose to adopt this one in future revisions of the grammar.
Annotations have names, which are identifiers immediately preceded by '@'.
<a name="annotation-name"></a> <a name="annotation-name"></a>
```abnf ```abnf
@ -699,7 +661,7 @@ Go to: _[identifier](#user-content-identifier)_;
A natural (number) is a sequence of one or more digits. A natural (number) is a sequence of one or more digits.
We allow leading zeros, e.g. '007'. We allow leading zeros, e.g. `007`.
<a name="natural"></a> <a name="natural"></a>
```abnf ```abnf
@ -707,7 +669,7 @@ natural = 1*digit
``` ```
An integer (number) is either a natural or its negation. An integer (number) is either a natural or its negation.
We allow leading zeros also in negative numbers, e.g. '-007'. We allow leading zeros also in negative numbers, e.g. `-007`.
<a name="integer"></a> <a name="integer"></a>
```abnf ```abnf
@ -778,7 +740,7 @@ Boolean literals are the usual two.
boolean-literal = %s"true" / %s"false" boolean-literal = %s"true" / %s"false"
``` ```
An address literal starts with 'aleo1' An address literal starts with `aleo1`
and continues with exactly 58 lowercase letters and digits. and continues with exactly 58 lowercase letters and digits.
Thus an address always consists of 63 characters. Thus an address always consists of 63 characters.
@ -802,16 +764,16 @@ atomic-literal = untyped-literal
/ address-literal / address-literal
``` ```
Go to: _[unsigned-literal](#user-content-unsigned-literal), [field-literal](#user-content-field-literal), [product-group-literal](#user-content-product-group-literal), [address-literal](#user-content-address-literal), [signed-literal](#user-content-signed-literal), [untyped-literal](#user-content-untyped-literal), [boolean-literal](#user-content-boolean-literal)_; Go to: _[signed-literal](#user-content-signed-literal), [field-literal](#user-content-field-literal), [product-group-literal](#user-content-product-group-literal), [unsigned-literal](#user-content-unsigned-literal), [untyped-literal](#user-content-untyped-literal), [boolean-literal](#user-content-boolean-literal), [address-literal](#user-content-address-literal)_;
After defining the (mostly) alphanumeric tokens above, After defining the (mostly) alphanumeric tokens above,
it remains to define tokens for non-alphanumeric symbols such as "+" and "(". it remains to define tokens for non-alphanumeric symbols such as `+` and `(`.
Different programming languages used different terminologies for these, Different programming languages used different terminologies for these,
e.g. operators, separators, punctuators, etc. e.g. operators, separators, punctuators, etc.
Here we use 'symbol', for all of them. Here we use `symbol`, for all of them.
We also include a token consisting of We also include a token consisting of
a closing parenthesis immediately followed by 'group': a closing parenthesis `)` immediately followed by `group`:
as defined in the syntactic grammar, as defined in the syntactic grammar,
this is the final part of an affine group literal; this is the final part of an affine group literal;
even though it includes letters, even though it includes letters,
@ -829,7 +791,7 @@ equality-operator = "=="
and defining 'symbol' in terms of those and defining `symbol` in terms of those
@ -844,7 +806,7 @@ but it would help establish a terminology in the grammar,
namely the exact names of some of these token. namely the exact names of some of these token.
On the other hand, at least some of them are perhaps simple enough On the other hand, at least some of them are perhaps simple enough
that they could be just described in terms of their symbols, that they could be just described in terms of their symbols,
e.g. 'double dot', 'question mark', etc. e.g. double dot, question mark, etc.
<a name="symbol"></a> <a name="symbol"></a>
```abnf ```abnf
@ -875,7 +837,7 @@ token = keyword
/ symbol / symbol
``` ```
Go to: _[format-string](#user-content-format-string), [annotation-name](#user-content-annotation-name), [symbol](#user-content-symbol), [keyword](#user-content-keyword), [atomic-literal](#user-content-atomic-literal), [identifier](#user-content-identifier), [package-name](#user-content-package-name)_; Go to: _[package-name](#user-content-package-name), [format-string](#user-content-format-string), [symbol](#user-content-symbol), [identifier](#user-content-identifier), [atomic-literal](#user-content-atomic-literal), [annotation-name](#user-content-annotation-name), [keyword](#user-content-keyword)_;
@ -953,10 +915,10 @@ address-type = %s"address"
scalar-type = boolean-type / arithmetic-type / address-type scalar-type = boolean-type / arithmetic-type / address-type
``` ```
Go to: _[arithmetic-type](#user-content-arithmetic-type), [address-type](#user-content-address-type), [boolean-type](#user-content-boolean-type)_; Go to: _[address-type](#user-content-address-type), [arithmetic-type](#user-content-arithmetic-type), [boolean-type](#user-content-boolean-type)_;
Circuit types are denoted by identifiers and the keyword 'Self'. Circuit types are denoted by identifiers and the keyword `Self`.
The latter is only allowed inside a circuit definition, The latter is only allowed inside a circuit definition,
to denote the circuit being defined. to denote the circuit being defined.
@ -970,7 +932,7 @@ self-type = %s"Self"
circuit-type = identifier / self-type circuit-type = identifier / self-type
``` ```
Go to: _[identifier](#user-content-identifier), [self-type](#user-content-self-type)_; Go to: _[self-type](#user-content-self-type), [identifier](#user-content-identifier)_;
A tuple type consists of zero, two, or more component types. A tuple type consists of zero, two, or more component types.
@ -993,7 +955,7 @@ or a tuple of one or more dimensions.
array-type = "[" type ";" array-dimensions "]" array-type = "[" type ";" array-dimensions "]"
``` ```
Go to: _[type](#user-content-type), [array-dimensions](#user-content-array-dimensions)_; Go to: _[array-dimensions](#user-content-array-dimensions), [type](#user-content-type)_;
<a name="array-dimensions"></a> <a name="array-dimensions"></a>
@ -1024,7 +986,7 @@ Scalar and aggregate types form all the types.
type = scalar-type / aggregate-type type = scalar-type / aggregate-type
``` ```
Go to: _[scalar-type](#user-content-scalar-type), [aggregate-type](#user-content-aggregate-type)_; Go to: _[aggregate-type](#user-content-aggregate-type), [scalar-type](#user-content-scalar-type)_;
The lexical grammar given earlier defines product group literals. The lexical grammar given earlier defines product group literals.
@ -1060,11 +1022,11 @@ A literal is either an atomic one or an affine group literal.
literal = atomic-literal / affine-group-literal literal = atomic-literal / affine-group-literal
``` ```
Go to: _[affine-group-literal](#user-content-affine-group-literal), [atomic-literal](#user-content-atomic-literal)_; Go to: _[atomic-literal](#user-content-atomic-literal), [affine-group-literal](#user-content-affine-group-literal)_;
The following rule is not directly referenced in the rules for expressions The following rule is not directly referenced in the rules for expressions
(which reference 'literal' instead), (which reference `literal` instead),
but it is useful to establish terminology: but it is useful to establish terminology:
a group literal is either a product group literal or an affine group literal. a group literal is either a product group literal or an affine group literal.
@ -1102,7 +1064,7 @@ primary-expression = identifier
/ circuit-expression / circuit-expression
``` ```
Go to: _[literal](#user-content-literal), [array-expression](#user-content-array-expression), [tuple-expression](#user-content-tuple-expression), [identifier](#user-content-identifier), [expression](#user-content-expression), [circuit-expression](#user-content-circuit-expression)_; Go to: _[array-expression](#user-content-array-expression), [identifier](#user-content-identifier), [expression](#user-content-expression), [literal](#user-content-literal), [tuple-expression](#user-content-tuple-expression), [circuit-expression](#user-content-circuit-expression)_;
Tuple expressions construct tuples. Tuple expressions construct tuples.
@ -1127,7 +1089,7 @@ Go to: _[tuple-construction](#user-content-tuple-construction)_;
Array expressions construct arrays. Array expressions construct arrays.
There are two kinds: There are two kinds:
one lists the element expressions (at least one), one lists the element expressions (at least one),
including spreads (via '...') which are arrays being spliced in; including spreads (via `...`) which are arrays being spliced in;
the other repeats (the value of) a single expression the other repeats (the value of) a single expression
across one or more dimensions. across one or more dimensions.
@ -1155,7 +1117,7 @@ Go to: _[expression](#user-content-expression)_;
array-repeat-construction = "[" expression ";" array-dimensions "]" array-repeat-construction = "[" expression ";" array-dimensions "]"
``` ```
Go to: _[array-dimensions](#user-content-array-dimensions), [expression](#user-content-expression)_; Go to: _[expression](#user-content-expression), [array-dimensions](#user-content-array-dimensions)_;
<a name="array-construction"></a> <a name="array-construction"></a>
@ -1163,7 +1125,7 @@ Go to: _[array-dimensions](#user-content-array-dimensions), [expression](#user-c
array-construction = array-inline-construction / array-repeat-construction array-construction = array-inline-construction / array-repeat-construction
``` ```
Go to: _[array-inline-construction](#user-content-array-inline-construction), [array-repeat-construction](#user-content-array-repeat-construction)_; Go to: _[array-repeat-construction](#user-content-array-repeat-construction), [array-inline-construction](#user-content-array-inline-construction)_;
<a name="array-expression"></a> <a name="array-expression"></a>
@ -1186,7 +1148,8 @@ so they are syntactically identical but semantically different.
<a name="circuit-construction"></a> <a name="circuit-construction"></a>
```abnf ```abnf
circuit-construction = circuit-type "{" circuit-construction = circuit-type "{"
circuit-inline-element *( "," circuit-inline-element ) [ "," ] circuit-inline-element
*( "," circuit-inline-element ) [ "," ]
"}" "}"
``` ```
@ -1249,7 +1212,7 @@ postfix-expression = primary-expression
/ postfix-expression "[" [expression] ".." [expression] "]" / postfix-expression "[" [expression] ".." [expression] "]"
``` ```
Go to: _[primary-expression](#user-content-primary-expression), [expression](#user-content-expression), [postfix-expression](#user-content-postfix-expression), [natural](#user-content-natural), [identifier](#user-content-identifier), [function-arguments](#user-content-function-arguments), [circuit-type](#user-content-circuit-type)_; Go to: _[identifier](#user-content-identifier), [function-arguments](#user-content-function-arguments), [natural](#user-content-natural), [circuit-type](#user-content-circuit-type), [primary-expression](#user-content-primary-expression), [postfix-expression](#user-content-postfix-expression), [expression](#user-content-expression)_;
Unary operators have the highest operator precedence. Unary operators have the highest operator precedence.
@ -1263,13 +1226,13 @@ unary-expression = postfix-expression
/ "-" unary-expression / "-" unary-expression
``` ```
Go to: _[unary-expression](#user-content-unary-expression), [postfix-expression](#user-content-postfix-expression)_; Go to: _[postfix-expression](#user-content-postfix-expression), [unary-expression](#user-content-unary-expression)_;
Next in the operator precedence is exponentiation, Next in the operator precedence is exponentiation,
following mathematical practice. following mathematical practice.
The current rule below makes exponentiation left-associative, The current rule below makes exponentiation right-associative,
i.e. 'a ** b ** c' must be parsed as '(a ** b) ** c'. i.e. `a ** b ** c` must be parsed as `a ** (b ** c)`.
<a name="exponential-expression"></a> <a name="exponential-expression"></a>
```abnf ```abnf
@ -1277,7 +1240,7 @@ exponential-expression = unary-expression
/ unary-expression "**" exponential-expression / unary-expression "**" exponential-expression
``` ```
Go to: _[exponential-expression](#user-content-exponential-expression), [unary-expression](#user-content-unary-expression)_; Go to: _[unary-expression](#user-content-unary-expression), [exponential-expression](#user-content-exponential-expression)_;
Next in precedence come multiplication and division, both left-associative. Next in precedence come multiplication and division, both left-associative.
@ -1301,7 +1264,7 @@ additive-expression = multiplicative-expression
/ additive-expression "-" multiplicative-expression / additive-expression "-" multiplicative-expression
``` ```
Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [additive-expression](#user-content-additive-expression)_; Go to: _[additive-expression](#user-content-additive-expression), [multiplicative-expression](#user-content-multiplicative-expression)_;
Next in the precedence order are ordering relations. Next in the precedence order are ordering relations.
@ -1351,7 +1314,7 @@ disjunctive-expression = conjunctive-expression
/ disjunctive-expression "||" conjunctive-expression / disjunctive-expression "||" conjunctive-expression
``` ```
Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [conjunctive-expression](#user-content-conjunctive-expression)_; Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [disjunctive-expression](#user-content-disjunctive-expression)_;
Finally we have conditional expressions. Finally we have conditional expressions.
@ -1396,7 +1359,7 @@ statement = expression-statement
/ block / block
``` ```
Go to: _[assignment-statement](#user-content-assignment-statement), [block](#user-content-block), [variable-definition-statement](#user-content-variable-definition-statement), [return-statement](#user-content-return-statement), [loop-statement](#user-content-loop-statement), [console-statement](#user-content-console-statement), [conditional-statement](#user-content-conditional-statement), [expression-statement](#user-content-expression-statement)_; Go to: _[return-statement](#user-content-return-statement), [loop-statement](#user-content-loop-statement), [assignment-statement](#user-content-assignment-statement), [expression-statement](#user-content-expression-statement), [console-statement](#user-content-console-statement), [block](#user-content-block), [conditional-statement](#user-content-conditional-statement), [variable-definition-statement](#user-content-variable-definition-statement)_;
<a name="block"></a> <a name="block"></a>
@ -1415,8 +1378,7 @@ expression-statement = expression ";"
Go to: _[expression](#user-content-expression)_; Go to: _[expression](#user-content-expression)_;
A return statement always takes an expression, A return statement always takes an expression, and ends with a semicolon.
and does not end with a semicolon.
<a name="return-statement"></a> <a name="return-statement"></a>
```abnf ```abnf
@ -1439,7 +1401,7 @@ variable-definition-statement = ( %s"let" / %s"const" )
[ ":" type ] "=" expression ";" [ ":" type ] "=" expression ";"
``` ```
Go to: _[identifier-or-identifiers](#user-content-identifier-or-identifiers), [expression](#user-content-expression), [type](#user-content-type)_; Go to: _[type](#user-content-type), [identifier-or-identifiers](#user-content-identifier-or-identifiers), [expression](#user-content-expression)_;
<a name="identifier-or-identifiers"></a> <a name="identifier-or-identifiers"></a>
@ -1472,7 +1434,7 @@ conditional-statement = branch
/ branch %s"else" conditional-statement / branch %s"else" conditional-statement
``` ```
Go to: _[branch](#user-content-branch), [conditional-statement](#user-content-conditional-statement), [block](#user-content-block)_; Go to: _[block](#user-content-block), [conditional-statement](#user-content-conditional-statement), [branch](#user-content-branch)_;
A loop statement implicitly defines a loop variable A loop statement implicitly defines a loop variable
@ -1484,11 +1446,11 @@ The body is a block.
loop-statement = %s"for" identifier %s"in" expression ".." expression block loop-statement = %s"for" identifier %s"in" expression ".." expression block
``` ```
Go to: _[block](#user-content-block), [identifier](#user-content-identifier), [expression](#user-content-expression)_; Go to: _[block](#user-content-block), [expression](#user-content-expression), [identifier](#user-content-identifier)_;
An assignment statement is straightforward. An assignment statement is straightforward.
Based on the operator, the assignment may be simple (i.e. '=') Based on the operator, the assignment may be simple (i.e. `=`)
or compound (i.e. combining assignment with an arithmetic operation). or compound (i.e. combining assignment with an arithmetic operation).
<a name="assignment-operator"></a> <a name="assignment-operator"></a>
@ -1504,13 +1466,13 @@ assignment-statement = expression assignment-operator expression ";"
Go to: _[expression](#user-content-expression), [assignment-operator](#user-content-assignment-operator)_; Go to: _[expression](#user-content-expression), [assignment-operator](#user-content-assignment-operator)_;
Console statements start with the 'console' keyword, Console statements start with the `console` keyword,
followed by a console function call. followed by a console function call.
The call may be an assertion or a print command. The call may be an assertion or a print command.
The former takes an expression (which must be boolean) as argument. The former takes an expression (which must be boolean) as argument.
The latter takes either no argument, The latter takes either no argument,
or a format string followed by expressions, or a format string followed by expressions,
whose number must match the number of containers '{}' in the format string. whose number must match the number of containers `{}` in the format string.
Note that the console function names are identifiers, not keywords. Note that the console function names are identifiers, not keywords.
There are three kinds of print commands. There are three kinds of print commands.
@ -1557,10 +1519,10 @@ Go to: _[format-string](#user-content-format-string)_;
print-call = print-function print-arguments print-call = print-function print-arguments
``` ```
Go to: _[print-function](#user-content-print-function), [print-arguments](#user-content-print-arguments)_; Go to: _[print-arguments](#user-content-print-arguments), [print-function](#user-content-print-function)_;
An annotation consists of an annotation name (which starts with '@') An annotation consists of an annotation name (which starts with `@`)
with optional annotation arguments, which are identifiers. with optional annotation arguments, which are identifiers.
Note that no parentheses are used if there are no arguments. Note that no parentheses are used if there are no arguments.
@ -1578,8 +1540,7 @@ The output type is optional, defaulting to the empty tuple type.
In general, a function input consists of an identifier and a type, In general, a function input consists of an identifier and a type,
with an optional 'const' modifier. with an optional 'const' modifier.
Additionally, functions inside circuits Additionally, functions inside circuits
may start with a 'mut self' or 'const self' or 'self' parameter. may start with a `mut self` or `const self` or `self` parameter.
Furthermore, any function may end with an 'input' parameter.
<a name="function-declaration"></a> <a name="function-declaration"></a>
```abnf ```abnf
@ -1588,7 +1549,7 @@ function-declaration = *annotation %s"function" identifier
block block
``` ```
Go to: _[block](#user-content-block), [function-parameters](#user-content-function-parameters), [identifier](#user-content-identifier), [type](#user-content-type)_; Go to: _[type](#user-content-type), [block](#user-content-block), [identifier](#user-content-identifier), [function-parameters](#user-content-function-parameters)_;
<a name="function-parameters"></a> <a name="function-parameters"></a>
@ -1598,7 +1559,7 @@ function-parameters = self-parameter
/ function-inputs / function-inputs
``` ```
Go to: _[self-parameter](#user-content-self-parameter), [function-inputs](#user-content-function-inputs)_; Go to: _[function-inputs](#user-content-function-inputs), [self-parameter](#user-content-self-parameter)_;
<a name="self-parameter"></a> <a name="self-parameter"></a>
@ -1622,11 +1583,6 @@ function-input = [ %s"const" ] identifier ":" type
Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_; Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_;
<a name="input-parameter"></a>
```abnf
input-parameter = %s"input"
```
A circuit member variable declaration consists of an identifier and a type. A circuit member variable declaration consists of an identifier and a type.
A circuit member function declaration consists of a function declaration. A circuit member function declaration consists of a function declaration.
@ -1636,7 +1592,7 @@ member-declaration = member-variable-declaration
/ member-function-declaration / member-function-declaration
``` ```
Go to: _[member-function-declaration](#user-content-member-function-declaration), [member-variable-declaration](#user-content-member-variable-declaration)_; Go to: _[member-variable-declaration](#user-content-member-variable-declaration), [member-function-declaration](#user-content-member-function-declaration)_;
<a name="member-variable-declaration"></a> <a name="member-variable-declaration"></a>
@ -1644,7 +1600,7 @@ Go to: _[member-function-declaration](#user-content-member-function-declaration)
member-variable-declaration = identifier ":" type member-variable-declaration = identifier ":" type
``` ```
Go to: _[type](#user-content-type), [identifier](#user-content-identifier)_; Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_;
<a name="member-function-declaration"></a> <a name="member-function-declaration"></a>
@ -1667,7 +1623,7 @@ circuit-declaration = *annotation %s"circuit" identifier
Go to: _[identifier](#user-content-identifier), [member-declaration](#user-content-member-declaration)_; Go to: _[identifier](#user-content-identifier), [member-declaration](#user-content-member-declaration)_;
An import declaration consists of the 'import' keyword An import declaration consists of the `import` keyword
followed by a package path, which may be one of the following: followed by a package path, which may be one of the following:
a single wildcard; a single wildcard;
an identifier, optionally followed by a local renamer; an identifier, optionally followed by a local renamer;
@ -1693,7 +1649,7 @@ package-path = "*"
/ "(" package-path *( "," package-path ) [","] ")" / "(" package-path *( "," package-path ) [","] ")"
``` ```
Go to: _[package-path](#user-content-package-path), [package-name](#user-content-package-name), [identifier](#user-content-identifier)_; Go to: _[package-name](#user-content-package-name), [package-path](#user-content-package-path), [identifier](#user-content-identifier)_;
Finally, we define a file as a sequence of zero or more declarations. Finally, we define a file as a sequence of zero or more declarations.
@ -1705,7 +1661,7 @@ declaration = import-declaration
/ circuit-declaration / circuit-declaration
``` ```
Go to: _[import-declaration](#user-content-import-declaration), [function-declaration](#user-content-function-declaration), [circuit-declaration](#user-content-circuit-declaration)_; Go to: _[function-declaration](#user-content-function-declaration), [circuit-declaration](#user-content-circuit-declaration), [import-declaration](#user-content-import-declaration)_;
<a name="file"></a> <a name="file"></a>
@ -1720,16 +1676,18 @@ file = *declaration
Format Note Format Note
----------- -----------
The ABNF standard requires grammars to consist of lines terminated by CR LF The ABNF standard requires grammars
to consist of lines terminated by `<CR><LF>`
(i.e. carriage return followed by line feed, DOS/Windows-style), (i.e. carriage return followed by line feed, DOS/Windows-style),
as explained in the background on ABNF earlier in this file. as explained in the background on ABNF earlier in this file.
This file's lines are therefore terminated by CR LF. This file's lines are therefore terminated by `<CR><LF>`.
To avoid losing this requirement across systems, To avoid losing this requirement across systems,
this file is marked as 'text eol=crlf' in .gitattributes: this file is marked as `text eol=crlf` in `.gitattributes`:
this means that the file is textual, enabling visual diffs, this means that the file is textual, enabling visual diffs,
but its lines will always be terminated by CR LF on any system. but its lines will always be terminated by `<CR><LF>` on any system.
Note that this CR LF requirement only applies to the grammar files themselves. Note that this `<CR><LF>` requirement only applies
to the grammar files themselves.
It does not apply to the lines of the languages described by the grammar. It does not apply to the lines of the languages described by the grammar.
ABNF grammars may describe any kind of languages, ABNF grammars may describe any kind of languages,
with any kind of line terminators, with any kind of line terminators,

View File

@ -53,59 +53,59 @@
; Instead of BNF's angle-bracket notation for nonterminals, ; Instead of BNF's angle-bracket notation for nonterminals,
; ABNF uses case-insensitive names consisting of letters, digits, and dashes, ; ABNF uses case-insensitive names consisting of letters, digits, and dashes,
; e.g. HTTP-message and IPv6address. ; e.g. `HTTP-message` and `IPv6address`.
; ABNF includes an angle-bracket notation for prose descriptions, ; ABNF includes an angle-bracket notation for prose descriptions,
; e.g. <host, see [RFC3986], Section 3.2.2>, ; e.g. `<host, see [RFC3986], Section 3.2.2>`,
; usable as last resort in the definiens of a nonterminal. ; usable as last resort in the definiens of a nonterminal.
; While BNF allows arbitrary terminals, ; While BNF allows arbitrary terminals,
; ABNF uses only natural numbers as terminals, ; ABNF uses only natural numbers as terminals,
; and denotes them via: ; and denotes them via:
; (i) binary, decimal, or hexadecimal sequences, ; (i) binary, decimal, or hexadecimal sequences,
; e.g. %b1.11.1010, %d1.3.10, and %x.1.3.A ; e.g. `%b1.11.1010`, `%d1.3.10`, and `%x.1.3.A`
; all denote the sequence of terminals '1 3 10'; ; all denote the sequence of terminals [1, 3, 10];
; (ii) binary, decimal, or hexadecimal ranges, ; (ii) binary, decimal, or hexadecimal ranges,
; e.g. %x30-39 denotes any singleton sequence of terminals ; e.g. `%x30-39` denotes any singleton sequence of terminals
; 'n' with 48 <= n <= 57 (an ASCII digit); ; [_n_] with 48 <= _n_ <= 57 (an ASCII digit);
; (iii) case-sensitive ASCII strings, ; (iii) case-sensitive ASCII strings,
; e.g. %s"Ab" denotes the sequence of terminals '65 98'; ; e.g. `%s"Ab"` denotes the sequence of terminals [65, 98];
; and (iv) case-insensitive ASCII strings, ; and (iv) case-insensitive ASCII strings,
; e.g. %i"ab", or just "ab", denotes ; e.g. `%i"ab"`, or just `"ab"`, denotes
; any sequence of terminals among ; any sequence of terminals among
; '65 66', ; [65, 66],
; '65 98', ; [65, 98],
; '97 66', and ; [97, 66], and
; '97 98'. ; [97, 98].
; ABNF terminals in suitable sets represent ASCII or Unicode characters. ; ABNF terminals in suitable sets represent ASCII or Unicode characters.
; ABNF allows repetition prefixes n*m, ; ABNF allows repetition prefixes `n*m`,
; where n and m are natural numbers in decimal notation; ; where `n` and `m` are natural numbers in decimal notation;
; if absent, ; if absent,
; n defaults to 0, and ; `n` defaults to 0, and
; m defaults to infinity. ; `m` defaults to infinity.
; For example, ; For example,
; 1*4HEXDIG denotes one to four HEXDIGs, ; `1*4HEXDIG` denotes one to four `HEXDIG`s,
; *3DIGIT denotes up to three DIGITs, and ; `*3DIGIT` denotes up to three `DIGIT`s, and
; 1*OCTET denotes one or more OCTETs. ; `1*OCTET` denotes one or more `OCTET`s.
; A single n prefix ; A single `n` prefix
; abbreviates n*n, ; abbreviates `n*n`,
; e.g. 3DIGIT denotes three DIGITs. ; e.g. `3DIGIT` denotes three `DIGIT`s.
; Instead of BNF's |, ABNF uses / to separate alternatives. ; Instead of BNF's `|`, ABNF uses `/` to separate alternatives.
; Repetition prefixes have precedence over juxtapositions, ; Repetition prefixes have precedence over juxtapositions,
; which have precedence over /. ; which have precedence over `/`.
; Round brackets group things and override the aforementioned precedence rules, ; Round brackets group things and override the aforementioned precedence rules,
; e.g. *(WSP / CRLF WSP) denotes sequences of terminals ; e.g. `*(WSP / CRLF WSP)` denotes sequences of terminals
; obtained by repeating, zero or more times, ; obtained by repeating, zero or more times,
; either (i) a WSP or (ii) a CRLF followed by a WSP. ; either (i) a `WSP` or (ii) a `CRLF` followed by a `WSP`.
; Square brackets also group things but make them optional, ; Square brackets also group things but make them optional,
; e.g. [":" port] is equivalent to 0*1(":" port). ; e.g. `[":" port]` is equivalent to `0*1(":" port)`.
; Instead of BNF's ::=, ABNF uses = to define nonterminals, ; Instead of BNF's `::=`, ABNF uses `=` to define nonterminals,
; and =/ to incrementally add alternatives ; and `=/` to incrementally add alternatives
; to previously defined nonterminals. ; to previously defined nonterminals.
; For example, the rule BIT = "0" / "1" ; For example, the rule `BIT = "0" / "1"`
; is equivalent to BIT = "0" followed by BIT =/ "1". ; is equivalent to `BIT = "0"` followed by `BIT =/ "1"`.
; The syntax of ABNF itself is formally specified in ABNF ; The syntax of ABNF itself is formally specified in ABNF
; (in Section 4 of the aforementioned RFC 5234, ; (in Section 4 of the aforementioned RFC 5234,
@ -125,7 +125,7 @@
; This ABNF grammar consists of two (sub-)grammars: ; This ABNF grammar consists of two (sub-)grammars:
; (i) a lexical grammar that describes how ; (i) a lexical grammar that describes how
; sequence of characters are parsed into tokens, and ; sequence of characters are parsed into tokens, and
; (ii) a syntactic grammar that described how ; (ii) a syntactic grammar that describes how
; tokens are parsed into expressions, statements, etc. ; tokens are parsed into expressions, statements, etc.
; The adjectives 'lexical' and 'syntactic' are ; The adjectives 'lexical' and 'syntactic' are
; the same ones used in the Java language reference, ; the same ones used in the Java language reference,
@ -180,8 +180,8 @@
; / additive-expression "-" multiplicative-expression ; / additive-expression "-" multiplicative-expression
; ;
; These rules tell us ; These rules tell us
; that the additive operators '+' and '-' have lower precedence ; that the additive operators `+` and `-` have lower precedence
; than the multiplicative operators '*' and '/', ; than the multiplicative operators `*` and `/`,
; and that both the additive and multiplicative operators associate to the left. ; and that both the additive and multiplicative operators associate to the left.
; This may be best understood via the examples given below. ; This may be best understood via the examples given below.
@ -239,7 +239,7 @@
; This ABNF grammar uses nonterminal names ; This ABNF grammar uses nonterminal names
; that consist of complete English words, separated by dashes, ; that consist of complete English words, separated by dashes,
; and that describe the construct the way it is in English. ; and that describe the construct the way it is in English.
; For instance, we use the name 'conditional-statement' ; For instance, we use the name `conditional-statement`
; to describe conditional statements. ; to describe conditional statements.
; At the same time, this grammar establishes ; At the same time, this grammar establishes
@ -284,8 +284,8 @@
; A Leo file is a finite sequence of Unicode characters, ; A Leo file is a finite sequence of Unicode characters,
; represented as Unicode code points, ; represented as Unicode code points,
; which are numbers in the range form 0 to 10FFFFh. ; which are numbers in the range from 0 to 10FFFFh.
; These are captured by the ABNF rule 'character' below. ; These are captured by the ABNF rule `character` below.
; The lexical grammar defines how, at least conceptually, ; The lexical grammar defines how, at least conceptually,
; the sequence of characters is turned into ; the sequence of characters is turned into
@ -293,20 +293,20 @@
; these entities are all defined by the grammar rules below. ; these entities are all defined by the grammar rules below.
; As stated, the lexical grammar alone is ambiguous. ; As stated, the lexical grammar alone is ambiguous.
; For example, the sequence of characters '**' (i.e. two stars) ; For example, the sequence of characters `**` (i.e. two stars)
; could be equally parsed as two '*' symbol tokens or one '**' symbol token ; could be equally parsed as two `*` symbol tokens or one `**` symbol token
; (see rule for 'symbol' below). ; (see rule for `symbol` below).
; As another example, the sequence or characters '<CR><LF>' ; As another example, the sequence or characters `<CR><LF>`
; (i.e. carriage return followed by line feed) ; (i.e. carriage return followed by line feed)
; could be equally parsed as two line terminators or one ; could be equally parsed as two line terminators or one
; (see rule for 'newline'). ; (see rule for `newline`).
; Thus, as often done in language syntax definitions, ; Thus, as often done in language syntax definitions,
; the lexical grammar is disambiguated by ; the lexical grammar is disambiguated by
; the extra-grammatical requirement that ; the extra-grammatical requirement that
; the longest possible sequence of characters is always parsed. ; the longest possible sequence of characters is always parsed.
; This way, '**' must be parsed as one '**' symbol token, ; This way, `**` must be parsed as one `**` symbol token,
; and '<CR><LF>' must be parsed as one line terminator. ; and `<CR><LF>` must be parsed as one line terminator.
; As mentioned above, a character is any Unicode code point. ; As mentioned above, a character is any Unicode code point.
; This grammar does not say how those are encoded in files (e.g. UTF-8): ; This grammar does not say how those are encoded in files (e.g. UTF-8):
@ -318,15 +318,15 @@ character = %x0-10FFFF ; any Unicode code point
; We give names to certain ASCII characters. ; We give names to certain ASCII characters.
horizontal-tab = %x9 horizontal-tab = %x9 ; <HT>
line-feed = %xA line-feed = %xA ; <LF>
carriage-return = %xD carriage-return = %xD ; <CR>
space = %x20 space = %x20 ; <SP>
double-quote = %x22 double-quote = %x22 ; "
; We give names to complements of certain ASCII characters. ; We give names to complements of certain ASCII characters.
; These consist of all the Unicode characters except for one or two. ; These consist of all the Unicode characters except for one or two.
@ -336,9 +336,16 @@ not-double-quote = %x0-22 / %x24-10FFFF ; anything but "
not-star = %x0-29 / %x2B-10FFFF ; anything but * not-star = %x0-29 / %x2B-10FFFF ; anything but *
not-line-feed-or-carriage-return = %x0-9 / %xB-C / %xE-10FFFF not-line-feed-or-carriage-return = %x0-9 / %xB-C / %xE-10FFFF
; anything but LF or CR ; anything but <LF> or <CR>
not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF ; anything but * or / not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF
; anything but " or {
not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF
; anything but " or }
not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF
; anything but * or /
; Lines in Leo may be terminated via ; Lines in Leo may be terminated via
; a single carriage return, ; a single carriage return,
@ -355,12 +362,12 @@ newline = line-feed / carriage-return / carriage-return line-feed
whitespace = space / horizontal-tab / newline whitespace = space / horizontal-tab / newline
; There are two kinds of comments in Leo, as in other languages. ; There are two kinds of comments in Leo, as in other languages.
; One is block comments of the form '/* ... */', ; One is block comments of the form `/* ... */`,
; and the other is end-of-line comments of the form '// ...'. ; and the other is end-of-line comments of the form `// ...`.
; The first kind start at '/*' and end at the first '*/', ; The first kind start at `/*` and end at the first `*/`,
; possibly spanning multiple (partial) lines; ; possibly spanning multiple (partial) lines;
; these do no nest. ; these do no nest.
; The second kind start at '//' and extend till the end of the line. ; The second kind start at `//` and extend till the end of the line.
; The rules about comments given below are similar to ; The rules about comments given below are similar to
; the ones used in the Java language reference. ; the ones used in the Java language reference.
@ -440,57 +447,30 @@ package-name = 1*( lowercase-letter / digit )
; A format string is a sequence of characters, other than double quote, ; A format string is a sequence of characters, other than double quote,
; surrounded by double quotes. ; surrounded by double quotes.
; Within a format string, sub-strings '{}' are distinguished as containers ; Within a format string, sub-strings `{}` are distinguished as containers
; (these are the ones that may be matched with values ; (these are the ones that may be matched with values
; whose textual representation replaces the containers ; whose textual representation replaces the containers
; in the printed string). ; in the printed string).
; There is an implicit extra-grammatical requirements that
; the explicit 'format-string-container' instances include
; all the occurrences of '{}' in the parsed character sequence:
; that is, there may not be two contiguous 'not-double-quote' instances
; that are '{' and '}'.
format-string-container = "{}" format-string-container = "{}"
not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF
not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF
format-string-element = not-double-quote-or-open-brace format-string-element = not-double-quote-or-open-brace
/ "{" not-double-quote-or-close-brace / "{" not-double-quote-or-close-brace
/ format-string-container / format-string-container
format-string = double-quote *format-string-element double-quote format-string = double-quote *format-string-element double-quote
; Here is (part of this ABNF comment), ; Annotations have names, which are identifiers immediately preceded by `@`.
; an alternative way to specify format strings,
; which captures the extra-grammatical requirement above in the grammar,
; but is more complicated:
;
; not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF
;
; not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF
;
; format-string-element = not-double-quote-or-open-brace
; / "{" not-double-quote-or-close-brace
; / format-string-container
;
; format-string = double-quote *format-string-element double-quote
;
; It is not immediately clear which approach is better; there are tradeoffs.
; We may choose to adopt this one in future revisions of the grammar.
; Annotations have names, which are identifiers immediately preceded by '@'.
annotation-name = "@" identifier annotation-name = "@" identifier
; A natural (number) is a sequence of one or more digits. ; A natural (number) is a sequence of one or more digits.
; We allow leading zeros, e.g. '007'. ; We allow leading zeros, e.g. `007`.
natural = 1*digit natural = 1*digit
; An integer (number) is either a natural or its negation. ; An integer (number) is either a natural or its negation.
; We allow leading zeros also in negative numbers, e.g. '-007'. ; We allow leading zeros also in negative numbers, e.g. `-007`.
integer = [ "-" ] natural integer = [ "-" ] natural
@ -522,7 +502,7 @@ product-group-literal = integer %s"group"
boolean-literal = %s"true" / %s"false" boolean-literal = %s"true" / %s"false"
; An address literal starts with 'aleo1' ; An address literal starts with `aleo1`
; and continues with exactly 58 lowercase letters and digits. ; and continues with exactly 58 lowercase letters and digits.
; Thus an address always consists of 63 characters. ; Thus an address always consists of 63 characters.
@ -541,12 +521,12 @@ atomic-literal = untyped-literal
/ address-literal / address-literal
; After defining the (mostly) alphanumeric tokens above, ; After defining the (mostly) alphanumeric tokens above,
; it remains to define tokens for non-alphanumeric symbols such as "+" and "(". ; it remains to define tokens for non-alphanumeric symbols such as `+` and `(`.
; Different programming languages used different terminologies for these, ; Different programming languages used different terminologies for these,
; e.g. operators, separators, punctuators, etc. ; e.g. operators, separators, punctuators, etc.
; Here we use 'symbol', for all of them. ; Here we use `symbol`, for all of them.
; We also include a token consisting of ; We also include a token consisting of
; a closing parenthesis immediately followed by 'group': ; a closing parenthesis `)` immediately followed by `group`:
; as defined in the syntactic grammar, ; as defined in the syntactic grammar,
; this is the final part of an affine group literal; ; this is the final part of an affine group literal;
; even though it includes letters, ; even though it includes letters,
@ -558,7 +538,7 @@ atomic-literal = untyped-literal
; ;
; equality-operator = "==" ; equality-operator = "=="
; ;
; and defining 'symbol' in terms of those ; and defining `symbol` in terms of those
; ;
; symbol = ... / equality-operator / ... ; symbol = ... / equality-operator / ...
; ;
@ -567,7 +547,7 @@ atomic-literal = untyped-literal
; namely the exact names of some of these token. ; namely the exact names of some of these token.
; On the other hand, at least some of them are perhaps simple enough ; On the other hand, at least some of them are perhaps simple enough
; that they could be just described in terms of their symbols, ; that they could be just described in terms of their symbols,
; e.g. 'double dot', 'question mark', etc. ; e.g. double dot, question mark, etc.
symbol = "!" / "&&" / "||" symbol = "!" / "&&" / "||"
/ "==" / "!=" / "==" / "!="
@ -632,7 +612,7 @@ address-type = %s"address"
scalar-type = boolean-type / arithmetic-type / address-type scalar-type = boolean-type / arithmetic-type / address-type
; Circuit types are denoted by identifiers and the keyword 'Self'. ; Circuit types are denoted by identifiers and the keyword `Self`.
; The latter is only allowed inside a circuit definition, ; The latter is only allowed inside a circuit definition,
; to denote the circuit being defined. ; to denote the circuit being defined.
@ -683,7 +663,7 @@ affine-group-literal = "(" group-coordinate "," group-coordinate %s")group"
literal = atomic-literal / affine-group-literal literal = atomic-literal / affine-group-literal
; The following rule is not directly referenced in the rules for expressions ; The following rule is not directly referenced in the rules for expressions
; (which reference 'literal' instead), ; (which reference `literal` instead),
; but it is useful to establish terminology: ; but it is useful to establish terminology:
; a group literal is either a product group literal or an affine group literal. ; a group literal is either a product group literal or an affine group literal.
@ -722,7 +702,7 @@ tuple-expression = tuple-construction
; Array expressions construct arrays. ; Array expressions construct arrays.
; There are two kinds: ; There are two kinds:
; one lists the element expressions (at least one), ; one lists the element expressions (at least one),
; including spreads (via '...') which are arrays being spliced in; ; including spreads (via `...`) which are arrays being spliced in;
; the other repeats (the value of) a single expression ; the other repeats (the value of) a single expression
; across one or more dimensions. ; across one or more dimensions.
@ -749,7 +729,8 @@ array-expression = array-construction
; so they are syntactically identical but semantically different. ; so they are syntactically identical but semantically different.
circuit-construction = circuit-type "{" circuit-construction = circuit-type "{"
circuit-inline-element *( "," circuit-inline-element ) [ "," ] circuit-inline-element
*( "," circuit-inline-element ) [ "," ]
"}" "}"
circuit-inline-element = identifier ":" expression / identifier circuit-inline-element = identifier ":" expression / identifier
@ -797,8 +778,8 @@ unary-expression = postfix-expression
; Next in the operator precedence is exponentiation, ; Next in the operator precedence is exponentiation,
; following mathematical practice. ; following mathematical practice.
; The current rule below makes exponentiation left-associative, ; The current rule below makes exponentiation right-associative,
; i.e. 'a ** b ** c' must be parsed as '(a ** b) ** c'. ; i.e. `a ** b ** c` must be parsed as `a ** (b ** c)`.
exponential-expression = unary-expression exponential-expression = unary-expression
/ unary-expression "**" exponential-expression / unary-expression "**" exponential-expression
@ -875,8 +856,7 @@ block = "{" *statement "}"
expression-statement = expression ";" expression-statement = expression ";"
; A return statement always takes an expression, ; A return statement always takes an expression, and ends with a semicolon.
; and does not end with a semicolon.
return-statement = %s"return" expression ";" return-statement = %s"return" expression ";"
@ -912,20 +892,20 @@ conditional-statement = branch
loop-statement = %s"for" identifier %s"in" expression ".." expression block loop-statement = %s"for" identifier %s"in" expression ".." expression block
; An assignment statement is straightforward. ; An assignment statement is straightforward.
; Based on the operator, the assignment may be simple (i.e. '=') ; Based on the operator, the assignment may be simple (i.e. `=`)
; or compound (i.e. combining assignment with an arithmetic operation). ; or compound (i.e. combining assignment with an arithmetic operation).
assignment-operator = "=" / "+=" / "-=" / "*=" / "/=" / "**=" assignment-operator = "=" / "+=" / "-=" / "*=" / "/=" / "**="
assignment-statement = expression assignment-operator expression ";" assignment-statement = expression assignment-operator expression ";"
; Console statements start with the 'console' keyword, ; Console statements start with the `console` keyword,
; followed by a console function call. ; followed by a console function call.
; The call may be an assertion or a print command. ; The call may be an assertion or a print command.
; The former takes an expression (which must be boolean) as argument. ; The former takes an expression (which must be boolean) as argument.
; The latter takes either no argument, ; The latter takes either no argument,
; or a format string followed by expressions, ; or a format string followed by expressions,
; whose number must match the number of containers '{}' in the format string. ; whose number must match the number of containers `{}` in the format string.
; Note that the console function names are identifiers, not keywords. ; Note that the console function names are identifiers, not keywords.
; There are three kinds of print commands. ; There are three kinds of print commands.
@ -942,7 +922,7 @@ print-arguments = "(" [ format-string *( "," expression ) ] ")"
print-call = print-function print-arguments print-call = print-function print-arguments
; An annotation consists of an annotation name (which starts with '@') ; An annotation consists of an annotation name (which starts with `@`)
; with optional annotation arguments, which are identifiers. ; with optional annotation arguments, which are identifiers.
; Note that no parentheses are used if there are no arguments. ; Note that no parentheses are used if there are no arguments.
@ -954,8 +934,7 @@ annotation = annotation-name
; In general, a function input consists of an identifier and a type, ; In general, a function input consists of an identifier and a type,
; with an optional 'const' modifier. ; with an optional 'const' modifier.
; Additionally, functions inside circuits ; Additionally, functions inside circuits
; may start with a 'mut self' or 'const self' or 'self' parameter. ; may start with a `mut self` or `const self` or `self` parameter.
; Furthermore, any function may end with an 'input' parameter.
function-declaration = *annotation %s"function" identifier function-declaration = *annotation %s"function" identifier
"(" [ function-parameters ] ")" [ "->" type ] "(" [ function-parameters ] ")" [ "->" type ]
@ -971,8 +950,6 @@ function-inputs = function-input *( "," function-input )
function-input = [ %s"const" ] identifier ":" type function-input = [ %s"const" ] identifier ":" type
input-parameter = %s"input"
; A circuit member variable declaration consists of an identifier and a type. ; A circuit member variable declaration consists of an identifier and a type.
; A circuit member function declaration consists of a function declaration. ; A circuit member function declaration consists of a function declaration.
@ -989,7 +966,7 @@ member-function-declaration = function-declaration
circuit-declaration = *annotation %s"circuit" identifier circuit-declaration = *annotation %s"circuit" identifier
"{" member-declaration *( "," member-declaration ) "}" "{" member-declaration *( "," member-declaration ) "}"
; An import declaration consists of the 'import' keyword ; An import declaration consists of the `import` keyword
; followed by a package path, which may be one of the following: ; followed by a package path, which may be one of the following:
; a single wildcard; ; a single wildcard;
; an identifier, optionally followed by a local renamer; ; an identifier, optionally followed by a local renamer;
@ -1019,16 +996,18 @@ file = *declaration
; Format Note ; Format Note
; ----------- ; -----------
; The ABNF standard requires grammars to consist of lines terminated by CR LF ; The ABNF standard requires grammars
; to consist of lines terminated by `<CR><LF>`
; (i.e. carriage return followed by line feed, DOS/Windows-style), ; (i.e. carriage return followed by line feed, DOS/Windows-style),
; as explained in the background on ABNF earlier in this file. ; as explained in the background on ABNF earlier in this file.
; This file's lines are therefore terminated by CR LF. ; This file's lines are therefore terminated by `<CR><LF>`.
; To avoid losing this requirement across systems, ; To avoid losing this requirement across systems,
; this file is marked as 'text eol=crlf' in .gitattributes: ; this file is marked as `text eol=crlf` in `.gitattributes`:
; this means that the file is textual, enabling visual diffs, ; this means that the file is textual, enabling visual diffs,
; but its lines will always be terminated by CR LF on any system. ; but its lines will always be terminated by `<CR><LF>` on any system.
; Note that this CR LF requirement only applies to the grammar files themselves. ; Note that this `<CR><LF>` requirement only applies
; to the grammar files themselves.
; It does not apply to the lines of the languages described by the grammar. ; It does not apply to the lines of the languages described by the grammar.
; ABNF grammars may describe any kind of languages, ; ABNF grammars may describe any kind of languages,
; with any kind of line terminators, ; with any kind of line terminators,

View File

@ -22,25 +22,24 @@ use reqwest::{
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Trait describes API Routes and Request bodies, struct which implements /// API Routes and Request bodies.
/// Route MUST also support Serialize to be usable in Api::run_route(r: Route) /// Structs that implement Route MUST also support Serialize to be usable in Api::run_route(r: Route)
pub trait Route { pub trait Route {
/// Whether to use bearer auth or not. Some routes may have additional /// [`true`] if a route supports bearer authentication.
/// features for logged-in users, so authorization token should be sent /// For example, the login route.
/// if it is created of course
const AUTH: bool; const AUTH: bool;
/// HTTP method to use when requesting /// The HTTP method to use when requesting.
const METHOD: Method; const METHOD: Method;
/// URL path without first forward slash (e.g. v1/package/fetch) /// The URL path without the first forward slash (e.g. v1/package/fetch)
const PATH: &'static str; const PATH: &'static str;
/// Output type for this route. For login it is simple - String /// The output type for this route. For example, the login route output is [`String`].
/// But for other routes may be more complex. /// But for other routes may be more complex.
type Output; type Output;
/// Process reqwest Response and turn it into Output /// Process the reqwest Response and turn it into an Output.
fn process(&self, res: Response) -> Result<Self::Output>; fn process(&self, res: Response) -> Result<Self::Output>;
/// Transform specific status codes into correct errors for this route. /// Transform specific status codes into correct errors for this route.
@ -50,18 +49,18 @@ pub trait Route {
} }
} }
/// REST API handler with reqwest::blocking inside /// REST API handler with reqwest::blocking inside.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Api { pub struct Api {
host: String, host: String,
client: Client, client: Client,
/// Authorization token for API requests /// Authorization token for API requests.
auth_token: Option<String>, auth_token: Option<String>,
} }
impl Api { impl Api {
/// Create new instance of API, set host and Client is going to be /// Returns a new instance of API.
/// created and set automatically /// The set host and Client are created automatically.
pub fn new(host: String, auth_token: Option<String>) -> Api { pub fn new(host: String, auth_token: Option<String>) -> Api {
Api { Api {
client: Client::new(), client: Client::new(),
@ -70,18 +69,23 @@ impl Api {
} }
} }
/// Get token for bearer auth, should be passed into Api through Context pub fn host(&self) -> &str {
&*self.host
}
/// Returns the token for bearer auth, otherwise None.
/// The [`auth_token`] should be passed into the Api through Context.
pub fn auth_token(&self) -> Option<String> { pub fn auth_token(&self) -> Option<String> {
self.auth_token.clone() self.auth_token.clone()
} }
/// Set authorization token for future requests /// Set the authorization token for future requests.
pub fn set_auth_token(&mut self, token: String) { pub fn set_auth_token(&mut self, token: String) {
self.auth_token = Some(token); self.auth_token = Some(token);
} }
/// Run specific route struct. Turn struct into request body /// Run specific route struct. Turn struct into request body
/// and use type constants and Route implementation to get request params /// and use type constants and Route implementation to get request params.
pub fn run_route<T>(&self, route: T) -> Result<T::Output> pub fn run_route<T>(&self, route: T) -> Result<T::Output>
where where
T: Route, T: Route,
@ -100,7 +104,9 @@ impl Api {
}; };
// only one error is possible here // only one error is possible here
let res = res.send().map_err(|_| anyhow!("Unable to connect to Aleo PM"))?; let res = res.send().map_err(|_| {
anyhow!("Unable to connect to Aleo PM. If you specified custom API endpoint, then check the URL for errors")
})?;
// where magic begins // where magic begins
route.process(res) route.process(res)
@ -143,7 +149,7 @@ impl Route for Fetch {
// TODO: we should return 404 on not found author/package // TODO: we should return 404 on not found author/package
// and return BAD_REQUEST if data format is incorrect or some of the arguments // and return BAD_REQUEST if data format is incorrect or some of the arguments
// were not passed // were not passed
StatusCode::NOT_FOUND => anyhow!("Package is hidden"), StatusCode::NOT_FOUND => anyhow!("Package not found"),
_ => anyhow!("Unknown API error: {}", status), _ => anyhow!("Unknown API error: {}", status),
} }
} }
@ -183,7 +189,7 @@ impl Route for Login {
} }
/// Handler for 'my_profile' route. Meant to be used to get profile details but /// Handler for 'my_profile' route. Meant to be used to get profile details but
/// in current application is used to check if user is logged in. Any non-200 response /// in the current application it is used to check if the user is logged in. Any non-200 response
/// is treated as Unauthorized. /// is treated as Unauthorized.
#[derive(Serialize)] #[derive(Serialize)]
pub struct Profile {} pub struct Profile {}

View File

@ -22,11 +22,11 @@ use leo_compiler::{
use leo_package::{ use leo_package::{
inputs::*, inputs::*,
outputs::{ChecksumFile, CircuitFile, OutputsDirectory, OUTPUTS_DIRECTORY_NAME}, outputs::{ChecksumFile, CircuitFile, OutputsDirectory, OUTPUTS_DIRECTORY_NAME},
source::{LibraryFile, MainFile, LIBRARY_FILENAME, MAIN_FILENAME, SOURCE_DIRECTORY_NAME}, source::{MainFile, MAIN_FILENAME, SOURCE_DIRECTORY_NAME},
}; };
use leo_synthesizer::{CircuitSynthesizer, SerializedCircuit}; use leo_synthesizer::{CircuitSynthesizer, SerializedCircuit};
use anyhow::Result; use anyhow::{anyhow, Result};
use snarkvm_curves::{bls12_377::Bls12_377, edwards_bls12::Fq}; use snarkvm_curves::{bls12_377::Bls12_377, edwards_bls12::Fq};
use snarkvm_r1cs::ConstraintSystem; use snarkvm_r1cs::ConstraintSystem;
use structopt::StructOpt; use structopt::StructOpt;
@ -39,7 +39,7 @@ pub struct Build {}
impl Command for Build { impl Command for Build {
type Input = (); type Input = ();
type Output = Option<(Compiler<'static, Fq, EdwardsGroupType>, bool)>; type Output = (Compiler<'static, Fq, EdwardsGroupType>, bool);
fn log_span(&self) -> Span { fn log_span(&self) -> Span {
tracing::span!(tracing::Level::INFO, "Build") tracing::span!(tracing::Level::INFO, "Build")
@ -65,115 +65,95 @@ impl Command for Build {
tracing::info!("Starting..."); tracing::info!("Starting...");
// Compile the package starting with the lib.leo file
if LibraryFile::exists_at(&package_path) {
// Construct the path to the library file in the source directory
let mut lib_file_path = package_path.clone();
lib_file_path.push(SOURCE_DIRECTORY_NAME);
lib_file_path.push(LIBRARY_FILENAME);
// Log compilation of library file to console
tracing::info!("Compiling library... ({:?})", lib_file_path);
// Compile the library file but do not output
let _program = Compiler::<Fq, EdwardsGroupType>::parse_program_without_input(
package_name.clone(),
lib_file_path,
output_directory.clone(),
thread_leaked_context(),
)?;
tracing::info!("Complete");
};
// Compile the main.leo file along with constraints // Compile the main.leo file along with constraints
if MainFile::exists_at(&package_path) { if !MainFile::exists_at(&package_path) {
// Create the output directory return Err(anyhow!("File main.leo not found in src/ directory"));
OutputsDirectory::create(&package_path)?;
// Construct the path to the main file in the source directory
let mut main_file_path = package_path.clone();
main_file_path.push(SOURCE_DIRECTORY_NAME);
main_file_path.push(MAIN_FILENAME);
// Load the input file at `package_name.in`
let (input_string, input_path) = InputFile::new(&package_name).read_from(&path)?;
// Load the state file at `package_name.in`
let (state_string, state_path) = StateFile::new(&package_name).read_from(&path)?;
// Log compilation of files to console
tracing::info!("Compiling main program... ({:?})", main_file_path);
// Load the program at `main_file_path`
let program = Compiler::<Fq, EdwardsGroupType>::parse_program_with_input(
package_name.clone(),
main_file_path,
output_directory,
&input_string,
&input_path,
&state_string,
&state_path,
thread_leaked_context(),
)?;
// Compute the current program checksum
let program_checksum = program.checksum()?;
// Generate the program on the constraint system and verify correctness
{
let mut cs = CircuitSynthesizer::<Bls12_377> {
constraints: Default::default(),
public_variables: Default::default(),
private_variables: Default::default(),
namespaces: Default::default(),
};
let temporary_program = program.clone();
let output = temporary_program.compile_constraints(&mut cs)?;
tracing::debug!("Compiled output - {:#?}", output);
tracing::info!("Number of constraints - {:#?}", cs.num_constraints());
// Serialize the circuit
let circuit_object = SerializedCircuit::from(cs);
let json = circuit_object.to_json_string().unwrap();
// println!("json: {}", json);
// Write serialized circuit to circuit `.json` file.
let circuit_file = CircuitFile::new(&package_name);
circuit_file.write_to(&path, json)?;
// Check that we can read the serialized circuit file
// let serialized = circuit_file.read_from(&package_path)?;
// Deserialize the circuit
// let deserialized = SerializedCircuit::from_json_string(&serialized).unwrap();
// let _circuit_synthesizer = CircuitSynthesizer::<Bls12_377>::try_from(deserialized).unwrap();
// println!("deserialized {:?}", circuit_synthesizer.num_constraints());
}
// If a checksum file exists, check if it differs from the new checksum
let checksum_file = ChecksumFile::new(&package_name);
let checksum_differs = if checksum_file.exists_at(&package_path) {
let previous_checksum = checksum_file.read_from(&package_path)?;
program_checksum != previous_checksum
} else {
// By default, the checksum differs if there is no checksum to compare against
true
};
// If checksum differs, compile the program
if checksum_differs {
// Write the new checksum to the output directory
checksum_file.write_to(&path, program_checksum)?;
tracing::debug!("Checksum saved ({:?})", path);
}
tracing::info!("Complete");
return Ok(Some((program, checksum_differs)));
} }
Ok(None) // Create the output directory
OutputsDirectory::create(&package_path)?;
// Construct the path to the main file in the source directory
let mut main_file_path = package_path.clone();
main_file_path.push(SOURCE_DIRECTORY_NAME);
main_file_path.push(MAIN_FILENAME);
// Load the input file at `package_name.in`
let (input_string, input_path) = InputFile::new(&package_name).read_from(&path)?;
// Load the state file at `package_name.in`
let (state_string, state_path) = StateFile::new(&package_name).read_from(&path)?;
// Log compilation of files to console
tracing::info!("Compiling main program... ({:?})", main_file_path);
// Load the program at `main_file_path`
let program = Compiler::<Fq, EdwardsGroupType>::parse_program_with_input(
package_name.clone(),
main_file_path,
output_directory,
&input_string,
&input_path,
&state_string,
&state_path,
thread_leaked_context(),
)?;
// Compute the current program checksum
let program_checksum = program.checksum()?;
// Generate the program on the constraint system and verify correctness
{
let mut cs = CircuitSynthesizer::<Bls12_377> {
constraints: Default::default(),
public_variables: Default::default(),
private_variables: Default::default(),
namespaces: Default::default(),
};
let temporary_program = program.clone();
let output = temporary_program.compile_constraints(&mut cs)?;
tracing::debug!("Compiled output - {:#?}", output);
tracing::info!("Number of constraints - {:#?}", cs.num_constraints());
// Serialize the circuit
let circuit_object = SerializedCircuit::from(cs);
let json = circuit_object.to_json_string().unwrap();
// println!("json: {}", json);
// Write serialized circuit to circuit `.json` file.
let circuit_file = CircuitFile::new(&package_name);
circuit_file.write_to(&path, json)?;
// Check that we can read the serialized circuit file
// let serialized = circuit_file.read_from(&package_path)?;
// Deserialize the circuit
// let deserialized = SerializedCircuit::from_json_string(&serialized).unwrap();
// let _circuit_synthesizer = CircuitSynthesizer::<Bls12_377>::try_from(deserialized).unwrap();
// println!("deserialized {:?}", circuit_synthesizer.num_constraints());
}
// If a checksum file exists, check if it differs from the new checksum
let checksum_file = ChecksumFile::new(&package_name);
let checksum_differs = if checksum_file.exists_at(&package_path) {
let previous_checksum = checksum_file.read_from(&package_path)?;
program_checksum != previous_checksum
} else {
// By default, the checksum differs if there is no checksum to compare against
true
};
// If checksum differs, compile the program
if checksum_differs {
// Write the new checksum to the output directory
checksum_file.write_to(&path, program_checksum)?;
tracing::debug!("Checksum saved ({:?})", path);
}
tracing::info!("Complete");
Ok((program, checksum_differs))
} }
} }

View File

@ -18,7 +18,6 @@ use crate::{commands::Command, config::*, context::Context};
use leo_package::LeoPackage; use leo_package::LeoPackage;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use std::env::current_dir;
use structopt::StructOpt; use structopt::StructOpt;
use tracing::span::Span; use tracing::span::Span;
@ -39,9 +38,9 @@ impl Command for Init {
Ok(()) Ok(())
} }
fn apply(self, _: Context, _: Self::Input) -> Result<Self::Output> { fn apply(self, context: Context, _: Self::Input) -> Result<Self::Output> {
// Derive the package directory path. // Derive the package directory path.
let path = current_dir()?; let path = context.dir()?;
// Check that the current package directory path exists. // Check that the current package directory path exists.
if !path.exists() { if !path.exists() {
@ -55,12 +54,12 @@ impl Command for Init {
.to_string_lossy() .to_string_lossy()
.to_string(); .to_string();
if !LeoPackage::is_package_name_valid(&package_name) { if !LeoPackage::is_package_name_valid(&package_name) {
return Err(anyhow!("Invalid Leo project name")); return Err(anyhow!("Invalid Leo project name: {}", package_name));
} }
let username = read_username().ok(); let username = read_username().ok();
LeoPackage::initialize(&package_name, false, &path, username)?; LeoPackage::initialize(&package_name, &path, username)?;
Ok(()) Ok(())
} }

View File

@ -18,7 +18,7 @@ use crate::{commands::Command, config::*, context::Context};
use leo_package::LeoPackage; use leo_package::LeoPackage;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use std::{env::current_dir, fs}; use std::fs;
use structopt::StructOpt; use structopt::StructOpt;
use tracing::span::Span; use tracing::span::Span;
@ -42,7 +42,7 @@ impl Command for New {
Ok(()) Ok(())
} }
fn apply(self, _: Context, _: Self::Input) -> Result<Self::Output> { fn apply(self, context: Context, _: Self::Input) -> Result<Self::Output> {
// Check that the given package name is valid. // Check that the given package name is valid.
let package_name = self.name; let package_name = self.name;
if !LeoPackage::is_package_name_valid(&package_name) { if !LeoPackage::is_package_name_valid(&package_name) {
@ -52,7 +52,7 @@ impl Command for New {
let username = read_username().ok(); let username = read_username().ok();
// Derive the package directory path. // Derive the package directory path.
let mut path = current_dir()?; let mut path = context.dir()?;
path.push(&package_name); path.push(&package_name);
// Verify the package directory path does not exist yet. // Verify the package directory path does not exist yet.
@ -63,7 +63,7 @@ impl Command for New {
// Create the package directory // Create the package directory
fs::create_dir_all(&path).map_err(|err| anyhow!("Could not create directory {}", err))?; fs::create_dir_all(&path).map_err(|err| anyhow!("Could not create directory {}", err))?;
LeoPackage::initialize(&package_name, false, &path, username)?; LeoPackage::initialize(&package_name, &path, username)?;
Ok(()) Ok(())
} }

View File

@ -15,10 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use super::build::Build; use super::build::Build;
use crate::{ use crate::{commands::Command, context::Context};
commands::Command,
context::{Context, PACKAGE_MANAGER_URL},
};
use leo_package::{ use leo_package::{
outputs::OutputsDirectory, outputs::OutputsDirectory,
root::{ZipFile, AUTHOR_PLACEHOLDER}, root::{ZipFile, AUTHOR_PLACEHOLDER},
@ -118,7 +115,7 @@ impl Command for Publish {
// Make a request to publish a package // Make a request to publish a package
let response = client let response = client
.post(format!("{}{}", PACKAGE_MANAGER_URL, PUBLISH_URL).as_str()) .post(format!("{}{}", context.api.host(), PUBLISH_URL).as_str())
.headers(headers) .headers(headers)
.multipart(form_data) .multipart(form_data)
.send(); .send();

View File

@ -58,8 +58,7 @@ impl Command for Setup {
let package_name = context.manifest()?.get_package_name(); let package_name = context.manifest()?.get_package_name();
// Check if leo build failed // Check if leo build failed
let (program, checksum_differs) = let (program, checksum_differs) = input;
input.ok_or_else(|| anyhow!("Unable to build, check that main file exists"))?;
// Check if a proving key and verification key already exists // Check if a proving key and verification key already exists
let keys_exist = ProvingKeyFile::new(&package_name).exists_at(&path) let keys_exist = ProvingKeyFile::new(&package_name).exists_at(&path)

View File

@ -21,7 +21,7 @@ use structopt::StructOpt;
use tracing::span::Span; use tracing::span::Span;
/// Setting for automatic updates of Leo /// Setting for automatic updates of Leo
#[derive(Debug, StructOpt, PartialEq)] #[derive(Debug, StructOpt)]
pub enum Automatic { pub enum Automatic {
Automatic { Automatic {
#[structopt(name = "bool", help = "Boolean value: true or false", parse(try_from_str))] #[structopt(name = "bool", help = "Boolean value: true or false", parse(try_from_str))]

View File

@ -65,13 +65,8 @@ impl Command for Watch {
// See changes on the write event // See changes on the write event
Ok(DebouncedEvent::Write(_write)) => { Ok(DebouncedEvent::Write(_write)) => {
match (Build {}).execute(context.clone()) { match (Build {}).execute(context.clone()) {
Ok(_output) => { Ok(_output) => tracing::info!("Built successfully"),
tracing::info!("Built successfully"); Err(e) => tracing::error!("Error {:?}", e),
}
Err(e) => {
// Syntax error
tracing::error!("Error {:?}", e);
}
}; };
} }
// Other events // Other events

View File

@ -48,19 +48,19 @@ impl Context {
} }
/// Create a new context for the current directory. /// Create a new context for the current directory.
pub fn create_context(path: PathBuf) -> Result<Context> { pub fn create_context(path: PathBuf, api_url: Option<String>) -> Result<Context> {
let token = config::read_token().ok(); let token = config::read_token().ok();
let api = Api::new(PACKAGE_MANAGER_URL.to_string(), token); let api = Api::new(api_url.unwrap_or_else(|| PACKAGE_MANAGER_URL.to_string()), token);
Ok(Context { api, path: Some(path) }) Ok(Context { api, path: Some(path) })
} }
/// Returns project context. /// Returns project context.
pub fn get_context() -> Result<Context> { pub fn get_context(api_url: Option<String>) -> Result<Context> {
let token = config::read_token().ok(); let token = config::read_token().ok();
let api = Api::new(PACKAGE_MANAGER_URL.to_string(), token); let api = Api::new(api_url.unwrap_or_else(|| PACKAGE_MANAGER_URL.to_string()), token);
Ok(Context { api, path: None }) Ok(Context { api, path: None })
} }

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // 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/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use std::fmt; use std::{fmt, sync::Once};
use colored::Colorize; use colored::Colorize;
use tracing::{event::Event, subscriber::Subscriber}; use tracing::{event::Event, subscriber::Subscriber};
@ -24,6 +24,8 @@ use tracing_subscriber::{
FmtSubscriber, FmtSubscriber,
}; };
static START: Once = Once::new();
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Format<F = Full, T = SystemTime> { pub struct Format<F = Full, T = SystemTime> {
format: F, format: F,
@ -220,5 +222,8 @@ pub fn init_logger(_app_name: &'static str, verbosity: usize) {
.event_format(Format::default()) .event_format(Format::default())
.finish(); .finish();
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed"); // call this line only once per process. needed for tests using same thread
START.call_once(|| {
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");
});
} }

View File

@ -55,6 +55,9 @@ struct Opt {
#[structopt(subcommand)] #[structopt(subcommand)]
command: CommandOpts, command: CommandOpts,
#[structopt(help = "Custom Aleo PM backend URL", env = "APM_URL")]
api: Option<String>,
#[structopt( #[structopt(
long, long,
global = true, global = true,
@ -178,9 +181,11 @@ enum CommandOpts {
} }
fn main() { fn main() {
// Read command line arguments. handle_error(run_with_args(Opt::from_args()))
let opt = Opt::from_args(); }
/// Run command with custom build arguments.
fn run_with_args(opt: Opt) -> Result<(), Error> {
if !opt.quiet { if !opt.quiet {
// Init logger with optional debug flag. // Init logger with optional debug flag.
logger::init_logger("leo", match opt.debug { logger::init_logger("leo", match opt.debug {
@ -192,11 +197,11 @@ fn main() {
// Get custom root folder and create context for it. // Get custom root folder and create context for it.
// If not specified, default context will be created in cwd. // If not specified, default context will be created in cwd.
let context = handle_error(match opt.path { let context = handle_error(match opt.path {
Some(path) => context::create_context(path), Some(path) => context::create_context(path, opt.api),
None => context::get_context(), None => context::get_context(opt.api),
}); });
handle_error(match opt.command { match opt.command {
CommandOpts::Init { command } => command.try_execute(context), CommandOpts::Init { command } => command.try_execute(context),
CommandOpts::New { command } => command.try_execute(context), CommandOpts::New { command } => command.try_execute(context),
CommandOpts::Build { command } => command.try_execute(context), CommandOpts::Build { command } => command.try_execute(context),
@ -217,7 +222,7 @@ fn main() {
CommandOpts::Lint { command } => command.try_execute(context), CommandOpts::Lint { command } => command.try_execute(context),
CommandOpts::Deploy { command } => command.try_execute(context), CommandOpts::Deploy { command } => command.try_execute(context),
}); }
} }
fn handle_error<T>(res: Result<T, Error>) -> T { fn handle_error<T>(res: Result<T, Error>) -> T {
@ -229,3 +234,140 @@ fn handle_error<T>(res: Result<T, Error>) -> T {
} }
} }
} }
#[cfg(test)]
mod cli_tests {
use crate::{run_with_args, Opt};
use anyhow::Error;
use std::path::PathBuf;
use structopt::StructOpt;
use test_dir::{DirBuilder, FileType, TestDir};
// Runs Command from cmd-like argument "leo run --arg1 --arg2".
fn run_cmd(args: &str, path: &Option<PathBuf>) -> Result<(), Error> {
let args = args.split(' ').collect::<Vec<&str>>();
let mut opts = Opt::from_iter_safe(args)?;
if path.is_some() {
opts.path = path.clone();
}
if !opts.debug {
// turn off tracing for all tests
opts.quiet = true;
}
run_with_args(opts)
}
// Create a test directory with name.
fn testdir(name: &str) -> TestDir {
TestDir::temp().create(name, FileType::Dir)
}
#[test]
fn global_options() {
let path = Some(PathBuf::from("examples/pedersen-hash"));
assert!(run_cmd("leo build", &path).is_ok());
assert!(run_cmd("leo -q build", &path).is_ok());
assert!(run_cmd("leo --path ../../examples/no-directory-there build", &None).is_err());
assert!(run_cmd("leo -v build", &None).is_err());
}
#[test]
fn global_options_fail() {
assert!(run_cmd("leo --path ../../examples/no-directory-there build", &None).is_err());
assert!(run_cmd("leo -v build", &None).is_err());
}
#[test]
fn init() {
let dir = testdir("test");
let path = Some(dir.path("test"));
assert!(run_cmd("leo init", &path).is_ok());
assert!(run_cmd("leo init", &path).is_err()); // 2nd time
}
#[test]
fn init_fail() {
let dir = testdir("incorrect_name");
let path = Some(dir.path("incorrect_name"));
let fake = Some(PathBuf::from("no_such_directory"));
assert!(run_cmd("leo init", &fake).is_err());
assert!(run_cmd("leo init", &path).is_err());
}
#[test]
fn new() {
let dir = testdir("new");
let path = Some(dir.path("new"));
assert!(run_cmd("leo new test", &path).is_ok());
assert!(run_cmd("leo new test", &path).is_err()); // 2nd time
assert!(run_cmd("leo new wrong_name", &path).is_err());
}
#[test]
#[should_panic]
fn unimplemented() {
assert!(run_cmd("leo lint", &None).is_err());
assert!(run_cmd("leo deploy", &None).is_err());
}
#[test]
fn clean() {
let path = &Some(PathBuf::from("examples/pedersen-hash"));
assert!(run_cmd("leo build", path).is_ok());
assert!(run_cmd("leo clean", path).is_ok());
}
#[test]
fn setup_prove_run_clean() {
let dir = testdir("test");
let path = dir.path("test");
assert!(run_cmd("leo new setup-test", &Some(path.clone())).is_ok());
let setup_path = &Some(path.join("setup-test"));
assert!(run_cmd("leo setup", setup_path).is_ok());
assert!(run_cmd("leo setup", setup_path).is_ok());
assert!(run_cmd("leo setup --skip-key-check", setup_path).is_ok());
assert!(run_cmd("leo prove --skip-key-check", setup_path).is_ok());
assert!(run_cmd("leo run --skip-key-check", setup_path).is_ok());
assert!(run_cmd("leo clean", setup_path).is_ok());
}
#[test]
fn test_missing_file() {
let dir = testdir("test");
let path = dir.path("test");
assert!(run_cmd("leo new test-file-missing", &Some(path.clone())).is_ok());
let path = path.join("test-file-missing");
let file = path.join("src/main.leo");
let path = Some(path);
assert!(run_cmd("leo test", &path).is_ok());
std::fs::remove_file(&file).unwrap();
assert!(run_cmd("leo test", &path).is_err());
}
#[test]
#[ignore] // ignore until imports path is fixed #875
fn test_sudoku() {
let path = &Some(PathBuf::from("examples/silly-sudoku"));
assert!(run_cmd("leo build", path).is_ok());
assert!(run_cmd("leo test", path).is_ok());
assert!(run_cmd("leo test -f src/lib.leo", path).is_ok());
assert!(run_cmd("leo test -f src/main.leo", path).is_ok());
}
}

View File

@ -14,9 +14,8 @@
// You should have received a copy of the GNU General Public License // 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/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use std::path::PathBuf;
use anyhow::Result; use anyhow::Result;
use std::path::PathBuf;
use crate::{ use crate::{
commands::{ commands::{
@ -152,7 +151,7 @@ pub fn leo_update_and_update_automatic() -> Result<()> {
/// Create context for Pedersen Hash example /// Create context for Pedersen Hash example
fn context() -> Result<Context> { fn context() -> Result<Context> {
let path = PathBuf::from(&PEDERSEN_HASH_PATH); let path = PathBuf::from(&PEDERSEN_HASH_PATH);
let context = create_context(path)?; let context = create_context(path, None)?;
Ok(context) Ok(context)
} }

View File

@ -33,13 +33,8 @@ pub struct LeoPackage;
impl LeoPackage { impl LeoPackage {
/// Initializes a Leo package at the given path. /// Initializes a Leo package at the given path.
pub fn initialize( pub fn initialize(package_name: &str, path: &Path, author: Option<String>) -> Result<(), PackageError> {
package_name: &str, package::Package::initialize(package_name, path, author)
is_lib: bool,
path: &Path,
author: Option<String>,
) -> Result<(), PackageError> {
package::Package::initialize(package_name, is_lib, path, author)
} }
/// Returns `true` if the given Leo package name is valid. /// Returns `true` if the given Leo package name is valid.

View File

@ -19,7 +19,7 @@ use crate::{
imports::ImportsDirectory, imports::ImportsDirectory,
inputs::{InputFile, InputsDirectory, StateFile}, inputs::{InputFile, InputsDirectory, StateFile},
root::{Gitignore, Manifest, README}, root::{Gitignore, Manifest, README},
source::{LibraryFile, MainFile, SourceDirectory}, source::{MainFile, SourceDirectory},
}; };
use serde::Deserialize; use serde::Deserialize;
@ -107,7 +107,7 @@ impl Package {
} }
/// Returns `true` if a package is can be initialized at a given path. /// Returns `true` if a package is can be initialized at a given path.
pub fn can_initialize(package_name: &str, is_lib: bool, path: &Path) -> bool { pub fn can_initialize(package_name: &str, path: &Path) -> bool {
// Check that the package name is valid. // Check that the package name is valid.
if !Self::is_package_name_valid(package_name) { if !Self::is_package_name_valid(package_name) {
return false; return false;
@ -122,32 +122,24 @@ impl Package {
result = false; result = false;
} }
if is_lib { // Check if the input file already exists.
// Check if the library file already exists. let input_file = InputFile::new(&package_name);
if LibraryFile::exists_at(path) { if input_file.exists_at(path) {
existing_files.push(LibraryFile::filename()); existing_files.push(input_file.filename());
result = false; result = false;
} }
} else {
// Check if the input file already exists.
let input_file = InputFile::new(&package_name);
if input_file.exists_at(path) {
existing_files.push(input_file.filename());
result = false;
}
// Check if the state file already exists. // Check if the state file already exists.
let state_file = StateFile::new(&package_name); let state_file = StateFile::new(&package_name);
if state_file.exists_at(path) { if state_file.exists_at(path) {
existing_files.push(state_file.filename()); existing_files.push(state_file.filename());
result = false; result = false;
} }
// Check if the main file already exists. // Check if the main file already exists.
if MainFile::exists_at(path) { if MainFile::exists_at(path) {
existing_files.push(MainFile::filename()); existing_files.push(MainFile::filename());
result = false; result = false;
}
} }
if !existing_files.is_empty() { if !existing_files.is_empty() {
@ -158,7 +150,7 @@ impl Package {
} }
/// Returns `true` if a package is initialized at the given path /// Returns `true` if a package is initialized at the given path
pub fn is_initialized(package_name: &str, is_lib: bool, path: &Path) -> bool { pub fn is_initialized(package_name: &str, path: &Path) -> bool {
// Check that the package name is valid. // Check that the package name is valid.
if !Self::is_package_name_valid(package_name) { if !Self::is_package_name_valid(package_name) {
return false; return false;
@ -169,43 +161,31 @@ impl Package {
return false; return false;
} }
if is_lib { // Check if the input file exists.
// Check if the library file exists. let input_file = InputFile::new(&package_name);
if !LibraryFile::exists_at(&path) { if !input_file.exists_at(&path) {
return false; return false;
} }
} else {
// Check if the input file exists.
let input_file = InputFile::new(&package_name);
if !input_file.exists_at(&path) {
return false;
}
// Check if the state file exists. // Check if the state file exists.
let state_file = StateFile::new(&package_name); let state_file = StateFile::new(&package_name);
if !state_file.exists_at(&path) { if !state_file.exists_at(&path) {
return false; return false;
} }
// Check if the main file exists. // Check if the main file exists.
if !MainFile::exists_at(&path) { if !MainFile::exists_at(&path) {
return false; return false;
}
} }
true true
} }
/// Creates a package at the given path /// Creates a package at the given path
pub fn initialize( pub fn initialize(package_name: &str, path: &Path, author: Option<String>) -> Result<(), PackageError> {
package_name: &str,
is_lib: bool,
path: &Path,
author: Option<String>,
) -> Result<(), PackageError> {
// First, verify that this directory is not already initialized as a Leo package. // First, verify that this directory is not already initialized as a Leo package.
{ {
if !Self::can_initialize(package_name, is_lib, path) { if !Self::can_initialize(package_name, path) {
return Err(PackageError::FailedToInitialize( return Err(PackageError::FailedToInitialize(
package_name.to_owned(), package_name.to_owned(),
path.as_os_str().to_owned(), path.as_os_str().to_owned(),
@ -232,27 +212,21 @@ impl Package {
// Create the source directory. // Create the source directory.
SourceDirectory::create(&path)?; SourceDirectory::create(&path)?;
// Create a new library or binary file. // Create the input directory.
if is_lib { InputsDirectory::create(&path)?;
// Create the library file in the source directory.
LibraryFile::new(&package_name).write_to(&path)?;
} else {
// Create the input directory.
InputsDirectory::create(&path)?;
// Create the input file in the inputs directory. // Create the input file in the inputs directory.
InputFile::new(&package_name).write_to(&path)?; InputFile::new(&package_name).write_to(&path)?;
// Create the state file in the inputs directory. // Create the state file in the inputs directory.
StateFile::new(&package_name).write_to(&path)?; StateFile::new(&package_name).write_to(&path)?;
// Create the main file in the source directory. // Create the main file in the source directory.
MainFile::new(&package_name).write_to(&path)?; MainFile::new(&package_name).write_to(&path)?;
}
} }
// Next, verify that a valid Leo package has been initialized in this directory // Next, verify that a valid Leo package has been initialized in this directory
{ {
if !Self::is_initialized(package_name, is_lib, path) { if !Self::is_initialized(package_name, path) {
return Err(PackageError::FailedToInitialize( return Err(PackageError::FailedToInitialize(
package_name.to_owned(), package_name.to_owned(),
path.as_os_str().to_owned(), path.as_os_str().to_owned(),

View File

@ -1,76 +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/>.
//! The `lib.leo` file.
use crate::{errors::LibraryFileError, source::directory::SOURCE_DIRECTORY_NAME};
use serde::Deserialize;
use std::{borrow::Cow, fs::File, io::Write, path::Path};
pub static LIBRARY_FILENAME: &str = "lib.leo";
#[derive(Deserialize)]
pub struct LibraryFile {
pub package_name: String,
}
impl LibraryFile {
pub fn new(package_name: &str) -> Self {
Self {
package_name: package_name.to_string(),
}
}
pub fn filename() -> String {
format!("{}{}", SOURCE_DIRECTORY_NAME, LIBRARY_FILENAME)
}
pub fn exists_at(path: &Path) -> bool {
let mut path = Cow::from(path);
if path.is_dir() {
if !path.ends_with(SOURCE_DIRECTORY_NAME) {
path.to_mut().push(SOURCE_DIRECTORY_NAME);
}
path.to_mut().push(LIBRARY_FILENAME);
}
path.exists()
}
pub fn write_to(self, path: &Path) -> Result<(), LibraryFileError> {
let mut path = Cow::from(path);
if path.is_dir() {
if !path.ends_with(SOURCE_DIRECTORY_NAME) {
path.to_mut().push(SOURCE_DIRECTORY_NAME);
}
path.to_mut().push(LIBRARY_FILENAME);
}
let mut file = File::create(&path)?;
Ok(file.write_all(self.template().as_bytes())?)
}
fn template(&self) -> String {
format!(
r#"// The '{}' library circuit.
circuit Foo {{
a: field
}}
"#,
self.package_name
)
}
}

View File

@ -17,8 +17,5 @@
pub mod directory; pub mod directory;
pub use directory::*; pub use directory::*;
pub mod library;
pub use library::*;
pub mod main; pub mod main;
pub use main::*; pub use main::*;

View File

@ -19,7 +19,7 @@ use leo_package::{
inputs::{InputFile, InputsDirectory, StateFile}, inputs::{InputFile, InputsDirectory, StateFile},
package::Package, package::Package,
root::Manifest, root::Manifest,
source::{LibraryFile, MainFile, SourceDirectory}, source::{MainFile, SourceDirectory},
}; };
const TEST_PACKAGE_NAME: &str = "test-package"; const TEST_PACKAGE_NAME: &str = "test-package";
@ -29,13 +29,13 @@ fn initialize_valid_package() {
let test_directory = test_dir(); let test_directory = test_dir();
// Ensure a package can be initialized at the `test_directory` // Ensure a package can be initialized at the `test_directory`
assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory));
// Initialize a package at the `test_directory` // Initialize a package at the `test_directory`
assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory, None).is_ok()); assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, None).is_ok());
// Ensure a package is initialized at the `test_directory` // Ensure a package is initialized at the `test_directory`
assert!(Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); assert!(Package::is_initialized(TEST_PACKAGE_NAME, &test_directory));
} }
#[test] #[test]
@ -43,21 +43,13 @@ fn initialize_valid_package_with_author() {
let test_directory = test_dir(); let test_directory = test_dir();
// Ensure a package can be initialized at the `test_directory` // Ensure a package can be initialized at the `test_directory`
assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory));
// Initialize a package at the `test_directory` // Initialize a package at the `test_directory`
assert!( assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, Some(String::from("test_user"))).is_ok());
Package::initialize(
TEST_PACKAGE_NAME,
false,
&test_directory,
Some(String::from("test_user"))
)
.is_ok()
);
// Ensure a package is initialized at the `test_directory` // Ensure a package is initialized at the `test_directory`
assert!(Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); assert!(Package::is_initialized(TEST_PACKAGE_NAME, &test_directory));
} }
#[test] #[test]
@ -71,7 +63,7 @@ fn initialize_fails_with_existing_manifest() {
let test_directory = test_dir(); let test_directory = test_dir();
// Ensure a package can be initialized at the `test_directory` // Ensure a package can be initialized at the `test_directory`
assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory));
// Manually add a manifest file to the `test_directory` // Manually add a manifest file to the `test_directory`
Manifest::new(TEST_PACKAGE_NAME, None) Manifest::new(TEST_PACKAGE_NAME, None)
@ -80,28 +72,10 @@ fn initialize_fails_with_existing_manifest() {
.unwrap(); .unwrap();
// Attempt to initialize a package at the `test_directory` // Attempt to initialize a package at the `test_directory`
assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory, None).is_err()); assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, None).is_err());
// Ensure package is not initialized at the `test_directory` // Ensure package is not initialized at the `test_directory`
assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); assert!(!Package::is_initialized(TEST_PACKAGE_NAME, &test_directory));
}
#[test]
fn initialize_fails_with_existing_library_file() {
let test_directory = test_dir();
// Ensure a package can be initialized at the `test_directory`
assert!(Package::can_initialize(TEST_PACKAGE_NAME, true, &test_directory));
// Manually add a source directory and a library file to the `test_directory`
SourceDirectory::create(&test_directory).unwrap();
LibraryFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap();
// Attempt to initialize a package at the `test_directory`
assert!(Package::initialize(TEST_PACKAGE_NAME, true, &test_directory, None).is_err());
// Ensure package is not initialized at the `test_directory`
assert!(!Package::is_initialized(TEST_PACKAGE_NAME, true, &test_directory));
} }
#[test] #[test]
@ -109,25 +83,17 @@ fn initialize_fails_with_existing_input_file() {
let test_directory = test_dir(); let test_directory = test_dir();
// Ensure a package can be initialized at the `test_directory` // Ensure a package can be initialized at the `test_directory`
assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory));
// Manually add an inputs directory and an input file to the `test_directory` // Manually add an inputs directory and an input file to the `test_directory`
InputsDirectory::create(&test_directory).unwrap(); InputsDirectory::create(&test_directory).unwrap();
InputFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); InputFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap();
// Attempt to initialize a package at the `test_directory` // Attempt to initialize a package at the `test_directory`
assert!( assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, Some(String::from("test_user"))).is_err());
Package::initialize(
TEST_PACKAGE_NAME,
false,
&test_directory,
Some(String::from("test_user"))
)
.is_err()
);
// Ensure package is not initialized at the `test_directory` // Ensure package is not initialized at the `test_directory`
assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); assert!(!Package::is_initialized(TEST_PACKAGE_NAME, &test_directory));
} }
#[test] #[test]
@ -135,17 +101,17 @@ fn initialize_fails_with_existing_state_file() {
let test_directory = test_dir(); let test_directory = test_dir();
// Ensure a package can be initialized at the `test_directory` // Ensure a package can be initialized at the `test_directory`
assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory));
// Manually add an inputs directory and a state file to the `test_directory` // Manually add an inputs directory and a state file to the `test_directory`
InputsDirectory::create(&test_directory).unwrap(); InputsDirectory::create(&test_directory).unwrap();
StateFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); StateFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap();
// Attempt to initialize a package at the `test_directory` // Attempt to initialize a package at the `test_directory`
assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory, None).is_err()); assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, None).is_err());
// Ensure package is not initialized at the `test_directory` // Ensure package is not initialized at the `test_directory`
assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); assert!(!Package::is_initialized(TEST_PACKAGE_NAME, &test_directory));
} }
#[test] #[test]
@ -153,15 +119,15 @@ fn initialize_fails_with_existing_main_file() {
let test_directory = test_dir(); let test_directory = test_dir();
// Ensure a package can be initialized at the `test_directory` // Ensure a package can be initialized at the `test_directory`
assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory));
// Manually add a source directory and a main file to the `test_directory` // Manually add a source directory and a main file to the `test_directory`
SourceDirectory::create(&test_directory).unwrap(); SourceDirectory::create(&test_directory).unwrap();
MainFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); MainFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap();
// Attempt to initialize a package at the `test_directory` // Attempt to initialize a package at the `test_directory`
assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory, None).is_err()); assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, None).is_err());
// Ensure package is not initialized at the `test_directory` // Ensure package is not initialized at the `test_directory`
assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); assert!(!Package::is_initialized(TEST_PACKAGE_NAME, &test_directory));
} }

View File

@ -54,6 +54,10 @@ version = "0.3"
[dev-dependencies.serde_yaml] [dev-dependencies.serde_yaml]
version = "0.8" version = "0.8"
[dev-dependencies.leo-test-framework]
path = "../test-framework"
version = "1.4.0"
[features] [features]
default = [ ] default = [ ]
ci_skip = [ ] ci_skip = [ ]

View File

@ -14,158 +14,36 @@
// You should have received a copy of the GNU General Public License // 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/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use std::{ use leo_ast::{Expression, ExpressionStatement, Span, Statement, ValueExpression};
fmt, use leo_test_framework::runner::{Namespace, ParseType, Runner};
fs,
path::{Path, PathBuf},
sync::Arc,
};
use leo_ast::{Expression, ExpressionStatement, Program, Span, Statement, ValueExpression};
use serde_yaml::Value; use serde_yaml::Value;
use tokenizer::Token; use tokenizer::Token;
use crate::{tokenizer, DeprecatedError, ParserContext, SyntaxError, TokenError}; use crate::{tokenizer, ParserContext};
struct TestFailure { struct TokenNamespace;
path: String,
errors: Vec<TestError>,
}
#[derive(Debug)] impl Namespace for TokenNamespace {
enum TestError { fn parse_type(&self) -> ParseType {
UnexpectedOutput { ParseType::Line
index: usize,
expected: String,
output: String,
},
PassedAndShouldntHave {
index: usize,
},
FailedAndShouldntHave {
index: usize,
error: String,
},
UnexpectedError {
index: usize,
expected: String,
output: String,
},
MismatchedTestExpectationLength,
}
impl fmt::Display for TestError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
TestError::UnexpectedOutput {
index,
expected,
output,
} => {
write!(f, "test #{} expected\n{}\ngot\n{}", index + 1, expected, output)
}
TestError::PassedAndShouldntHave { index } => write!(f, "test #{} passed and shouldn't have", index + 1),
TestError::FailedAndShouldntHave { index, error } => {
write!(f, "test #{} failed and shouldn't have:\n{}", index + 1, error)
}
TestError::UnexpectedError {
expected,
output,
index,
} => {
write!(f, "test #{} expected error\n{}\ngot\n{}", index + 1, expected, output)
}
TestError::MismatchedTestExpectationLength => write!(f, "invalid number of test expectations"),
}
} }
}
pub fn find_tests<T: AsRef<Path>>(path: T, out: &mut Vec<(String, String)>) { fn run_test(&self, test: &str) -> Result<Value, String> {
for entry in fs::read_dir(path).expect("fail to read tests").into_iter() { let output = tokenizer::tokenize("test", test.into());
let entry = entry.expect("fail to read tests").path(); output
if entry.is_dir() { .map(|tokens| {
find_tests(entry.as_path(), out); Value::String(
continue; tokens
} else if entry.extension().map(|x| x.to_str()).flatten().unwrap_or_default() != "leo" { .into_iter()
continue; .map(|x| x.to_string())
} .collect::<Vec<String>>()
let content = fs::read_to_string(entry.as_path()).expect("failed to read test"); .join(","),
out.push((entry.as_path().to_str().unwrap_or_default().to_string(), content)); )
})
.map_err(|x| x.to_string())
} }
} }
#[derive(serde::Serialize, serde::Deserialize, PartialEq, Debug, Clone)]
enum TestNamespace {
Parse,
ParseStatement,
ParseExpression,
Token,
}
#[derive(serde::Serialize, serde::Deserialize, PartialEq, Debug, Clone)]
enum TestExpectationMode {
Pass,
Fail,
}
#[derive(serde::Serialize, serde::Deserialize)]
struct TestConfig {
namespace: TestNamespace,
expectation: TestExpectationMode,
}
#[derive(serde::Serialize, serde::Deserialize, Clone)]
struct TestExpectation {
namespace: TestNamespace,
expectation: TestExpectationMode,
outputs: Vec<Value>,
}
fn extract_test_config(source: &str) -> Option<TestConfig> {
let first_comment_start = source.find("/*")?;
let end_first_comment = source[first_comment_start + 2..].find("*/")?;
let comment_inner = &source[first_comment_start + 2..first_comment_start + 2 + end_first_comment];
Some(serde_yaml::from_str(comment_inner).expect("invalid test configuration"))
}
fn split_tests_oneline(source: &str) -> Vec<&str> {
source.lines().map(|x| x.trim()).filter(|x| !x.is_empty()).collect()
}
fn split_tests_twoline(source: &str) -> Vec<String> {
let mut out = vec![];
let mut lines = vec![];
for line in source.lines() {
let line = line.trim();
if line.is_empty() {
if !lines.is_empty() {
out.push(lines.join("\n"));
}
lines.clear();
continue;
}
lines.push(line);
}
let last_test = lines.join("\n");
if !last_test.trim().is_empty() {
out.push(last_test.trim().to_string());
}
out
}
fn run_individual_token_test(path: &str, source: &str) -> Result<String, String> {
let output = tokenizer::tokenize(path, source.into());
output
.map(|tokens| {
tokens
.into_iter()
.map(|x| x.to_string())
.collect::<Vec<String>>()
.join(",")
})
.map_err(|x| strip_path_syntax_error(x.into()))
}
fn not_fully_consumed(tokens: &mut ParserContext) -> Result<(), String> { fn not_fully_consumed(tokens: &mut ParserContext) -> Result<(), String> {
if !tokens.has_next() { if !tokens.has_next() {
return Ok(()); return Ok(());
@ -178,389 +56,95 @@ fn not_fully_consumed(tokens: &mut ParserContext) -> Result<(), String> {
Err(out) Err(out)
} }
fn run_individual_expression_test(path: &str, source: &str) -> Result<Expression, String> { struct ParseExpressionNamespace;
let tokenizer = tokenizer::tokenize(path, source.into()).map_err(|x| strip_path_syntax_error(x.into()))?;
if tokenizer impl Namespace for ParseExpressionNamespace {
.iter() fn parse_type(&self) -> ParseType {
.all(|x| matches!(x.token, Token::CommentLine(_) | Token::CommentBlock(_))) ParseType::Line
{
return Ok(Expression::Value(ValueExpression::Implicit("".into(), Span::default())));
} }
let mut tokens = ParserContext::new(tokenizer);
let parsed = tokens.parse_expression().map_err(strip_path_syntax_error)?; fn run_test(&self, test: &str) -> Result<Value, String> {
not_fully_consumed(&mut tokens)?; let tokenizer = tokenizer::tokenize("test", test.into()).map_err(|x| x.to_string())?;
if tokenizer
Ok(parsed) .iter()
} .all(|x| matches!(x.token, Token::CommentLine(_) | Token::CommentBlock(_)))
{
fn run_individual_statement_test(path: &str, source: &str) -> Result<Statement, String> { return Ok(serde_yaml::to_value(&Expression::Value(ValueExpression::Implicit(
let tokenizer = tokenizer::tokenize(path, source.into()).map_err(|x| strip_path_syntax_error(x.into()))?; "".into(),
if tokenizer Span::default(),
.iter() )))
.all(|x| matches!(x.token, Token::CommentLine(_) | Token::CommentBlock(_))) .expect("serialization failed"));
{
return Ok(Statement::Expression(ExpressionStatement {
expression: Expression::Value(ValueExpression::Implicit("".into(), Span::default())),
span: Span::default(),
}));
}
let mut tokens = ParserContext::new(tokenizer);
let parsed = tokens.parse_statement().map_err(strip_path_syntax_error)?;
not_fully_consumed(&mut tokens)?;
Ok(parsed)
}
fn strip_path_syntax_error(mut err: SyntaxError) -> String {
let inner = match &mut err {
SyntaxError::DeprecatedError(DeprecatedError::Error(x)) => x,
SyntaxError::Error(x) => x,
SyntaxError::TokenError(TokenError::Error(x)) => x,
};
inner.path = Arc::new("test".to_string());
err.to_string()
}
fn run_individual_parse_test(path: &str, source: &str) -> Result<Program, String> {
let tokenizer = tokenizer::tokenize(path, source.into()).map_err(|x| strip_path_syntax_error(x.into()))?;
let mut tokens = ParserContext::new(tokenizer);
let parsed = tokens.parse_program().map_err(strip_path_syntax_error)?;
not_fully_consumed(&mut tokens)?;
Ok(parsed)
}
fn emit_errors<T: PartialEq + ToString + serde::de::DeserializeOwned>(
output: Result<&T, &str>,
mode: &TestExpectationMode,
expected_output: Option<Value>,
test_index: usize,
) -> Option<TestError> {
match (output, mode) {
(Ok(output), TestExpectationMode::Pass) => {
let expected_output: Option<T> =
expected_output.map(|x| serde_yaml::from_value(x).expect("test expectation deserialize failed"));
// passed and should have
if let Some(expected_output) = expected_output.as_ref() {
if output != expected_output {
// invalid output
return Some(TestError::UnexpectedOutput {
index: test_index,
expected: expected_output.to_string(),
output: output.to_string(),
});
}
}
None
}
(Ok(_tokens), TestExpectationMode::Fail) => Some(TestError::PassedAndShouldntHave { index: test_index }),
(Err(err), TestExpectationMode::Pass) => Some(TestError::FailedAndShouldntHave {
error: err.to_string(),
index: test_index,
}),
(Err(err), TestExpectationMode::Fail) => {
let expected_output: Option<String> =
expected_output.map(|x| serde_yaml::from_value(x).expect("test expectation deserialize failed"));
if let Some(expected_output) = expected_output.as_deref() {
if err != expected_output {
// invalid output
return Some(TestError::UnexpectedError {
expected: expected_output.to_string(),
output: err.to_string(),
index: test_index,
});
}
}
None
} }
let mut tokens = ParserContext::new(tokenizer);
let parsed = tokens.parse_expression().map_err(|x| x.to_string())?;
not_fully_consumed(&mut tokens)?;
Ok(serde_yaml::to_value(&parsed).expect("serialization failed"))
} }
} }
fn run_test( struct ParseStatementNamespace;
config: &TestConfig,
path: &str,
source: &str,
expectations: Option<&TestExpectation>,
errors: &mut Vec<TestError>,
) -> Vec<Value> {
let end_of_header = source.find("*/").expect("failed to find header block in test");
let source = &source[end_of_header + 2..];
let mut outputs = vec![];
match &config.namespace {
TestNamespace::Token => {
let tests = split_tests_oneline(source);
if let Some(expectations) = expectations.as_ref() {
if tests.len() != expectations.outputs.len() {
errors.push(TestError::MismatchedTestExpectationLength);
}
}
let mut expected_output = expectations.as_ref().map(|x| x.outputs.iter());
for (i, test) in tests.into_iter().enumerate() {
let expected_output = expected_output
.as_mut()
.map(|x| x.next())
.flatten()
.map(|x| x.as_str())
.flatten();
let output = run_individual_token_test(path, test);
if let Some(error) = emit_errors(
output.as_ref().map_err(|x| &**x),
&config.expectation,
expected_output.map(|x| Value::String(x.to_string())),
i,
) {
errors.push(error);
} else {
outputs.push(serde_yaml::to_value(output.unwrap_or_else(|e| e)).expect("serialization failed"));
}
}
}
TestNamespace::Parse => {
if let Some(expectations) = expectations.as_ref() {
if expectations.outputs.len() != 1 {
errors.push(TestError::MismatchedTestExpectationLength);
}
}
let expected_output = expectations
.map(|x| x.outputs.get(0))
.flatten()
.map(|x| serde_yaml::from_value(x.clone()).expect("invalid test expectation form"));
let output = run_individual_parse_test(path, source);
if let Some(error) = emit_errors(
output.as_ref().map_err(|x| &**x),
&config.expectation,
expected_output,
0,
) {
errors.push(error);
} else {
outputs.push(
output
.map(|x| serde_yaml::to_value(x).expect("serialization failed"))
.unwrap_or_else(|e| serde_yaml::to_value(e).expect("serialization failed")),
);
}
}
TestNamespace::ParseStatement => {
let tests = split_tests_twoline(source);
if let Some(expectations) = expectations.as_ref() {
if tests.len() != expectations.outputs.len() {
errors.push(TestError::MismatchedTestExpectationLength);
}
}
let mut expected_output = expectations.as_ref().map(|x| x.outputs.iter());
for (i, test) in tests.into_iter().enumerate() {
let expected_output = expected_output
.as_mut()
.map(|x| x.next())
.flatten()
.map(|x| serde_yaml::from_value(x.clone()).expect("invalid test expectation form"));
let output = run_individual_statement_test(path, &test); impl Namespace for ParseStatementNamespace {
if let Some(error) = emit_errors( fn parse_type(&self) -> ParseType {
output.as_ref().map_err(|x| &**x), ParseType::ContinuousLines
&config.expectation, }
expected_output,
i, fn run_test(&self, test: &str) -> Result<Value, String> {
) { let tokenizer = tokenizer::tokenize("test", test.into()).map_err(|x| x.to_string())?;
errors.push(error); if tokenizer
} else { .iter()
outputs.push( .all(|x| matches!(x.token, Token::CommentLine(_) | Token::CommentBlock(_)))
output {
.map(|x| serde_yaml::to_value(x).expect("serialization failed")) return Ok(serde_yaml::to_value(&Statement::Expression(ExpressionStatement {
.unwrap_or_else(|e| serde_yaml::to_value(e).expect("serialization failed")), expression: Expression::Value(ValueExpression::Implicit("".into(), Span::default())),
); span: Span::default(),
} }))
} .expect("serialization failed"));
} }
TestNamespace::ParseExpression => { let mut tokens = ParserContext::new(tokenizer);
let tests = split_tests_oneline(source);
if let Some(expectations) = expectations.as_ref() { let parsed = tokens.parse_statement().map_err(|x| x.to_string())?;
if tests.len() != expectations.outputs.len() { not_fully_consumed(&mut tokens)?;
errors.push(TestError::MismatchedTestExpectationLength);
} Ok(serde_yaml::to_value(&parsed).expect("serialization failed"))
} }
let mut expected_output = expectations.as_ref().map(|x| x.outputs.iter()); }
for (i, test) in tests.into_iter().enumerate() {
let expected_output = expected_output struct ParseNamespace;
.as_mut()
.map(|x| x.next()) impl Namespace for ParseNamespace {
.flatten() fn parse_type(&self) -> ParseType {
.map(|x| serde_yaml::from_value(x.clone()).expect("invalid test expectation form")); ParseType::Whole
}
let output = run_individual_expression_test(path, test);
if let Some(error) = emit_errors( fn run_test(&self, test: &str) -> Result<Value, String> {
output.as_ref().map_err(|x| &**x), let tokenizer = tokenizer::tokenize("test", test.into()).map_err(|x| x.to_string())?;
&config.expectation, let mut tokens = ParserContext::new(tokenizer);
expected_output,
i, let parsed = tokens.parse_program().map_err(|x| x.to_string())?;
) { not_fully_consumed(&mut tokens)?;
errors.push(error);
} else { Ok(serde_yaml::to_value(&parsed).expect("serialization failed"))
outputs.push( }
output }
.map(|x| serde_yaml::to_value(x).expect("serialization failed"))
.unwrap_or_else(|e| serde_yaml::to_value(e).expect("serialization failed")), struct TestRunner;
);
} impl Runner for TestRunner {
} fn resolve_namespace(&self, name: &str) -> Option<Box<dyn Namespace>> {
} Some(match name {
"Parse" => Box::new(ParseNamespace),
"ParseStatement" => Box::new(ParseStatementNamespace),
"ParseExpression" => Box::new(ParseExpressionNamespace),
"Token" => Box::new(TokenNamespace),
_ => return None,
})
} }
outputs
} }
#[test] #[test]
pub fn parser_tests() { pub fn parser_tests() {
let mut pass = 0; leo_test_framework::run_tests(&TestRunner, "parser");
let mut fail = Vec::new();
let mut tests = Vec::new();
let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_dir.push("../tests/parser/");
find_tests(&test_dir, &mut tests);
let mut outputs = vec![];
for (path, content) in tests.into_iter() {
let config = extract_test_config(&content);
if config.is_none() {
panic!("missing configuration for {}", path);
}
let config = config.unwrap();
let mut expectation_path = path.clone();
expectation_path += ".out";
let expectations: Option<TestExpectation> = if std::path::Path::new(&expectation_path).exists() {
if !std::env::var("CLEAR_LEO_TEST_EXPECTATIONS")
.unwrap_or_default()
.trim()
.is_empty()
{
None
} else {
let raw = std::fs::read_to_string(&expectation_path).expect("failed to read expectations file");
Some(serde_yaml::from_str(&raw).expect("invalid yaml in expectations file"))
}
} else {
None
};
let mut errors = vec![];
let raw_path = Path::new(&path);
let new_outputs = run_test(
&config,
raw_path.file_name().unwrap_or_default().to_str().unwrap_or_default(),
&content,
expectations.as_ref(),
&mut errors,
);
if errors.is_empty() {
if expectations.is_none() {
outputs.push((expectation_path, TestExpectation {
namespace: config.namespace,
expectation: config.expectation,
outputs: new_outputs,
}));
}
pass += 1;
} else {
fail.push(TestFailure {
path: path.clone(),
errors,
})
}
}
if !fail.is_empty() {
for (i, fail) in fail.iter().enumerate() {
println!(
"\n\n-----------------TEST #{} FAILED (and shouldn't have)-----------------",
i + 1
);
println!("File: {}", fail.path);
for error in &fail.errors {
println!("{}", error);
}
}
panic!("failed {}/{} tests", fail.len(), fail.len() + pass);
} else {
for (path, new_expectation) in outputs {
std::fs::write(
&path,
serde_yaml::to_string(&new_expectation).expect("failed to serialize expectation yaml"),
)
.expect("failed to write expectation file");
}
println!("passed {}/{} tests", pass, pass);
}
}
#[test]
pub fn parser_pass_tests() {
let mut pass = 0;
let mut fail = Vec::new();
let mut tests = Vec::new();
let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_dir.push("../tests/old/pass/");
find_tests(&test_dir, &mut tests);
for (path, content) in tests.into_iter() {
match crate::parse(&path, &content) {
Ok(_) => {
pass += 1;
}
Err(e) => {
fail.push(TestFailure {
path,
errors: vec![TestError::FailedAndShouldntHave {
index: 0,
error: e.to_string(),
}],
});
}
}
}
if !fail.is_empty() {
for (i, fail) in fail.iter().enumerate() {
println!(
"\n\n-----------------TEST #{} FAILED (and shouldn't have)-----------------",
i + 1
);
println!("File: {}", fail.path);
for error in &fail.errors {
println!("{}", error);
}
}
panic!("failed {}/{} tests", fail.len(), fail.len() + pass);
} else {
println!("passed {}/{} tests", pass, pass);
}
}
#[test]
pub fn parser_fail_tests() {
let mut pass = 0;
let mut fail = Vec::new();
let mut tests = Vec::new();
let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_dir.push("../tests/old/fail/");
find_tests(&test_dir, &mut tests);
for (path, content) in tests.into_iter() {
match crate::parse(&path, &content) {
Ok(_) => {
fail.push(path);
}
Err(_e) => {
pass += 1;
}
}
}
if !fail.is_empty() {
for (i, fail) in fail.iter().enumerate() {
println!(
"\n\n-----------------TEST #{} PASSED (and shouldn't have)-----------------",
i + 1
);
println!("File: {}", fail);
}
panic!("failed {}/{} tests", fail.len(), fail.len() + pass);
} else {
println!("passed {}/{} tests", pass, pass);
}
} }

28
test-framework/Cargo.toml Normal file
View File

@ -0,0 +1,28 @@
[package]
name = "leo-test-framework"
version = "1.4.0"
authors = [ "The Aleo Team <hello@aleo.org>" ]
description = "Leo testing framework"
homepage = "https://aleo.org"
repository = "https://github.com/AleoHQ/leo"
keywords = [
"aleo",
"cryptography",
"leo",
"programming-language",
"zero-knowledge"
]
categories = [ "cryptography::cryptocurrencies", "web-programming" ]
include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ]
license = "GPL-3.0"
edition = "2018"
[dependencies.serde]
version = "1.0"
features = [ "derive" ]
[dependencies.serde_json]
version = "1.0"
[dependencies.serde_yaml]
version = "0.8"

124
test-framework/src/error.rs Normal file
View File

@ -0,0 +1,124 @@
// 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 std::fmt;
use serde_yaml::Value;
use crate::test::TestExpectationMode;
pub struct TestFailure {
pub path: String,
pub errors: Vec<TestError>,
}
#[derive(Debug)]
pub enum TestError {
UnexpectedOutput {
index: usize,
expected: Value,
output: Value,
},
PassedAndShouldntHave {
index: usize,
},
FailedAndShouldntHave {
index: usize,
error: String,
},
UnexpectedError {
index: usize,
expected: String,
output: String,
},
MismatchedTestExpectationLength,
}
impl fmt::Display for TestError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
TestError::UnexpectedOutput {
index,
expected,
output,
} => {
write!(
f,
"test #{} expected\n{}\ngot\n{}",
index + 1,
serde_yaml::to_string(&expected).expect("serialization failed"),
serde_yaml::to_string(&output).expect("serialization failed")
)
}
TestError::PassedAndShouldntHave { index } => write!(f, "test #{} passed and shouldn't have", index + 1),
TestError::FailedAndShouldntHave { index, error } => {
write!(f, "test #{} failed and shouldn't have:\n{}", index + 1, error)
}
TestError::UnexpectedError {
expected,
output,
index,
} => {
write!(f, "test #{} expected error\n{}\ngot\n{}", index + 1, expected, output)
}
TestError::MismatchedTestExpectationLength => write!(f, "invalid number of test expectations"),
}
}
}
pub fn emit_errors(
output: Result<&Value, &str>,
mode: &TestExpectationMode,
expected_output: Option<Value>,
test_index: usize,
) -> Option<TestError> {
match (output, mode) {
(Ok(output), TestExpectationMode::Pass) => {
// passed and should have
if let Some(expected_output) = expected_output.as_ref() {
if output != expected_output {
// invalid output
return Some(TestError::UnexpectedOutput {
index: test_index,
expected: expected_output.clone(),
output: output.clone(),
});
}
}
None
}
(Ok(_tokens), TestExpectationMode::Fail) => Some(TestError::PassedAndShouldntHave { index: test_index }),
(Err(err), TestExpectationMode::Pass) => Some(TestError::FailedAndShouldntHave {
error: err.to_string(),
index: test_index,
}),
(Err(err), TestExpectationMode::Fail) => {
let expected_output: Option<String> =
expected_output.map(|x| serde_yaml::from_value(x).expect("test expectation deserialize failed"));
if let Some(expected_output) = expected_output.as_deref() {
if err != expected_output {
// invalid output
return Some(TestError::UnexpectedError {
expected: expected_output.to_string(),
output: err.to_string(),
index: test_index,
});
}
}
None
}
}
}

View File

@ -0,0 +1,56 @@
// 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 std::{fs, path::Path};
pub fn find_tests<T: AsRef<Path>>(path: T, out: &mut Vec<(String, String)>) {
for entry in fs::read_dir(path).expect("fail to read tests").into_iter() {
let entry = entry.expect("fail to read tests").path();
if entry.is_dir() {
find_tests(entry.as_path(), out);
continue;
} else if entry.extension().map(|x| x.to_str()).flatten().unwrap_or_default() != "leo" {
continue;
}
let content = fs::read_to_string(entry.as_path()).expect("failed to read test");
out.push((entry.as_path().to_str().unwrap_or_default().to_string(), content));
}
}
pub fn split_tests_oneline(source: &str) -> Vec<&str> {
source.lines().map(|x| x.trim()).filter(|x| !x.is_empty()).collect()
}
pub fn split_tests_twoline(source: &str) -> Vec<String> {
let mut out = vec![];
let mut lines = vec![];
for line in source.lines() {
let line = line.trim();
if line.is_empty() {
if !lines.is_empty() {
out.push(lines.join("\n"));
}
lines.clear();
continue;
}
lines.push(line);
}
let last_test = lines.join("\n");
if !last_test.trim().is_empty() {
out.push(last_test.trim().to_string());
}
out
}

35
test-framework/src/lib.rs Normal file
View File

@ -0,0 +1,35 @@
// 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/>.
//! The test framework to run integration tests with Leo code text.
//!
//! This module contains the [`run_tests()`] method which runs all integration tests in the
//! root [`tests/`] directory.
//!
//! To regenerate the tests after a syntax change or failing test, delete the [`tests/expectations/`]
//! directory and run the [`parser_tests()`] test in [`parser/src/test.rs`].
pub mod error;
pub mod fetch;
pub mod output;
pub mod runner;
pub mod test;
pub use runner::*;

View File

@ -0,0 +1,25 @@
// 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 crate::test::TestExpectationMode;
use serde_yaml::Value;
#[derive(serde::Serialize, serde::Deserialize, Clone)]
pub struct TestExpectation {
pub namespace: String,
pub expectation: TestExpectationMode,
pub outputs: Vec<Value>,
}

View File

@ -0,0 +1,196 @@
// 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 serde_yaml::Value;
use std::path::{Path, PathBuf};
use crate::{error::*, fetch::find_tests, output::TestExpectation, test::*};
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum ParseType {
Line,
ContinuousLines,
Whole,
}
pub trait Namespace {
fn parse_type(&self) -> ParseType;
fn run_test(&self, test: &str) -> Result<Value, String>;
}
pub trait Runner {
fn resolve_namespace(&self, name: &str) -> Option<Box<dyn Namespace>>;
}
pub fn run_tests<T: Runner>(runner: &T, expectation_category: &str) {
let mut pass_categories = 0;
let mut pass_tests = 0;
let mut fail_tests = 0;
let mut fail_categories = Vec::new();
let mut tests = Vec::new();
let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_dir.push("../tests/");
let mut expectation_dir = test_dir.clone();
expectation_dir.push("expectations");
find_tests(&test_dir, &mut tests);
let mut outputs = vec![];
for (path, content) in tests.into_iter() {
let config = extract_test_config(&content);
if config.is_none() {
panic!("missing configuration for {}", path);
}
let config = config.unwrap();
let namespace = runner.resolve_namespace(&config.namespace);
if namespace.is_none() {
continue;
}
let namespace = namespace.unwrap();
let path = Path::new(&path);
let relative_path = path.strip_prefix(&test_dir).expect("path error for test");
let mut expectation_path = expectation_dir.clone();
expectation_path.push(expectation_category);
expectation_path.push(relative_path.parent().expect("no parent dir for test"));
let mut test_name = relative_path
.file_name()
.expect("no file name for test")
.to_str()
.unwrap()
.to_string();
test_name += ".out";
expectation_path.push(&test_name);
let expectations: Option<TestExpectation> = if expectation_path.exists() {
if !std::env::var("CLEAR_LEO_TEST_EXPECTATIONS")
.unwrap_or_default()
.trim()
.is_empty()
{
None
} else {
let raw = std::fs::read_to_string(&expectation_path).expect("failed to read expectations file");
Some(serde_yaml::from_str(&raw).expect("invalid yaml in expectations file"))
}
} else {
None
};
let end_of_header = content.find("*/").expect("failed to find header block in test");
let content = &content[end_of_header + 2..];
let tests = match namespace.parse_type() {
ParseType::Line => crate::fetch::split_tests_oneline(content)
.into_iter()
.map(|x| x.to_string())
.collect(),
ParseType::ContinuousLines => crate::fetch::split_tests_twoline(content),
ParseType::Whole => vec![content.to_string()],
};
let mut errors = vec![];
if let Some(expectations) = expectations.as_ref() {
if tests.len() != expectations.outputs.len() {
errors.push(TestError::MismatchedTestExpectationLength);
}
}
let mut new_outputs = vec![];
let mut expected_output = expectations.as_ref().map(|x| x.outputs.iter());
for (i, test) in tests.into_iter().enumerate() {
let expected_output = expected_output
.as_mut()
.map(|x| x.next())
.flatten()
.map(|x| x.as_str())
.flatten();
let output = namespace.run_test(&test);
if let Some(error) = emit_errors(
output.as_ref().map_err(|x| &**x),
&config.expectation,
expected_output.map(|x| Value::String(x.to_string())),
i,
) {
fail_tests += 1;
errors.push(error);
} else {
pass_tests += 1;
new_outputs.push(
output
.as_ref()
.map(|x| serde_yaml::to_value(x).expect("serialization failed"))
.unwrap_or_else(|e| Value::String(e.clone())),
);
}
}
if errors.is_empty() {
if expectations.is_none() {
outputs.push((expectation_path, TestExpectation {
namespace: config.namespace,
expectation: config.expectation,
outputs: new_outputs,
}));
}
pass_categories += 1;
} else {
fail_categories.push(TestFailure {
path: path.to_str().unwrap().to_string(),
errors,
})
}
}
if !fail_categories.is_empty() {
for (i, fail) in fail_categories.iter().enumerate() {
println!(
"\n\n-----------------TEST #{} FAILED (and shouldn't have)-----------------",
i + 1
);
println!("File: {}", fail.path);
for error in &fail.errors {
println!("{}", error);
}
}
panic!(
"failed {}/{} tests in {}/{} categories",
pass_tests,
fail_tests + pass_tests,
fail_categories.len(),
fail_categories.len() + pass_categories
);
} else {
for (path, new_expectation) in outputs {
std::fs::create_dir_all(path.parent().unwrap()).expect("failed to make test expectation parent directory");
std::fs::write(
&path,
serde_yaml::to_string(&new_expectation).expect("failed to serialize expectation yaml"),
)
.expect("failed to write expectation file");
}
println!(
"passed {}/{} tests in {}/{} categories",
pass_tests,
fail_tests + pass_tests,
pass_categories,
pass_categories
);
}
}

View File

@ -0,0 +1,34 @@
// 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/>.
#[derive(serde::Serialize, serde::Deserialize, PartialEq, Debug, Clone)]
pub enum TestExpectationMode {
Pass,
Fail,
}
#[derive(serde::Serialize, serde::Deserialize)]
pub struct TestConfig {
pub namespace: String,
pub expectation: TestExpectationMode,
}
pub fn extract_test_config(source: &str) -> Option<TestConfig> {
let first_comment_start = source.find("/*")?;
let end_first_comment = source[first_comment_start + 2..].find("*/")?;
let comment_inner = &source[first_comment_start + 2..first_comment_start + 2 + end_first_comment];
Some(serde_yaml::from_str(comment_inner).expect("invalid test configuration"))
}

View File

@ -6,12 +6,12 @@ outputs:
expected_input: [] expected_input: []
imports: [] imports: []
circuits: circuits:
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"big_self.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"big_self.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
members: members:
- CircuitFunction: - CircuitFunction:
annotations: [] annotations: []
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"big_self.leo\\\",\\\"content\\\":\\\" function x() -> Self {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x() -> Self {\\\"}\"}"
input: [] input: []
output: SelfType output: SelfType
block: block:
@ -19,34 +19,34 @@ outputs:
- Return: - Return:
expression: expression:
CircuitInit: CircuitInit:
name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"big_self.leo\\\",\\\"content\\\":\\\" return Self {};\\\"}\"}" name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" return Self {};\\\"}\"}"
members: [] members: []
span: span:
line_start: 5 line_start: 5
line_stop: 5 line_stop: 5
col_start: 16 col_start: 16
col_stop: 23 col_stop: 23
path: big_self.leo path: test
content: " return Self {};" content: " return Self {};"
span: span:
line_start: 5 line_start: 5
line_stop: 5 line_stop: 5
col_start: 9 col_start: 9
col_stop: 23 col_stop: 23
path: big_self.leo path: test
content: " return Self {};" content: " return Self {};"
span: span:
line_start: 4 line_start: 4
line_stop: 6 line_stop: 6
col_start: 26 col_start: 26
col_stop: 6 col_stop: 6
path: big_self.leo path: test
content: " function x() -> Self {\n...\n }" content: " function x() -> Self {\n...\n }"
span: span:
line_start: 4 line_start: 4
line_stop: 6 line_stop: 6
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: big_self.leo path: test
content: " function x() -> Self {\n...\n }" content: " function x() -> Self {\n...\n }"
functions: {} functions: {}

View File

@ -6,7 +6,7 @@ outputs:
expected_input: [] expected_input: []
imports: [] imports: []
circuits: circuits:
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"empty.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"empty.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
members: [] members: []
functions: {} functions: {}

View File

@ -6,18 +6,18 @@ outputs:
expected_input: [] expected_input: []
imports: [] imports: []
circuits: circuits:
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"field_and_functions.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"field_and_functions.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
members: members:
- CircuitVariable: - CircuitVariable:
- "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"field_and_functions.leo\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}" - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}"
- IntegerType: U32 - IntegerType: U32
- CircuitVariable: - CircuitVariable:
- "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"field_and_functions.leo\\\",\\\"content\\\":\\\" y: u32,\\\"}\"}" - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" y: u32,\\\"}\"}"
- IntegerType: U32 - IntegerType: U32
- CircuitFunction: - CircuitFunction:
annotations: [] annotations: []
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"field_and_functions.leo\\\",\\\"content\\\":\\\" function x() {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x() {\\\"}\"}"
input: [] input: []
output: ~ output: ~
block: block:
@ -31,32 +31,32 @@ outputs:
line_stop: 7 line_stop: 7
col_start: 16 col_start: 16
col_stop: 18 col_stop: 18
path: field_and_functions.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 7 line_start: 7
line_stop: 7 line_stop: 7
col_start: 9 col_start: 9
col_stop: 18 col_stop: 18
path: field_and_functions.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 6 line_start: 6
line_stop: 8 line_stop: 8
col_start: 18 col_start: 18
col_stop: 6 col_stop: 6
path: field_and_functions.leo path: test
content: " function x() {\n...\n }" content: " function x() {\n...\n }"
span: span:
line_start: 6 line_start: 6
line_stop: 8 line_stop: 8
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: field_and_functions.leo path: test
content: " function x() {\n...\n }" content: " function x() {\n...\n }"
- CircuitFunction: - CircuitFunction:
annotations: [] annotations: []
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"field_and_functions.leo\\\",\\\"content\\\":\\\" function y() {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function y() {\\\"}\"}"
input: [] input: []
output: ~ output: ~
block: block:
@ -70,27 +70,27 @@ outputs:
line_stop: 10 line_stop: 10
col_start: 16 col_start: 16
col_stop: 18 col_stop: 18
path: field_and_functions.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 10 line_start: 10
line_stop: 10 line_stop: 10
col_start: 9 col_start: 9
col_stop: 18 col_stop: 18
path: field_and_functions.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 9 line_start: 9
line_stop: 11 line_stop: 11
col_start: 18 col_start: 18
col_stop: 6 col_stop: 6
path: field_and_functions.leo path: test
content: " function y() {\n...\n }" content: " function y() {\n...\n }"
span: span:
line_start: 9 line_start: 9
line_stop: 11 line_stop: 11
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: field_and_functions.leo path: test
content: " function y() {\n...\n }" content: " function y() {\n...\n }"
functions: {} functions: {}

View File

@ -6,13 +6,13 @@ outputs:
expected_input: [] expected_input: []
imports: [] imports: []
circuits: circuits:
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"fields.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"fields.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
members: members:
- CircuitVariable: - CircuitVariable:
- "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"fields.leo\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}" - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}"
- IntegerType: U32 - IntegerType: U32
- CircuitVariable: - CircuitVariable:
- "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"fields.leo\\\",\\\"content\\\":\\\" y: u32,\\\"}\"}" - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" y: u32,\\\"}\"}"
- IntegerType: U32 - IntegerType: U32
functions: {} functions: {}

View File

@ -6,12 +6,12 @@ outputs:
expected_input: [] expected_input: []
imports: [] imports: []
circuits: circuits:
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"functions.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"functions.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
members: members:
- CircuitFunction: - CircuitFunction:
annotations: [] annotations: []
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"functions.leo\\\",\\\"content\\\":\\\" function x() {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x() {\\\"}\"}"
input: [] input: []
output: ~ output: ~
block: block:
@ -25,32 +25,32 @@ outputs:
line_stop: 5 line_stop: 5
col_start: 16 col_start: 16
col_stop: 18 col_stop: 18
path: functions.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 5 line_start: 5
line_stop: 5 line_stop: 5
col_start: 9 col_start: 9
col_stop: 18 col_stop: 18
path: functions.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 4 line_start: 4
line_stop: 6 line_stop: 6
col_start: 18 col_start: 18
col_stop: 6 col_stop: 6
path: functions.leo path: test
content: " function x() {\n...\n }" content: " function x() {\n...\n }"
span: span:
line_start: 4 line_start: 4
line_stop: 6 line_stop: 6
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: functions.leo path: test
content: " function x() {\n...\n }" content: " function x() {\n...\n }"
- CircuitFunction: - CircuitFunction:
annotations: [] annotations: []
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"functions.leo\\\",\\\"content\\\":\\\" function y() {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function y() {\\\"}\"}"
input: [] input: []
output: ~ output: ~
block: block:
@ -64,27 +64,27 @@ outputs:
line_stop: 8 line_stop: 8
col_start: 16 col_start: 16
col_stop: 18 col_stop: 18
path: functions.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 8 line_start: 8
line_stop: 8 line_stop: 8
col_start: 9 col_start: 9
col_stop: 18 col_stop: 18
path: functions.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 7 line_start: 7
line_stop: 9 line_stop: 9
col_start: 18 col_start: 18
col_stop: 6 col_stop: 6
path: functions.leo path: test
content: " function y() {\n...\n }" content: " function y() {\n...\n }"
span: span:
line_start: 7 line_start: 7
line_stop: 9 line_stop: 9
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: functions.leo path: test
content: " function y() {\n...\n }" content: " function y() {\n...\n }"
functions: {} functions: {}

View File

@ -6,14 +6,14 @@ outputs:
expected_input: [] expected_input: []
imports: [] imports: []
circuits: circuits:
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"mut_self.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"mut_self.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
members: members:
- CircuitFunction: - CircuitFunction:
annotations: [] annotations: []
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"mut_self.leo\\\",\\\"content\\\":\\\" function x(mut self) {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x(mut self) {\\\"}\"}"
input: input:
- MutSelfKeyword: "{\"name\":\"mut self\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":16,\\\"col_stop\\\":24,\\\"path\\\":\\\"mut_self.leo\\\",\\\"content\\\":\\\" function x(mut self) {\\\"}\"}" - MutSelfKeyword: "{\"name\":\"mut self\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":16,\\\"col_stop\\\":24,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x(mut self) {\\\"}\"}"
output: ~ output: ~
block: block:
statements: statements:
@ -26,27 +26,27 @@ outputs:
line_stop: 5 line_stop: 5
col_start: 16 col_start: 16
col_stop: 18 col_stop: 18
path: mut_self.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 5 line_start: 5
line_stop: 5 line_stop: 5
col_start: 9 col_start: 9
col_stop: 18 col_stop: 18
path: mut_self.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 4 line_start: 4
line_stop: 6 line_stop: 6
col_start: 26 col_start: 26
col_stop: 6 col_stop: 6
path: mut_self.leo path: test
content: " function x(mut self) {\n...\n }" content: " function x(mut self) {\n...\n }"
span: span:
line_start: 4 line_start: 4
line_stop: 6 line_stop: 6
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: mut_self.leo path: test
content: " function x(mut self) {\n...\n }" content: " function x(mut self) {\n...\n }"
functions: {} functions: {}

View File

@ -6,14 +6,14 @@ outputs:
expected_input: [] expected_input: []
imports: [] imports: []
circuits: circuits:
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"self.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"self.leo\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
members: members:
- CircuitFunction: - CircuitFunction:
annotations: [] annotations: []
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"self.leo\\\",\\\"content\\\":\\\" function x(self) {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x(self) {\\\"}\"}"
input: input:
- SelfKeyword: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"self.leo\\\",\\\"content\\\":\\\" function x(self) {\\\"}\"}" - SelfKeyword: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x(self) {\\\"}\"}"
output: ~ output: ~
block: block:
statements: statements:
@ -26,27 +26,27 @@ outputs:
line_stop: 5 line_stop: 5
col_start: 16 col_start: 16
col_stop: 18 col_stop: 18
path: self.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 5 line_start: 5
line_stop: 5 line_stop: 5
col_start: 9 col_start: 9
col_stop: 18 col_stop: 18
path: self.leo path: test
content: " return ();" content: " return ();"
span: span:
line_start: 4 line_start: 4
line_stop: 6 line_stop: 6
col_start: 22 col_start: 22
col_stop: 6 col_stop: 6
path: self.leo path: test
content: " function x(self) {\n...\n }" content: " function x(self) {\n...\n }"
span: span:
line_start: 4 line_start: 4
line_stop: 6 line_stop: 6
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: self.leo path: test
content: " function x(self) {\n...\n }" content: " function x(self) {\n...\n }"
functions: {} functions: {}

View File

@ -4,7 +4,7 @@ expectation: Pass
outputs: outputs:
- ArrayAccess: - ArrayAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[0]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0]\\\"}\"}"
index: index:
Value: Value:
Implicit: Implicit:
@ -13,18 +13,18 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: array_access.leo path: test
content: "x[0]" content: "x[0]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: array_access.leo path: test
content: "x[0]" content: "x[0]"
- ArrayAccess: - ArrayAccess:
array: array:
Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"X[1]\\\"}\"}" Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X[1]\\\"}\"}"
index: index:
Value: Value:
Implicit: Implicit:
@ -33,18 +33,18 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: array_access.leo path: test
content: "X[1]" content: "X[1]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: array_access.leo path: test
content: "X[1]" content: "X[1]"
- ArrayAccess: - ArrayAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[0u8]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0u8]\\\"}\"}"
index: index:
Value: Value:
Integer: Integer:
@ -54,20 +54,20 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 6 col_stop: 6
path: array_access.leo path: test
content: "x[0u8]" content: "x[0u8]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_access.leo path: test
content: "x[0u8]" content: "x[0u8]"
- ArrayAccess: - ArrayAccess:
array: array:
ArrayAccess: ArrayAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[1u8][2u8]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[1u8][2u8]\\\"}\"}"
index: index:
Value: Value:
Integer: Integer:
@ -77,14 +77,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 6 col_stop: 6
path: array_access.leo path: test
content: "x[1u8][2u8]" content: "x[1u8][2u8]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_access.leo path: test
content: "x[1u8][2u8]" content: "x[1u8][2u8]"
index: index:
Value: Value:
@ -95,14 +95,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 8 col_start: 8
col_stop: 11 col_stop: 11
path: array_access.leo path: test
content: "x[1u8][2u8]" content: "x[1u8][2u8]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: array_access.leo path: test
content: "x[1u8][2u8]" content: "x[1u8][2u8]"
- ArrayAccess: - ArrayAccess:
array: array:
@ -110,39 +110,39 @@ outputs:
array: array:
ArrayAccess: ArrayAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}"
index: index:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: array_access.leo path: test
content: "x[x][y][z]" content: "x[x][y][z]"
index: index:
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: array_access.leo path: test
content: "x[x][y][z]" content: "x[x][y][z]"
index: index:
Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 11 col_stop: 11
path: array_access.leo path: test
content: "x[x][y][z]" content: "x[x][y][z]"
- Call: - Call:
function: function:
ArrayAccess: ArrayAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[0]()\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0]()\\\"}\"}"
index: index:
Value: Value:
Implicit: Implicit:
@ -151,14 +151,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: array_access.leo path: test
content: "x[0]()" content: "x[0]()"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: array_access.leo path: test
content: "x[0]()" content: "x[0]()"
arguments: [] arguments: []
span: span:
@ -166,20 +166,20 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_access.leo path: test
content: "x[0]()" content: "x[0]()"
- ArrayAccess: - ArrayAccess:
array: array:
Call: Call:
function: function:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x()[0]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x()[0]\\\"}\"}"
arguments: [] arguments: []
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: array_access.leo path: test
content: "x()[0]" content: "x()[0]"
index: index:
Value: Value:
@ -189,14 +189,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: array_access.leo path: test
content: "x()[0]" content: "x()[0]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_access.leo path: test
content: "x()[0]" content: "x()[0]"
- Call: - Call:
function: function:
@ -204,32 +204,32 @@ outputs:
circuit: circuit:
Call: Call:
function: function:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}"
arguments: arguments:
- Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: array_access.leo path: test
content: "x(y)::y(x)" content: "x(y)::y(x)"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: array_access.leo path: test
content: "x(y)::y(x)" content: "x(y)::y(x)"
arguments: arguments:
- Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 11 col_stop: 11
path: array_access.leo path: test
content: "x(y)::y(x)" content: "x(y)::y(x)"
- ArrayAccess: - ArrayAccess:
array: array:
@ -237,15 +237,15 @@ outputs:
tuple: tuple:
ArrayAccess: ArrayAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}"
index: index:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: array_access.leo path: test
content: "x[x].0[x]" content: "x[x].0[x]"
index: index:
value: "0" value: "0"
@ -254,14 +254,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_access.leo path: test
content: "x[x].0[x]" content: "x[x].0[x]"
index: index:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"array_access.leo\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: array_access.leo path: test
content: "x[x].0[x]" content: "x[x].0[x]"

View File

@ -4,7 +4,7 @@ expectation: Pass
outputs: outputs:
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[..]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..]\\\"}\"}"
left: ~ left: ~
right: ~ right: ~
span: span:
@ -12,11 +12,11 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: array_range_access.leo path: test
content: "x[..]" content: "x[..]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[1..]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[1..]\\\"}\"}"
left: left:
Value: Value:
Implicit: Implicit:
@ -25,7 +25,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: array_range_access.leo path: test
content: "x[1..]" content: "x[1..]"
right: ~ right: ~
span: span:
@ -33,11 +33,11 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_range_access.leo path: test
content: "x[1..]" content: "x[1..]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[..1]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..1]\\\"}\"}"
left: ~ left: ~
right: right:
Value: Value:
@ -47,18 +47,18 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: array_range_access.leo path: test
content: "x[..1]" content: "x[..1]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_range_access.leo path: test
content: "x[..1]" content: "x[..1]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[1..1]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[1..1]\\\"}\"}"
left: left:
Value: Value:
Implicit: Implicit:
@ -67,7 +67,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: array_range_access.leo path: test
content: "x[1..1]" content: "x[1..1]"
right: right:
Value: Value:
@ -77,18 +77,18 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: array_range_access.leo path: test
content: "x[1..1]" content: "x[1..1]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: array_range_access.leo path: test
content: "x[1..1]" content: "x[1..1]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[0..100]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0..100]\\\"}\"}"
left: left:
Value: Value:
Implicit: Implicit:
@ -97,7 +97,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: array_range_access.leo path: test
content: "x[0..100]" content: "x[0..100]"
right: right:
Value: Value:
@ -107,20 +107,20 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 9 col_stop: 9
path: array_range_access.leo path: test
content: "x[0..100]" content: "x[0..100]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: array_range_access.leo path: test
content: "x[0..100]" content: "x[0..100]"
- ArrayAccess: - ArrayAccess:
array: array:
ArrayAccess: ArrayAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[323452345.2345234523453453][323452345.2345234523453453]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[323452345.2345234523453453][323452345.2345234523453453]\\\"}\"}"
index: index:
TupleAccess: TupleAccess:
tuple: tuple:
@ -131,7 +131,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 12 col_stop: 12
path: array_range_access.leo path: test
content: "x[323452345.2345234523453453][323452345.2345234523453453]" content: "x[323452345.2345234523453453][323452345.2345234523453453]"
index: index:
value: "2345234523453453" value: "2345234523453453"
@ -140,14 +140,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 29 col_stop: 29
path: array_range_access.leo path: test
content: "x[323452345.2345234523453453][323452345.2345234523453453]" content: "x[323452345.2345234523453453][323452345.2345234523453453]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 30 col_stop: 30
path: array_range_access.leo path: test
content: "x[323452345.2345234523453453][323452345.2345234523453453]" content: "x[323452345.2345234523453453][323452345.2345234523453453]"
index: index:
TupleAccess: TupleAccess:
@ -159,7 +159,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 31 col_start: 31
col_stop: 40 col_stop: 40
path: array_range_access.leo path: test
content: "x[323452345.2345234523453453][323452345.2345234523453453]" content: "x[323452345.2345234523453453][323452345.2345234523453453]"
index: index:
value: "2345234523453453" value: "2345234523453453"
@ -168,18 +168,18 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 31 col_start: 31
col_stop: 57 col_stop: 57
path: array_range_access.leo path: test
content: "x[323452345.2345234523453453][323452345.2345234523453453]" content: "x[323452345.2345234523453453][323452345.2345234523453453]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 58 col_stop: 58
path: array_range_access.leo path: test
content: "x[323452345.2345234523453453][323452345.2345234523453453]" content: "x[323452345.2345234523453453][323452345.2345234523453453]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[0u8..1u8]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0u8..1u8]\\\"}\"}"
left: left:
Value: Value:
Integer: Integer:
@ -189,7 +189,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 6 col_stop: 6
path: array_range_access.leo path: test
content: "x[0u8..1u8]" content: "x[0u8..1u8]"
right: right:
Value: Value:
@ -200,18 +200,18 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 8 col_start: 8
col_stop: 11 col_stop: 11
path: array_range_access.leo path: test
content: "x[0u8..1u8]" content: "x[0u8..1u8]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: array_range_access.leo path: test
content: "x[0u8..1u8]" content: "x[0u8..1u8]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[0u8..]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0u8..]\\\"}\"}"
left: left:
Value: Value:
Integer: Integer:
@ -221,7 +221,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 6 col_stop: 6
path: array_range_access.leo path: test
content: "x[0u8..]" content: "x[0u8..]"
right: ~ right: ~
span: span:
@ -229,11 +229,11 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 9 col_stop: 9
path: array_range_access.leo path: test
content: "x[0u8..]" content: "x[0u8..]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[..0u8]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..0u8]\\\"}\"}"
left: ~ left: ~
right: right:
Value: Value:
@ -244,18 +244,18 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 8 col_stop: 8
path: array_range_access.leo path: test
content: "x[..0u8]" content: "x[..0u8]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 9 col_stop: 9
path: array_range_access.leo path: test
content: "x[..0u8]" content: "x[..0u8]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[..]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..]\\\"}\"}"
left: ~ left: ~
right: ~ right: ~
span: span:
@ -263,22 +263,22 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: array_range_access.leo path: test
content: "x[..]" content: "x[..]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}"
left: left:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 6 col_stop: 6
path: array_range_access.leo path: test
content: "x[x.y..]" content: "x[x.y..]"
right: ~ right: ~
span: span:
@ -286,116 +286,116 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 9 col_stop: 9
path: array_range_access.leo path: test
content: "x[x.y..]" content: "x[x.y..]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}"
left: ~ left: ~
right: right:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}"
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 8 col_stop: 8
path: array_range_access.leo path: test
content: "x[..y.x]" content: "x[..y.x]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 9 col_stop: 9
path: array_range_access.leo path: test
content: "x[..y.x]" content: "x[..y.x]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}"
left: left:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 6 col_stop: 6
path: array_range_access.leo path: test
content: "x[x.y..y.x]" content: "x[x.y..y.x]"
right: right:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}"
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 8 col_start: 8
col_stop: 11 col_stop: 11
path: array_range_access.leo path: test
content: "x[x.y..y.x]" content: "x[x.y..y.x]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: array_range_access.leo path: test
content: "x[x.y..y.x]" content: "x[x.y..y.x]"
- ArrayRangeAccess: - ArrayRangeAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}"
left: left:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 6 col_stop: 6
path: array_range_access.leo path: test
content: "x[x.y.x..y.x.y]" content: "x[x.y.x..y.x.y]"
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 8 col_stop: 8
path: array_range_access.leo path: test
content: "x[x.y.x..y.x.y]" content: "x[x.y.x..y.x.y]"
right: right:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}"
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 13 col_stop: 13
path: array_range_access.leo path: test
content: "x[x.y.x..y.x.y]" content: "x[x.y.x..y.x.y]"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"array_range_access.leo\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 15 col_stop: 15
path: array_range_access.leo path: test
content: "x[x.y.x..y.x.y]" content: "x[x.y.x..y.x.y]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 16 col_stop: 16
path: array_range_access.leo path: test
content: "x[x.y.x..y.x.y]" content: "x[x.y.x..y.x.y]"

View File

@ -4,77 +4,77 @@ expectation: Pass
outputs: outputs:
- Call: - Call:
function: function:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x()\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x()\\\"}\"}"
arguments: [] arguments: []
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: call.leo path: test
content: x() content: x()
- Call: - Call:
function: function:
Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"X()\\\"}\"}" Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X()\\\"}\"}"
arguments: [] arguments: []
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: call.leo path: test
content: X() content: X()
- Call: - Call:
function: function:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x(y)\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)\\\"}\"}"
arguments: arguments:
- Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x(y)\\\"}\"}" - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: call.leo path: test
content: x(y) content: x(y)
- Call: - Call:
function: function:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}"
arguments: arguments:
- Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}" - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}"
- Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}" - Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: call.leo path: test
content: "x(y, z)" content: "x(y, z)"
- Call: - Call:
function: function:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}"
arguments: arguments:
- Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}"
- Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}"
- Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" - Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 11 col_stop: 11
path: call.leo path: test
content: "x(x, y, z)" content: "x(x, y, z)"
- Call: - Call:
function: function:
CircuitStaticFunctionAccess: CircuitStaticFunctionAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y()\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y()\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: call.leo path: test
content: "x::y()" content: "x::y()"
arguments: [] arguments: []
span: span:
@ -82,35 +82,35 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: call.leo path: test
content: "x::y()" content: "x::y()"
- Call: - Call:
function: function:
CircuitStaticFunctionAccess: CircuitStaticFunctionAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: call.leo path: test
content: "x::y(x)" content: "x::y(x)"
arguments: arguments:
- Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: call.leo path: test
content: "x::y(x)" content: "x::y(x)"
- Call: - Call:
function: function:
TupleAccess: TupleAccess:
tuple: tuple:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}"
index: index:
value: "0" value: "0"
span: span:
@ -118,22 +118,22 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: call.leo path: test
content: x.0(x) content: x.0(x)
arguments: arguments:
- Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: call.leo path: test
content: x.0(x) content: x.0(x)
- Call: - Call:
function: function:
ArrayAccess: ArrayAccess:
array: array:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}"
index: index:
Value: Value:
Implicit: Implicit:
@ -142,21 +142,21 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: call.leo path: test
content: "x[0](x)" content: "x[0](x)"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: call.leo path: test
content: "x[0](x)" content: "x[0](x)"
arguments: arguments:
- Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"call.leo\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: call.leo path: test
content: "x[0](x)" content: "x[0](x)"

View File

@ -4,59 +4,59 @@ expectation: Pass
outputs: outputs:
- CircuitMemberAccess: - CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: circuit.leo path: test
content: x.y content: x.y
- CircuitMemberAccess: - CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"X.Y\\\"}\"}" Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X.Y\\\"}\"}"
name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"X.Y\\\"}\"}" name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X.Y\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: circuit.leo path: test
content: X.Y content: X.Y
- CircuitMemberAccess: - CircuitMemberAccess:
circuit: circuit:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: circuit.leo path: test
content: x.y.z content: x.y.z
name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: circuit.leo path: test
content: x.y.z content: x.y.z
- Call: - Call:
function: function:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y()\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y()\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y()\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y()\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: circuit.leo path: test
content: x.y() content: x.y()
arguments: [] arguments: []
span: span:
@ -64,20 +64,20 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: circuit.leo path: test
content: x.y() content: x.y()
- TupleAccess: - TupleAccess:
tuple: tuple:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: circuit.leo path: test
content: x.y.0 content: x.y.0
index: index:
value: "0" value: "0"
@ -86,20 +86,20 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: circuit.leo path: test
content: x.y.0 content: x.y.0
- ArrayAccess: - ArrayAccess:
array: array:
CircuitMemberAccess: CircuitMemberAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit.leo\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: circuit.leo path: test
content: "x.y[1]" content: "x.y[1]"
index: index:
Value: Value:
@ -109,12 +109,12 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: circuit.leo path: test
content: "x.y[1]" content: "x.y[1]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: circuit.leo path: test
content: "x.y[1]" content: "x.y[1]"

View File

@ -4,59 +4,59 @@ expectation: Pass
outputs: outputs:
- CircuitStaticFunctionAccess: - CircuitStaticFunctionAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: circuit_static.leo path: test
content: "x::y" content: "x::y"
- CircuitStaticFunctionAccess: - CircuitStaticFunctionAccess:
circuit: circuit:
Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"X::Y\\\"}\"}" Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X::Y\\\"}\"}"
name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"X::Y\\\"}\"}" name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X::Y\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: circuit_static.leo path: test
content: "X::Y" content: "X::Y"
- CircuitStaticFunctionAccess: - CircuitStaticFunctionAccess:
circuit: circuit:
CircuitStaticFunctionAccess: CircuitStaticFunctionAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: circuit_static.leo path: test
content: "x::y::z" content: "x::y::z"
name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: circuit_static.leo path: test
content: "x::y::z" content: "x::y::z"
- Call: - Call:
function: function:
CircuitStaticFunctionAccess: CircuitStaticFunctionAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y()\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y()\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: circuit_static.leo path: test
content: "x::y()" content: "x::y()"
arguments: [] arguments: []
span: span:
@ -64,20 +64,20 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: circuit_static.leo path: test
content: "x::y()" content: "x::y()"
- TupleAccess: - TupleAccess:
tuple: tuple:
CircuitStaticFunctionAccess: CircuitStaticFunctionAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: circuit_static.leo path: test
content: "x::y.0" content: "x::y.0"
index: index:
value: "0" value: "0"
@ -86,20 +86,20 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: circuit_static.leo path: test
content: "x::y.0" content: "x::y.0"
- ArrayAccess: - ArrayAccess:
array: array:
CircuitStaticFunctionAccess: CircuitStaticFunctionAccess:
circuit: circuit:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}"
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"circuit_static.leo\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}" name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: circuit_static.leo path: test
content: "x::y[1]" content: "x::y[1]"
index: index:
Value: Value:
@ -109,12 +109,12 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: circuit_static.leo path: test
content: "x::y[1]" content: "x::y[1]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: circuit_static.leo path: test
content: "x::y[1]" content: "x::y[1]"

View File

@ -4,7 +4,7 @@ expectation: Pass
outputs: outputs:
- TupleAccess: - TupleAccess:
tuple: tuple:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"tuple.leo\\\",\\\"content\\\":\\\"x.0\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0\\\"}\"}"
index: index:
value: "0" value: "0"
span: span:
@ -12,11 +12,11 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: tuple.leo path: test
content: x.0 content: x.0
- TupleAccess: - TupleAccess:
tuple: tuple:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"tuple.leo\\\",\\\"content\\\":\\\"x.1\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.1\\\"}\"}"
index: index:
value: "1" value: "1"
span: span:
@ -24,11 +24,11 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: tuple.leo path: test
content: x.1 content: x.1
- TupleAccess: - TupleAccess:
tuple: tuple:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"tuple.leo\\\",\\\"content\\\":\\\"x.2\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.2\\\"}\"}"
index: index:
value: "2" value: "2"
span: span:
@ -36,13 +36,13 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: tuple.leo path: test
content: x.2 content: x.2
- TupleAccess: - TupleAccess:
tuple: tuple:
TupleAccess: TupleAccess:
tuple: tuple:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"tuple.leo\\\",\\\"content\\\":\\\"x.0.0\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0.0\\\"}\"}"
index: index:
value: "0" value: "0"
span: span:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: tuple.leo path: test
content: x.0.0 content: x.0.0
index: index:
value: "0" value: "0"
@ -59,13 +59,13 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: tuple.leo path: test
content: x.0.0 content: x.0.0
- TupleAccess: - TupleAccess:
tuple: tuple:
TupleAccess: TupleAccess:
tuple: tuple:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"tuple.leo\\\",\\\"content\\\":\\\"x.1.1\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.1.1\\\"}\"}"
index: index:
value: "1" value: "1"
span: span:
@ -73,7 +73,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: tuple.leo path: test
content: x.1.1 content: x.1.1
index: index:
value: "1" value: "1"
@ -82,13 +82,13 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: tuple.leo path: test
content: x.1.1 content: x.1.1
- TupleAccess: - TupleAccess:
tuple: tuple:
TupleAccess: TupleAccess:
tuple: tuple:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"tuple.leo\\\",\\\"content\\\":\\\"x.2.2\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.2.2\\\"}\"}"
index: index:
value: "2" value: "2"
span: span:
@ -96,7 +96,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: tuple.leo path: test
content: x.2.2 content: x.2.2
index: index:
value: "2" value: "2"
@ -105,5 +105,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: tuple.leo path: test
content: x.2.2 content: x.2.2

View File

@ -12,7 +12,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 5 col_stop: 5
path: array_init.leo path: test
content: "[0u8; 1]" content: "[0u8; 1]"
dimensions: dimensions:
- value: "1" - value: "1"
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 9 col_stop: 9
path: array_init.leo path: test
content: "[0u8; 1]" content: "[0u8; 1]"
- ArrayInit: - ArrayInit:
element: element:
@ -32,7 +32,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 3 col_stop: 3
path: array_init.leo path: test
content: "[0; 1]" content: "[0; 1]"
dimensions: dimensions:
- value: "1" - value: "1"
@ -41,7 +41,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_init.leo path: test
content: "[0; 1]" content: "[0; 1]"
- ArrayInit: - ArrayInit:
element: element:
@ -52,7 +52,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 3 col_stop: 3
path: array_init.leo path: test
content: "[0; (1)]" content: "[0; (1)]"
dimensions: dimensions:
- value: "1" - value: "1"
@ -61,7 +61,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 9 col_stop: 9
path: array_init.leo path: test
content: "[0; (1)]" content: "[0; (1)]"
- ArrayInit: - ArrayInit:
element: element:
@ -72,7 +72,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 3 col_stop: 3
path: array_init.leo path: test
content: "[0; (1, 2)]" content: "[0; (1, 2)]"
dimensions: dimensions:
- value: "1" - value: "1"
@ -82,7 +82,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: array_init.leo path: test
content: "[0; (1, 2)]" content: "[0; (1, 2)]"
- ArrayInit: - ArrayInit:
element: element:
@ -93,7 +93,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 3 col_stop: 3
path: array_init.leo path: test
content: "[0; (1, 2, 3)]" content: "[0; (1, 2, 3)]"
dimensions: dimensions:
- value: "1" - value: "1"
@ -104,7 +104,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: array_init.leo path: test
content: "[0; (1, 2, 3)]" content: "[0; (1, 2, 3)]"
- ArrayInit: - ArrayInit:
element: element:
@ -119,7 +119,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 4 col_start: 4
col_stop: 5 col_stop: 5
path: array_init.leo path: test
content: "[[[0; 3]; 2]; 1]" content: "[[[0; 3]; 2]; 1]"
dimensions: dimensions:
- value: "3" - value: "3"
@ -128,7 +128,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 9 col_stop: 9
path: array_init.leo path: test
content: "[[[0; 3]; 2]; 1]" content: "[[[0; 3]; 2]; 1]"
dimensions: dimensions:
- value: "2" - value: "2"
@ -137,7 +137,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 13 col_stop: 13
path: array_init.leo path: test
content: "[[[0; 3]; 2]; 1]" content: "[[[0; 3]; 2]; 1]"
dimensions: dimensions:
- value: "1" - value: "1"
@ -146,5 +146,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 17 col_stop: 17
path: array_init.leo path: test
content: "[[[0; 3]; 2]; 1]" content: "[[[0; 3]; 2]; 1]"

View File

@ -13,7 +13,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 5 col_stop: 5
path: array_inline.leo path: test
content: "[0u8, 1, 2, 3]" content: "[0u8, 1, 2, 3]"
- Expression: - Expression:
Value: Value:
@ -23,7 +23,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 7 col_start: 7
col_stop: 8 col_stop: 8
path: array_inline.leo path: test
content: "[0u8, 1, 2, 3]" content: "[0u8, 1, 2, 3]"
- Expression: - Expression:
Value: Value:
@ -33,7 +33,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: array_inline.leo path: test
content: "[0u8, 1, 2, 3]" content: "[0u8, 1, 2, 3]"
- Expression: - Expression:
Value: Value:
@ -43,14 +43,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: array_inline.leo path: test
content: "[0u8, 1, 2, 3]" content: "[0u8, 1, 2, 3]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: array_inline.leo path: test
content: "[0u8, 1, 2, 3]" content: "[0u8, 1, 2, 3]"
- ArrayInline: - ArrayInline:
elements: elements:
@ -62,14 +62,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 3 col_stop: 3
path: array_inline.leo path: test
content: "[1]" content: "[1]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: array_inline.leo path: test
content: "[1]" content: "[1]"
- ArrayInline: - ArrayInline:
elements: elements:
@ -82,14 +82,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 5 col_stop: 5
path: array_inline.leo path: test
content: "[1u8]" content: "[1u8]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: array_inline.leo path: test
content: "[1u8]" content: "[1u8]"
- ArrayInline: - ArrayInline:
elements: elements:
@ -102,14 +102,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 5 col_stop: 5
path: array_inline.leo path: test
content: "[1u8,]" content: "[1u8,]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_inline.leo path: test
content: "[1u8,]" content: "[1u8,]"
- ArrayInline: - ArrayInline:
elements: elements:
@ -121,7 +121,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 3 col_stop: 3
path: array_inline.leo path: test
content: "[0, 1,]" content: "[0, 1,]"
- Expression: - Expression:
Value: Value:
@ -131,14 +131,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: array_inline.leo path: test
content: "[0, 1,]" content: "[0, 1,]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: array_inline.leo path: test
content: "[0, 1,]" content: "[0, 1,]"
- ArrayInline: - ArrayInline:
elements: elements:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 3 col_stop: 3
path: array_inline.leo path: test
content: "[0,1,]" content: "[0,1,]"
- Expression: - Expression:
Value: Value:
@ -160,14 +160,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 4 col_start: 4
col_stop: 5 col_stop: 5
path: array_inline.leo path: test
content: "[0,1,]" content: "[0,1,]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: array_inline.leo path: test
content: "[0,1,]" content: "[0,1,]"
- ArrayInline: - ArrayInline:
elements: [] elements: []
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 3 col_stop: 3
path: array_inline.leo path: test
content: "[]" content: "[]"
- ArrayInline: - ArrayInline:
elements: elements:
@ -191,7 +191,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: array_inline.leo path: test
content: "[[1,2,3],[1,2,3]]" content: "[[1,2,3],[1,2,3]]"
- Expression: - Expression:
Value: Value:
@ -201,7 +201,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: array_inline.leo path: test
content: "[[1,2,3],[1,2,3]]" content: "[[1,2,3],[1,2,3]]"
- Expression: - Expression:
Value: Value:
@ -211,14 +211,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 7 col_start: 7
col_stop: 8 col_stop: 8
path: array_inline.leo path: test
content: "[[1,2,3],[1,2,3]]" content: "[[1,2,3],[1,2,3]]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 9 col_stop: 9
path: array_inline.leo path: test
content: "[[1,2,3],[1,2,3]]" content: "[[1,2,3],[1,2,3]]"
- Expression: - Expression:
ArrayInline: ArrayInline:
@ -231,7 +231,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: array_inline.leo path: test
content: "[[1,2,3],[1,2,3]]" content: "[[1,2,3],[1,2,3]]"
- Expression: - Expression:
Value: Value:
@ -241,7 +241,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: array_inline.leo path: test
content: "[[1,2,3],[1,2,3]]" content: "[[1,2,3],[1,2,3]]"
- Expression: - Expression:
Value: Value:
@ -251,21 +251,21 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 15 col_start: 15
col_stop: 16 col_stop: 16
path: array_inline.leo path: test
content: "[[1,2,3],[1,2,3]]" content: "[[1,2,3],[1,2,3]]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 17 col_stop: 17
path: array_inline.leo path: test
content: "[[1,2,3],[1,2,3]]" content: "[[1,2,3],[1,2,3]]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 18 col_stop: 18
path: array_inline.leo path: test
content: "[[1,2,3],[1,2,3]]" content: "[[1,2,3],[1,2,3]]"
- ArrayInline: - ArrayInline:
elements: elements:
@ -277,14 +277,14 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 4 col_stop: 4
path: array_inline.leo path: test
content: "[[]]" content: "[[]]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: array_inline.leo path: test
content: "[[]]" content: "[[]]"
- ArrayInline: - ArrayInline:
elements: elements:
@ -296,7 +296,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 2 col_start: 2
col_stop: 4 col_stop: 4
path: array_inline.leo path: test
content: "[[], []]" content: "[[], []]"
- Expression: - Expression:
ArrayInline: ArrayInline:
@ -306,12 +306,12 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 8 col_stop: 8
path: array_inline.leo path: test
content: "[[], []]" content: "[[], []]"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 9 col_stop: 9
path: array_inline.leo path: test
content: "[[], []]" content: "[[], []]"

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: add.leo path: test
content: 1 + 1 content: 1 + 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 + 1 content: 1 + 1
op: Add op: Add
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 + 1 content: 1 + 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: add.leo path: test
content: 2+3 content: 2+3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: add.leo path: test
content: 2+3 content: 2+3
op: Add op: Add
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: add.leo path: test
content: 2+3 content: 2+3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: add.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
op: Add op: Add
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: add.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
op: Add op: Add
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: add.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: add.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
op: Mul op: Mul
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: add.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: add.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
op: Mul op: Mul
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: add.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
op: Add op: Add
span: span:
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: add.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
- Binary: - Binary:
left: left:
@ -189,7 +189,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: add.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
right: right:
Value: Value:
@ -199,7 +199,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
op: Add op: Add
span: span:
@ -207,7 +207,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
right: right:
Value: Value:
@ -217,7 +217,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: add.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
op: Sub op: Sub
span: span:
@ -225,7 +225,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: add.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
- Binary: - Binary:
left: left:
@ -240,7 +240,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Value: Value:
@ -250,7 +250,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Mul op: Mul
span: span:
@ -258,7 +258,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Binary: Binary:
@ -270,7 +270,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Value: Value:
@ -280,7 +280,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Mul op: Mul
span: span:
@ -288,7 +288,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Add op: Add
span: span:
@ -296,7 +296,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Binary: Binary:
@ -308,7 +308,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 17 col_start: 17
col_stop: 18 col_stop: 18
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Value: Value:
@ -318,7 +318,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 21 col_start: 21
col_stop: 22 col_stop: 22
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Mul op: Mul
span: span:
@ -326,7 +326,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 17 col_start: 17
col_stop: 22 col_stop: 22
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Sub op: Sub
span: span:
@ -334,5 +334,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 22 col_stop: 22
path: add.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: and.leo path: test
content: true && false content: true && false
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: and.leo path: test
content: true && false content: true && false
op: And op: And
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: and.leo path: test
content: true && false content: true && false
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: and.leo path: test
content: false&&true content: false&&true
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 8 col_start: 8
col_stop: 12 col_stop: 12
path: and.leo path: test
content: false&&true content: false&&true
op: And op: And
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: and.leo path: test
content: false&&true content: false&&true
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: and.leo path: test
content: true&&false&&true content: true&&false&&true
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 7 col_start: 7
col_stop: 12 col_stop: 12
path: and.leo path: test
content: true&&false&&true content: true&&false&&true
op: And op: And
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: and.leo path: test
content: true&&false&&true content: true&&false&&true
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 14 col_start: 14
col_stop: 18 col_stop: 18
path: and.leo path: test
content: true&&false&&true content: true&&false&&true
op: And op: And
span: span:
@ -107,5 +107,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 18 col_stop: 18
path: and.leo path: test
content: true&&false&&true content: true&&false&&true

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: div.leo path: test
content: 1 / 1 content: 1 / 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: div.leo path: test
content: 1 / 1 content: 1 / 1
op: Div op: Div
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: div.leo path: test
content: 1 / 1 content: 1 / 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: div.leo path: test
content: 2/3 content: 2/3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: div.leo path: test
content: 2/3 content: 2/3
op: Div op: Div
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: div.leo path: test
content: 2/3 content: 2/3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: div.leo path: test
content: 1 / 2 / 3 content: 1 / 2 / 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: div.leo path: test
content: 1 / 2 / 3 content: 1 / 2 / 3
op: Div op: Div
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: div.leo path: test
content: 1 / 2 / 3 content: 1 / 2 / 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: div.leo path: test
content: 1 / 2 / 3 content: 1 / 2 / 3
op: Div op: Div
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: div.leo path: test
content: 1 / 2 / 3 content: 1 / 2 / 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: div.leo path: test
content: 1 ** 2 / 3 ** 4 content: 1 ** 2 / 3 ** 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: div.leo path: test
content: 1 ** 2 / 3 ** 4 content: 1 ** 2 / 3 ** 4
op: Pow op: Pow
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: div.leo path: test
content: 1 ** 2 / 3 ** 4 content: 1 ** 2 / 3 ** 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: div.leo path: test
content: 1 ** 2 / 3 ** 4 content: 1 ** 2 / 3 ** 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 15 col_start: 15
col_stop: 16 col_stop: 16
path: div.leo path: test
content: 1 ** 2 / 3 ** 4 content: 1 ** 2 / 3 ** 4
op: Pow op: Pow
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 16 col_stop: 16
path: div.leo path: test
content: 1 ** 2 / 3 ** 4 content: 1 ** 2 / 3 ** 4
op: Div op: Div
span: span:
@ -176,5 +176,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 16 col_stop: 16
path: div.leo path: test
content: 1 ** 2 / 3 ** 4 content: 1 ** 2 / 3 ** 4

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: eq.leo path: test
content: 1 == 1 content: 1 == 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: eq.leo path: test
content: 1 == 1 content: 1 == 1
op: Eq op: Eq
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: eq.leo path: test
content: 1 == 1 content: 1 == 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: eq.leo path: test
content: 2==3 content: 2==3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 4 col_start: 4
col_stop: 5 col_stop: 5
path: eq.leo path: test
content: 2==3 content: 2==3
op: Eq op: Eq
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: eq.leo path: test
content: 2==3 content: 2==3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
op: Eq op: Eq
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
op: Eq op: Eq
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: eq.leo path: test
content: 1 < 2 == 3 < 4 content: 1 < 2 == 3 < 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: eq.leo path: test
content: 1 < 2 == 3 < 4 content: 1 < 2 == 3 < 4
op: Lt op: Lt
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: eq.leo path: test
content: 1 < 2 == 3 < 4 content: 1 < 2 == 3 < 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: eq.leo path: test
content: 1 < 2 == 3 < 4 content: 1 < 2 == 3 < 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 14 col_start: 14
col_stop: 15 col_stop: 15
path: eq.leo path: test
content: 1 < 2 == 3 < 4 content: 1 < 2 == 3 < 4
op: Lt op: Lt
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 15 col_stop: 15
path: eq.leo path: test
content: 1 < 2 == 3 < 4 content: 1 < 2 == 3 < 4
op: Eq op: Eq
span: span:
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: eq.leo path: test
content: 1 < 2 == 3 < 4 content: 1 < 2 == 3 < 4
- Binary: - Binary:
left: left:
@ -189,7 +189,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
right: right:
Value: Value:
@ -199,7 +199,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
op: Eq op: Eq
span: span:
@ -207,7 +207,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
right: right:
Value: Value:
@ -217,7 +217,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
op: Eq op: Eq
span: span:
@ -225,7 +225,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: eq.leo path: test
content: 1 == 2 == 3 content: 1 == 2 == 3
- Binary: - Binary:
left: left:
@ -240,7 +240,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
right: right:
Value: Value:
@ -250,7 +250,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
op: Lt op: Lt
span: span:
@ -258,7 +258,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
right: right:
Binary: Binary:
@ -270,7 +270,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
right: right:
Value: Value:
@ -280,7 +280,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 14 col_start: 14
col_stop: 15 col_stop: 15
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
op: Lt op: Lt
span: span:
@ -288,7 +288,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 15 col_stop: 15
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
op: Eq op: Eq
span: span:
@ -296,7 +296,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
right: right:
Binary: Binary:
@ -308,7 +308,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 20 col_stop: 20
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
right: right:
Value: Value:
@ -318,7 +318,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 23 col_start: 23
col_stop: 24 col_stop: 24
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
op: Lt op: Lt
span: span:
@ -326,7 +326,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 24 col_stop: 24
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6
op: Eq op: Eq
span: span:
@ -334,5 +334,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 24 col_stop: 24
path: eq.leo path: test
content: 1 < 2 == 3 < 4 == 5 < 6 content: 1 < 2 == 3 < 4 == 5 < 6

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: exp.leo path: test
content: 1 ** 1 content: 1 ** 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: exp.leo path: test
content: 1 ** 1 content: 1 ** 1
op: Pow op: Pow
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: exp.leo path: test
content: 1 ** 1 content: 1 ** 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: exp.leo path: test
content: 2**3 content: 2**3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 4 col_start: 4
col_stop: 5 col_stop: 5
path: exp.leo path: test
content: 2**3 content: 2**3
op: Pow op: Pow
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: exp.leo path: test
content: 2**3 content: 2**3
- Binary: - Binary:
left: left:
@ -69,7 +69,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: exp.leo path: test
content: 1 ** 2 ** 3 content: 1 ** 2 ** 3
right: right:
Binary: Binary:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: exp.leo path: test
content: 1 ** 2 ** 3 content: 1 ** 2 ** 3
right: right:
Value: Value:
@ -91,7 +91,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: exp.leo path: test
content: 1 ** 2 ** 3 content: 1 ** 2 ** 3
op: Pow op: Pow
span: span:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 12 col_stop: 12
path: exp.leo path: test
content: 1 ** 2 ** 3 content: 1 ** 2 ** 3
op: Pow op: Pow
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: exp.leo path: test
content: 1 ** 2 ** 3 content: 1 ** 2 ** 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 content: 1 as i8 ** 3 as i8
target_type: target_type:
IntegerType: I8 IntegerType: I8
@ -129,7 +129,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 content: 1 as i8 ** 3 as i8
right: right:
Cast: Cast:
@ -141,7 +141,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 12 col_start: 12
col_stop: 13 col_stop: 13
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 content: 1 as i8 ** 3 as i8
target_type: target_type:
IntegerType: I8 IntegerType: I8
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 12 col_start: 12
col_stop: 19 col_stop: 19
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 content: 1 as i8 ** 3 as i8
op: Pow op: Pow
span: span:
@ -158,7 +158,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 19 col_stop: 19
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 content: 1 as i8 ** 3 as i8
- Binary: - Binary:
left: left:
@ -171,7 +171,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 ** 5 as i8 content: 1 as i8 ** 3 as i8 ** 5 as i8
target_type: target_type:
IntegerType: I8 IntegerType: I8
@ -180,7 +180,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 ** 5 as i8 content: 1 as i8 ** 3 as i8 ** 5 as i8
right: right:
Binary: Binary:
@ -194,7 +194,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 12 col_start: 12
col_stop: 13 col_stop: 13
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 ** 5 as i8 content: 1 as i8 ** 3 as i8 ** 5 as i8
target_type: target_type:
IntegerType: I8 IntegerType: I8
@ -203,7 +203,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 12 col_start: 12
col_stop: 19 col_stop: 19
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 ** 5 as i8 content: 1 as i8 ** 3 as i8 ** 5 as i8
right: right:
Cast: Cast:
@ -215,7 +215,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 23 col_start: 23
col_stop: 24 col_stop: 24
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 ** 5 as i8 content: 1 as i8 ** 3 as i8 ** 5 as i8
target_type: target_type:
IntegerType: I8 IntegerType: I8
@ -224,7 +224,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 23 col_start: 23
col_stop: 30 col_stop: 30
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 ** 5 as i8 content: 1 as i8 ** 3 as i8 ** 5 as i8
op: Pow op: Pow
span: span:
@ -232,7 +232,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 12 col_start: 12
col_stop: 30 col_stop: 30
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 ** 5 as i8 content: 1 as i8 ** 3 as i8 ** 5 as i8
op: Pow op: Pow
span: span:
@ -240,5 +240,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 30 col_stop: 30
path: exp.leo path: test
content: 1 as i8 ** 3 as i8 ** 5 as i8 content: 1 as i8 ** 3 as i8 ** 5 as i8

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gt.leo path: test
content: 1 > 1 content: 1 > 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 > 1 content: 1 > 1
op: Gt op: Gt
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 > 1 content: 1 > 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gt.leo path: test
content: 2>3 content: 2>3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: gt.leo path: test
content: 2>3 content: 2>3
op: Gt op: Gt
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: gt.leo path: test
content: 2>3 content: 2>3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
op: Gt op: Gt
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
op: Gt op: Gt
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gt.leo path: test
content: 1 + 2 > 3 + 4 content: 1 + 2 > 3 + 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 + 2 > 3 + 4 content: 1 + 2 > 3 + 4
op: Add op: Add
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 + 2 > 3 + 4 content: 1 + 2 > 3 + 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: gt.leo path: test
content: 1 + 2 > 3 + 4 content: 1 + 2 > 3 + 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: gt.leo path: test
content: 1 + 2 > 3 + 4 content: 1 + 2 > 3 + 4
op: Add op: Add
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: gt.leo path: test
content: 1 + 2 > 3 + 4 content: 1 + 2 > 3 + 4
op: Gt op: Gt
span: span:
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: gt.leo path: test
content: 1 + 2 > 3 + 4 content: 1 + 2 > 3 + 4
- Binary: - Binary:
left: left:
@ -189,7 +189,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
right: right:
Value: Value:
@ -199,7 +199,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
op: Gt op: Gt
span: span:
@ -207,7 +207,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
right: right:
Value: Value:
@ -217,7 +217,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
op: Gt op: Gt
span: span:
@ -225,7 +225,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: gt.leo path: test
content: 1 > 2 > 3 content: 1 > 2 > 3
- Binary: - Binary:
left: left:
@ -240,7 +240,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
right: right:
Value: Value:
@ -250,7 +250,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
op: Add op: Add
span: span:
@ -258,7 +258,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
right: right:
Binary: Binary:
@ -270,7 +270,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
right: right:
Value: Value:
@ -280,7 +280,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
op: Add op: Add
span: span:
@ -288,7 +288,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
op: Gt op: Gt
span: span:
@ -296,7 +296,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
right: right:
Binary: Binary:
@ -308,7 +308,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 17 col_start: 17
col_stop: 18 col_stop: 18
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
right: right:
Value: Value:
@ -318,7 +318,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 21 col_start: 21
col_stop: 22 col_stop: 22
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
op: Add op: Add
span: span:
@ -326,7 +326,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 17 col_start: 17
col_stop: 22 col_stop: 22
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6
op: Gt op: Gt
span: span:
@ -334,5 +334,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 22 col_stop: 22
path: gt.leo path: test
content: 1 + 2 > 3 + 4 > 5 + 6 content: 1 + 2 > 3 + 4 > 5 + 6

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gte.leo path: test
content: 1 >= 1 content: 1 >= 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: gte.leo path: test
content: 1 >= 1 content: 1 >= 1
op: Ge op: Ge
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: gte.leo path: test
content: 1 >= 1 content: 1 >= 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gte.leo path: test
content: 2 >= 3 content: 2 >= 3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: gte.leo path: test
content: 2 >= 3 content: 2 >= 3
op: Ge op: Ge
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: gte.leo path: test
content: 2 >= 3 content: 2 >= 3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
op: Ge op: Ge
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
op: Ge op: Ge
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 content: 1 + 2 >= 3 + 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 content: 1 + 2 >= 3 + 4
op: Add op: Add
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 content: 1 + 2 >= 3 + 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 content: 1 + 2 >= 3 + 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 14 col_start: 14
col_stop: 15 col_stop: 15
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 content: 1 + 2 >= 3 + 4
op: Add op: Add
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 15 col_stop: 15
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 content: 1 + 2 >= 3 + 4
op: Ge op: Ge
span: span:
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 content: 1 + 2 >= 3 + 4
- Binary: - Binary:
left: left:
@ -189,7 +189,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
right: right:
Value: Value:
@ -199,7 +199,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
op: Ge op: Ge
span: span:
@ -207,7 +207,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
right: right:
Value: Value:
@ -217,7 +217,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
op: Ge op: Ge
span: span:
@ -225,7 +225,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: gte.leo path: test
content: 1 >= 2 >= 3 content: 1 >= 2 >= 3
- Binary: - Binary:
left: left:
@ -240,7 +240,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
right: right:
Value: Value:
@ -250,7 +250,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
op: Add op: Add
span: span:
@ -258,7 +258,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
right: right:
Binary: Binary:
@ -270,7 +270,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
right: right:
Value: Value:
@ -280,7 +280,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 14 col_start: 14
col_stop: 15 col_stop: 15
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
op: Add op: Add
span: span:
@ -288,7 +288,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 15 col_stop: 15
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
op: Ge op: Ge
span: span:
@ -296,7 +296,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
right: right:
Binary: Binary:
@ -308,7 +308,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 20 col_stop: 20
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
right: right:
Value: Value:
@ -318,7 +318,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 23 col_start: 23
col_stop: 24 col_stop: 24
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
op: Add op: Add
span: span:
@ -326,7 +326,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 24 col_stop: 24
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6
op: Ge op: Ge
span: span:
@ -334,5 +334,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 24 col_stop: 24
path: gte.leo path: test
content: 1 + 2 >= 3 + 4 >= 5 + 6 content: 1 + 2 >= 3 + 4 >= 5 + 6

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lt.leo path: test
content: 1 < 1 content: 1 < 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 < 1 content: 1 < 1
op: Lt op: Lt
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 < 1 content: 1 < 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lt.leo path: test
content: 2<3 content: 2<3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: lt.leo path: test
content: 2<3 content: 2<3
op: Lt op: Lt
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: lt.leo path: test
content: 2<3 content: 2<3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
op: Lt op: Lt
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
op: Lt op: Lt
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lt.leo path: test
content: 1 + 2 < 3 + 4 content: 1 + 2 < 3 + 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 + 2 < 3 + 4 content: 1 + 2 < 3 + 4
op: Add op: Add
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 + 2 < 3 + 4 content: 1 + 2 < 3 + 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: lt.leo path: test
content: 1 + 2 < 3 + 4 content: 1 + 2 < 3 + 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: lt.leo path: test
content: 1 + 2 < 3 + 4 content: 1 + 2 < 3 + 4
op: Add op: Add
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: lt.leo path: test
content: 1 + 2 < 3 + 4 content: 1 + 2 < 3 + 4
op: Lt op: Lt
span: span:
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: lt.leo path: test
content: 1 + 2 < 3 + 4 content: 1 + 2 < 3 + 4
- Binary: - Binary:
left: left:
@ -189,7 +189,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
right: right:
Value: Value:
@ -199,7 +199,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
op: Lt op: Lt
span: span:
@ -207,7 +207,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
right: right:
Value: Value:
@ -217,7 +217,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
op: Lt op: Lt
span: span:
@ -225,7 +225,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: lt.leo path: test
content: 1 < 2 < 3 content: 1 < 2 < 3
- Binary: - Binary:
left: left:
@ -240,7 +240,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
right: right:
Value: Value:
@ -250,7 +250,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
op: Add op: Add
span: span:
@ -258,7 +258,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
right: right:
Binary: Binary:
@ -270,7 +270,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
right: right:
Value: Value:
@ -280,7 +280,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
op: Add op: Add
span: span:
@ -288,7 +288,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
op: Lt op: Lt
span: span:
@ -296,7 +296,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
right: right:
Binary: Binary:
@ -308,7 +308,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 17 col_start: 17
col_stop: 18 col_stop: 18
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
right: right:
Value: Value:
@ -318,7 +318,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 21 col_start: 21
col_stop: 22 col_stop: 22
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
op: Add op: Add
span: span:
@ -326,7 +326,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 17 col_start: 17
col_stop: 22 col_stop: 22
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6
op: Lt op: Lt
span: span:
@ -334,5 +334,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 22 col_stop: 22
path: lt.leo path: test
content: 1 + 2 < 3 + 4 < 5 + 6 content: 1 + 2 < 3 + 4 < 5 + 6

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lte.leo path: test
content: 1 <= 1 content: 1 <= 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: lte.leo path: test
content: 1 <= 1 content: 1 <= 1
op: Le op: Le
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: lte.leo path: test
content: 1 <= 1 content: 1 <= 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lte.leo path: test
content: 2 <= 3 content: 2 <= 3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: lte.leo path: test
content: 2 <= 3 content: 2 <= 3
op: Le op: Le
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: lte.leo path: test
content: 2 <= 3 content: 2 <= 3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
op: Le op: Le
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
op: Le op: Le
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 content: 1 + 2 <= 3 + 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 content: 1 + 2 <= 3 + 4
op: Add op: Add
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 content: 1 + 2 <= 3 + 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 content: 1 + 2 <= 3 + 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 14 col_start: 14
col_stop: 15 col_stop: 15
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 content: 1 + 2 <= 3 + 4
op: Add op: Add
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 15 col_stop: 15
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 content: 1 + 2 <= 3 + 4
op: Le op: Le
span: span:
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 content: 1 + 2 <= 3 + 4
- Binary: - Binary:
left: left:
@ -189,7 +189,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
right: right:
Value: Value:
@ -199,7 +199,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
op: Le op: Le
span: span:
@ -207,7 +207,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
right: right:
Value: Value:
@ -217,7 +217,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
op: Le op: Le
span: span:
@ -225,7 +225,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: lte.leo path: test
content: 1 <= 2 <= 3 content: 1 <= 2 <= 3
- Binary: - Binary:
left: left:
@ -240,7 +240,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
right: right:
Value: Value:
@ -250,7 +250,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
op: Add op: Add
span: span:
@ -258,7 +258,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
right: right:
Binary: Binary:
@ -270,7 +270,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
right: right:
Value: Value:
@ -280,7 +280,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 14 col_start: 14
col_stop: 15 col_stop: 15
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
op: Add op: Add
span: span:
@ -288,7 +288,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 15 col_stop: 15
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
op: Le op: Le
span: span:
@ -296,7 +296,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
right: right:
Binary: Binary:
@ -308,7 +308,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 20 col_stop: 20
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
right: right:
Value: Value:
@ -318,7 +318,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 23 col_start: 23
col_stop: 24 col_stop: 24
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
op: Add op: Add
span: span:
@ -326,7 +326,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 24 col_stop: 24
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6
op: Le op: Le
span: span:
@ -334,5 +334,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 24 col_stop: 24
path: lte.leo path: test
content: 1 + 2 <= 3 + 4 <= 5 + 6 content: 1 + 2 <= 3 + 4 <= 5 + 6

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: mul.leo path: test
content: 1 * 1 content: 1 * 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: mul.leo path: test
content: 1 * 1 content: 1 * 1
op: Mul op: Mul
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: mul.leo path: test
content: 1 * 1 content: 1 * 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: mul.leo path: test
content: 2*3 content: 2*3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: mul.leo path: test
content: 2*3 content: 2*3
op: Mul op: Mul
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: mul.leo path: test
content: 2*3 content: 2*3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: mul.leo path: test
content: 1 * 2 * 3 content: 1 * 2 * 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: mul.leo path: test
content: 1 * 2 * 3 content: 1 * 2 * 3
op: Mul op: Mul
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: mul.leo path: test
content: 1 * 2 * 3 content: 1 * 2 * 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: mul.leo path: test
content: 1 * 2 * 3 content: 1 * 2 * 3
op: Mul op: Mul
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: mul.leo path: test
content: 1 * 2 * 3 content: 1 * 2 * 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 content: 1 ** 2 * 3 ** 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 content: 1 ** 2 * 3 ** 4
op: Pow op: Pow
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 content: 1 ** 2 * 3 ** 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 content: 1 ** 2 * 3 ** 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 15 col_start: 15
col_stop: 16 col_stop: 16
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 content: 1 ** 2 * 3 ** 4
op: Pow op: Pow
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 16 col_stop: 16
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 content: 1 ** 2 * 3 ** 4
op: Mul op: Mul
span: span:
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 16 col_stop: 16
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 content: 1 ** 2 * 3 ** 4
- Binary: - Binary:
left: left:
@ -191,7 +191,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
right: right:
Value: Value:
@ -201,7 +201,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
op: Pow op: Pow
span: span:
@ -209,7 +209,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
right: right:
Binary: Binary:
@ -221,7 +221,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
right: right:
Value: Value:
@ -231,7 +231,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 15 col_start: 15
col_stop: 16 col_stop: 16
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
op: Pow op: Pow
span: span:
@ -239,7 +239,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 16 col_stop: 16
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
op: Mul op: Mul
span: span:
@ -247,7 +247,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 16 col_stop: 16
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
right: right:
Binary: Binary:
@ -259,7 +259,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 20 col_stop: 20
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
right: right:
Value: Value:
@ -269,7 +269,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 24 col_start: 24
col_stop: 25 col_stop: 25
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
op: Pow op: Pow
span: span:
@ -277,7 +277,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 25 col_stop: 25
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6
op: Div op: Div
span: span:
@ -285,5 +285,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 25 col_stop: 25
path: mul.leo path: test
content: 1 ** 2 * 3 ** 4 / 5 ** 6 content: 1 ** 2 * 3 ** 4 / 5 ** 6

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: ne.leo path: test
content: 1 != 1 content: 1 != 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: ne.leo path: test
content: 1 != 1 content: 1 != 1
op: Ne op: Ne
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: ne.leo path: test
content: 1 != 1 content: 1 != 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: ne.leo path: test
content: 2!=3 content: 2!=3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 4 col_start: 4
col_stop: 5 col_stop: 5
path: ne.leo path: test
content: 2!=3 content: 2!=3
op: Ne op: Ne
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: ne.leo path: test
content: 2!=3 content: 2!=3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
op: Ne op: Ne
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
op: Ne op: Ne
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: ne.leo path: test
content: 1 < 2 != 3 < 4 content: 1 < 2 != 3 < 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: ne.leo path: test
content: 1 < 2 != 3 < 4 content: 1 < 2 != 3 < 4
op: Lt op: Lt
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: ne.leo path: test
content: 1 < 2 != 3 < 4 content: 1 < 2 != 3 < 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: ne.leo path: test
content: 1 < 2 != 3 < 4 content: 1 < 2 != 3 < 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 14 col_start: 14
col_stop: 15 col_stop: 15
path: ne.leo path: test
content: 1 < 2 != 3 < 4 content: 1 < 2 != 3 < 4
op: Lt op: Lt
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 15 col_stop: 15
path: ne.leo path: test
content: 1 < 2 != 3 < 4 content: 1 < 2 != 3 < 4
op: Ne op: Ne
span: span:
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: ne.leo path: test
content: 1 < 2 != 3 < 4 content: 1 < 2 != 3 < 4
- Binary: - Binary:
left: left:
@ -189,7 +189,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
right: right:
Value: Value:
@ -199,7 +199,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 7 col_stop: 7
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
op: Ne op: Ne
span: span:
@ -207,7 +207,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 7 col_stop: 7
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
right: right:
Value: Value:
@ -217,7 +217,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 11 col_start: 11
col_stop: 12 col_stop: 12
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
op: Ne op: Ne
span: span:
@ -225,7 +225,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 12 col_stop: 12
path: ne.leo path: test
content: 1 != 2 != 3 content: 1 != 2 != 3
- Binary: - Binary:
left: left:
@ -240,7 +240,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
right: right:
Value: Value:
@ -250,7 +250,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
op: Lt op: Lt
span: span:
@ -258,7 +258,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
right: right:
Binary: Binary:
@ -270,7 +270,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 11 col_stop: 11
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
right: right:
Value: Value:
@ -280,7 +280,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 14 col_start: 14
col_stop: 15 col_stop: 15
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
op: Lt op: Lt
span: span:
@ -288,7 +288,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 10 col_start: 10
col_stop: 15 col_stop: 15
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
op: Ne op: Ne
span: span:
@ -296,7 +296,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 15 col_stop: 15
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
right: right:
Binary: Binary:
@ -308,7 +308,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 20 col_stop: 20
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
right: right:
Value: Value:
@ -318,7 +318,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 23 col_start: 23
col_stop: 24 col_stop: 24
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
op: Lt op: Lt
span: span:
@ -326,7 +326,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 19 col_start: 19
col_stop: 24 col_stop: 24
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6
op: Ne op: Ne
span: span:
@ -334,5 +334,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 24 col_stop: 24
path: ne.leo path: test
content: 1 < 2 != 3 < 4 != 5 < 6 content: 1 < 2 != 3 < 4 != 5 < 6

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: or.leo path: test
content: 1 + 1 content: 1 + 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 + 1 content: 1 + 1
op: Add op: Add
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 + 1 content: 1 + 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: or.leo path: test
content: 2+3 content: 2+3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: or.leo path: test
content: 2+3 content: 2+3
op: Add op: Add
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: or.leo path: test
content: 2+3 content: 2+3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: or.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
op: Add op: Add
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: or.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
op: Add op: Add
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: or.leo path: test
content: 1 + 2 + 3 content: 1 + 2 + 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: or.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
op: Mul op: Mul
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: or.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: or.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
op: Mul op: Mul
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: or.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
op: Add op: Add
span: span:
@ -176,7 +176,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: or.leo path: test
content: 1 * 2 + 3 * 4 content: 1 * 2 + 3 * 4
- Binary: - Binary:
left: left:
@ -189,7 +189,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: or.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
right: right:
Value: Value:
@ -199,7 +199,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
op: Add op: Add
span: span:
@ -207,7 +207,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
right: right:
Value: Value:
@ -217,7 +217,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: or.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
op: Sub op: Sub
span: span:
@ -225,7 +225,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: or.leo path: test
content: 1 + 2 - 3 content: 1 + 2 - 3
- Binary: - Binary:
left: left:
@ -240,7 +240,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Value: Value:
@ -250,7 +250,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Mul op: Mul
span: span:
@ -258,7 +258,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Binary: Binary:
@ -270,7 +270,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Value: Value:
@ -280,7 +280,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Mul op: Mul
span: span:
@ -288,7 +288,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Add op: Add
span: span:
@ -296,7 +296,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Binary: Binary:
@ -308,7 +308,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 17 col_start: 17
col_stop: 18 col_stop: 18
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
right: right:
Value: Value:
@ -318,7 +318,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 21 col_start: 21
col_stop: 22 col_stop: 22
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Mul op: Mul
span: span:
@ -326,7 +326,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 17 col_start: 17
col_stop: 22 col_stop: 22
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6
op: Sub op: Sub
span: span:
@ -334,5 +334,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 22 col_stop: 22
path: or.leo path: test
content: 1 * 2 + 3 * 4 - 5 * 6 content: 1 * 2 + 3 * 4 - 5 * 6

View File

@ -11,7 +11,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: sub.leo path: test
content: 1 - 1 content: 1 - 1
right: right:
Value: Value:
@ -21,7 +21,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: sub.leo path: test
content: 1 - 1 content: 1 - 1
op: Sub op: Sub
span: span:
@ -29,7 +29,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: sub.leo path: test
content: 1 - 1 content: 1 - 1
- Binary: - Binary:
left: left:
@ -40,7 +40,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: sub.leo path: test
content: 2-3 content: 2-3
right: right:
Value: Value:
@ -50,7 +50,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 3 col_start: 3
col_stop: 4 col_stop: 4
path: sub.leo path: test
content: 2-3 content: 2-3
op: Sub op: Sub
span: span:
@ -58,7 +58,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: sub.leo path: test
content: 2-3 content: 2-3
- Binary: - Binary:
left: left:
@ -71,7 +71,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: sub.leo path: test
content: 1 - 2 - 3 content: 1 - 2 - 3
right: right:
Value: Value:
@ -81,7 +81,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: sub.leo path: test
content: 1 - 2 - 3 content: 1 - 2 - 3
op: Sub op: Sub
span: span:
@ -89,7 +89,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: sub.leo path: test
content: 1 - 2 - 3 content: 1 - 2 - 3
right: right:
Value: Value:
@ -99,7 +99,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: sub.leo path: test
content: 1 - 2 - 3 content: 1 - 2 - 3
op: Sub op: Sub
span: span:
@ -107,7 +107,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: sub.leo path: test
content: 1 - 2 - 3 content: 1 - 2 - 3
- Binary: - Binary:
left: left:
@ -120,7 +120,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 2 col_stop: 2
path: sub.leo path: test
content: 1 * 2 - 3 * 4 content: 1 * 2 - 3 * 4
right: right:
Value: Value:
@ -130,7 +130,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 5 col_start: 5
col_stop: 6 col_stop: 6
path: sub.leo path: test
content: 1 * 2 - 3 * 4 content: 1 * 2 - 3 * 4
op: Mul op: Mul
span: span:
@ -138,7 +138,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: sub.leo path: test
content: 1 * 2 - 3 * 4 content: 1 * 2 - 3 * 4
right: right:
Binary: Binary:
@ -150,7 +150,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 10 col_stop: 10
path: sub.leo path: test
content: 1 * 2 - 3 * 4 content: 1 * 2 - 3 * 4
right: right:
Value: Value:
@ -160,7 +160,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 13 col_start: 13
col_stop: 14 col_stop: 14
path: sub.leo path: test
content: 1 * 2 - 3 * 4 content: 1 * 2 - 3 * 4
op: Mul op: Mul
span: span:
@ -168,7 +168,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 9 col_start: 9
col_stop: 14 col_stop: 14
path: sub.leo path: test
content: 1 * 2 - 3 * 4 content: 1 * 2 - 3 * 4
op: Sub op: Sub
span: span:
@ -176,5 +176,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 14 col_stop: 14
path: sub.leo path: test
content: 1 * 2 - 3 * 4 content: 1 * 2 - 3 * 4

View File

@ -4,7 +4,7 @@ expectation: Pass
outputs: outputs:
- Cast: - Cast:
inner: inner:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"x as u8\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as u8\\\"}\"}"
target_type: target_type:
IntegerType: U8 IntegerType: U8
span: span:
@ -12,23 +12,23 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: cast.leo path: test
content: x as u8 content: x as u8
- Cast: - Cast:
inner: inner:
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"y as id\\\"}\"}" Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"y as id\\\"}\"}"
target_type: target_type:
Circuit: "{\"name\":\"id\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":8,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"y as id\\\"}\"}" Circuit: "{\"name\":\"id\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"y as id\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: cast.leo path: test
content: y as id content: y as id
- Cast: - Cast:
inner: inner:
Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"z as u32\\\"}\"}" Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"z as u32\\\"}\"}"
target_type: target_type:
IntegerType: U32 IntegerType: U32
span: span:
@ -36,11 +36,11 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 9 col_stop: 9
path: cast.leo path: test
content: z as u32 content: z as u32
- Cast: - Cast:
inner: inner:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"x as i128\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as i128\\\"}\"}"
target_type: target_type:
IntegerType: I128 IntegerType: I128
span: span:
@ -48,13 +48,13 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: cast.leo path: test
content: x as i128 content: x as i128
- Cast: - Cast:
inner: inner:
Cast: Cast:
inner: inner:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"x as u8 as u128\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as u8 as u128\\\"}\"}"
target_type: target_type:
IntegerType: U8 IntegerType: U8
span: span:
@ -62,7 +62,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: cast.leo path: test
content: x as u8 as u128 content: x as u8 as u128
target_type: target_type:
IntegerType: U128 IntegerType: U128
@ -71,39 +71,39 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 16 col_stop: 16
path: cast.leo path: test
content: x as u8 as u128 content: x as u8 as u128
- Cast: - Cast:
inner: inner:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"x as field\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as field\\\"}\"}"
target_type: Field target_type: Field
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 11 col_stop: 11
path: cast.leo path: test
content: x as field content: x as field
- Cast: - Cast:
inner: inner:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"x as group\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as group\\\"}\"}"
target_type: Group target_type: Group
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 11 col_stop: 11
path: cast.leo path: test
content: x as group content: x as group
- Binary: - Binary:
left: left:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"x ** y as u32 ** z\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ** y as u32 ** z\\\"}\"}"
right: right:
Binary: Binary:
left: left:
Cast: Cast:
inner: inner:
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"x ** y as u32 ** z\\\"}\"}" Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ** y as u32 ** z\\\"}\"}"
target_type: target_type:
IntegerType: U32 IntegerType: U32
span: span:
@ -111,17 +111,17 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 14 col_stop: 14
path: cast.leo path: test
content: x ** y as u32 ** z content: x ** y as u32 ** z
right: right:
Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"x ** y as u32 ** z\\\"}\"}" Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ** y as u32 ** z\\\"}\"}"
op: Pow op: Pow
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 6 col_start: 6
col_stop: 19 col_stop: 19
path: cast.leo path: test
content: x ** y as u32 ** z content: x ** y as u32 ** z
op: Pow op: Pow
span: span:
@ -129,7 +129,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 19 col_stop: 19
path: cast.leo path: test
content: x ** y as u32 ** z content: x ** y as u32 ** z
- Value: - Value:
Implicit: Implicit:
@ -144,14 +144,14 @@ outputs:
inner: inner:
Unary: Unary:
inner: inner:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"!x as u32\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!x as u32\\\"}\"}"
op: Not op: Not
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 3 col_stop: 3
path: cast.leo path: test
content: "!x as u32" content: "!x as u32"
target_type: target_type:
IntegerType: U32 IntegerType: U32
@ -160,20 +160,20 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: cast.leo path: test
content: "!x as u32" content: "!x as u32"
- Cast: - Cast:
inner: inner:
Unary: Unary:
inner: inner:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"cast.leo\\\",\\\"content\\\":\\\"-x as u32\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"-x as u32\\\"}\"}"
op: Negate op: Negate
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 3 col_stop: 3
path: cast.leo path: test
content: "-x as u32" content: "-x as u32"
target_type: target_type:
IntegerType: U32 IntegerType: U32
@ -182,5 +182,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 10 col_stop: 10
path: cast.leo path: test
content: "-x as u32" content: "-x as u32"

View File

@ -3,111 +3,111 @@ namespace: ParseExpression
expectation: Pass expectation: Pass
outputs: outputs:
- CircuitInit: - CircuitInit:
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x {}\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x {}\\\"}\"}"
members: [] members: []
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: circuit_init.leo path: test
content: "x {}" content: "x {}"
- CircuitInit: - CircuitInit:
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x {y}\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x {y}\\\"}\"}"
members: members:
- identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x {y}\\\"}\"}" - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x {y}\\\"}\"}"
expression: ~ expression: ~
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: circuit_init.leo path: test
content: "x {y}" content: "x {y}"
- CircuitInit: - CircuitInit:
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y}\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y}\\\"}\"}"
members: members:
- identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y}\\\"}\"}" - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y}\\\"}\"}"
expression: ~ expression: ~
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: circuit_init.leo path: test
content: "x{y}" content: "x{y}"
- CircuitInit: - CircuitInit:
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{}\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{}\\\"}\"}"
members: [] members: []
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 4 col_stop: 4
path: circuit_init.leo path: test
content: "x{}" content: "x{}"
- CircuitInit: - CircuitInit:
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y: y}\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: y}\\\"}\"}"
members: members:
- identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y: y}\\\"}\"}" - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: y}\\\"}\"}"
expression: expression:
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y: y}\\\"}\"}" Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: y}\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: circuit_init.leo path: test
content: "x{y: y}" content: "x{y: y}"
- CircuitInit: - CircuitInit:
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y: x}\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x}\\\"}\"}"
members: members:
- identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y: x}\\\"}\"}" - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x}\\\"}\"}"
expression: expression:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y: x}\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x}\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: circuit_init.leo path: test
content: "x{y: x}" content: "x{y: x}"
- CircuitInit: - CircuitInit:
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y: x,}\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x,}\\\"}\"}"
members: members:
- identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y: x,}\\\"}\"}" - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x,}\\\"}\"}"
expression: expression:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y: x,}\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x,}\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 9 col_stop: 9
path: circuit_init.leo path: test
content: "x{y: x,}" content: "x{y: x,}"
- CircuitInit: - CircuitInit:
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}"
members: members:
- identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}"
expression: expression:
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}"
- identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}"
expression: expression:
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}"
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 13 col_stop: 13
path: circuit_init.leo path: test
content: "x{y:x, x:y,}" content: "x{y:x, x:y,}"
- CircuitInit: - CircuitInit:
name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"circuit_init.leo\\\",\\\"content\\\":\\\"Self {}\\\"}\"}" name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"Self {}\\\"}\"}"
members: [] members: []
span: span:
line_start: 1 line_start: 1
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 8 col_stop: 8
path: circuit_init.leo path: test
content: "Self {}" content: "Self {}"

View File

@ -2,22 +2,22 @@
namespace: ParseExpression namespace: ParseExpression
expectation: Pass expectation: Pass
outputs: outputs:
- Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"x\\\"}\"}" - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x\\\"}\"}"
- Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"X\\\"}\"}" - Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X\\\"}\"}"
- Identifier: "{\"name\":\"xxx\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"xxx\\\"}\"}" - Identifier: "{\"name\":\"xxx\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"xxx\\\"}\"}"
- Identifier: "{\"name\":\"XXX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"XXX\\\"}\"}" - Identifier: "{\"name\":\"XXX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"XXX\\\"}\"}"
- Identifier: "{\"name\":\"x1\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"x1\\\"}\"}" - Identifier: "{\"name\":\"x1\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x1\\\"}\"}"
- Identifier: "{\"name\":\"xu32\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"xu32\\\"}\"}" - Identifier: "{\"name\":\"xu32\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"xu32\\\"}\"}"
- Identifier: "{\"name\":\"testx\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"testx\\\"}\"}" - Identifier: "{\"name\":\"testx\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"testx\\\"}\"}"
- Identifier: "{\"name\":\"truex\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"truex\\\"}\"}" - Identifier: "{\"name\":\"truex\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"truex\\\"}\"}"
- Identifier: "{\"name\":\"TRUE\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"TRUE\\\"}\"}" - Identifier: "{\"name\":\"TRUE\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"TRUE\\\"}\"}"
- Identifier: "{\"name\":\"testX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"testX\\\"}\"}" - Identifier: "{\"name\":\"testX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"testX\\\"}\"}"
- Identifier: "{\"name\":\"letX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"letX\\\"}\"}" - Identifier: "{\"name\":\"letX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"letX\\\"}\"}"
- Identifier: "{\"name\":\"constX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":7,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"constX\\\"}\"}" - Identifier: "{\"name\":\"constX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"constX\\\"}\"}"
- Identifier: "{\"name\":\"test_test\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":10,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"test_test\\\"}\"}" - Identifier: "{\"name\":\"test_test\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"test_test\\\"}\"}"
- Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"self\\\"}\"}" - Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"self\\\"}\"}"
- Identifier: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"Self\\\"}\"}" - Identifier: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"Self\\\"}\"}"
- Identifier: "{\"name\":\"input\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"input\\\"}\"}" - Identifier: "{\"name\":\"input\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"input\\\"}\"}"
- Identifier: "{\"name\":\"selfX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"selfX\\\"}\"}" - Identifier: "{\"name\":\"selfX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"selfX\\\"}\"}"
- Identifier: "{\"name\":\"SelfX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"SelfX\\\"}\"}" - Identifier: "{\"name\":\"SelfX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"SelfX\\\"}\"}"
- Identifier: "{\"name\":\"inputX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":7,\\\"path\\\":\\\"ident.leo\\\",\\\"content\\\":\\\"inputX\\\"}\"}" - Identifier: "{\"name\":\"inputX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"inputX\\\"}\"}"

View File

@ -9,7 +9,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 64 col_stop: 64
path: address_parse.leo path: test
content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
- Value: - Value:
Address: Address:
@ -18,7 +18,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 64 col_stop: 64
path: address_parse.leo path: test
content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9 content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9
- Value: - Value:
Address: Address:
@ -27,7 +27,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 64 col_stop: 64
path: address_parse.leo path: test
content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9 content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9
- Value: - Value:
Address: Address:
@ -36,5 +36,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 64 col_stop: 64
path: address_parse.leo path: test
content: aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st content: aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st

View File

@ -9,7 +9,7 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 5 col_stop: 5
path: bool_parse.leo path: test
content: "true" content: "true"
- Value: - Value:
Boolean: Boolean:
@ -18,5 +18,5 @@ outputs:
line_stop: 1 line_stop: 1
col_start: 1 col_start: 1
col_stop: 6 col_stop: 6
path: bool_parse.leo path: test
content: "false" content: "false"

Some files were not shown because too many files have changed in this diff Show More