diff --git a/.github/workflows/mixin-cargo-test.yml b/.github/workflows/mixin-cargo-test.yml index f2dcf3c2..ae24edcc 100644 --- a/.github/workflows/mixin-cargo-test.yml +++ b/.github/workflows/mixin-cargo-test.yml @@ -45,10 +45,15 @@ jobs: - name: Run unit tests with coverage run: cargo llvm-cov nextest --lib --workspace --codecov --output-path codecov-unittests.json + - name: Run regression tests with coverage + env: + CI: true + run: cargo llvm-cov nextest --test 'regression' --codecov --output-path codecov-regression.json + - name: Run doctests run: cargo test --workspace --doc - - name: Upload coverage to Codecov + - name: Upload unit coverage to Codecov uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -56,3 +61,12 @@ jobs: flags: tests,unit-tests files: codecov-unittests.json fail_ci_if_error: true + + - name: Upload regression coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: BraneFramework/brane + flags: tests,regression-tests + files: codecov-regression.json + fail_ci_if_error: true diff --git a/Cargo.lock b/Cargo.lock index 6050bdfb..468ada31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -763,6 +763,7 @@ version = "3.0.0" dependencies = [ "brane-shr 3.0.0", "enum-debug", + "insta", "log", "nom", "nom_locate", @@ -2660,6 +2661,20 @@ dependencies = [ "web-time", ] +[[package]] +name = "insta" +version = "1.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50259abbaa67d11d2bcafc7ba1d094ed7a0c70e3ce893f0d0997f73558cb3084" +dependencies = [ + "console", + "linked-hash-map", + "once_cell", + "pin-project", + "serde", + "similar", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -2860,6 +2875,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.9.2" @@ -4287,6 +4308,12 @@ dependencies = [ "libc", ] +[[package]] +name = "similar" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" + [[package]] name = "simple_asn1" version = "0.6.3" diff --git a/brane-dsl/Cargo.toml b/brane-dsl/Cargo.toml index 591f8bee..0109c36f 100644 --- a/brane-dsl/Cargo.toml +++ b/brane-dsl/Cargo.toml @@ -19,5 +19,8 @@ serde = "1.0.204" brane-shr = { path = "../brane-shr" } specifications = { path = "../specifications" } +[dev-dependencies] +insta = { version = "1.42.2", features=["yaml"] } + [lints] workspace = true diff --git a/brane-dsl/src/compiler.rs b/brane-dsl/src/compiler.rs index 14fe6255..eb81b58e 100644 --- a/brane-dsl/src/compiler.rs +++ b/brane-dsl/src/compiler.rs @@ -26,71 +26,6 @@ use crate::scanner::{self, Span, Token, Tokens}; use crate::spec::Language; -/***** TESTS *****/ -#[cfg(test)] -pub mod tests { - use brane_shr::utilities::{create_package_index, test_on_dsl_files}; - - use super::*; - - - /// Tests BraneScript files. - #[test] - fn test_bscript() { - // Simply pass to the compiler - test_on_dsl_files("BraneScript", |path, code| { - // Print the header always - println!("{}", (0..80).map(|_| '-').collect::()); - println!("File '{}' gave us:", path.display()); - - // Read the package index - let pindex: PackageIndex = create_package_index(); - - // Create a compiler and compile it; - let res: Program = match parse(code, &pindex, &ParserOptions::bscript()) { - Ok(res) => res, - Err(err) => { - panic!("Failed to parse BraneScript file '{}': {}", path.display(), err); - }, - }; - - // Print it for good measure - println!("{res:#?}"); - println!("{}\n\n", (0..80).map(|_| '-').collect::()); - }); - } - - /// Tests Bakery files. - #[test] - fn test_bakery() { - // Simply pass to the compiler - test_on_dsl_files("Bakery", |path, code| { - // Print the header always - println!("{}", (0..80).map(|_| '-').collect::()); - println!("File '{}' gave us:", path.display()); - - // Read the package index - let pindex: PackageIndex = create_package_index(); - - // Create a compiler and compile it; - let res: Program = match parse(code, &pindex, &ParserOptions::bakery()) { - Ok(res) => res, - Err(err) => { - panic!("Failed to parse Bakery file '{}': {}", path.display(), err); - }, - }; - - // Print it for good measure - println!("{res:#?}"); - println!("{}\n\n", (0..80).map(|_| '-').collect::()); - }); - } -} - - - - - /***** AUXILLARY STRUCTS *****/ /// Defines options that configure the compiler before we use it. #[derive(Clone, Debug)] diff --git a/brane-dsl/tests/regression.rs b/brane-dsl/tests/regression.rs new file mode 100644 index 00000000..9701ce25 --- /dev/null +++ b/brane-dsl/tests/regression.rs @@ -0,0 +1,44 @@ +use brane_dsl::{ParserOptions, parse}; +use brane_shr::utilities::{create_package_index, test_on_dsl_files}; + + +/// Tests BraneScript files. +#[test] +fn test_bscript() { + // Simply pass to the compiler + test_on_dsl_files("BraneScript", |path, code| { + // Read the package index + let pindex = create_package_index(); + + // Create a compiler and compile it; + let res = match parse(code, &pindex, &ParserOptions::bscript()) { + Ok(res) => res, + Err(err) => { + panic!("Failed to parse BraneScript file '{}': {}", path.display(), err); + }, + }; + + insta::assert_debug_snapshot!(path.as_os_str().to_str().expect("Invalid test name"), res); + }); +} + + +/// Tests Bakery files. +#[test] +fn test_bakery() { + // Simply pass to the compiler + test_on_dsl_files("Bakery", |path, code| { + // Read the package index + let pindex = create_package_index(); + + // Create a compiler and compile it; + let res = match parse(code, &pindex, &ParserOptions::bakery()) { + Ok(res) => res, + Err(err) => { + panic!("Failed to parse Bakery file '{}': {}", path.display(), err); + }, + }; + + insta::assert_debug_snapshot!(path.as_os_str().to_str().expect("Invalid test name"), res); + }); +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__arrays.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__arrays.bs.snap new file mode 100644 index 00000000..313553b1 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__arrays.bs.snap @@ -0,0 +1,1484 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "arr1", + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 9, + }, + }, + }, + value: Array { + values: [ + Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 3, + col: 15, + }, + end: TextPos { + line: 3, + col: 16, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 2, + range: TextRange { + start: TextPos { + line: 3, + col: 18, + }, + end: TextPos { + line: 3, + col: 19, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 3, + range: TextRange { + start: TextPos { + line: 3, + col: 21, + }, + end: TextPos { + line: 3, + col: 22, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 4, + range: TextRange { + start: TextPos { + line: 3, + col: 24, + }, + end: TextPos { + line: 3, + col: 25, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 5, + range: TextRange { + start: TextPos { + line: 3, + col: 27, + }, + end: TextPos { + line: 3, + col: 28, + }, + }, + }, + }, + ], + data_type: Any, + range: TextRange { + start: TextPos { + line: 3, + col: 13, + }, + end: TextPos { + line: 3, + col: 30, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 31, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + ArrayIndex { + array: VarRef { + name: Identifier { + value: "arr1", + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 13, + }, + }, + }, + st_entry: None, + }, + index: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 4, + col: 14, + }, + end: TextPos { + line: 4, + col: 15, + }, + }, + }, + }, + data_type: Any, + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 16, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 17, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 18, + }, + }, + }, + LetAssign { + name: Identifier { + value: "arr2", + range: TextRange { + start: TextPos { + line: 6, + col: 5, + }, + end: TextPos { + line: 6, + col: 9, + }, + }, + }, + value: Array { + values: [ + Literal { + literal: Integer { + value: 10, + range: TextRange { + start: TextPos { + line: 6, + col: 15, + }, + end: TextPos { + line: 6, + col: 17, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 9, + range: TextRange { + start: TextPos { + line: 6, + col: 19, + }, + end: TextPos { + line: 6, + col: 20, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 8, + range: TextRange { + start: TextPos { + line: 6, + col: 22, + }, + end: TextPos { + line: 6, + col: 23, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 7, + range: TextRange { + start: TextPos { + line: 6, + col: 25, + }, + end: TextPos { + line: 6, + col: 26, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 6, + range: TextRange { + start: TextPos { + line: 6, + col: 28, + }, + end: TextPos { + line: 6, + col: 29, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 5, + range: TextRange { + start: TextPos { + line: 6, + col: 31, + }, + end: TextPos { + line: 6, + col: 32, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 4, + range: TextRange { + start: TextPos { + line: 6, + col: 34, + }, + end: TextPos { + line: 6, + col: 35, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 3, + range: TextRange { + start: TextPos { + line: 6, + col: 37, + }, + end: TextPos { + line: 6, + col: 38, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 2, + range: TextRange { + start: TextPos { + line: 6, + col: 40, + }, + end: TextPos { + line: 6, + col: 41, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 6, + col: 43, + }, + end: TextPos { + line: 6, + col: 44, + }, + }, + }, + }, + ], + data_type: Any, + range: TextRange { + start: TextPos { + line: 6, + col: 13, + }, + end: TextPos { + line: 6, + col: 46, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 47, + }, + }, + }, + For { + initializer: LetAssign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 7, + col: 10, + }, + end: TextPos { + line: 7, + col: 11, + }, + }, + }, + value: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 7, + col: 15, + }, + end: TextPos { + line: 7, + col: 16, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 6, + }, + end: TextPos { + line: 7, + col: 17, + }, + }, + }, + condition: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 7, + col: 20, + }, + end: TextPos { + line: 7, + col: 21, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 7, + col: 18, + }, + end: TextPos { + line: 7, + col: 19, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 10, + range: TextRange { + start: TextPos { + line: 7, + col: 22, + }, + end: TextPos { + line: 7, + col: 24, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 7, + col: 18, + }, + end: TextPos { + line: 7, + col: 24, + }, + }, + }, + increment: Assign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 7, + col: 26, + }, + end: TextPos { + line: 7, + col: 27, + }, + }, + }, + value: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 7, + col: 33, + }, + end: TextPos { + line: 7, + col: 34, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 7, + col: 31, + }, + end: TextPos { + line: 7, + col: 32, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 7, + col: 35, + }, + end: TextPos { + line: 7, + col: 36, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 7, + col: 31, + }, + end: TextPos { + line: 7, + col: 36, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 26, + }, + end: TextPos { + line: 7, + col: 36, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 8, + col: 11, + }, + end: TextPos { + line: 8, + col: 12, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 13, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 14, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: ") ", + range: TextRange { + start: TextPos { + line: 9, + col: 11, + }, + end: TextPos { + line: 9, + col: 15, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 16, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 17, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 10, + col: 5, + }, + end: TextPos { + line: 10, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + ArrayIndex { + array: VarRef { + name: Identifier { + value: "arr2", + range: TextRange { + start: TextPos { + line: 10, + col: 13, + }, + end: TextPos { + line: 10, + col: 17, + }, + }, + }, + st_entry: None, + }, + index: BinOp { + op: Sub { + range: TextRange { + start: TextPos { + line: 10, + col: 20, + }, + end: TextPos { + line: 10, + col: 21, + }, + }, + }, + lhs: Literal { + literal: Integer { + value: 9, + range: TextRange { + start: TextPos { + line: 10, + col: 18, + }, + end: TextPos { + line: 10, + col: 19, + }, + }, + }, + }, + rhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 10, + col: 22, + }, + end: TextPos { + line: 10, + col: 23, + }, + }, + }, + st_entry: None, + }, + range: TextRange { + start: TextPos { + line: 10, + col: 18, + }, + end: TextPos { + line: 10, + col: 23, + }, + }, + }, + data_type: Any, + range: TextRange { + start: TextPos { + line: 10, + col: 13, + }, + end: TextPos { + line: 10, + col: 24, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 10, + col: 5, + }, + end: TextPos { + line: 10, + col: 25, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 5, + }, + end: TextPos { + line: 10, + col: 26, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 38, + }, + end: TextPos { + line: 11, + col: 2, + }, + }, + }, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 11, + col: 2, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 13, + col: 1, + }, + end: TextPos { + line: 13, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + ArrayIndex { + array: Array { + values: [ + Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 13, + col: 10, + }, + end: TextPos { + line: 13, + col: 11, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 2, + range: TextRange { + start: TextPos { + line: 13, + col: 13, + }, + end: TextPos { + line: 13, + col: 14, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 3, + range: TextRange { + start: TextPos { + line: 13, + col: 16, + }, + end: TextPos { + line: 13, + col: 17, + }, + }, + }, + }, + ], + data_type: Any, + range: TextRange { + start: TextPos { + line: 13, + col: 9, + }, + end: TextPos { + line: 13, + col: 18, + }, + }, + }, + index: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 13, + col: 19, + }, + end: TextPos { + line: 13, + col: 20, + }, + }, + }, + }, + data_type: Any, + range: TextRange { + start: TextPos { + line: 13, + col: 9, + }, + end: TextPos { + line: 13, + col: 21, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 13, + col: 1, + }, + end: TextPos { + line: 13, + col: 22, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 13, + col: 1, + }, + end: TextPos { + line: 13, + col: 23, + }, + }, + }, + LetAssign { + name: Identifier { + value: "arr_arr", + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 12, + }, + }, + }, + value: Array { + values: [ + Array { + values: [ + Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 15, + col: 19, + }, + end: TextPos { + line: 15, + col: 20, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 2, + range: TextRange { + start: TextPos { + line: 15, + col: 22, + }, + end: TextPos { + line: 15, + col: 23, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 3, + range: TextRange { + start: TextPos { + line: 15, + col: 25, + }, + end: TextPos { + line: 15, + col: 26, + }, + }, + }, + }, + ], + data_type: Any, + range: TextRange { + start: TextPos { + line: 15, + col: 18, + }, + end: TextPos { + line: 15, + col: 27, + }, + }, + }, + Array { + values: [ + Literal { + literal: Integer { + value: 4, + range: TextRange { + start: TextPos { + line: 15, + col: 30, + }, + end: TextPos { + line: 15, + col: 31, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 5, + range: TextRange { + start: TextPos { + line: 15, + col: 33, + }, + end: TextPos { + line: 15, + col: 34, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 6, + range: TextRange { + start: TextPos { + line: 15, + col: 36, + }, + end: TextPos { + line: 15, + col: 37, + }, + }, + }, + }, + ], + data_type: Any, + range: TextRange { + start: TextPos { + line: 15, + col: 29, + }, + end: TextPos { + line: 15, + col: 38, + }, + }, + }, + Array { + values: [ + Literal { + literal: Integer { + value: 7, + range: TextRange { + start: TextPos { + line: 15, + col: 41, + }, + end: TextPos { + line: 15, + col: 42, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 8, + range: TextRange { + start: TextPos { + line: 15, + col: 44, + }, + end: TextPos { + line: 15, + col: 45, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 9, + range: TextRange { + start: TextPos { + line: 15, + col: 47, + }, + end: TextPos { + line: 15, + col: 48, + }, + }, + }, + }, + ], + data_type: Any, + range: TextRange { + start: TextPos { + line: 15, + col: 40, + }, + end: TextPos { + line: 15, + col: 49, + }, + }, + }, + ], + data_type: Any, + range: TextRange { + start: TextPos { + line: 15, + col: 16, + }, + end: TextPos { + line: 15, + col: 51, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 15, + col: 1, + }, + end: TextPos { + line: 15, + col: 52, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 16, + col: 1, + }, + end: TextPos { + line: 16, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + ArrayIndex { + array: VarRef { + name: Identifier { + value: "arr_arr", + range: TextRange { + start: TextPos { + line: 16, + col: 9, + }, + end: TextPos { + line: 16, + col: 16, + }, + }, + }, + st_entry: None, + }, + index: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 16, + col: 17, + }, + end: TextPos { + line: 16, + col: 18, + }, + }, + }, + }, + data_type: Any, + range: TextRange { + start: TextPos { + line: 16, + col: 9, + }, + end: TextPos { + line: 16, + col: 19, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 16, + col: 1, + }, + end: TextPos { + line: 16, + col: 20, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 16, + col: 1, + }, + end: TextPos { + line: 16, + col: 21, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 17, + col: 1, + }, + end: TextPos { + line: 17, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + ArrayIndex { + array: ArrayIndex { + array: VarRef { + name: Identifier { + value: "arr_arr", + range: TextRange { + start: TextPos { + line: 17, + col: 9, + }, + end: TextPos { + line: 17, + col: 16, + }, + }, + }, + st_entry: None, + }, + index: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 17, + col: 17, + }, + end: TextPos { + line: 17, + col: 18, + }, + }, + }, + }, + data_type: Any, + range: TextRange { + start: TextPos { + line: 17, + col: 9, + }, + end: TextPos { + line: 17, + col: 19, + }, + }, + }, + index: Literal { + literal: Integer { + value: 2, + range: TextRange { + start: TextPos { + line: 17, + col: 20, + }, + end: TextPos { + line: 17, + col: 21, + }, + }, + }, + }, + data_type: Any, + range: TextRange { + start: TextPos { + line: 17, + col: 9, + }, + end: TextPos { + line: 17, + col: 22, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 17, + col: 1, + }, + end: TextPos { + line: 17, + col: 23, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 17, + col: 1, + }, + end: TextPos { + line: 17, + col: 24, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 17, + col: 24, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__attributes.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__attributes.bs.snap new file mode 100644 index 00000000..3e766fcc --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__attributes.bs.snap @@ -0,0 +1,1879 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 3, + col: 8, + }, + end: TextPos { + line: 3, + col: 19, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 20, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "tag", + range: TextRange { + start: TextPos { + line: 7, + col: 3, + }, + end: TextPos { + line: 7, + col: 6, + }, + }, + }, + values: [ + String { + value: "amy.foo", + range: TextRange { + start: TextPos { + line: 7, + col: 7, + }, + end: TextPos { + line: 7, + col: 16, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 18, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 8, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 8, + col: 9, + }, + end: TextPos { + line: 8, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 8, + col: 9, + }, + end: TextPos { + line: 8, + col: 22, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 8, + col: 23, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 8, + col: 24, + }, + }, + }, + Block { + block: Block { + stmts: [ + Attribute( + List { + key: Identifier { + value: "tag", + range: TextRange { + start: TextPos { + line: 13, + col: 7, + }, + end: TextPos { + line: 13, + col: 10, + }, + }, + }, + values: [ + String { + value: "bob.bar", + range: TextRange { + start: TextPos { + line: 13, + col: 11, + }, + end: TextPos { + line: 13, + col: 20, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 13, + col: 5, + }, + end: TextPos { + line: 13, + col: 22, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 14, + col: 13, + }, + end: TextPos { + line: 14, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 14, + col: 13, + }, + end: TextPos { + line: 14, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 28, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "tag", + range: TextRange { + start: TextPos { + line: 15, + col: 7, + }, + end: TextPos { + line: 15, + col: 10, + }, + }, + }, + values: [ + String { + value: "bob.bar", + range: TextRange { + start: TextPos { + line: 15, + col: 11, + }, + end: TextPos { + line: 15, + col: 20, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 22, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 16, + col: 13, + }, + end: TextPos { + line: 16, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 16, + col: 13, + }, + end: TextPos { + line: 16, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 28, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 12, + col: 1, + }, + end: TextPos { + line: 17, + col: 2, + }, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "tag", + range: TextRange { + start: TextPos { + line: 19, + col: 3, + }, + end: TextPos { + line: 19, + col: 6, + }, + }, + }, + values: [ + String { + value: "bob.bar", + range: TextRange { + start: TextPos { + line: 19, + col: 7, + }, + end: TextPos { + line: 19, + col: 16, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 19, + col: 1, + }, + end: TextPos { + line: 19, + col: 18, + }, + }, + }, + ), + Block { + block: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 21, + col: 5, + }, + end: TextPos { + line: 21, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 21, + col: 13, + }, + end: TextPos { + line: 21, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 21, + col: 13, + }, + end: TextPos { + line: 21, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 21, + col: 5, + }, + end: TextPos { + line: 21, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 21, + col: 5, + }, + end: TextPos { + line: 21, + col: 28, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 22, + col: 5, + }, + end: TextPos { + line: 22, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 22, + col: 13, + }, + end: TextPos { + line: 22, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 22, + col: 13, + }, + end: TextPos { + line: 22, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 22, + col: 5, + }, + end: TextPos { + line: 22, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 22, + col: 5, + }, + end: TextPos { + line: 22, + col: 28, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 20, + col: 1, + }, + end: TextPos { + line: 23, + col: 2, + }, + }, + }, + }, + Block { + block: Block { + stmts: [ + AttributeInner( + List { + key: Identifier { + value: "tag", + range: TextRange { + start: TextPos { + line: 28, + col: 8, + }, + end: TextPos { + line: 28, + col: 11, + }, + }, + }, + values: [ + String { + value: "bob.bar", + range: TextRange { + start: TextPos { + line: 28, + col: 12, + }, + end: TextPos { + line: 28, + col: 21, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 28, + col: 5, + }, + end: TextPos { + line: 28, + col: 23, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 29, + col: 5, + }, + end: TextPos { + line: 29, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 29, + col: 13, + }, + end: TextPos { + line: 29, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 29, + col: 13, + }, + end: TextPos { + line: 29, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 29, + col: 5, + }, + end: TextPos { + line: 29, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 29, + col: 5, + }, + end: TextPos { + line: 29, + col: 28, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 30, + col: 5, + }, + end: TextPos { + line: 30, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 30, + col: 13, + }, + end: TextPos { + line: 30, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 30, + col: 13, + }, + end: TextPos { + line: 30, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 30, + col: 5, + }, + end: TextPos { + line: 30, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 30, + col: 5, + }, + end: TextPos { + line: 30, + col: 28, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 27, + col: 1, + }, + end: TextPos { + line: 31, + col: 2, + }, + }, + }, + }, + AttributeInner( + List { + key: Identifier { + value: "wf_tag", + range: TextRange { + start: TextPos { + line: 34, + col: 4, + }, + end: TextPos { + line: 34, + col: 10, + }, + }, + }, + values: [ + String { + value: "cho.baz", + range: TextRange { + start: TextPos { + line: 34, + col: 11, + }, + end: TextPos { + line: 34, + col: 20, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 34, + col: 1, + }, + end: TextPos { + line: 34, + col: 22, + }, + }, + }, + ), + AttributeInner( + List { + key: Identifier { + value: "tag", + range: TextRange { + start: TextPos { + line: 36, + col: 4, + }, + end: TextPos { + line: 36, + col: 7, + }, + }, + }, + values: [ + String { + value: "dan.qux", + range: TextRange { + start: TextPos { + line: 36, + col: 8, + }, + end: TextPos { + line: 36, + col: 17, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 36, + col: 1, + }, + end: TextPos { + line: 36, + col: 19, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 37, + col: 1, + }, + end: TextPos { + line: 37, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 37, + col: 9, + }, + end: TextPos { + line: 37, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 37, + col: 9, + }, + end: TextPos { + line: 37, + col: 22, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 37, + col: 1, + }, + end: TextPos { + line: 37, + col: 23, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 37, + col: 1, + }, + end: TextPos { + line: 37, + col: 24, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 38, + col: 1, + }, + end: TextPos { + line: 38, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 38, + col: 9, + }, + end: TextPos { + line: 38, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 38, + col: 9, + }, + end: TextPos { + line: 38, + col: 22, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 38, + col: 1, + }, + end: TextPos { + line: 38, + col: 23, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 38, + col: 1, + }, + end: TextPos { + line: 38, + col: 24, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "tag", + range: TextRange { + start: TextPos { + line: 44, + col: 3, + }, + end: TextPos { + line: 44, + col: 6, + }, + }, + }, + values: [ + String { + value: "eve.quux", + range: TextRange { + start: TextPos { + line: 44, + col: 7, + }, + end: TextPos { + line: 44, + col: 17, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 44, + col: 1, + }, + end: TextPos { + line: 44, + col: 19, + }, + }, + }, + ), + If { + cond: BinOp { + op: Eq { + range: TextRange { + start: TextPos { + line: 45, + col: 19, + }, + end: TextPos { + line: 45, + col: 21, + }, + }, + }, + lhs: Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 45, + col: 5, + }, + end: TextPos { + line: 45, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 45, + col: 5, + }, + end: TextPos { + line: 45, + col: 18, + }, + }, + }, + rhs: Literal { + literal: String { + value: "Hello, world!", + range: TextRange { + start: TextPos { + line: 45, + col: 22, + }, + end: TextPos { + line: 45, + col: 37, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 45, + col: 5, + }, + end: TextPos { + line: 45, + col: 37, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 46, + col: 5, + }, + end: TextPos { + line: 46, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 46, + col: 13, + }, + end: TextPos { + line: 46, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 46, + col: 13, + }, + end: TextPos { + line: 46, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 46, + col: 5, + }, + end: TextPos { + line: 46, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 46, + col: 5, + }, + end: TextPos { + line: 46, + col: 28, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 45, + col: 39, + }, + end: TextPos { + line: 47, + col: 2, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 48, + col: 5, + }, + end: TextPos { + line: 48, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 48, + col: 13, + }, + end: TextPos { + line: 48, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 48, + col: 13, + }, + end: TextPos { + line: 48, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 48, + col: 5, + }, + end: TextPos { + line: 48, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 48, + col: 5, + }, + end: TextPos { + line: 48, + col: 28, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 47, + col: 8, + }, + end: TextPos { + line: 49, + col: 2, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 45, + col: 1, + }, + end: TextPos { + line: 49, + col: 2, + }, + }, + }, + If { + cond: BinOp { + op: Eq { + range: TextRange { + start: TextPos { + line: 51, + col: 19, + }, + end: TextPos { + line: 51, + col: 21, + }, + }, + }, + lhs: Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 51, + col: 5, + }, + end: TextPos { + line: 51, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 51, + col: 5, + }, + end: TextPos { + line: 51, + col: 18, + }, + }, + }, + rhs: Literal { + literal: String { + value: "Hello, world!", + range: TextRange { + start: TextPos { + line: 51, + col: 22, + }, + end: TextPos { + line: 51, + col: 37, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 51, + col: 5, + }, + end: TextPos { + line: 51, + col: 37, + }, + }, + }, + consequent: Block { + stmts: [ + AttributeInner( + List { + key: Identifier { + value: "tag", + range: TextRange { + start: TextPos { + line: 52, + col: 8, + }, + end: TextPos { + line: 52, + col: 11, + }, + }, + }, + values: [ + String { + value: "eve.quux", + range: TextRange { + start: TextPos { + line: 52, + col: 12, + }, + end: TextPos { + line: 52, + col: 22, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 52, + col: 5, + }, + end: TextPos { + line: 52, + col: 24, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 53, + col: 5, + }, + end: TextPos { + line: 53, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 53, + col: 13, + }, + end: TextPos { + line: 53, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 53, + col: 13, + }, + end: TextPos { + line: 53, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 53, + col: 5, + }, + end: TextPos { + line: 53, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 53, + col: 5, + }, + end: TextPos { + line: 53, + col: 28, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 51, + col: 39, + }, + end: TextPos { + line: 54, + col: 2, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 55, + col: 5, + }, + end: TextPos { + line: 55, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 55, + col: 13, + }, + end: TextPos { + line: 55, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 55, + col: 13, + }, + end: TextPos { + line: 55, + col: 26, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 55, + col: 5, + }, + end: TextPos { + line: 55, + col: 27, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 55, + col: 5, + }, + end: TextPos { + line: 55, + col: 28, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 54, + col: 8, + }, + end: TextPos { + line: 56, + col: 2, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 51, + col: 1, + }, + end: TextPos { + line: 56, + col: 2, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 56, + col: 2, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__average.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__average.bs.snap new file mode 100644 index 00000000..ed3a451c --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__average.bs.snap @@ -0,0 +1,460 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "average", + range: TextRange { + start: TextPos { + line: 1, + col: 8, + }, + end: TextPos { + line: 1, + col: 15, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 1, + col: 1, + }, + end: TextPos { + line: 1, + col: 16, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "on", + range: TextRange { + start: TextPos { + line: 3, + col: 3, + }, + end: TextPos { + line: 3, + col: 5, + }, + }, + }, + values: [ + String { + value: "Amy", + range: TextRange { + start: TextPos { + line: 3, + col: 6, + }, + end: TextPos { + line: 3, + col: 11, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 13, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "average", + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [ + Instance { + name: Identifier { + value: "Data", + range: TextRange { + start: TextPos { + line: 4, + col: 21, + }, + end: TextPos { + line: 4, + col: 25, + }, + }, + }, + properties: [ + PropertyExpr { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 4, + col: 28, + }, + end: TextPos { + line: 4, + col: 32, + }, + }, + }, + value: Literal { + literal: String { + value: "numbers", + range: TextRange { + start: TextPos { + line: 4, + col: 36, + }, + end: TextPos { + line: 4, + col: 45, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 4, + col: 28, + }, + end: TextPos { + line: 4, + col: 45, + }, + }, + }, + ], + st_entry: None, + range: TextRange { + start: TextPos { + line: 4, + col: 17, + }, + end: TextPos { + line: 4, + col: 47, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 48, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 49, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 50, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "on", + range: TextRange { + start: TextPos { + line: 6, + col: 3, + }, + end: TextPos { + line: 6, + col: 5, + }, + }, + }, + values: [ + String { + value: "Dan", + range: TextRange { + start: TextPos { + line: 6, + col: 6, + }, + end: TextPos { + line: 6, + col: 11, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 13, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "average", + range: TextRange { + start: TextPos { + line: 7, + col: 9, + }, + end: TextPos { + line: 7, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [ + Instance { + name: Identifier { + value: "Data", + range: TextRange { + start: TextPos { + line: 7, + col: 21, + }, + end: TextPos { + line: 7, + col: 25, + }, + }, + }, + properties: [ + PropertyExpr { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 7, + col: 28, + }, + end: TextPos { + line: 7, + col: 32, + }, + }, + }, + value: Literal { + literal: String { + value: "numbers", + range: TextRange { + start: TextPos { + line: 7, + col: 36, + }, + end: TextPos { + line: 7, + col: 45, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 7, + col: 28, + }, + end: TextPos { + line: 7, + col: 45, + }, + }, + }, + ], + st_entry: None, + range: TextRange { + start: TextPos { + line: 7, + col: 17, + }, + end: TextPos { + line: 7, + col: 47, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 9, + }, + end: TextPos { + line: 7, + col: 48, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 49, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 50, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 1, + col: 1, + }, + end: TextPos { + line: 7, + col: 50, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__call.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__call.bs.snap new file mode 100644 index 00000000..9a7132e6 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__call.bs.snap @@ -0,0 +1,371 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Hello there!", + range: TextRange { + start: TextPos { + line: 3, + col: 9, + }, + end: TextPos { + line: 3, + col: 23, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 24, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 25, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "General \" Kenobi,\n\tyou are a bold one!", + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 52, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 53, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 54, + }, + }, + }, + FuncDef { + ident: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 6, + col: 6, + }, + end: TextPos { + line: 6, + col: 10, + }, + }, + }, + params: [], + code: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "General Kenobi!!!", + range: TextRange { + start: TextPos { + line: 7, + col: 13, + }, + end: TextPos { + line: 7, + col: 32, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 33, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 34, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 13, + }, + end: TextPos { + line: 8, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 8, + col: 2, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 10, + col: 1, + }, + end: TextPos { + line: 10, + col: 5, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 10, + col: 1, + }, + end: TextPos { + line: 10, + col: 7, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 1, + }, + end: TextPos { + line: 10, + col: 8, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 11, + col: 1, + }, + end: TextPos { + line: 11, + col: 5, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 11, + col: 1, + }, + end: TextPos { + line: 11, + col: 7, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 1, + }, + end: TextPos { + line: 11, + col: 8, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 11, + col: 8, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__class.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__class.bs.snap new file mode 100644 index 00000000..f3e18d36 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__class.bs.snap @@ -0,0 +1,710 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + ClassDef { + ident: Identifier { + value: "Jedi", + range: TextRange { + start: TextPos { + line: 2, + col: 7, + }, + end: TextPos { + line: 2, + col: 11, + }, + }, + }, + props: [ + Property { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 9, + }, + }, + }, + data_type: String, + st_entry: None, + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 18, + }, + }, + }, + Property { + name: Identifier { + value: "is_master", + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 14, + }, + }, + }, + data_type: Boolean, + st_entry: None, + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 21, + }, + }, + }, + Property { + name: Identifier { + value: "lightsaber_colour", + range: TextRange { + start: TextPos { + line: 5, + col: 5, + }, + end: TextPos { + line: 5, + col: 22, + }, + }, + }, + data_type: String, + st_entry: None, + range: TextRange { + start: TextPos { + line: 5, + col: 5, + }, + end: TextPos { + line: 5, + col: 31, + }, + }, + }, + ], + methods: [ + FuncDef { + ident: Identifier { + value: "swoosh", + range: TextRange { + start: TextPos { + line: 7, + col: 10, + }, + end: TextPos { + line: 7, + col: 16, + }, + }, + }, + params: [ + Identifier { + value: "self", + range: TextRange { + start: TextPos { + line: 7, + col: 17, + }, + end: TextPos { + line: 7, + col: 21, + }, + }, + }, + ], + code: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 8, + col: 9, + }, + end: TextPos { + line: 8, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [ + BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 8, + col: 76, + }, + end: TextPos { + line: 8, + col: 77, + }, + }, + }, + lhs: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 8, + col: 51, + }, + end: TextPos { + line: 8, + col: 52, + }, + }, + }, + lhs: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 8, + col: 27, + }, + end: TextPos { + line: 8, + col: 28, + }, + }, + }, + lhs: Proj { + lhs: VarRef { + name: Identifier { + value: "self", + range: TextRange { + start: TextPos { + line: 8, + col: 17, + }, + end: TextPos { + line: 8, + col: 21, + }, + }, + }, + st_entry: None, + }, + rhs: Identifier { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 8, + col: 22, + }, + end: TextPos { + line: 8, + col: 26, + }, + }, + }, + st_entry: None, + }, + st_entry: None, + range: TextRange { + start: TextPos { + line: 8, + col: 17, + }, + end: TextPos { + line: 8, + col: 26, + }, + }, + }, + rhs: Literal { + literal: String { + value: " is swinging their ", + range: TextRange { + start: TextPos { + line: 8, + col: 29, + }, + end: TextPos { + line: 8, + col: 50, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 8, + col: 17, + }, + end: TextPos { + line: 8, + col: 50, + }, + }, + }, + rhs: Proj { + lhs: VarRef { + name: Identifier { + value: "self", + range: TextRange { + start: TextPos { + line: 8, + col: 53, + }, + end: TextPos { + line: 8, + col: 57, + }, + }, + }, + st_entry: None, + }, + rhs: Identifier { + name: Identifier { + value: "lightsaber_colour", + range: TextRange { + start: TextPos { + line: 8, + col: 58, + }, + end: TextPos { + line: 8, + col: 75, + }, + }, + }, + st_entry: None, + }, + st_entry: None, + range: TextRange { + start: TextPos { + line: 8, + col: 53, + }, + end: TextPos { + line: 8, + col: 75, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 8, + col: 17, + }, + end: TextPos { + line: 8, + col: 75, + }, + }, + }, + rhs: Literal { + literal: String { + value: " lightsaber!", + range: TextRange { + start: TextPos { + line: 8, + col: 78, + }, + end: TextPos { + line: 8, + col: 92, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 8, + col: 17, + }, + end: TextPos { + line: 8, + col: 92, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 8, + col: 9, + }, + end: TextPos { + line: 8, + col: 93, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 9, + }, + end: TextPos { + line: 8, + col: 94, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 23, + }, + end: TextPos { + line: 9, + col: 6, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 9, + col: 6, + }, + }, + }, + ], + st_entry: None, + symbol_table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 10, + col: 2, + }, + }, + }, + LetAssign { + name: Identifier { + value: "obi_wan", + range: TextRange { + start: TextPos { + line: 13, + col: 5, + }, + end: TextPos { + line: 13, + col: 12, + }, + }, + }, + value: Instance { + name: Identifier { + value: "Jedi", + range: TextRange { + start: TextPos { + line: 13, + col: 20, + }, + end: TextPos { + line: 13, + col: 24, + }, + }, + }, + properties: [ + PropertyExpr { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 9, + }, + }, + }, + value: Literal { + literal: String { + value: "Obi-Wan Kenobi", + range: TextRange { + start: TextPos { + line: 14, + col: 26, + }, + end: TextPos { + line: 14, + col: 42, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 43, + }, + }, + }, + PropertyExpr { + name: Identifier { + value: "is_master", + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 14, + }, + }, + }, + value: Literal { + literal: Boolean { + value: true, + range: TextRange { + start: TextPos { + line: 15, + col: 26, + }, + end: TextPos { + line: 15, + col: 30, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 31, + }, + }, + }, + PropertyExpr { + name: Identifier { + value: "lightsaber_colour", + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 22, + }, + }, + }, + value: Literal { + literal: String { + value: "blue", + range: TextRange { + start: TextPos { + line: 16, + col: 26, + }, + end: TextPos { + line: 16, + col: 32, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 33, + }, + }, + }, + ], + st_entry: None, + range: TextRange { + start: TextPos { + line: 13, + col: 16, + }, + end: TextPos { + line: 17, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 13, + col: 1, + }, + end: TextPos { + line: 17, + col: 3, + }, + }, + }, + Expr { + expr: Call { + expr: Proj { + lhs: VarRef { + name: Identifier { + value: "obi_wan", + range: TextRange { + start: TextPos { + line: 20, + col: 1, + }, + end: TextPos { + line: 20, + col: 8, + }, + }, + }, + st_entry: None, + }, + rhs: Identifier { + name: Identifier { + value: "swoosh", + range: TextRange { + start: TextPos { + line: 20, + col: 9, + }, + end: TextPos { + line: 20, + col: 15, + }, + }, + }, + st_entry: None, + }, + st_entry: None, + range: TextRange { + start: TextPos { + line: 20, + col: 1, + }, + end: TextPos { + line: 20, + col: 15, + }, + }, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 20, + col: 1, + }, + end: TextPos { + line: 20, + col: 17, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 20, + col: 1, + }, + end: TextPos { + line: 20, + col: 18, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 20, + col: 18, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__comments.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__comments.bs.snap new file mode 100644 index 00000000..72f01d71 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__comments.bs.snap @@ -0,0 +1,30 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__cutoff.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__cutoff.bs.snap new file mode 100644 index 00000000..5e10e05a --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__cutoff.bs.snap @@ -0,0 +1,2226 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + For { + initializer: LetAssign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 2, + col: 10, + }, + end: TextPos { + line: 2, + col: 11, + }, + }, + }, + value: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 2, + col: 15, + }, + end: TextPos { + line: 2, + col: 16, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 6, + }, + end: TextPos { + line: 2, + col: 17, + }, + }, + }, + condition: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 2, + col: 20, + }, + end: TextPos { + line: 2, + col: 21, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 2, + col: 18, + }, + end: TextPos { + line: 2, + col: 19, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 10, + range: TextRange { + start: TextPos { + line: 2, + col: 22, + }, + end: TextPos { + line: 2, + col: 24, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 2, + col: 18, + }, + end: TextPos { + line: 2, + col: 24, + }, + }, + }, + increment: Assign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 2, + col: 26, + }, + end: TextPos { + line: 2, + col: 27, + }, + }, + }, + value: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 2, + col: 33, + }, + end: TextPos { + line: 2, + col: 34, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 2, + col: 31, + }, + end: TextPos { + line: 2, + col: 32, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 2, + col: 35, + }, + end: TextPos { + line: 2, + col: 36, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 2, + col: 31, + }, + end: TextPos { + line: 2, + col: 36, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 26, + }, + end: TextPos { + line: 2, + col: 36, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "This should be a while loop", + range: TextRange { + start: TextPos { + line: 3, + col: 13, + }, + end: TextPos { + line: 3, + col: 42, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 43, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 44, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 38, + }, + end: TextPos { + line: 4, + col: 2, + }, + }, + }, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 4, + col: 2, + }, + }, + }, + FuncDef { + ident: Identifier { + value: "hello", + range: TextRange { + start: TextPos { + line: 7, + col: 6, + }, + end: TextPos { + line: 7, + col: 11, + }, + }, + }, + params: [], + code: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "H", + range: TextRange { + start: TextPos { + line: 8, + col: 11, + }, + end: TextPos { + line: 8, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "e", + range: TextRange { + start: TextPos { + line: 9, + col: 11, + }, + end: TextPos { + line: 9, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 10, + col: 5, + }, + end: TextPos { + line: 10, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "l", + range: TextRange { + start: TextPos { + line: 10, + col: 11, + }, + end: TextPos { + line: 10, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 10, + col: 5, + }, + end: TextPos { + line: 10, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 5, + }, + end: TextPos { + line: 10, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "l", + range: TextRange { + start: TextPos { + line: 11, + col: 11, + }, + end: TextPos { + line: 11, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 12, + col: 5, + }, + end: TextPos { + line: 12, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "o", + range: TextRange { + start: TextPos { + line: 12, + col: 11, + }, + end: TextPos { + line: 12, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 12, + col: 5, + }, + end: TextPos { + line: 12, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 12, + col: 5, + }, + end: TextPos { + line: 12, + col: 16, + }, + }, + }, + Return { + expr: None, + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 13, + col: 5, + }, + end: TextPos { + line: 13, + col: 12, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: ",", + range: TextRange { + start: TextPos { + line: 14, + col: 11, + }, + end: TextPos { + line: 14, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: " ", + range: TextRange { + start: TextPos { + line: 15, + col: 11, + }, + end: TextPos { + line: 15, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "W", + range: TextRange { + start: TextPos { + line: 16, + col: 11, + }, + end: TextPos { + line: 16, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 17, + col: 5, + }, + end: TextPos { + line: 17, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "o", + range: TextRange { + start: TextPos { + line: 17, + col: 11, + }, + end: TextPos { + line: 17, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 17, + col: 5, + }, + end: TextPos { + line: 17, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 17, + col: 5, + }, + end: TextPos { + line: 17, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 18, + col: 5, + }, + end: TextPos { + line: 18, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "r", + range: TextRange { + start: TextPos { + line: 18, + col: 11, + }, + end: TextPos { + line: 18, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 18, + col: 5, + }, + end: TextPos { + line: 18, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 18, + col: 5, + }, + end: TextPos { + line: 18, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 19, + col: 5, + }, + end: TextPos { + line: 19, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "l", + range: TextRange { + start: TextPos { + line: 19, + col: 11, + }, + end: TextPos { + line: 19, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 19, + col: 5, + }, + end: TextPos { + line: 19, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 19, + col: 5, + }, + end: TextPos { + line: 19, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 20, + col: 5, + }, + end: TextPos { + line: 20, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "d", + range: TextRange { + start: TextPos { + line: 20, + col: 11, + }, + end: TextPos { + line: 20, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 20, + col: 5, + }, + end: TextPos { + line: 20, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 20, + col: 5, + }, + end: TextPos { + line: 20, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 21, + col: 5, + }, + end: TextPos { + line: 21, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "!", + range: TextRange { + start: TextPos { + line: 21, + col: 11, + }, + end: TextPos { + line: 21, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 21, + col: 5, + }, + end: TextPos { + line: 21, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 21, + col: 5, + }, + end: TextPos { + line: 21, + col: 16, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 14, + }, + end: TextPos { + line: 22, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 22, + col: 2, + }, + }, + }, + FuncDef { + ident: Identifier { + value: "hel", + range: TextRange { + start: TextPos { + line: 24, + col: 6, + }, + end: TextPos { + line: 24, + col: 9, + }, + }, + }, + params: [ + Identifier { + value: "a", + range: TextRange { + start: TextPos { + line: 24, + col: 10, + }, + end: TextPos { + line: 24, + col: 11, + }, + }, + }, + ], + code: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 25, + col: 5, + }, + end: TextPos { + line: 25, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "H", + range: TextRange { + start: TextPos { + line: 25, + col: 11, + }, + end: TextPos { + line: 25, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 25, + col: 5, + }, + end: TextPos { + line: 25, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 25, + col: 5, + }, + end: TextPos { + line: 25, + col: 16, + }, + }, + }, + If { + cond: BinOp { + op: Eq { + range: TextRange { + start: TextPos { + line: 26, + col: 11, + }, + end: TextPos { + line: 26, + col: 13, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "a", + range: TextRange { + start: TextPos { + line: 26, + col: 9, + }, + end: TextPos { + line: 26, + col: 10, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Boolean { + value: true, + range: TextRange { + start: TextPos { + line: 26, + col: 14, + }, + end: TextPos { + line: 26, + col: 18, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 26, + col: 9, + }, + end: TextPos { + line: 26, + col: 18, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 27, + col: 9, + }, + end: TextPos { + line: 27, + col: 14, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "e", + range: TextRange { + start: TextPos { + line: 27, + col: 15, + }, + end: TextPos { + line: 27, + col: 18, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 27, + col: 9, + }, + end: TextPos { + line: 27, + col: 19, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 27, + col: 9, + }, + end: TextPos { + line: 27, + col: 20, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 26, + col: 20, + }, + end: TextPos { + line: 28, + col: 6, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Return { + expr: None, + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 29, + col: 9, + }, + end: TextPos { + line: 29, + col: 16, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 28, + col: 12, + }, + end: TextPos { + line: 30, + col: 6, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 26, + col: 5, + }, + end: TextPos { + line: 30, + col: 6, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 31, + col: 5, + }, + end: TextPos { + line: 31, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "l", + range: TextRange { + start: TextPos { + line: 31, + col: 11, + }, + end: TextPos { + line: 31, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 31, + col: 5, + }, + end: TextPos { + line: 31, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 31, + col: 5, + }, + end: TextPos { + line: 31, + col: 16, + }, + }, + }, + If { + cond: BinOp { + op: Eq { + range: TextRange { + start: TextPos { + line: 32, + col: 11, + }, + end: TextPos { + line: 32, + col: 13, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "a", + range: TextRange { + start: TextPos { + line: 32, + col: 9, + }, + end: TextPos { + line: 32, + col: 10, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Boolean { + value: true, + range: TextRange { + start: TextPos { + line: 32, + col: 14, + }, + end: TextPos { + line: 32, + col: 18, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 32, + col: 9, + }, + end: TextPos { + line: 32, + col: 18, + }, + }, + }, + consequent: Block { + stmts: [ + Return { + expr: None, + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 33, + col: 9, + }, + end: TextPos { + line: 33, + col: 16, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 32, + col: 20, + }, + end: TextPos { + line: 34, + col: 6, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Return { + expr: None, + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 35, + col: 9, + }, + end: TextPos { + line: 35, + col: 16, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 34, + col: 12, + }, + end: TextPos { + line: 36, + col: 6, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 32, + col: 5, + }, + end: TextPos { + line: 36, + col: 6, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 37, + col: 5, + }, + end: TextPos { + line: 37, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "l", + range: TextRange { + start: TextPos { + line: 37, + col: 11, + }, + end: TextPos { + line: 37, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 37, + col: 5, + }, + end: TextPos { + line: 37, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 37, + col: 5, + }, + end: TextPos { + line: 37, + col: 16, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 38, + col: 5, + }, + end: TextPos { + line: 38, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "o", + range: TextRange { + start: TextPos { + line: 38, + col: 11, + }, + end: TextPos { + line: 38, + col: 14, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 38, + col: 5, + }, + end: TextPos { + line: 38, + col: 15, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 38, + col: 5, + }, + end: TextPos { + line: 38, + col: 16, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 24, + col: 13, + }, + end: TextPos { + line: 39, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 24, + col: 1, + }, + end: TextPos { + line: 39, + col: 2, + }, + }, + }, + FuncDef { + ident: Identifier { + value: "insert", + range: TextRange { + start: TextPos { + line: 41, + col: 6, + }, + end: TextPos { + line: 41, + col: 12, + }, + }, + }, + params: [ + Identifier { + value: "a", + range: TextRange { + start: TextPos { + line: 41, + col: 13, + }, + end: TextPos { + line: 41, + col: 14, + }, + }, + }, + ], + code: Block { + stmts: [ + If { + cond: BinOp { + op: Eq { + range: TextRange { + start: TextPos { + line: 42, + col: 11, + }, + end: TextPos { + line: 42, + col: 13, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "a", + range: TextRange { + start: TextPos { + line: 42, + col: 9, + }, + end: TextPos { + line: 42, + col: 10, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Boolean { + value: true, + range: TextRange { + start: TextPos { + line: 42, + col: 14, + }, + end: TextPos { + line: 42, + col: 18, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 42, + col: 9, + }, + end: TextPos { + line: 42, + col: 18, + }, + }, + }, + consequent: Block { + stmts: [ + Return { + expr: None, + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 43, + col: 9, + }, + end: TextPos { + line: 43, + col: 16, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 42, + col: 20, + }, + end: TextPos { + line: 44, + col: 6, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 45, + col: 9, + }, + end: TextPos { + line: 45, + col: 14, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "A return statement should be inserted below this one", + range: TextRange { + start: TextPos { + line: 45, + col: 15, + }, + end: TextPos { + line: 45, + col: 69, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 45, + col: 9, + }, + end: TextPos { + line: 45, + col: 70, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 45, + col: 9, + }, + end: TextPos { + line: 45, + col: 71, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 44, + col: 12, + }, + end: TextPos { + line: 46, + col: 6, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 42, + col: 5, + }, + end: TextPos { + line: 46, + col: 6, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 41, + col: 16, + }, + end: TextPos { + line: 47, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 41, + col: 1, + }, + end: TextPos { + line: 47, + col: 2, + }, + }, + }, + Return { + expr: None, + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 49, + col: 1, + }, + end: TextPos { + line: 49, + col: 8, + }, + }, + }, + ClassDef { + ident: Identifier { + value: "Test", + range: TextRange { + start: TextPos { + line: 51, + col: 7, + }, + end: TextPos { + line: 51, + col: 11, + }, + }, + }, + props: [ + Property { + name: Identifier { + value: "used", + range: TextRange { + start: TextPos { + line: 52, + col: 5, + }, + end: TextPos { + line: 52, + col: 9, + }, + }, + }, + data_type: Boolean, + st_entry: None, + range: TextRange { + start: TextPos { + line: 52, + col: 5, + }, + end: TextPos { + line: 52, + col: 17, + }, + }, + }, + ], + methods: [], + st_entry: None, + symbol_table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + attrs: [], + range: TextRange { + start: TextPos { + line: 51, + col: 1, + }, + end: TextPos { + line: 53, + col: 2, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 53, + col: 2, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__data.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__data.bs.snap new file mode 100644 index 00000000..9686d100 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__data.bs.snap @@ -0,0 +1,675 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "data_test", + range: TextRange { + start: TextPos { + line: 3, + col: 8, + }, + end: TextPos { + line: 3, + col: 17, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 18, + }, + }, + }, + LetAssign { + name: Identifier { + value: "ect_umc", + range: TextRange { + start: TextPos { + line: 5, + col: 5, + }, + end: TextPos { + line: 5, + col: 12, + }, + }, + }, + value: Instance { + name: Identifier { + value: "Data", + range: TextRange { + start: TextPos { + line: 5, + col: 20, + }, + end: TextPos { + line: 5, + col: 24, + }, + }, + }, + properties: [ + PropertyExpr { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 5, + col: 26, + }, + end: TextPos { + line: 5, + col: 30, + }, + }, + }, + value: Literal { + literal: String { + value: "Test", + range: TextRange { + start: TextPos { + line: 5, + col: 34, + }, + end: TextPos { + line: 5, + col: 40, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 5, + col: 26, + }, + end: TextPos { + line: 5, + col: 40, + }, + }, + }, + ], + st_entry: None, + range: TextRange { + start: TextPos { + line: 5, + col: 16, + }, + end: TextPos { + line: 5, + col: 42, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 1, + }, + end: TextPos { + line: 5, + col: 43, + }, + }, + }, + LetAssign { + name: Identifier { + value: "ect_sta", + range: TextRange { + start: TextPos { + line: 6, + col: 5, + }, + end: TextPos { + line: 6, + col: 12, + }, + }, + }, + value: Instance { + name: Identifier { + value: "Data", + range: TextRange { + start: TextPos { + line: 6, + col: 20, + }, + end: TextPos { + line: 6, + col: 24, + }, + }, + }, + properties: [ + PropertyExpr { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 6, + col: 26, + }, + end: TextPos { + line: 6, + col: 30, + }, + }, + }, + value: Literal { + literal: String { + value: "Test", + range: TextRange { + start: TextPos { + line: 6, + col: 34, + }, + end: TextPos { + line: 6, + col: 40, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 6, + col: 26, + }, + end: TextPos { + line: 6, + col: 40, + }, + }, + }, + ], + st_entry: None, + range: TextRange { + start: TextPos { + line: 6, + col: 16, + }, + end: TextPos { + line: 6, + col: 42, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 43, + }, + }, + }, + Parallel { + result: Some( + Identifier { + value: "local", + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 10, + }, + }, + }, + ), + blocks: [ + Block { + stmts: [ + Return { + expr: Some( + Call { + expr: Identifier { + name: Identifier { + value: "run_script", + range: TextRange { + start: TextPos { + line: 9, + col: 12, + }, + end: TextPos { + line: 9, + col: 22, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "ect_umc", + range: TextRange { + start: TextPos { + line: 9, + col: 23, + }, + end: TextPos { + line: 9, + col: 30, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 9, + col: 12, + }, + end: TextPos { + line: 9, + col: 31, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 32, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 30, + }, + end: TextPos { + line: 10, + col: 2, + }, + }, + }, + Block { + stmts: [ + Return { + expr: Some( + Call { + expr: Identifier { + name: Identifier { + value: "run_script", + range: TextRange { + start: TextPos { + line: 11, + col: 12, + }, + end: TextPos { + line: 11, + col: 22, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "ect_sta", + range: TextRange { + start: TextPos { + line: 11, + col: 23, + }, + end: TextPos { + line: 11, + col: 30, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 11, + col: 12, + }, + end: TextPos { + line: 11, + col: 31, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 32, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 4, + }, + end: TextPos { + line: 12, + col: 2, + }, + }, + }, + ], + merge: Some( + Identifier { + value: "all", + range: TextRange { + start: TextPos { + line: 8, + col: 24, + }, + end: TextPos { + line: 8, + col: 27, + }, + }, + }, + ), + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 12, + col: 4, + }, + }, + }, + LetAssign { + name: Identifier { + value: "res", + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 8, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 14, + col: 12, + }, + end: TextPos { + line: 14, + col: 21, + }, + }, + }, + st_entry: None, + }, + args: [ + ArrayIndex { + array: VarRef { + name: Identifier { + value: "local", + range: TextRange { + start: TextPos { + line: 14, + col: 22, + }, + end: TextPos { + line: 14, + col: 27, + }, + }, + }, + st_entry: None, + }, + index: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 14, + col: 28, + }, + end: TextPos { + line: 14, + col: 29, + }, + }, + }, + }, + data_type: Any, + range: TextRange { + start: TextPos { + line: 14, + col: 22, + }, + end: TextPos { + line: 14, + col: 30, + }, + }, + }, + ArrayIndex { + array: VarRef { + name: Identifier { + value: "local", + range: TextRange { + start: TextPos { + line: 14, + col: 32, + }, + end: TextPos { + line: 14, + col: 37, + }, + }, + }, + st_entry: None, + }, + index: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 14, + col: 38, + }, + end: TextPos { + line: 14, + col: 39, + }, + }, + }, + }, + data_type: Any, + range: TextRange { + start: TextPos { + line: 14, + col: 32, + }, + end: TextPos { + line: 14, + col: 40, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 14, + col: 12, + }, + end: TextPos { + line: 14, + col: 41, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 14, + col: 1, + }, + end: TextPos { + line: 14, + col: 42, + }, + }, + }, + Return { + expr: Some( + VarRef { + name: Identifier { + value: "res", + range: TextRange { + start: TextPos { + line: 15, + col: 8, + }, + end: TextPos { + line: 15, + col: 11, + }, + }, + }, + st_entry: None, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 15, + col: 1, + }, + end: TextPos { + line: 15, + col: 12, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 15, + col: 12, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__data_complex.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__data_complex.bs.snap new file mode 100644 index 00000000..0ed3e452 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__data_complex.bs.snap @@ -0,0 +1,2420 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "copy_result", + range: TextRange { + start: TextPos { + line: 2, + col: 8, + }, + end: TextPos { + line: 2, + col: 19, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 20, + }, + }, + }, + Import { + name: Identifier { + value: "data_test", + range: TextRange { + start: TextPos { + line: 3, + col: 8, + }, + end: TextPos { + line: 3, + col: 17, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 18, + }, + }, + }, + LetAssign { + name: Identifier { + value: "data0", + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 10, + }, + }, + }, + value: Instance { + name: Identifier { + value: "Data", + range: TextRange { + start: TextPos { + line: 8, + col: 18, + }, + end: TextPos { + line: 8, + col: 22, + }, + }, + }, + properties: [ + PropertyExpr { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 8, + col: 25, + }, + end: TextPos { + line: 8, + col: 29, + }, + }, + }, + value: Literal { + literal: String { + value: "Test", + range: TextRange { + start: TextPos { + line: 8, + col: 33, + }, + end: TextPos { + line: 8, + col: 39, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 8, + col: 25, + }, + end: TextPos { + line: 8, + col: 39, + }, + }, + }, + ], + st_entry: None, + range: TextRange { + start: TextPos { + line: 8, + col: 14, + }, + end: TextPos { + line: 8, + col: 41, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 8, + col: 42, + }, + }, + }, + LetAssign { + name: Identifier { + value: "res1", + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 9, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "run_script", + range: TextRange { + start: TextPos { + line: 9, + col: 13, + }, + end: TextPos { + line: 9, + col: 23, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "data0", + range: TextRange { + start: TextPos { + line: 9, + col: 24, + }, + end: TextPos { + line: 9, + col: 29, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 9, + col: 13, + }, + end: TextPos { + line: 9, + col: 30, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 1, + }, + end: TextPos { + line: 9, + col: 31, + }, + }, + }, + LetAssign { + name: Identifier { + value: "gres1", + range: TextRange { + start: TextPos { + line: 10, + col: 5, + }, + end: TextPos { + line: 10, + col: 10, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 10, + col: 14, + }, + end: TextPos { + line: 10, + col: 23, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "res1", + range: TextRange { + start: TextPos { + line: 10, + col: 24, + }, + end: TextPos { + line: 10, + col: 28, + }, + }, + }, + st_entry: None, + }, + VarRef { + name: Identifier { + value: "res1", + range: TextRange { + start: TextPos { + line: 10, + col: 30, + }, + end: TextPos { + line: 10, + col: 34, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 10, + col: 14, + }, + end: TextPos { + line: 10, + col: 35, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 1, + }, + end: TextPos { + line: 10, + col: 36, + }, + }, + }, + LetAssign { + name: Identifier { + value: "data1", + range: TextRange { + start: TextPos { + line: 12, + col: 5, + }, + end: TextPos { + line: 12, + col: 10, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "commit_result", + range: TextRange { + start: TextPos { + line: 12, + col: 14, + }, + end: TextPos { + line: 12, + col: 27, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "test_data_1", + range: TextRange { + start: TextPos { + line: 12, + col: 28, + }, + end: TextPos { + line: 12, + col: 41, + }, + }, + }, + }, + VarRef { + name: Identifier { + value: "gres1", + range: TextRange { + start: TextPos { + line: 12, + col: 43, + }, + end: TextPos { + line: 12, + col: 48, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 12, + col: 14, + }, + end: TextPos { + line: 12, + col: 49, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 12, + col: 1, + }, + end: TextPos { + line: 12, + col: 50, + }, + }, + }, + LetAssign { + name: Identifier { + value: "res2", + range: TextRange { + start: TextPos { + line: 17, + col: 5, + }, + end: TextPos { + line: 17, + col: 9, + }, + }, + }, + value: Literal { + literal: Null { + range: TextRange { + start: TextPos { + line: 17, + col: 13, + }, + end: TextPos { + line: 17, + col: 17, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 17, + col: 1, + }, + end: TextPos { + line: 17, + col: 18, + }, + }, + }, + If { + cond: BinOp { + op: Eq { + range: TextRange { + start: TextPos { + line: 18, + col: 8, + }, + end: TextPos { + line: 18, + col: 10, + }, + }, + }, + lhs: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 18, + col: 5, + }, + end: TextPos { + line: 18, + col: 7, + }, + }, + }, + }, + rhs: Literal { + literal: Integer { + value: 32, + range: TextRange { + start: TextPos { + line: 18, + col: 11, + }, + end: TextPos { + line: 18, + col: 13, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 18, + col: 5, + }, + end: TextPos { + line: 18, + col: 13, + }, + }, + }, + consequent: Block { + stmts: [ + Assign { + name: Identifier { + value: "res2", + range: TextRange { + start: TextPos { + line: 19, + col: 5, + }, + end: TextPos { + line: 19, + col: 9, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "run_script", + range: TextRange { + start: TextPos { + line: 19, + col: 13, + }, + end: TextPos { + line: 19, + col: 23, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "data1", + range: TextRange { + start: TextPos { + line: 19, + col: 24, + }, + end: TextPos { + line: 19, + col: 29, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 19, + col: 13, + }, + end: TextPos { + line: 19, + col: 30, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 19, + col: 5, + }, + end: TextPos { + line: 19, + col: 31, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 18, + col: 15, + }, + end: TextPos { + line: 20, + col: 2, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Assign { + name: Identifier { + value: "res2", + range: TextRange { + start: TextPos { + line: 21, + col: 5, + }, + end: TextPos { + line: 21, + col: 9, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "run_script", + range: TextRange { + start: TextPos { + line: 21, + col: 13, + }, + end: TextPos { + line: 21, + col: 23, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "data1", + range: TextRange { + start: TextPos { + line: 21, + col: 24, + }, + end: TextPos { + line: 21, + col: 29, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 21, + col: 13, + }, + end: TextPos { + line: 21, + col: 30, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 21, + col: 5, + }, + end: TextPos { + line: 21, + col: 31, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 20, + col: 8, + }, + end: TextPos { + line: 22, + col: 2, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 18, + col: 1, + }, + end: TextPos { + line: 22, + col: 2, + }, + }, + }, + LetAssign { + name: Identifier { + value: "gres2", + range: TextRange { + start: TextPos { + line: 23, + col: 5, + }, + end: TextPos { + line: 23, + col: 10, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 23, + col: 14, + }, + end: TextPos { + line: 23, + col: 23, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "res2", + range: TextRange { + start: TextPos { + line: 23, + col: 24, + }, + end: TextPos { + line: 23, + col: 28, + }, + }, + }, + st_entry: None, + }, + VarRef { + name: Identifier { + value: "res2", + range: TextRange { + start: TextPos { + line: 23, + col: 30, + }, + end: TextPos { + line: 23, + col: 34, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 23, + col: 14, + }, + end: TextPos { + line: 23, + col: 35, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 23, + col: 1, + }, + end: TextPos { + line: 23, + col: 36, + }, + }, + }, + LetAssign { + name: Identifier { + value: "data2", + range: TextRange { + start: TextPos { + line: 25, + col: 5, + }, + end: TextPos { + line: 25, + col: 10, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "commit_result", + range: TextRange { + start: TextPos { + line: 25, + col: 14, + }, + end: TextPos { + line: 25, + col: 27, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "test_data_2", + range: TextRange { + start: TextPos { + line: 25, + col: 28, + }, + end: TextPos { + line: 25, + col: 41, + }, + }, + }, + }, + VarRef { + name: Identifier { + value: "gres2", + range: TextRange { + start: TextPos { + line: 25, + col: 43, + }, + end: TextPos { + line: 25, + col: 48, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 25, + col: 14, + }, + end: TextPos { + line: 25, + col: 49, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 25, + col: 1, + }, + end: TextPos { + line: 25, + col: 50, + }, + }, + }, + LetAssign { + name: Identifier { + value: "gres3", + range: TextRange { + start: TextPos { + line: 30, + col: 5, + }, + end: TextPos { + line: 30, + col: 10, + }, + }, + }, + value: Literal { + literal: Null { + range: TextRange { + start: TextPos { + line: 30, + col: 14, + }, + end: TextPos { + line: 30, + col: 18, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 30, + col: 1, + }, + end: TextPos { + line: 30, + col: 19, + }, + }, + }, + For { + initializer: LetAssign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 31, + col: 10, + }, + end: TextPos { + line: 31, + col: 11, + }, + }, + }, + value: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 31, + col: 15, + }, + end: TextPos { + line: 31, + col: 16, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 31, + col: 6, + }, + end: TextPos { + line: 31, + col: 17, + }, + }, + }, + condition: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 31, + col: 20, + }, + end: TextPos { + line: 31, + col: 21, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 31, + col: 18, + }, + end: TextPos { + line: 31, + col: 19, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 10, + range: TextRange { + start: TextPos { + line: 31, + col: 22, + }, + end: TextPos { + line: 31, + col: 24, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 31, + col: 18, + }, + end: TextPos { + line: 31, + col: 24, + }, + }, + }, + increment: Assign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 31, + col: 26, + }, + end: TextPos { + line: 31, + col: 27, + }, + }, + }, + value: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 31, + col: 33, + }, + end: TextPos { + line: 31, + col: 34, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 31, + col: 31, + }, + end: TextPos { + line: 31, + col: 32, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 31, + col: 35, + }, + end: TextPos { + line: 31, + col: 36, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 31, + col: 31, + }, + end: TextPos { + line: 31, + col: 36, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 31, + col: 26, + }, + end: TextPos { + line: 31, + col: 36, + }, + }, + }, + consequent: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "res3", + range: TextRange { + start: TextPos { + line: 32, + col: 9, + }, + end: TextPos { + line: 32, + col: 13, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "run_script", + range: TextRange { + start: TextPos { + line: 32, + col: 17, + }, + end: TextPos { + line: 32, + col: 27, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "data2", + range: TextRange { + start: TextPos { + line: 32, + col: 28, + }, + end: TextPos { + line: 32, + col: 33, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 32, + col: 17, + }, + end: TextPos { + line: 32, + col: 34, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 32, + col: 5, + }, + end: TextPos { + line: 32, + col: 35, + }, + }, + }, + Assign { + name: Identifier { + value: "gres3", + range: TextRange { + start: TextPos { + line: 33, + col: 5, + }, + end: TextPos { + line: 33, + col: 10, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 33, + col: 14, + }, + end: TextPos { + line: 33, + col: 23, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "res3", + range: TextRange { + start: TextPos { + line: 33, + col: 24, + }, + end: TextPos { + line: 33, + col: 28, + }, + }, + }, + st_entry: None, + }, + VarRef { + name: Identifier { + value: "res3", + range: TextRange { + start: TextPos { + line: 33, + col: 30, + }, + end: TextPos { + line: 33, + col: 34, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 33, + col: 14, + }, + end: TextPos { + line: 33, + col: 35, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 33, + col: 5, + }, + end: TextPos { + line: 33, + col: 36, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 31, + col: 38, + }, + end: TextPos { + line: 34, + col: 2, + }, + }, + }, + attrs: [], + range: TextRange { + start: TextPos { + line: 31, + col: 1, + }, + end: TextPos { + line: 34, + col: 2, + }, + }, + }, + LetAssign { + name: Identifier { + value: "data3", + range: TextRange { + start: TextPos { + line: 36, + col: 5, + }, + end: TextPos { + line: 36, + col: 10, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "commit_result", + range: TextRange { + start: TextPos { + line: 36, + col: 14, + }, + end: TextPos { + line: 36, + col: 27, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "test_data_3", + range: TextRange { + start: TextPos { + line: 36, + col: 28, + }, + end: TextPos { + line: 36, + col: 41, + }, + }, + }, + }, + VarRef { + name: Identifier { + value: "gres3", + range: TextRange { + start: TextPos { + line: 36, + col: 43, + }, + end: TextPos { + line: 36, + col: 48, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 36, + col: 14, + }, + end: TextPos { + line: 36, + col: 49, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 36, + col: 1, + }, + end: TextPos { + line: 36, + col: 50, + }, + }, + }, + LetAssign { + name: Identifier { + value: "gres4", + range: TextRange { + start: TextPos { + line: 41, + col: 5, + }, + end: TextPos { + line: 41, + col: 10, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "copy_result", + range: TextRange { + start: TextPos { + line: 41, + col: 14, + }, + end: TextPos { + line: 41, + col: 25, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "data3", + range: TextRange { + start: TextPos { + line: 41, + col: 26, + }, + end: TextPos { + line: 41, + col: 31, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 41, + col: 14, + }, + end: TextPos { + line: 41, + col: 32, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 41, + col: 1, + }, + end: TextPos { + line: 41, + col: 33, + }, + }, + }, + For { + initializer: LetAssign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 42, + col: 10, + }, + end: TextPos { + line: 42, + col: 11, + }, + }, + }, + value: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 42, + col: 15, + }, + end: TextPos { + line: 42, + col: 16, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 42, + col: 6, + }, + end: TextPos { + line: 42, + col: 17, + }, + }, + }, + condition: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 42, + col: 20, + }, + end: TextPos { + line: 42, + col: 21, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 42, + col: 18, + }, + end: TextPos { + line: 42, + col: 19, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 10, + range: TextRange { + start: TextPos { + line: 42, + col: 22, + }, + end: TextPos { + line: 42, + col: 24, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 42, + col: 18, + }, + end: TextPos { + line: 42, + col: 24, + }, + }, + }, + increment: Assign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 42, + col: 26, + }, + end: TextPos { + line: 42, + col: 27, + }, + }, + }, + value: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 42, + col: 33, + }, + end: TextPos { + line: 42, + col: 34, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 42, + col: 31, + }, + end: TextPos { + line: 42, + col: 32, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 42, + col: 35, + }, + end: TextPos { + line: 42, + col: 36, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 42, + col: 31, + }, + end: TextPos { + line: 42, + col: 36, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 42, + col: 26, + }, + end: TextPos { + line: 42, + col: 36, + }, + }, + }, + consequent: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "res4", + range: TextRange { + start: TextPos { + line: 43, + col: 9, + }, + end: TextPos { + line: 43, + col: 13, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "run_script", + range: TextRange { + start: TextPos { + line: 43, + col: 17, + }, + end: TextPos { + line: 43, + col: 27, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "gres4", + range: TextRange { + start: TextPos { + line: 43, + col: 28, + }, + end: TextPos { + line: 43, + col: 33, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 43, + col: 17, + }, + end: TextPos { + line: 43, + col: 34, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 43, + col: 5, + }, + end: TextPos { + line: 43, + col: 35, + }, + }, + }, + Assign { + name: Identifier { + value: "gres4", + range: TextRange { + start: TextPos { + line: 44, + col: 5, + }, + end: TextPos { + line: 44, + col: 10, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 44, + col: 14, + }, + end: TextPos { + line: 44, + col: 23, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "res4", + range: TextRange { + start: TextPos { + line: 44, + col: 24, + }, + end: TextPos { + line: 44, + col: 28, + }, + }, + }, + st_entry: None, + }, + VarRef { + name: Identifier { + value: "res4", + range: TextRange { + start: TextPos { + line: 44, + col: 30, + }, + end: TextPos { + line: 44, + col: 34, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 44, + col: 14, + }, + end: TextPos { + line: 44, + col: 35, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 44, + col: 5, + }, + end: TextPos { + line: 44, + col: 36, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 42, + col: 38, + }, + end: TextPos { + line: 45, + col: 2, + }, + }, + }, + attrs: [], + range: TextRange { + start: TextPos { + line: 42, + col: 1, + }, + end: TextPos { + line: 45, + col: 2, + }, + }, + }, + LetAssign { + name: Identifier { + value: "data4", + range: TextRange { + start: TextPos { + line: 47, + col: 5, + }, + end: TextPos { + line: 47, + col: 10, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "commit_result", + range: TextRange { + start: TextPos { + line: 47, + col: 14, + }, + end: TextPos { + line: 47, + col: 27, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "test_data_4", + range: TextRange { + start: TextPos { + line: 47, + col: 28, + }, + end: TextPos { + line: 47, + col: 41, + }, + }, + }, + }, + VarRef { + name: Identifier { + value: "gres4", + range: TextRange { + start: TextPos { + line: 47, + col: 43, + }, + end: TextPos { + line: 47, + col: 48, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 47, + col: 14, + }, + end: TextPos { + line: 47, + col: 49, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 47, + col: 1, + }, + end: TextPos { + line: 47, + col: 50, + }, + }, + }, + LetAssign { + name: Identifier { + value: "data12", + range: TextRange { + start: TextPos { + line: 52, + col: 5, + }, + end: TextPos { + line: 52, + col: 11, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 52, + col: 15, + }, + end: TextPos { + line: 52, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "data1", + range: TextRange { + start: TextPos { + line: 52, + col: 25, + }, + end: TextPos { + line: 52, + col: 30, + }, + }, + }, + st_entry: None, + }, + VarRef { + name: Identifier { + value: "data2", + range: TextRange { + start: TextPos { + line: 52, + col: 32, + }, + end: TextPos { + line: 52, + col: 37, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 52, + col: 15, + }, + end: TextPos { + line: 52, + col: 38, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 52, + col: 1, + }, + end: TextPos { + line: 52, + col: 39, + }, + }, + }, + LetAssign { + name: Identifier { + value: "data34", + range: TextRange { + start: TextPos { + line: 53, + col: 5, + }, + end: TextPos { + line: 53, + col: 11, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 53, + col: 15, + }, + end: TextPos { + line: 53, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "data3", + range: TextRange { + start: TextPos { + line: 53, + col: 25, + }, + end: TextPos { + line: 53, + col: 30, + }, + }, + }, + st_entry: None, + }, + VarRef { + name: Identifier { + value: "data4", + range: TextRange { + start: TextPos { + line: 53, + col: 32, + }, + end: TextPos { + line: 53, + col: 37, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 53, + col: 15, + }, + end: TextPos { + line: 53, + col: 38, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 53, + col: 1, + }, + end: TextPos { + line: 53, + col: 39, + }, + }, + }, + LetAssign { + name: Identifier { + value: "data1234", + range: TextRange { + start: TextPos { + line: 54, + col: 5, + }, + end: TextPos { + line: 54, + col: 13, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 54, + col: 17, + }, + end: TextPos { + line: 54, + col: 26, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "data12", + range: TextRange { + start: TextPos { + line: 54, + col: 27, + }, + end: TextPos { + line: 54, + col: 33, + }, + }, + }, + st_entry: None, + }, + VarRef { + name: Identifier { + value: "data34", + range: TextRange { + start: TextPos { + line: 54, + col: 35, + }, + end: TextPos { + line: 54, + col: 41, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 54, + col: 17, + }, + end: TextPos { + line: 54, + col: 42, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 54, + col: 1, + }, + end: TextPos { + line: 54, + col: 43, + }, + }, + }, + Return { + expr: Some( + Call { + expr: Identifier { + name: Identifier { + value: "commit_result", + range: TextRange { + start: TextPos { + line: 59, + col: 8, + }, + end: TextPos { + line: 59, + col: 21, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "test_data_1234", + range: TextRange { + start: TextPos { + line: 59, + col: 22, + }, + end: TextPos { + line: 59, + col: 38, + }, + }, + }, + }, + VarRef { + name: Identifier { + value: "data1234", + range: TextRange { + start: TextPos { + line: 59, + col: 40, + }, + end: TextPos { + line: 59, + col: 48, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 59, + col: 8, + }, + end: TextPos { + line: 59, + col: 49, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 59, + col: 1, + }, + end: TextPos { + line: 59, + col: 50, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 59, + col: 50, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__delayed_initialization.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__delayed_initialization.bs.snap new file mode 100644 index 00000000..97d68ffe --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__delayed_initialization.bs.snap @@ -0,0 +1,179 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 2, + col: 5, + }, + end: TextPos { + line: 2, + col: 9, + }, + }, + }, + value: Literal { + literal: Null { + range: TextRange { + start: TextPos { + line: 2, + col: 13, + }, + end: TextPos { + line: 2, + col: 17, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 18, + }, + }, + }, + Assign { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 5, + }, + }, + }, + value: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 3, + col: 9, + }, + end: TextPos { + line: 3, + col: 11, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 12, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 13, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 14, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 15, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 4, + col: 15, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__empty.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__empty.bs.snap new file mode 100644 index 00000000..72f01d71 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__empty.bs.snap @@ -0,0 +1,30 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__epi.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__epi.bs.snap new file mode 100644 index 00000000..4a8c039d --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__epi.bs.snap @@ -0,0 +1,551 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "epi", + range: TextRange { + start: TextPos { + line: 4, + col: 8, + }, + end: TextPos { + line: 4, + col: 11, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 12, + }, + }, + }, + LetAssign { + name: Identifier { + value: "res_sta", + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 12, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "local_compute", + range: TextRange { + start: TextPos { + line: 7, + col: 16, + }, + end: TextPos { + line: 7, + col: 29, + }, + }, + }, + st_entry: None, + }, + args: [ + Instance { + name: Identifier { + value: "Data", + range: TextRange { + start: TextPos { + line: 7, + col: 34, + }, + end: TextPos { + line: 7, + col: 38, + }, + }, + }, + properties: [ + PropertyExpr { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 7, + col: 40, + }, + end: TextPos { + line: 7, + col: 44, + }, + }, + }, + value: Literal { + literal: String { + value: "st_antonius_ect", + range: TextRange { + start: TextPos { + line: 7, + col: 48, + }, + end: TextPos { + line: 7, + col: 65, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 7, + col: 40, + }, + end: TextPos { + line: 7, + col: 65, + }, + }, + }, + ], + st_entry: None, + range: TextRange { + start: TextPos { + line: 7, + col: 30, + }, + end: TextPos { + line: 7, + col: 67, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 16, + }, + end: TextPos { + line: 7, + col: 68, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 69, + }, + }, + }, + LetAssign { + name: Identifier { + value: "res_umc", + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 12, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "local_compute", + range: TextRange { + start: TextPos { + line: 8, + col: 16, + }, + end: TextPos { + line: 8, + col: 29, + }, + }, + }, + st_entry: None, + }, + args: [ + Instance { + name: Identifier { + value: "Data", + range: TextRange { + start: TextPos { + line: 8, + col: 34, + }, + end: TextPos { + line: 8, + col: 38, + }, + }, + }, + properties: [ + PropertyExpr { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 8, + col: 40, + }, + end: TextPos { + line: 8, + col: 44, + }, + }, + }, + value: Literal { + literal: String { + value: "umc_utrecht_ect", + range: TextRange { + start: TextPos { + line: 8, + col: 48, + }, + end: TextPos { + line: 8, + col: 65, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 8, + col: 40, + }, + end: TextPos { + line: 8, + col: 65, + }, + }, + }, + ], + st_entry: None, + range: TextRange { + start: TextPos { + line: 8, + col: 30, + }, + end: TextPos { + line: 8, + col: 67, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 8, + col: 16, + }, + end: TextPos { + line: 8, + col: 68, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 8, + col: 69, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "loc", + range: TextRange { + start: TextPos { + line: 11, + col: 3, + }, + end: TextPos { + line: 11, + col: 6, + }, + }, + }, + values: [ + String { + value: "surf", + range: TextRange { + start: TextPos { + line: 11, + col: 7, + }, + end: TextPos { + line: 11, + col: 13, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 11, + col: 1, + }, + end: TextPos { + line: 11, + col: 15, + }, + }, + }, + ), + LetAssign { + name: Identifier { + value: "res", + range: TextRange { + start: TextPos { + line: 12, + col: 5, + }, + end: TextPos { + line: 12, + col: 8, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 12, + col: 12, + }, + end: TextPos { + line: 12, + col: 21, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "res_sta", + range: TextRange { + start: TextPos { + line: 12, + col: 22, + }, + end: TextPos { + line: 12, + col: 29, + }, + }, + }, + st_entry: None, + }, + VarRef { + name: Identifier { + value: "res_umc", + range: TextRange { + start: TextPos { + line: 12, + col: 31, + }, + end: TextPos { + line: 12, + col: 38, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 12, + col: 12, + }, + end: TextPos { + line: 12, + col: 39, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 12, + col: 1, + }, + end: TextPos { + line: 12, + col: 40, + }, + }, + }, + Return { + expr: Some( + Call { + expr: Identifier { + name: Identifier { + value: "commit_result", + range: TextRange { + start: TextPos { + line: 13, + col: 8, + }, + end: TextPos { + line: 13, + col: 21, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "surf_res", + range: TextRange { + start: TextPos { + line: 13, + col: 22, + }, + end: TextPos { + line: 13, + col: 32, + }, + }, + }, + }, + VarRef { + name: Identifier { + value: "res", + range: TextRange { + start: TextPos { + line: 13, + col: 34, + }, + end: TextPos { + line: 13, + col: 37, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 13, + col: 8, + }, + end: TextPos { + line: 13, + col: 38, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 13, + col: 1, + }, + end: TextPos { + line: 13, + col: 39, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 13, + col: 39, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__epi_one.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__epi_one.bs.snap new file mode 100644 index 00000000..e0c261f7 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__epi_one.bs.snap @@ -0,0 +1,421 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "epi", + range: TextRange { + start: TextPos { + line: 4, + col: 8, + }, + end: TextPos { + line: 4, + col: 11, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 12, + }, + }, + }, + LetAssign { + name: Identifier { + value: "res_umc", + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 12, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "local_compute", + range: TextRange { + start: TextPos { + line: 7, + col: 16, + }, + end: TextPos { + line: 7, + col: 29, + }, + }, + }, + st_entry: None, + }, + args: [ + Instance { + name: Identifier { + value: "Data", + range: TextRange { + start: TextPos { + line: 7, + col: 34, + }, + end: TextPos { + line: 7, + col: 38, + }, + }, + }, + properties: [ + PropertyExpr { + name: Identifier { + value: "name", + range: TextRange { + start: TextPos { + line: 7, + col: 40, + }, + end: TextPos { + line: 7, + col: 44, + }, + }, + }, + value: Literal { + literal: String { + value: "umc_utrecht_ect", + range: TextRange { + start: TextPos { + line: 7, + col: 48, + }, + end: TextPos { + line: 7, + col: 65, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 7, + col: 40, + }, + end: TextPos { + line: 7, + col: 65, + }, + }, + }, + ], + st_entry: None, + range: TextRange { + start: TextPos { + line: 7, + col: 30, + }, + end: TextPos { + line: 7, + col: 67, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 16, + }, + end: TextPos { + line: 7, + col: 68, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 69, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "loc", + range: TextRange { + start: TextPos { + line: 10, + col: 3, + }, + end: TextPos { + line: 10, + col: 6, + }, + }, + }, + values: [ + String { + value: "surf", + range: TextRange { + start: TextPos { + line: 10, + col: 7, + }, + end: TextPos { + line: 10, + col: 13, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 10, + col: 1, + }, + end: TextPos { + line: 10, + col: 15, + }, + }, + }, + ), + LetAssign { + name: Identifier { + value: "res", + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 8, + }, + }, + }, + value: Call { + expr: Identifier { + name: Identifier { + value: "aggregate", + range: TextRange { + start: TextPos { + line: 11, + col: 12, + }, + end: TextPos { + line: 11, + col: 21, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "res_umc", + range: TextRange { + start: TextPos { + line: 11, + col: 22, + }, + end: TextPos { + line: 11, + col: 29, + }, + }, + }, + st_entry: None, + }, + VarRef { + name: Identifier { + value: "res_umc", + range: TextRange { + start: TextPos { + line: 11, + col: 31, + }, + end: TextPos { + line: 11, + col: 38, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 11, + col: 12, + }, + end: TextPos { + line: 11, + col: 39, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 1, + }, + end: TextPos { + line: 11, + col: 40, + }, + }, + }, + Return { + expr: Some( + Call { + expr: Identifier { + name: Identifier { + value: "commit_result", + range: TextRange { + start: TextPos { + line: 12, + col: 8, + }, + end: TextPos { + line: 12, + col: 21, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "surf_res", + range: TextRange { + start: TextPos { + line: 12, + col: 22, + }, + end: TextPos { + line: 12, + col: 32, + }, + }, + }, + }, + VarRef { + name: Identifier { + value: "res", + range: TextRange { + start: TextPos { + line: 12, + col: 34, + }, + end: TextPos { + line: 12, + col: 37, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 12, + col: 8, + }, + end: TextPos { + line: 12, + col: 38, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 12, + col: 1, + }, + end: TextPos { + line: 12, + col: 39, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 12, + col: 39, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__for.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__for.bs.snap new file mode 100644 index 00000000..c5cb3c16 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__for.bs.snap @@ -0,0 +1,739 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + For { + initializer: LetAssign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 2, + col: 10, + }, + end: TextPos { + line: 2, + col: 11, + }, + }, + }, + value: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 2, + col: 15, + }, + end: TextPos { + line: 2, + col: 16, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 6, + }, + end: TextPos { + line: 2, + col: 17, + }, + }, + }, + condition: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 2, + col: 20, + }, + end: TextPos { + line: 2, + col: 21, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 2, + col: 18, + }, + end: TextPos { + line: 2, + col: 19, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 10, + range: TextRange { + start: TextPos { + line: 2, + col: 22, + }, + end: TextPos { + line: 2, + col: 24, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 2, + col: 18, + }, + end: TextPos { + line: 2, + col: 24, + }, + }, + }, + increment: Assign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 2, + col: 26, + }, + end: TextPos { + line: 2, + col: 27, + }, + }, + }, + value: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 2, + col: 33, + }, + end: TextPos { + line: 2, + col: 34, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 2, + col: 31, + }, + end: TextPos { + line: 2, + col: 32, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 2, + col: 35, + }, + end: TextPos { + line: 2, + col: 36, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 2, + col: 31, + }, + end: TextPos { + line: 2, + col: 36, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 26, + }, + end: TextPos { + line: 2, + col: 36, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 10, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 3, + col: 11, + }, + end: TextPos { + line: 3, + col: 12, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 13, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 14, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: ") It's dancing time!", + range: TextRange { + start: TextPos { + line: 4, + col: 13, + }, + end: TextPos { + line: 4, + col: 35, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 36, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 37, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 38, + }, + end: TextPos { + line: 5, + col: 2, + }, + }, + }, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 5, + col: 2, + }, + }, + }, + For { + initializer: LetAssign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 9, + col: 10, + }, + end: TextPos { + line: 9, + col: 11, + }, + }, + }, + value: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 9, + col: 15, + }, + end: TextPos { + line: 9, + col: 16, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 6, + }, + end: TextPos { + line: 9, + col: 17, + }, + }, + }, + condition: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 9, + col: 20, + }, + end: TextPos { + line: 9, + col: 21, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 9, + col: 18, + }, + end: TextPos { + line: 9, + col: 19, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 10, + range: TextRange { + start: TextPos { + line: 9, + col: 22, + }, + end: TextPos { + line: 9, + col: 24, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 9, + col: 18, + }, + end: TextPos { + line: 9, + col: 24, + }, + }, + }, + increment: Assign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 9, + col: 26, + }, + end: TextPos { + line: 9, + col: 27, + }, + }, + }, + value: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 9, + col: 33, + }, + end: TextPos { + line: 9, + col: 34, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 9, + col: 31, + }, + end: TextPos { + line: 9, + col: 32, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 9, + col: 35, + }, + end: TextPos { + line: 9, + col: 36, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 9, + col: 31, + }, + end: TextPos { + line: 9, + col: 36, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 26, + }, + end: TextPos { + line: 9, + col: 36, + }, + }, + }, + consequent: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "a", + range: TextRange { + start: TextPos { + line: 10, + col: 9, + }, + end: TextPos { + line: 10, + col: 10, + }, + }, + }, + value: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 10, + col: 14, + }, + end: TextPos { + line: 10, + col: 16, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 5, + }, + end: TextPos { + line: 10, + col: 17, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 11, + col: 15, + }, + end: TextPos { + line: 11, + col: 16, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "a", + range: TextRange { + start: TextPos { + line: 11, + col: 13, + }, + end: TextPos { + line: 11, + col: 14, + }, + }, + }, + st_entry: None, + }, + rhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 11, + col: 17, + }, + end: TextPos { + line: 11, + col: 18, + }, + }, + }, + st_entry: None, + }, + range: TextRange { + start: TextPos { + line: 11, + col: 13, + }, + end: TextPos { + line: 11, + col: 18, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 19, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 20, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 38, + }, + end: TextPos { + line: 12, + col: 2, + }, + }, + }, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 1, + }, + end: TextPos { + line: 12, + col: 2, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 12, + col: 2, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__function.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__function.bs.snap new file mode 100644 index 00000000..b809cc0a --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__function.bs.snap @@ -0,0 +1,699 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + FuncDef { + ident: Identifier { + value: "hello_there", + range: TextRange { + start: TextPos { + line: 2, + col: 6, + }, + end: TextPos { + line: 2, + col: 17, + }, + }, + }, + params: [], + code: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Hello there!", + range: TextRange { + start: TextPos { + line: 3, + col: 13, + }, + end: TextPos { + line: 3, + col: 27, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 28, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 29, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 20, + }, + end: TextPos { + line: 4, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 4, + col: 2, + }, + }, + }, + FuncDef { + ident: Identifier { + value: "say", + range: TextRange { + start: TextPos { + line: 6, + col: 6, + }, + end: TextPos { + line: 6, + col: 9, + }, + }, + }, + params: [ + Identifier { + value: "text", + range: TextRange { + start: TextPos { + line: 6, + col: 10, + }, + end: TextPos { + line: 6, + col: 14, + }, + }, + }, + ], + code: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "text", + range: TextRange { + start: TextPos { + line: 7, + col: 13, + }, + end: TextPos { + line: 7, + col: 17, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 18, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 19, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 16, + }, + end: TextPos { + line: 8, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 8, + col: 2, + }, + }, + }, + FuncDef { + ident: Identifier { + value: "add", + range: TextRange { + start: TextPos { + line: 10, + col: 6, + }, + end: TextPos { + line: 10, + col: 9, + }, + }, + }, + params: [ + Identifier { + value: "lhs", + range: TextRange { + start: TextPos { + line: 10, + col: 10, + }, + end: TextPos { + line: 10, + col: 13, + }, + }, + }, + Identifier { + value: "rhs", + range: TextRange { + start: TextPos { + line: 10, + col: 15, + }, + end: TextPos { + line: 10, + col: 18, + }, + }, + }, + ], + code: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "result", + range: TextRange { + start: TextPos { + line: 11, + col: 9, + }, + end: TextPos { + line: 11, + col: 15, + }, + }, + }, + value: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 11, + col: 23, + }, + end: TextPos { + line: 11, + col: 24, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "lhs", + range: TextRange { + start: TextPos { + line: 11, + col: 19, + }, + end: TextPos { + line: 11, + col: 22, + }, + }, + }, + st_entry: None, + }, + rhs: VarRef { + name: Identifier { + value: "rhs", + range: TextRange { + start: TextPos { + line: 11, + col: 25, + }, + end: TextPos { + line: 11, + col: 28, + }, + }, + }, + st_entry: None, + }, + range: TextRange { + start: TextPos { + line: 11, + col: 19, + }, + end: TextPos { + line: 11, + col: 28, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 29, + }, + }, + }, + Return { + expr: Some( + VarRef { + name: Identifier { + value: "result", + range: TextRange { + start: TextPos { + line: 12, + col: 12, + }, + end: TextPos { + line: 12, + col: 18, + }, + }, + }, + st_entry: None, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 12, + col: 5, + }, + end: TextPos { + line: 12, + col: 19, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 20, + }, + end: TextPos { + line: 13, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 1, + }, + end: TextPos { + line: 13, + col: 2, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "hello_there", + range: TextRange { + start: TextPos { + line: 16, + col: 1, + }, + end: TextPos { + line: 16, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 16, + col: 1, + }, + end: TextPos { + line: 16, + col: 14, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 16, + col: 1, + }, + end: TextPos { + line: 16, + col: 15, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "say", + range: TextRange { + start: TextPos { + line: 17, + col: 1, + }, + end: TextPos { + line: 17, + col: 4, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "General Kenobi!", + range: TextRange { + start: TextPos { + line: 17, + col: 5, + }, + end: TextPos { + line: 17, + col: 22, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 17, + col: 1, + }, + end: TextPos { + line: 17, + col: 23, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 17, + col: 1, + }, + end: TextPos { + line: 17, + col: 24, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 18, + col: 1, + }, + end: TextPos { + line: 18, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "add", + range: TextRange { + start: TextPos { + line: 18, + col: 9, + }, + end: TextPos { + line: 18, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: Integer { + value: 21, + range: TextRange { + start: TextPos { + line: 18, + col: 13, + }, + end: TextPos { + line: 18, + col: 15, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 21, + range: TextRange { + start: TextPos { + line: 18, + col: 17, + }, + end: TextPos { + line: 18, + col: 19, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 18, + col: 9, + }, + end: TextPos { + line: 18, + col: 20, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 18, + col: 1, + }, + end: TextPos { + line: 18, + col: 21, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 18, + col: 1, + }, + end: TextPos { + line: 18, + col: 22, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 18, + col: 22, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__hello_world.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__hello_world.bs.snap new file mode 100644 index 00000000..875d13a2 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__hello_world.bs.snap @@ -0,0 +1,155 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 2, + col: 8, + }, + end: TextPos { + line: 2, + col: 19, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 20, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 22, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 23, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 24, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 4, + col: 24, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__if.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__if.bs.snap new file mode 100644 index 00000000..a36ce123 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__if.bs.snap @@ -0,0 +1,569 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 2, + col: 5, + }, + end: TextPos { + line: 2, + col: 10, + }, + }, + }, + value: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 2, + col: 14, + }, + end: TextPos { + line: 2, + col: 16, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 17, + }, + }, + }, + If { + cond: BinOp { + op: Gt { + range: TextRange { + start: TextPos { + line: 3, + col: 11, + }, + end: TextPos { + line: 3, + col: 12, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 10, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 3, + col: 13, + }, + end: TextPos { + line: 3, + col: 15, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 15, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "More than the magic number!", + range: TextRange { + start: TextPos { + line: 4, + col: 13, + }, + end: TextPos { + line: 4, + col: 42, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 43, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 44, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 17, + }, + end: TextPos { + line: 5, + col: 2, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + If { + cond: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 6, + col: 15, + }, + end: TextPos { + line: 6, + col: 16, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 6, + col: 9, + }, + end: TextPos { + line: 6, + col: 14, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 6, + col: 17, + }, + end: TextPos { + line: 6, + col: 19, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 6, + col: 9, + }, + end: TextPos { + line: 6, + col: 19, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 7, + col: 9, + }, + end: TextPos { + line: 7, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Less than the magic number!", + range: TextRange { + start: TextPos { + line: 7, + col: 17, + }, + end: TextPos { + line: 7, + col: 46, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 9, + }, + end: TextPos { + line: 7, + col: 47, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 9, + }, + end: TextPos { + line: 7, + col: 48, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 21, + }, + end: TextPos { + line: 8, + col: 6, + }, + }, + }, + alternative: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 5, + }, + end: TextPos { + line: 8, + col: 6, + }, + }, + }, + If { + cond: BinOp { + op: Eq { + range: TextRange { + start: TextPos { + line: 9, + col: 15, + }, + end: TextPos { + line: 9, + col: 17, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 9, + col: 9, + }, + end: TextPos { + line: 9, + col: 14, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 9, + col: 18, + }, + end: TextPos { + line: 9, + col: 20, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 9, + col: 9, + }, + end: TextPos { + line: 9, + col: 20, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 10, + col: 9, + }, + end: TextPos { + line: 10, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Equal to the magic number!", + range: TextRange { + start: TextPos { + line: 10, + col: 17, + }, + end: TextPos { + line: 10, + col: 45, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 10, + col: 9, + }, + end: TextPos { + line: 10, + col: 46, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 9, + }, + end: TextPos { + line: 10, + col: 47, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 22, + }, + end: TextPos { + line: 11, + col: 6, + }, + }, + }, + alternative: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 11, + col: 6, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 8, + }, + end: TextPos { + line: 12, + col: 2, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 12, + col: 2, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 12, + col: 2, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__if_complex.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__if_complex.bs.snap new file mode 100644 index 00000000..13cb32b9 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__if_complex.bs.snap @@ -0,0 +1,1705 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 2, + col: 5, + }, + end: TextPos { + line: 2, + col: 10, + }, + }, + }, + value: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 2, + col: 14, + }, + end: TextPos { + line: 2, + col: 16, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 17, + }, + }, + }, + If { + cond: BinOp { + op: Gt { + range: TextRange { + start: TextPos { + line: 3, + col: 11, + }, + end: TextPos { + line: 3, + col: 12, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 10, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 3, + col: 13, + }, + end: TextPos { + line: 3, + col: 14, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 14, + }, + }, + }, + consequent: Block { + stmts: [ + If { + cond: BinOp { + op: Gt { + range: TextRange { + start: TextPos { + line: 4, + col: 15, + }, + end: TextPos { + line: 4, + col: 16, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 14, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 4, + col: 17, + }, + end: TextPos { + line: 4, + col: 19, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 19, + }, + }, + }, + consequent: Block { + stmts: [ + If { + cond: BinOp { + op: Gt { + range: TextRange { + start: TextPos { + line: 5, + col: 19, + }, + end: TextPos { + line: 5, + col: 20, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 5, + col: 13, + }, + end: TextPos { + line: 5, + col: 18, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 84, + range: TextRange { + start: TextPos { + line: 5, + col: 21, + }, + end: TextPos { + line: 5, + col: 23, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 5, + col: 13, + }, + end: TextPos { + line: 5, + col: 23, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 6, + col: 13, + }, + end: TextPos { + line: 6, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is more than 84!", + range: TextRange { + start: TextPos { + line: 6, + col: 21, + }, + end: TextPos { + line: 6, + col: 45, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 6, + col: 13, + }, + end: TextPos { + line: 6, + col: 46, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 13, + }, + end: TextPos { + line: 6, + col: 47, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 25, + }, + end: TextPos { + line: 7, + col: 10, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + If { + cond: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 8, + col: 23, + }, + end: TextPos { + line: 8, + col: 24, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 8, + col: 17, + }, + end: TextPos { + line: 8, + col: 22, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 84, + range: TextRange { + start: TextPos { + line: 8, + col: 25, + }, + end: TextPos { + line: 8, + col: 27, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 8, + col: 17, + }, + end: TextPos { + line: 8, + col: 27, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 9, + col: 17, + }, + end: TextPos { + line: 9, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is less than 84!", + range: TextRange { + start: TextPos { + line: 9, + col: 25, + }, + end: TextPos { + line: 9, + col: 49, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 9, + col: 17, + }, + end: TextPos { + line: 9, + col: 50, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 17, + }, + end: TextPos { + line: 9, + col: 51, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 29, + }, + end: TextPos { + line: 10, + col: 14, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 11, + col: 17, + }, + end: TextPos { + line: 11, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is 84!", + range: TextRange { + start: TextPos { + line: 11, + col: 25, + }, + end: TextPos { + line: 11, + col: 39, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 11, + col: 17, + }, + end: TextPos { + line: 11, + col: 40, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 17, + }, + end: TextPos { + line: 11, + col: 41, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 20, + }, + end: TextPos { + line: 12, + col: 14, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 13, + }, + end: TextPos { + line: 12, + col: 14, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 16, + }, + end: TextPos { + line: 13, + col: 10, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 9, + }, + end: TextPos { + line: 13, + col: 10, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 21, + }, + end: TextPos { + line: 14, + col: 6, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + If { + cond: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 15, + col: 19, + }, + end: TextPos { + line: 15, + col: 20, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 15, + col: 13, + }, + end: TextPos { + line: 15, + col: 18, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 15, + col: 21, + }, + end: TextPos { + line: 15, + col: 23, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 15, + col: 13, + }, + end: TextPos { + line: 15, + col: 23, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 16, + col: 13, + }, + end: TextPos { + line: 16, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is less than 42!", + range: TextRange { + start: TextPos { + line: 16, + col: 21, + }, + end: TextPos { + line: 16, + col: 45, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 16, + col: 13, + }, + end: TextPos { + line: 16, + col: 46, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 16, + col: 13, + }, + end: TextPos { + line: 16, + col: 47, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 15, + col: 25, + }, + end: TextPos { + line: 17, + col: 10, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 18, + col: 13, + }, + end: TextPos { + line: 18, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is 42!", + range: TextRange { + start: TextPos { + line: 18, + col: 21, + }, + end: TextPos { + line: 18, + col: 35, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 18, + col: 13, + }, + end: TextPos { + line: 18, + col: 36, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 18, + col: 13, + }, + end: TextPos { + line: 18, + col: 37, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 17, + col: 16, + }, + end: TextPos { + line: 19, + col: 10, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 15, + col: 9, + }, + end: TextPos { + line: 19, + col: 10, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 14, + col: 12, + }, + end: TextPos { + line: 20, + col: 6, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 20, + col: 6, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 16, + }, + end: TextPos { + line: 21, + col: 2, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + If { + cond: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 22, + col: 15, + }, + end: TextPos { + line: 22, + col: 16, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 22, + col: 9, + }, + end: TextPos { + line: 22, + col: 14, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 22, + col: 17, + }, + end: TextPos { + line: 22, + col: 18, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 22, + col: 9, + }, + end: TextPos { + line: 22, + col: 18, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 23, + col: 9, + }, + end: TextPos { + line: 23, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is less than 0!", + range: TextRange { + start: TextPos { + line: 23, + col: 17, + }, + end: TextPos { + line: 23, + col: 40, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 23, + col: 9, + }, + end: TextPos { + line: 23, + col: 41, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 23, + col: 9, + }, + end: TextPos { + line: 23, + col: 42, + }, + }, + }, + If { + cond: BinOp { + op: Gt { + range: TextRange { + start: TextPos { + line: 24, + col: 19, + }, + end: TextPos { + line: 24, + col: 20, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 24, + col: 13, + }, + end: TextPos { + line: 24, + col: 18, + }, + }, + }, + st_entry: None, + }, + rhs: UnaOp { + op: Neg { + range: TextRange { + start: TextPos { + line: 24, + col: 21, + }, + end: TextPos { + line: 24, + col: 22, + }, + }, + }, + expr: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 24, + col: 22, + }, + end: TextPos { + line: 24, + col: 24, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 24, + col: 21, + }, + end: TextPos { + line: 24, + col: 24, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 24, + col: 13, + }, + end: TextPos { + line: 24, + col: 24, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 25, + col: 13, + }, + end: TextPos { + line: 25, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is more than -42!", + range: TextRange { + start: TextPos { + line: 25, + col: 21, + }, + end: TextPos { + line: 25, + col: 46, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 25, + col: 13, + }, + end: TextPos { + line: 25, + col: 47, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 25, + col: 13, + }, + end: TextPos { + line: 25, + col: 48, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 24, + col: 26, + }, + end: TextPos { + line: 26, + col: 10, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + If { + cond: BinOp { + op: Lt { + range: TextRange { + start: TextPos { + line: 27, + col: 23, + }, + end: TextPos { + line: 27, + col: 24, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "value", + range: TextRange { + start: TextPos { + line: 27, + col: 17, + }, + end: TextPos { + line: 27, + col: 22, + }, + }, + }, + st_entry: None, + }, + rhs: UnaOp { + op: Neg { + range: TextRange { + start: TextPos { + line: 27, + col: 25, + }, + end: TextPos { + line: 27, + col: 26, + }, + }, + }, + expr: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 27, + col: 26, + }, + end: TextPos { + line: 27, + col: 28, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 27, + col: 25, + }, + end: TextPos { + line: 27, + col: 28, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 27, + col: 17, + }, + end: TextPos { + line: 27, + col: 28, + }, + }, + }, + consequent: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 28, + col: 17, + }, + end: TextPos { + line: 28, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is less than -42!", + range: TextRange { + start: TextPos { + line: 28, + col: 25, + }, + end: TextPos { + line: 28, + col: 50, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 28, + col: 17, + }, + end: TextPos { + line: 28, + col: 51, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 28, + col: 17, + }, + end: TextPos { + line: 28, + col: 52, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 27, + col: 30, + }, + end: TextPos { + line: 29, + col: 14, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 30, + col: 17, + }, + end: TextPos { + line: 30, + col: 24, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is -42!", + range: TextRange { + start: TextPos { + line: 30, + col: 25, + }, + end: TextPos { + line: 30, + col: 40, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 30, + col: 17, + }, + end: TextPos { + line: 30, + col: 41, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 30, + col: 17, + }, + end: TextPos { + line: 30, + col: 42, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 29, + col: 20, + }, + end: TextPos { + line: 31, + col: 14, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 27, + col: 13, + }, + end: TextPos { + line: 31, + col: 14, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 26, + col: 16, + }, + end: TextPos { + line: 32, + col: 10, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 24, + col: 9, + }, + end: TextPos { + line: 32, + col: 10, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 22, + col: 20, + }, + end: TextPos { + line: 33, + col: 6, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 34, + col: 9, + }, + end: TextPos { + line: 34, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Value is 0!", + range: TextRange { + start: TextPos { + line: 34, + col: 17, + }, + end: TextPos { + line: 34, + col: 30, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 34, + col: 9, + }, + end: TextPos { + line: 34, + col: 31, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 34, + col: 9, + }, + end: TextPos { + line: 34, + col: 32, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 33, + col: 12, + }, + end: TextPos { + line: 35, + col: 6, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 22, + col: 5, + }, + end: TextPos { + line: 35, + col: 6, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 21, + col: 8, + }, + end: TextPos { + line: 36, + col: 2, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 36, + col: 2, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 36, + col: 2, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__import.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__import.bs.snap new file mode 100644 index 00000000..1e07e581 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__import.bs.snap @@ -0,0 +1,155 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 2, + col: 8, + }, + end: TextPos { + line: 2, + col: 12, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 13, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 12, + col: 1, + }, + end: TextPos { + line: 12, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 12, + col: 9, + }, + end: TextPos { + line: 12, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 12, + col: 9, + }, + end: TextPos { + line: 12, + col: 22, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 12, + col: 1, + }, + end: TextPos { + line: 12, + col: 23, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 12, + col: 1, + }, + end: TextPos { + line: 12, + col: 24, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 12, + col: 24, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__math.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__math.bs.snap new file mode 100644 index 00000000..83752c1d --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__math.bs.snap @@ -0,0 +1,614 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Expr { + expr: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 2, + col: 3, + }, + end: TextPos { + line: 2, + col: 4, + }, + }, + }, + lhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 2, + }, + }, + }, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 2, + col: 5, + }, + end: TextPos { + line: 2, + col: 6, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 6, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 7, + }, + }, + }, + Expr { + expr: BinOp { + op: Sub { + range: TextRange { + start: TextPos { + line: 3, + col: 3, + }, + end: TextPos { + line: 3, + col: 4, + }, + }, + }, + lhs: Literal { + literal: Integer { + value: 2, + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 2, + }, + }, + }, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 6, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 6, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 7, + }, + }, + }, + Expr { + expr: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 10, + }, + }, + }, + lhs: BinOp { + op: Mul { + range: TextRange { + start: TextPos { + line: 4, + col: 4, + }, + end: TextPos { + line: 4, + col: 5, + }, + }, + }, + lhs: Literal { + literal: Integer { + value: 42, + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 3, + }, + }, + }, + }, + rhs: Literal { + literal: Integer { + value: 55, + range: TextRange { + start: TextPos { + line: 4, + col: 6, + }, + end: TextPos { + line: 4, + col: 8, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 8, + }, + }, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 4, + col: 11, + }, + end: TextPos { + line: 4, + col: 12, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 12, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 13, + }, + }, + }, + Expr { + expr: BinOp { + op: Mul { + range: TextRange { + start: TextPos { + line: 5, + col: 7, + }, + end: TextPos { + line: 5, + col: 8, + }, + }, + }, + lhs: Literal { + literal: Integer { + value: 33333, + range: TextRange { + start: TextPos { + line: 5, + col: 1, + }, + end: TextPos { + line: 5, + col: 6, + }, + }, + }, + }, + rhs: Literal { + literal: Integer { + value: 33333, + range: TextRange { + start: TextPos { + line: 5, + col: 9, + }, + end: TextPos { + line: 5, + col: 14, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 5, + col: 1, + }, + end: TextPos { + line: 5, + col: 14, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 1, + }, + end: TextPos { + line: 5, + col: 15, + }, + }, + }, + Expr { + expr: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 6, + col: 5, + }, + end: TextPos { + line: 6, + col: 6, + }, + }, + }, + lhs: Literal { + literal: Integer { + value: 828, + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 4, + }, + }, + }, + }, + rhs: BinOp { + op: Div { + range: TextRange { + start: TextPos { + line: 6, + col: 22, + }, + end: TextPos { + line: 6, + col: 23, + }, + }, + }, + lhs: BinOp { + op: Mod { + range: TextRange { + start: TextPos { + line: 6, + col: 13, + }, + end: TextPos { + line: 6, + col: 14, + }, + }, + }, + lhs: Literal { + literal: Integer { + value: 12318, + range: TextRange { + start: TextPos { + line: 6, + col: 7, + }, + end: TextPos { + line: 6, + col: 12, + }, + }, + }, + }, + rhs: Literal { + literal: Integer { + value: 123123, + range: TextRange { + start: TextPos { + line: 6, + col: 15, + }, + end: TextPos { + line: 6, + col: 21, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 6, + col: 7, + }, + end: TextPos { + line: 6, + col: 21, + }, + }, + }, + rhs: Literal { + literal: Integer { + value: 1231231231, + range: TextRange { + start: TextPos { + line: 6, + col: 24, + }, + end: TextPos { + line: 6, + col: 34, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 6, + col: 7, + }, + end: TextPos { + line: 6, + col: 34, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 34, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 35, + }, + }, + }, + Expr { + expr: BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 7, + col: 7, + }, + end: TextPos { + line: 7, + col: 8, + }, + }, + }, + lhs: Literal { + literal: Real { + value: 12.0, + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 6, + }, + }, + }, + }, + rhs: Literal { + literal: Integer { + value: 123123, + range: TextRange { + start: TextPos { + line: 7, + col: 9, + }, + end: TextPos { + line: 7, + col: 16, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 16, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 17, + }, + }, + }, + Expr { + expr: Literal { + literal: Real { + value: 777777.777777, + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 8, + col: 14, + }, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 8, + col: 15, + }, + }, + }, + Expr { + expr: Literal { + literal: Real { + value: 5550000000000.0, + range: TextRange { + start: TextPos { + line: 9, + col: 1, + }, + end: TextPos { + line: 9, + col: 8, + }, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 1, + }, + end: TextPos { + line: 9, + col: 9, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 9, + col: 9, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__metadata.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__metadata.bs.snap new file mode 100644 index 00000000..46360d6f --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__metadata.bs.snap @@ -0,0 +1,333 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 1, + col: 8, + }, + end: TextPos { + line: 1, + col: 19, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 1, + col: 1, + }, + end: TextPos { + line: 1, + col: 20, + }, + }, + }, + AttributeInner( + List { + key: Identifier { + value: "wf_tag", + range: TextRange { + start: TextPos { + line: 3, + col: 4, + }, + end: TextPos { + line: 3, + col: 10, + }, + }, + }, + values: [ + String { + value: "foo", + range: TextRange { + start: TextPos { + line: 3, + col: 11, + }, + end: TextPos { + line: 3, + col: 16, + }, + }, + }, + String { + value: "bar", + range: TextRange { + start: TextPos { + line: 3, + col: 18, + }, + end: TextPos { + line: 3, + col: 23, + }, + }, + }, + String { + value: "baz", + range: TextRange { + start: TextPos { + line: 3, + col: 25, + }, + end: TextPos { + line: 3, + col: 30, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 32, + }, + }, + }, + ), + Attribute( + List { + key: Identifier { + value: "tag", + range: TextRange { + start: TextPos { + line: 5, + col: 3, + }, + end: TextPos { + line: 5, + col: 6, + }, + }, + }, + values: [ + String { + value: "foo2", + range: TextRange { + start: TextPos { + line: 5, + col: 7, + }, + end: TextPos { + line: 5, + col: 13, + }, + }, + }, + String { + value: "bar2", + range: TextRange { + start: TextPos { + line: 5, + col: 15, + }, + end: TextPos { + line: 5, + col: 21, + }, + }, + }, + String { + value: "baz2", + range: TextRange { + start: TextPos { + line: 5, + col: 23, + }, + end: TextPos { + line: 5, + col: 29, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 5, + col: 1, + }, + end: TextPos { + line: 5, + col: 31, + }, + }, + }, + ), + Attribute( + List { + key: Identifier { + value: "on", + range: TextRange { + start: TextPos { + line: 6, + col: 3, + }, + end: TextPos { + line: 6, + col: 5, + }, + }, + }, + values: [ + String { + value: "test", + range: TextRange { + start: TextPos { + line: 6, + col: 6, + }, + end: TextPos { + line: 6, + col: 12, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 14, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 7, + col: 9, + }, + end: TextPos { + line: 7, + col: 20, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 9, + }, + end: TextPos { + line: 7, + col: 22, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 23, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 24, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 1, + col: 1, + }, + end: TextPos { + line: 7, + col: 24, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__on.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__on.bs.snap new file mode 100644 index 00000000..0ebc3cc7 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__on.bs.snap @@ -0,0 +1,786 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Import { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 1, + col: 8, + }, + end: TextPos { + line: 1, + col: 12, + }, + }, + }, + version: Semver { + value: "latest", + range: TextRange { + start: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + end: TextPos { + line: 18446744073709551615, + col: 18446744073709551615, + }, + }, + }, + st_funcs: None, + st_classes: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 1, + col: 1, + }, + end: TextPos { + line: 1, + col: 13, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 14, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 15, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "on", + range: TextRange { + start: TextPos { + line: 6, + col: 3, + }, + end: TextPos { + line: 6, + col: 5, + }, + }, + }, + values: [ + String { + value: "test", + range: TextRange { + start: TextPos { + line: 6, + col: 6, + }, + end: TextPos { + line: 6, + col: 12, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 14, + }, + }, + }, + ), + Block { + block: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "I'm talking to you from far away!", + range: TextRange { + start: TextPos { + line: 8, + col: 13, + }, + end: TextPos { + line: 8, + col: 48, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 49, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 5, + }, + end: TextPos { + line: 8, + col: 50, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 18, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 5, + }, + end: TextPos { + line: 9, + col: 19, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 10, + col: 2, + }, + }, + }, + }, + LetAssign { + name: Identifier { + value: "random", + range: TextRange { + start: TextPos { + line: 12, + col: 5, + }, + end: TextPos { + line: 12, + col: 11, + }, + }, + }, + value: Literal { + literal: String { + value: "random", + range: TextRange { + start: TextPos { + line: 12, + col: 15, + }, + end: TextPos { + line: 12, + col: 23, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 12, + col: 1, + }, + end: TextPos { + line: 12, + col: 24, + }, + }, + }, + Block { + block: Block { + stmts: [ + AttributeInner( + List { + key: Identifier { + value: "on", + range: TextRange { + start: TextPos { + line: 14, + col: 8, + }, + end: TextPos { + line: 14, + col: 10, + }, + }, + }, + values: [ + String { + value: "random_but_not_really_anymore", + range: TextRange { + start: TextPos { + line: 14, + col: 11, + }, + end: TextPos { + line: 14, + col: 42, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 14, + col: 5, + }, + end: TextPos { + line: 14, + col: 44, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "I have no idea where I am!", + range: TextRange { + start: TextPos { + line: 15, + col: 13, + }, + end: TextPos { + line: 15, + col: 41, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 42, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 43, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 18, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 19, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 13, + col: 1, + }, + end: TextPos { + line: 17, + col: 2, + }, + }, + }, + }, + FuncDef { + ident: Identifier { + value: "fourty_two", + range: TextRange { + start: TextPos { + line: 19, + col: 6, + }, + end: TextPos { + line: 19, + col: 16, + }, + }, + }, + params: [], + code: Block { + stmts: [ + Return { + expr: Some( + Literal { + literal: String { + value: "42", + range: TextRange { + start: TextPos { + line: 20, + col: 12, + }, + end: TextPos { + line: 20, + col: 16, + }, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 20, + col: 5, + }, + end: TextPos { + line: 20, + col: 17, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 19, + col: 19, + }, + end: TextPos { + line: 21, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 19, + col: 1, + }, + end: TextPos { + line: 21, + col: 2, + }, + }, + }, + Attribute( + List { + key: Identifier { + value: "on", + range: TextRange { + start: TextPos { + line: 22, + col: 3, + }, + end: TextPos { + line: 22, + col: 5, + }, + }, + }, + values: [ + String { + value: "42", + range: TextRange { + start: TextPos { + line: 22, + col: 6, + }, + end: TextPos { + line: 22, + col: 10, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 22, + col: 1, + }, + end: TextPos { + line: 22, + col: 12, + }, + }, + }, + ), + Block { + block: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 24, + col: 5, + }, + end: TextPos { + line: 24, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "I have found the answer", + range: TextRange { + start: TextPos { + line: 24, + col: 13, + }, + end: TextPos { + line: 24, + col: 38, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 24, + col: 5, + }, + end: TextPos { + line: 24, + col: 39, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 24, + col: 5, + }, + end: TextPos { + line: 24, + col: 40, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "hello_world", + range: TextRange { + start: TextPos { + line: 25, + col: 5, + }, + end: TextPos { + line: 25, + col: 16, + }, + }, + }, + st_entry: None, + }, + args: [], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 25, + col: 5, + }, + end: TextPos { + line: 25, + col: 18, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 25, + col: 5, + }, + end: TextPos { + line: 25, + col: 19, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 23, + col: 1, + }, + end: TextPos { + line: 26, + col: 2, + }, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 1, + col: 1, + }, + end: TextPos { + line: 26, + col: 2, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__parallel.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__parallel.bs.snap new file mode 100644 index 00000000..5b37a879 --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__parallel.bs.snap @@ -0,0 +1,1051 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Parallel { + result: None, + blocks: [ + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Running in parallel...", + range: TextRange { + start: TextPos { + line: 3, + col: 13, + }, + end: TextPos { + line: 3, + col: 37, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 38, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 5, + }, + end: TextPos { + line: 3, + col: 39, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 11, + }, + end: TextPos { + line: 4, + col: 2, + }, + }, + }, + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 5, + col: 5, + }, + end: TextPos { + line: 5, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "...so we can...", + range: TextRange { + start: TextPos { + line: 5, + col: 13, + }, + end: TextPos { + line: 5, + col: 30, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 5, + col: 5, + }, + end: TextPos { + line: 5, + col: 31, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 5, + }, + end: TextPos { + line: 5, + col: 32, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 4, + }, + end: TextPos { + line: 6, + col: 2, + }, + }, + }, + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "...finish each other's sentences!", + range: TextRange { + start: TextPos { + line: 7, + col: 13, + }, + end: TextPos { + line: 7, + col: 48, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 49, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 50, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 4, + }, + end: TextPos { + line: 8, + col: 2, + }, + }, + }, + ], + merge: None, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 8, + col: 4, + }, + }, + }, + Parallel { + result: Some( + Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 10, + col: 5, + }, + end: TextPos { + line: 10, + col: 9, + }, + }, + }, + ), + blocks: [ + Block { + stmts: [ + Return { + expr: Some( + Literal { + literal: String { + value: "No parallelism at all, gnagnagnagna", + range: TextRange { + start: TextPos { + line: 11, + col: 12, + }, + end: TextPos { + line: 11, + col: 49, + }, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 50, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 29, + }, + end: TextPos { + line: 12, + col: 2, + }, + }, + }, + ], + merge: Some( + Identifier { + value: "all", + range: TextRange { + start: TextPos { + line: 10, + col: 23, + }, + end: TextPos { + line: 10, + col: 26, + }, + }, + }, + ), + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 1, + }, + end: TextPos { + line: 12, + col: 4, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 13, + col: 1, + }, + end: TextPos { + line: 13, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 13, + col: 9, + }, + end: TextPos { + line: 13, + col: 13, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 13, + col: 1, + }, + end: TextPos { + line: 13, + col: 14, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 13, + col: 1, + }, + end: TextPos { + line: 13, + col: 15, + }, + }, + }, + Parallel { + result: Some( + Identifier { + value: "sum", + range: TextRange { + start: TextPos { + line: 15, + col: 5, + }, + end: TextPos { + line: 15, + col: 8, + }, + }, + }, + ), + blocks: [ + Block { + stmts: [ + Return { + expr: Some( + Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 16, + col: 12, + }, + end: TextPos { + line: 16, + col: 13, + }, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 14, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 15, + col: 28, + }, + end: TextPos { + line: 17, + col: 2, + }, + }, + }, + Block { + stmts: [ + Return { + expr: Some( + Literal { + literal: Integer { + value: 2, + range: TextRange { + start: TextPos { + line: 18, + col: 12, + }, + end: TextPos { + line: 18, + col: 13, + }, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 18, + col: 5, + }, + end: TextPos { + line: 18, + col: 14, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 17, + col: 4, + }, + end: TextPos { + line: 19, + col: 2, + }, + }, + }, + Block { + stmts: [ + Return { + expr: Some( + Literal { + literal: Integer { + value: 3, + range: TextRange { + start: TextPos { + line: 20, + col: 12, + }, + end: TextPos { + line: 20, + col: 13, + }, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 20, + col: 5, + }, + end: TextPos { + line: 20, + col: 14, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 19, + col: 4, + }, + end: TextPos { + line: 21, + col: 2, + }, + }, + }, + Block { + stmts: [ + Return { + expr: Some( + Literal { + literal: Integer { + value: 4, + range: TextRange { + start: TextPos { + line: 22, + col: 12, + }, + end: TextPos { + line: 22, + col: 13, + }, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 22, + col: 5, + }, + end: TextPos { + line: 22, + col: 14, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 21, + col: 3, + }, + end: TextPos { + line: 23, + col: 2, + }, + }, + }, + ], + merge: Some( + Identifier { + value: "sum", + range: TextRange { + start: TextPos { + line: 15, + col: 22, + }, + end: TextPos { + line: 15, + col: 25, + }, + }, + }, + ), + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 15, + col: 1, + }, + end: TextPos { + line: 23, + col: 4, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 24, + col: 1, + }, + end: TextPos { + line: 24, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "sum", + range: TextRange { + start: TextPos { + line: 24, + col: 9, + }, + end: TextPos { + line: 24, + col: 12, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 24, + col: 1, + }, + end: TextPos { + line: 24, + col: 13, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 24, + col: 1, + }, + end: TextPos { + line: 24, + col: 14, + }, + }, + }, + Parallel { + result: None, + blocks: [ + Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 27, + col: 5, + }, + end: TextPos { + line: 27, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Running somewhere randomly!", + range: TextRange { + start: TextPos { + line: 27, + col: 13, + }, + end: TextPos { + line: 27, + col: 42, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 27, + col: 5, + }, + end: TextPos { + line: 27, + col: 43, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 27, + col: 5, + }, + end: TextPos { + line: 27, + col: 44, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 26, + col: 11, + }, + end: TextPos { + line: 28, + col: 2, + }, + }, + }, + Block { + stmts: [ + AttributeInner( + List { + key: Identifier { + value: "on", + range: TextRange { + start: TextPos { + line: 29, + col: 8, + }, + end: TextPos { + line: 29, + col: 10, + }, + }, + }, + values: [ + String { + value: "some_location", + range: TextRange { + start: TextPos { + line: 29, + col: 11, + }, + end: TextPos { + line: 29, + col: 26, + }, + }, + }, + ], + range: TextRange { + start: TextPos { + line: 29, + col: 5, + }, + end: TextPos { + line: 29, + col: 28, + }, + }, + }, + ), + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 30, + col: 5, + }, + end: TextPos { + line: 30, + col: 12, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Running somewhere specific but in parallel!", + range: TextRange { + start: TextPos { + line: 30, + col: 13, + }, + end: TextPos { + line: 30, + col: 58, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 30, + col: 5, + }, + end: TextPos { + line: 30, + col: 59, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 30, + col: 5, + }, + end: TextPos { + line: 30, + col: 60, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 28, + col: 4, + }, + end: TextPos { + line: 31, + col: 2, + }, + }, + }, + ], + merge: None, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 26, + col: 1, + }, + end: TextPos { + line: 31, + col: 4, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 31, + col: 4, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__recursion.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__recursion.bs.snap new file mode 100644 index 00000000..e904ce9d --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__recursion.bs.snap @@ -0,0 +1,1119 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + FuncDef { + ident: Identifier { + value: "fibonacci", + range: TextRange { + start: TextPos { + line: 5, + col: 6, + }, + end: TextPos { + line: 5, + col: 15, + }, + }, + }, + params: [ + Identifier { + value: "n", + range: TextRange { + start: TextPos { + line: 5, + col: 16, + }, + end: TextPos { + line: 5, + col: 17, + }, + }, + }, + Identifier { + value: "n_1", + range: TextRange { + start: TextPos { + line: 5, + col: 19, + }, + end: TextPos { + line: 5, + col: 22, + }, + }, + }, + Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 5, + col: 24, + }, + end: TextPos { + line: 5, + col: 25, + }, + }, + }, + ], + code: Block { + stmts: [ + If { + cond: BinOp { + op: Eq { + range: TextRange { + start: TextPos { + line: 6, + col: 11, + }, + end: TextPos { + line: 6, + col: 13, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 6, + col: 9, + }, + end: TextPos { + line: 6, + col: 10, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 6, + col: 14, + }, + end: TextPos { + line: 6, + col: 15, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 6, + col: 9, + }, + end: TextPos { + line: 6, + col: 15, + }, + }, + }, + consequent: Block { + stmts: [ + Return { + expr: Some( + Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 7, + col: 16, + }, + end: TextPos { + line: 7, + col: 17, + }, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 9, + }, + end: TextPos { + line: 7, + col: 18, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 17, + }, + end: TextPos { + line: 8, + col: 6, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + If { + cond: BinOp { + op: Eq { + range: TextRange { + start: TextPos { + line: 9, + col: 15, + }, + end: TextPos { + line: 9, + col: 17, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 9, + col: 13, + }, + end: TextPos { + line: 9, + col: 14, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 9, + col: 18, + }, + end: TextPos { + line: 9, + col: 19, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 9, + col: 13, + }, + end: TextPos { + line: 9, + col: 19, + }, + }, + }, + consequent: Block { + stmts: [ + Return { + expr: Some( + VarRef { + name: Identifier { + value: "n_1", + range: TextRange { + start: TextPos { + line: 10, + col: 20, + }, + end: TextPos { + line: 10, + col: 23, + }, + }, + }, + st_entry: None, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 10, + col: 13, + }, + end: TextPos { + line: 10, + col: 24, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 21, + }, + end: TextPos { + line: 11, + col: 10, + }, + }, + }, + alternative: Some( + Block { + stmts: [ + Return { + expr: Some( + Call { + expr: Identifier { + name: Identifier { + value: "fibonacci", + range: TextRange { + start: TextPos { + line: 12, + col: 20, + }, + end: TextPos { + line: 12, + col: 29, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "n_1", + range: TextRange { + start: TextPos { + line: 12, + col: 30, + }, + end: TextPos { + line: 12, + col: 33, + }, + }, + }, + st_entry: None, + }, + BinOp { + op: Add { + range: TextRange { + start: TextPos { + line: 12, + col: 37, + }, + end: TextPos { + line: 12, + col: 38, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "n", + range: TextRange { + start: TextPos { + line: 12, + col: 35, + }, + end: TextPos { + line: 12, + col: 36, + }, + }, + }, + st_entry: None, + }, + rhs: VarRef { + name: Identifier { + value: "n_1", + range: TextRange { + start: TextPos { + line: 12, + col: 39, + }, + end: TextPos { + line: 12, + col: 42, + }, + }, + }, + st_entry: None, + }, + range: TextRange { + start: TextPos { + line: 12, + col: 35, + }, + end: TextPos { + line: 12, + col: 42, + }, + }, + }, + BinOp { + op: Sub { + range: TextRange { + start: TextPos { + line: 12, + col: 46, + }, + end: TextPos { + line: 12, + col: 47, + }, + }, + }, + lhs: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 12, + col: 44, + }, + end: TextPos { + line: 12, + col: 45, + }, + }, + }, + st_entry: None, + }, + rhs: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 12, + col: 48, + }, + end: TextPos { + line: 12, + col: 49, + }, + }, + }, + }, + range: TextRange { + start: TextPos { + line: 12, + col: 44, + }, + end: TextPos { + line: 12, + col: 49, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 12, + col: 20, + }, + end: TextPos { + line: 12, + col: 50, + }, + }, + }, + ), + data_type: Any, + output: {}, + attrs: [], + range: TextRange { + start: TextPos { + line: 12, + col: 13, + }, + end: TextPos { + line: 12, + col: 51, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 16, + }, + end: TextPos { + line: 13, + col: 10, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 9, + col: 9, + }, + end: TextPos { + line: 13, + col: 10, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 12, + }, + end: TextPos { + line: 14, + col: 6, + }, + }, + }, + ), + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 5, + }, + end: TextPos { + line: 14, + col: 6, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 27, + }, + end: TextPos { + line: 15, + col: 2, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 1, + }, + end: TextPos { + line: 15, + col: 2, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 18, + col: 1, + }, + end: TextPos { + line: 18, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "fibonacci", + range: TextRange { + start: TextPos { + line: 18, + col: 9, + }, + end: TextPos { + line: 18, + col: 18, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 18, + col: 19, + }, + end: TextPos { + line: 18, + col: 20, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 18, + col: 22, + }, + end: TextPos { + line: 18, + col: 23, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 18, + col: 25, + }, + end: TextPos { + line: 18, + col: 26, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 18, + col: 9, + }, + end: TextPos { + line: 18, + col: 27, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 18, + col: 1, + }, + end: TextPos { + line: 18, + col: 28, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 18, + col: 1, + }, + end: TextPos { + line: 18, + col: 29, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 19, + col: 1, + }, + end: TextPos { + line: 19, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "fibonacci", + range: TextRange { + start: TextPos { + line: 19, + col: 9, + }, + end: TextPos { + line: 19, + col: 18, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 19, + col: 19, + }, + end: TextPos { + line: 19, + col: 20, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 19, + col: 22, + }, + end: TextPos { + line: 19, + col: 23, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 5, + range: TextRange { + start: TextPos { + line: 19, + col: 25, + }, + end: TextPos { + line: 19, + col: 26, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 19, + col: 9, + }, + end: TextPos { + line: 19, + col: 27, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 19, + col: 1, + }, + end: TextPos { + line: 19, + col: 28, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 19, + col: 1, + }, + end: TextPos { + line: 19, + col: 29, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 20, + col: 1, + }, + end: TextPos { + line: 20, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "fibonacci", + range: TextRange { + start: TextPos { + line: 20, + col: 9, + }, + end: TextPos { + line: 20, + col: 18, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 20, + col: 19, + }, + end: TextPos { + line: 20, + col: 20, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 20, + col: 22, + }, + end: TextPos { + line: 20, + col: 23, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 10, + range: TextRange { + start: TextPos { + line: 20, + col: 25, + }, + end: TextPos { + line: 20, + col: 27, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 20, + col: 9, + }, + end: TextPos { + line: 20, + col: 28, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 20, + col: 1, + }, + end: TextPos { + line: 20, + col: 29, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 20, + col: 1, + }, + end: TextPos { + line: 20, + col: 30, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 21, + col: 1, + }, + end: TextPos { + line: 21, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Call { + expr: Identifier { + name: Identifier { + value: "fibonacci", + range: TextRange { + start: TextPos { + line: 21, + col: 9, + }, + end: TextPos { + line: 21, + col: 18, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: Integer { + value: 0, + range: TextRange { + start: TextPos { + line: 21, + col: 19, + }, + end: TextPos { + line: 21, + col: 20, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 21, + col: 22, + }, + end: TextPos { + line: 21, + col: 23, + }, + }, + }, + }, + Literal { + literal: Integer { + value: 20, + range: TextRange { + start: TextPos { + line: 21, + col: 25, + }, + end: TextPos { + line: 21, + col: 27, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 21, + col: 9, + }, + end: TextPos { + line: 21, + col: 28, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 21, + col: 1, + }, + end: TextPos { + line: 21, + col: 29, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 21, + col: 1, + }, + end: TextPos { + line: 21, + col: 30, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 1, + }, + end: TextPos { + line: 21, + col: 30, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__scopes.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__scopes.bs.snap new file mode 100644 index 00000000..89f374ff --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__scopes.bs.snap @@ -0,0 +1,337 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + Block { + block: Block { + stmts: [ + FuncDef { + ident: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 4, + col: 10, + }, + end: TextPos { + line: 4, + col: 14, + }, + }, + }, + params: [ + Identifier { + value: "text", + range: TextRange { + start: TextPos { + line: 4, + col: 15, + }, + end: TextPos { + line: 4, + col: 19, + }, + }, + }, + ], + code: Block { + stmts: [ + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 5, + col: 9, + }, + end: TextPos { + line: 5, + col: 14, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "Test123", + range: TextRange { + start: TextPos { + line: 5, + col: 15, + }, + end: TextPos { + line: 5, + col: 24, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 5, + col: 9, + }, + end: TextPos { + line: 5, + col: 25, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 5, + col: 9, + }, + end: TextPos { + line: 5, + col: 26, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "print", + range: TextRange { + start: TextPos { + line: 6, + col: 9, + }, + end: TextPos { + line: 6, + col: 14, + }, + }, + }, + st_entry: None, + }, + args: [ + VarRef { + name: Identifier { + value: "text", + range: TextRange { + start: TextPos { + line: 6, + col: 15, + }, + end: TextPos { + line: 6, + col: 19, + }, + }, + }, + st_entry: None, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 6, + col: 9, + }, + end: TextPos { + line: 6, + col: 20, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 9, + }, + end: TextPos { + line: 6, + col: 21, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 21, + }, + end: TextPos { + line: 7, + col: 6, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 7, + col: 6, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 8, + col: 2, + }, + }, + }, + }, + LetAssign { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 16, + col: 5, + }, + end: TextPos { + line: 16, + col: 6, + }, + }, + }, + value: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 16, + col: 10, + }, + end: TextPos { + line: 16, + col: 11, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 16, + col: 1, + }, + end: TextPos { + line: 16, + col: 12, + }, + }, + }, + LetAssign { + name: Identifier { + value: "j", + range: TextRange { + start: TextPos { + line: 17, + col: 5, + }, + end: TextPos { + line: 17, + col: 6, + }, + }, + }, + value: VarRef { + name: Identifier { + value: "i", + range: TextRange { + start: TextPos { + line: 17, + col: 10, + }, + end: TextPos { + line: 17, + col: 11, + }, + }, + }, + st_entry: None, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 17, + col: 1, + }, + end: TextPos { + line: 17, + col: 12, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 17, + col: 12, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__vars.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__vars.bs.snap new file mode 100644 index 00000000..559f9e3e --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__vars.bs.snap @@ -0,0 +1,283 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 2, + col: 5, + }, + end: TextPos { + line: 2, + col: 9, + }, + }, + }, + value: Literal { + literal: Integer { + value: 1, + range: TextRange { + start: TextPos { + line: 2, + col: 13, + }, + end: TextPos { + line: 2, + col: 14, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 15, + }, + }, + }, + Assign { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 5, + }, + }, + }, + value: Literal { + literal: Integer { + value: 2, + range: TextRange { + start: TextPos { + line: 3, + col: 9, + }, + end: TextPos { + line: 3, + col: 10, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 3, + col: 11, + }, + }, + }, + Assign { + name: Identifier { + value: "test", + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 5, + }, + }, + }, + value: Literal { + literal: Integer { + value: 3, + range: TextRange { + start: TextPos { + line: 4, + col: 9, + }, + end: TextPos { + line: 4, + col: 10, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 1, + }, + end: TextPos { + line: 4, + col: 11, + }, + }, + }, + LetAssign { + name: Identifier { + value: "abc__2", + range: TextRange { + start: TextPos { + line: 7, + col: 5, + }, + end: TextPos { + line: 7, + col: 11, + }, + }, + }, + value: Literal { + literal: String { + value: "Hello there!", + range: TextRange { + start: TextPos { + line: 7, + col: 15, + }, + end: TextPos { + line: 7, + col: 29, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 7, + col: 1, + }, + end: TextPos { + line: 7, + col: 30, + }, + }, + }, + Assign { + name: Identifier { + value: "abc__2", + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 8, + col: 7, + }, + }, + }, + value: Literal { + literal: Boolean { + value: true, + range: TextRange { + start: TextPos { + line: 8, + col: 11, + }, + end: TextPos { + line: 8, + col: 15, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 8, + col: 1, + }, + end: TextPos { + line: 8, + col: 16, + }, + }, + }, + LetAssign { + name: Identifier { + value: "new_test", + range: TextRange { + start: TextPos { + line: 11, + col: 5, + }, + end: TextPos { + line: 11, + col: 13, + }, + }, + }, + value: Literal { + literal: String { + value: "Keyword bug: fixed", + range: TextRange { + start: TextPos { + line: 11, + col: 17, + }, + end: TextPos { + line: 11, + col: 37, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 11, + col: 1, + }, + end: TextPos { + line: 11, + col: 38, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 11, + col: 38, + }, + }, + }, + metadata: {}, +} diff --git a/brane-dsl/tests/snapshots/regression__..__tests__branescript__while.bs.snap b/brane-dsl/tests/snapshots/regression__..__tests__branescript__while.bs.snap new file mode 100644 index 00000000..e8db761f --- /dev/null +++ b/brane-dsl/tests/snapshots/regression__..__tests__branescript__while.bs.snap @@ -0,0 +1,232 @@ +--- +source: brane-dsl/tests/regression.rs +expression: res +--- +Program { + block: Block { + stmts: [ + LetAssign { + name: Identifier { + value: "condition", + range: TextRange { + start: TextPos { + line: 2, + col: 5, + }, + end: TextPos { + line: 2, + col: 14, + }, + }, + }, + value: Literal { + literal: Boolean { + value: true, + range: TextRange { + start: TextPos { + line: 2, + col: 18, + }, + end: TextPos { + line: 2, + col: 22, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 2, + col: 23, + }, + }, + }, + While { + condition: VarRef { + name: Identifier { + value: "condition", + range: TextRange { + start: TextPos { + line: 3, + col: 8, + }, + end: TextPos { + line: 3, + col: 17, + }, + }, + }, + st_entry: None, + }, + consequent: Block { + stmts: [ + Assign { + name: Identifier { + value: "condition", + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 14, + }, + }, + }, + value: Literal { + literal: Boolean { + value: false, + range: TextRange { + start: TextPos { + line: 4, + col: 18, + }, + end: TextPos { + line: 4, + col: 23, + }, + }, + }, + }, + st_entry: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 4, + col: 5, + }, + end: TextPos { + line: 4, + col: 24, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 19, + }, + end: TextPos { + line: 5, + col: 2, + }, + }, + }, + attrs: [], + range: TextRange { + start: TextPos { + line: 3, + col: 1, + }, + end: TextPos { + line: 5, + col: 2, + }, + }, + }, + Expr { + expr: Call { + expr: Identifier { + name: Identifier { + value: "println", + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 8, + }, + }, + }, + st_entry: None, + }, + args: [ + Literal { + literal: String { + value: "That was one iteration :)", + range: TextRange { + start: TextPos { + line: 6, + col: 9, + }, + end: TextPos { + line: 6, + col: 36, + }, + }, + }, + }, + ], + st_entry: None, + locations: All, + input: {}, + result: {}, + metadata: {}, + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 37, + }, + }, + }, + data_type: Any, + attrs: [], + range: TextRange { + start: TextPos { + line: 6, + col: 1, + }, + end: TextPos { + line: 6, + col: 38, + }, + }, + }, + ], + table: RefCell { + value: SymbolTable { + parent: None, + functions: {}, + classes: {}, + variables: {}, + }, + }, + ret_type: None, + attrs: [], + range: TextRange { + start: TextPos { + line: 2, + col: 1, + }, + end: TextPos { + line: 6, + col: 38, + }, + }, + }, + metadata: {}, +}