diff --git a/Cargo.lock b/Cargo.lock index 2fd675137b..3301d9770c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,9 +270,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.1.6" +version = "3.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123" +checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c" dependencies = [ "atty", "bitflags", @@ -559,9 +559,9 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9289ed2c0440a6536e65119725cf91fc2c6b5e513bfd2e36e1134d7cca6ca12f" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" dependencies = [ "indenter", "once_cell", @@ -672,16 +672,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -[[package]] -name = "futf" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" -dependencies = [ - "mac", - "new_debug_unreachable", -] - [[package]] name = "futures-channel" version = "0.3.19" @@ -758,17 +748,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.4" @@ -777,7 +756,7 @@ checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -934,9 +913,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" dependencies = [ "autocfg", "hashbrown", @@ -1079,7 +1058,6 @@ dependencies = [ "serde", "serde_json", "smallvec", - "tendril", ] [[package]] @@ -1116,7 +1094,6 @@ dependencies = [ "eyre", "leo-span", "serde", - "tendril", "thiserror", ] @@ -1126,7 +1103,7 @@ version = "1.5.3" dependencies = [ "ansi_term", "assert_cmd", - "clap 3.1.6", + "clap 3.1.8", "color-backtrace", "colored", "console", @@ -1137,8 +1114,8 @@ dependencies = [ "leo-errors", "leo-package", "notify", - "rand 0.8.4", - "rand_core 0.6.3", + "rand", + "rand_core", "reqwest", "rusty-hook", "self_update", @@ -1183,7 +1160,6 @@ dependencies = [ "serde_yaml", "smallvec", "structopt", - "tendril", "tracing", ] @@ -1195,7 +1171,6 @@ dependencies = [ "indexmap", "scoped-tls", "serde", - "tendril", ] [[package]] @@ -1231,12 +1206,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "mac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" - [[package]] name = "matches" version = "0.1.9" @@ -1384,12 +1353,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" - [[package]] name = "nias" version = "0.5.0" @@ -1565,7 +1528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d791538a6dcc1e7cb7fe6f6b58aca40e7f79403c45b2bc274008b5e647af1d8" dependencies = [ "base64ct", - "rand_core 0.6.3", + "rand_core", "subtle", ] @@ -1735,19 +1698,6 @@ dependencies = [ "proc-macro2", ] -[[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]] name = "rand" version = "0.8.4" @@ -1755,19 +1705,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", - "rand_hc 0.3.1", -] - -[[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", + "rand_chacha", + "rand_core", + "rand_hc", ] [[package]] @@ -1777,16 +1717,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", -] - -[[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", + "rand_core", ] [[package]] @@ -1795,16 +1726,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.4", -] - -[[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", + "getrandom", ] [[package]] @@ -1813,7 +1735,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ - "rand_core 0.6.3", + "rand_core", ] [[package]] @@ -1856,7 +1778,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "getrandom 0.2.4", + "getrandom", "redox_syscall", ] @@ -2191,7 +2113,7 @@ dependencies = [ "bincode", "itertools", "num-bigint", - "rand 0.8.4", + "rand", "serde", "snarkvm-derives", "thiserror", @@ -2274,17 +2196,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "tendril" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9ef557cb397a4f0a5a3a628f06515f78563f2209e64d47055d9dc6052bf5e33" -dependencies = [ - "futf", - "mac", - "utf-8", -] - [[package]] name = "termcolor" version = "1.1.2" @@ -2312,11 +2223,11 @@ checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" [[package]] name = "test_dir" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e571ebf9127a9da821890a9fa8a8ef777fce3e0f959ff6949cf06ca8b736381d" +checksum = "1fc19daf9fc57fadcf740c4abaaa0cd08d9ce22a2a0629aaf6cbd9ae4b80683a" dependencies = [ - "rand 0.7.3", + "rand", ] [[package]] @@ -2506,9 +2417,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e0ab7bdc962035a87fba73f3acca9b8a8d0034c2e6f60b84aeaaddddc155dce" +checksum = "b9df98b037d039d03400d9dd06b0f8ce05486b5f25e9a2d7d36196e142ebbc52" dependencies = [ "ansi_term", "sharded-slab", @@ -2590,12 +2501,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "valuable" version = "0.1.0" @@ -2650,12 +2555,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index 7a0b36ba6b..81a4f0c3db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -106,7 +106,7 @@ version = "0.5" version = "0.1" [dependencies.tracing-subscriber] -version = "0.3.9" +version = "0.3.10" features = [ "fmt" ] [dependencies.zip] @@ -122,7 +122,7 @@ version = "2.0.4" version = "0.11.2" [dev-dependencies.test_dir] -version = "0.1.0" +version = "0.2.0" [features] default = [ ] diff --git a/compiler/ast/Cargo.toml b/compiler/ast/Cargo.toml index 748d65c171..d4193ad5f0 100644 --- a/compiler/ast/Cargo.toml +++ b/compiler/ast/Cargo.toml @@ -41,9 +41,6 @@ features = [ "derive", "rc" ] version = "1.0" features = [ "preserve_order" ] -[dependencies.tendril] -version = "0.4" - [dev-dependencies.criterion] version = "0.3" diff --git a/compiler/parser/Cargo.toml b/compiler/parser/Cargo.toml index 9003397d8b..4b5ff2ccaa 100644 --- a/compiler/parser/Cargo.toml +++ b/compiler/parser/Cargo.toml @@ -48,9 +48,6 @@ version = "1.3.0" version = "1.0" features = [ "derive" ] -[dependencies.tendril] -version = "0.4" - [dependencies.tracing] version = "0.1" diff --git a/compiler/parser/src/parser/statement.rs b/compiler/parser/src/parser/statement.rs index ce2fdaa0a6..354257738c 100644 --- a/compiler/parser/src/parser/statement.rs +++ b/compiler/parser/src/parser/statement.rs @@ -19,14 +19,7 @@ use super::*; use leo_errors::{ParserError, Result}; use leo_span::sym; -const ASSIGN_TOKENS: &[Token] = &[ - Token::Assign, - Token::AddEq, - Token::MinusEq, - Token::MulEq, - Token::DivEq, - Token::ExpEq, -]; +const ASSIGN_TOKENS: &[Token] = &[Token::Assign]; impl ParserContext<'_> { /// @@ -85,11 +78,6 @@ impl ParserContext<'_> { assignee, operation: match operator.token { Token::Assign => AssignOperation::Assign, - Token::AddEq => AssignOperation::Add, - Token::MinusEq => AssignOperation::Sub, - Token::MulEq => AssignOperation::Mul, - Token::DivEq => AssignOperation::Div, - Token::ExpEq => AssignOperation::Pow, _ => unreachable!("parse_assign_statement_ shouldn't produce this"), }, value, diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index 571931ea45..f65260ff24 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -261,20 +261,12 @@ impl Token { Some('*') => { input.next(); if input.next_if_eq(&'*').is_some() { - if input.next_if_eq(&'=').is_some() { - return Ok((3, Token::ExpEq)); - } return Ok((2, Token::Exp)); - } else if input.next_if_eq(&'=').is_some() { - return Ok((2, Token::MulEq)); } return Ok((1, Token::Mul)); } Some('+') => { input.next(); - if input.next_if_eq(&'=').is_some() { - return Ok((2, Token::AddEq)); - } return Ok((1, Token::Add)); } Some(',') => { @@ -285,8 +277,6 @@ impl Token { input.next(); if input.next_if_eq(&'>').is_some() { return Ok((2, Token::Arrow)); - } else if input.next_if_eq(&'=').is_some() { - return Ok((2, Token::MinusEq)); } return Ok((1, Token::Minus)); } @@ -333,8 +323,6 @@ impl Token { return Err(ParserError::lexer_block_comment_does_not_close_before_eof(comment).into()); } return Ok((comment.len(), Token::CommentBlock(comment))); - } else if input.next_if_eq(&'=').is_some() { - return Ok((2, Token::DivEq)); } return Ok((1, Token::Div)); } diff --git a/compiler/parser/src/tokenizer/mod.rs b/compiler/parser/src/tokenizer/mod.rs index 69fce18a11..2b99a86027 100644 --- a/compiler/parser/src/tokenizer/mod.rs +++ b/compiler/parser/src/tokenizer/mod.rs @@ -159,19 +159,14 @@ mod tests { ) * ** - **= - *= + - += , - - -= -> _ . .. / - /= : ; < @@ -199,7 +194,7 @@ mod tests { assert_eq!( output, - r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address bool const else false field for function group i128 i64 i32 i16 i8 if in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** **= *= + += , - -= -> _ . .. / /= : ; < <= = == > >= [ ] { { } } || ? // test + r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address bool const else false field for function group i128 i64 i32 i16 i8 if in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** + , - -> _ . .. / : ; < <= = == > >= [ ] { { } } || ? // test /* test */ // "# ); }); diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index 8e227499c4..05862cb591 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -76,11 +76,6 @@ pub enum Token { Div, Exp, Assign, - AddEq, - MinusEq, - MulEq, - DivEq, - ExpEq, LeftParen, RightParen, LeftSquare, @@ -251,11 +246,6 @@ impl fmt::Display for Token { Div => write!(f, "/"), Exp => write!(f, "**"), Assign => write!(f, "="), - AddEq => write!(f, "+="), - MinusEq => write!(f, "-="), - MulEq => write!(f, "*="), - DivEq => write!(f, "/="), - ExpEq => write!(f, "**="), LeftParen => write!(f, "("), RightParen => write!(f, ")"), LeftSquare => write!(f, "["), diff --git a/docs/grammar/README.md b/docs/grammar/README.md index 9584e7ad31..9af4a38e19 100644 Binary files a/docs/grammar/README.md and b/docs/grammar/README.md differ diff --git a/docs/grammar/abnf-grammar.txt b/docs/grammar/abnf-grammar.txt index 6181893379..cd50022c52 100644 --- a/docs/grammar/abnf-grammar.txt +++ b/docs/grammar/abnf-grammar.txt @@ -181,6 +181,7 @@ symbol = "!" / "&&" / "||" token = keyword / identifier / atomic-literal + / numeral / symbol lexeme = token / comment / whitespace diff --git a/leo/errors/Cargo.toml b/leo/errors/Cargo.toml index db0b886495..c7d29a7a38 100644 --- a/leo/errors/Cargo.toml +++ b/leo/errors/Cargo.toml @@ -35,15 +35,12 @@ version = "0.5.1" version = "2.2.0" [dependencies.eyre] -version = "0.6.7" +version = "0.6.8" default-features = false [dependencies.serde] version = "1.0.133" features = [ "derive", "rc" ] -[dependencies.tendril] -version = "0.4.2" - [dependencies.thiserror] version = "1.0.30" diff --git a/leo/span/Cargo.toml b/leo/span/Cargo.toml index f6b8744bf6..4bf317337a 100644 --- a/leo/span/Cargo.toml +++ b/leo/span/Cargo.toml @@ -31,6 +31,3 @@ features = [ "derive", "rc" ] [dependencies.scoped-tls] version = "1.0.0" - -[dependencies.tendril] -version = "0.4.2" diff --git a/leo/span/src/lib.rs b/leo/span/src/lib.rs index 85d52015b3..6851878fbe 100644 --- a/leo/span/src/lib.rs +++ b/leo/span/src/lib.rs @@ -23,5 +23,3 @@ pub mod span; pub use span::Span; pub mod span_json; - -pub mod tendril_json; diff --git a/leo/span/src/tendril_json.rs b/leo/span/src/tendril_json.rs deleted file mode 100644 index 5f2194ab4c..0000000000 --- a/leo/span/src/tendril_json.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2019-2022 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 . - -//! Provides logic for serializing and deserializing the `StrTendril` type. - -use serde::{Deserialize, Deserializer, Serializer}; -use tendril::StrTendril; - -/// Serialization for the StrTendril type. -pub fn serialize(tendril: &StrTendril, serializer: S) -> Result { - serializer.serialize_str(tendril) -} - -/// Deserialization for the StrTendril type. -pub fn deserialize<'de, D: Deserializer<'de>>(deserializer: D) -> Result { - Ok(String::deserialize(deserializer)?.into()) -} diff --git a/tests/expectations/parser/parser/expression/token_format.leo.out b/tests/expectations/parser/parser/expression/token_format.leo.out index c329e3e9ef..2aca9b16fe 100644 --- a/tests/expectations/parser/parser/expression/token_format.leo.out +++ b/tests/expectations/parser/parser/expression/token_format.leo.out @@ -25,11 +25,11 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got '**'\n --> test:1:1\n |\n 1 | **\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '/'\n --> test:1:1\n |\n 1 | /\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:1\n |\n 1 | =\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '+='\n --> test:1:1\n |\n 1 | +=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '-='\n --> test:1:1\n |\n 1 | -=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '*='\n --> test:1:1\n |\n 1 | *=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '/='\n --> test:1:1\n |\n 1 | /=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '**='\n --> test:1:1\n |\n 1 | **=\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '+'\n --> test:1:1\n |\n 1 | +=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:2\n |\n 1 | -=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '*'\n --> test:1:1\n |\n 1 | *=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '/'\n --> test:1:1\n |\n 1 | /=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '**'\n --> test:1:1\n |\n 1 | **=\n | ^^" - "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | (\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:1\n |\n 1 | )\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [\n | ^" diff --git a/tests/expectations/parser/parser/statement/assign.leo.out b/tests/expectations/parser/parser/statement/assign.leo.out index ac520eb734..b87db92545 100644 --- a/tests/expectations/parser/parser/statement/assign.leo.out +++ b/tests/expectations/parser/parser/statement/assign.leo.out @@ -87,397 +87,3 @@ outputs: col_stop: 8 path: "" content: x = x(); - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x += expr;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x += expr; - value: - Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x += expr;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x += expr; - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x += x+y;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x += x+y; - value: - Binary: - left: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x += x+y;\\\"}\"}" - right: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x += x+y;\\\"}\"}" - op: Add - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 9 - path: "" - content: x += x+y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x += x+y; - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x += x();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x += x(); - value: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x += x();\\\"}\"}" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 9 - path: "" - content: x += x(); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x += x(); - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x -= expr;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x -= expr; - value: - Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x -= expr;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x -= expr; - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x -= x+y;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x -= x+y; - value: - Binary: - left: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x -= x+y;\\\"}\"}" - right: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x -= x+y;\\\"}\"}" - op: Add - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 9 - path: "" - content: x -= x+y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x -= x+y; - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x -= x();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x -= x(); - value: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x -= x();\\\"}\"}" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 9 - path: "" - content: x -= x(); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x -= x(); - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x *= expr;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x *= expr; - value: - Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x *= expr;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x *= expr; - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x *= x+y;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x *= x+y; - value: - Binary: - left: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x *= x+y;\\\"}\"}" - right: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x *= x+y;\\\"}\"}" - op: Add - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 9 - path: "" - content: x *= x+y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x *= x+y; - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x *= x();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x *= x(); - value: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x *= x();\\\"}\"}" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 9 - path: "" - content: x *= x(); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x *= x(); - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x /= expr;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x /= expr; - value: - Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x /= expr;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x /= expr; - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x /= x+y;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x /= x+y; - value: - Binary: - left: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x /= x+y;\\\"}\"}" - right: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x /= x+y;\\\"}\"}" - op: Add - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 9 - path: "" - content: x /= x+y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x /= x+y; - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x /= x();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x /= x(); - value: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x /= x();\\\"}\"}" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 9 - path: "" - content: x /= x(); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x /= x(); - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= expr;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x **= expr; - value: - Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= expr;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: x **= expr; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= x+y;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x **= x+y; - value: - Binary: - left: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= x+y;\\\"}\"}" - right: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= x+y;\\\"}\"}" - op: Add - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 10 - path: "" - content: x **= x+y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x **= x+y; diff --git a/tests/parser/statement/assign.leo b/tests/parser/statement/assign.leo index 6d368cc6fd..323adebec3 100644 --- a/tests/parser/statement/assign.leo +++ b/tests/parser/statement/assign.leo @@ -8,31 +8,3 @@ x = expr; x = x+y; x = x(); - -x += expr; - -x += x+y; - -x += x(); - -x -= expr; - -x -= x+y; - -x -= x(); - -x *= expr; - -x *= x+y; - -x *= x(); - -x /= expr; - -x /= x+y; - -x /= x(); - -x **= expr; - -x **= x+y;