From b7c3a5a20b581f40da33afa376f1748b48951024 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Wed, 31 Jul 2024 11:17:20 +0200 Subject: [PATCH 01/13] fix: Don't panic when recovering while combining Pratt matches (#1039) Closes #1035 Fow now this simply stops panicking in the recover path but we do not attempt any reduction post recovery. --- .../parser_support/sequence_helper.rs | 14 +++- .../parser_support/sequence_helper.rs | 14 +++- .../src/cst_output/generated/source_unit.rs | 5 ++ .../generated/0.4.11-failure.yml | 64 +++++++++++++++++++ .../pratt_precedence_recovery/input.sol | 5 ++ .../parser_support/sequence_helper.rs | 14 +++- 6 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 crates/solidity/testing/snapshots/cst_output/SourceUnit/pratt_precedence_recovery/generated/0.4.11-failure.yml create mode 100644 crates/solidity/testing/snapshots/cst_output/SourceUnit/pratt_precedence_recovery/input.sol diff --git a/crates/codegen/runtime/cargo/src/runtime/language/parser_support/sequence_helper.rs b/crates/codegen/runtime/cargo/src/runtime/language/parser_support/sequence_helper.rs index 3eac27101b..d8b80e1231 100644 --- a/crates/codegen/runtime/cargo/src/runtime/language/parser_support/sequence_helper.rs +++ b/crates/codegen/runtime/cargo/src/runtime/language/parser_support/sequence_helper.rs @@ -116,8 +116,18 @@ impl SequenceHelper { })); } - (ParserResult::PrattOperatorMatch(_), ParserResult::SkippedUntil(_)) => - unreachable!("Error recovery happens outside precedence parsing"), + (ParserResult::PrattOperatorMatch(running), ParserResult::SkippedUntil(skipped)) => { + let nodes: Vec<_> = std::mem::take(&mut running.elements) + .into_iter() + .flat_map(PrattElement::into_nodes) + .chain(skipped.nodes) + .collect(); + + self.result = State::Running(ParserResult::SkippedUntil(SkippedUntil { + nodes, + ..skipped + })); + } // Try to recover until we hit an expected boundary terminal. // If the sequence is unwinding, then a subsequent non-empty match must mean that diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/parser_support/sequence_helper.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/parser_support/sequence_helper.rs index 4d46325e81..9bf13418fc 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/parser_support/sequence_helper.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/parser_support/sequence_helper.rs @@ -118,8 +118,18 @@ impl SequenceHelper { })); } - (ParserResult::PrattOperatorMatch(_), ParserResult::SkippedUntil(_)) => - unreachable!("Error recovery happens outside precedence parsing"), + (ParserResult::PrattOperatorMatch(running), ParserResult::SkippedUntil(skipped)) => { + let nodes: Vec<_> = std::mem::take(&mut running.elements) + .into_iter() + .flat_map(PrattElement::into_nodes) + .chain(skipped.nodes) + .collect(); + + self.result = State::Running(ParserResult::SkippedUntil(SkippedUntil { + nodes, + ..skipped + })); + } // Try to recover until we hit an expected boundary terminal. // If the sequence is unwinding, then a subsequent non-empty match must mean that diff --git a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/source_unit.rs b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/source_unit.rs index 491465736a..13451137b6 100644 --- a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/source_unit.rs +++ b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/source_unit.rs @@ -97,6 +97,11 @@ fn partial_definition() -> Result<()> { run("SourceUnit", "partial_definition") } +#[test] +fn pratt_precedence_recovery() -> Result<()> { + run("SourceUnit", "pratt_precedence_recovery") +} + #[test] fn safe_math() -> Result<()> { run("SourceUnit", "safe_math") diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/pratt_precedence_recovery/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/pratt_precedence_recovery/generated/0.4.11-failure.yml new file mode 100644 index 0000000000..e683e35fbb --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/pratt_precedence_recovery/generated/0.4.11-failure.yml @@ -0,0 +1,64 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ contract A { │ 0..12 + 2 │ function a() { │ 13..28 + 3 │ 2 + ( │ 29..36 + 4 │ } │ 37..39 + 5 │ } │ 40..41 + +Errors: # 1 total + - > + Error: Expected CloseParen or Comma. + ╭─[crates/solidity/testing/snapshots/cst_output/SourceUnit/pratt_precedence_recovery/input.sol:4:2] + │ + 4 │ } + │ │ + │ ╰─ Error occurred here. + ───╯ + +Tree: + - (SourceUnit) ► (members꞉ SourceUnitMembers): # "contract A {\n\tfunction a() {\n\t\t2 + (\n\t}\n}\n" (0..42) + - (item꞉ SourceUnitMember) ► (variant꞉ ContractDefinition): # "contract A {\n\tfunction a() {\n\t\t2 + (\n\t}\n}\n" (0..42) + - (contract_keyword꞉ ContractKeyword): "contract" # (0..8) + - (leading_trivia꞉ Whitespace): " " # (8..9) + - (name꞉ Identifier): "A" # (9..10) + - (leading_trivia꞉ Whitespace): " " # (10..11) + - (open_brace꞉ OpenBrace): "{" # (11..12) + - (trailing_trivia꞉ EndOfLine): "\n" # (12..13) + - (members꞉ ContractMembers): # "\tfunction a() {\n\t\t2 + (\n\t}\n" (13..40) + - (item꞉ ContractMember) ► (variant꞉ FunctionDefinition): # "\tfunction a() {\n\t\t2 + (\n\t}\n" (13..40) + - (leading_trivia꞉ Whitespace): "\t" # (13..14) + - (function_keyword꞉ FunctionKeyword): "function" # (14..22) + - (name꞉ FunctionName): # " a" (22..24) + - (leading_trivia꞉ Whitespace): " " # (22..23) + - (variant꞉ Identifier): "a" # (23..24) + - (parameters꞉ ParametersDeclaration): # "()" (24..26) + - (open_paren꞉ OpenParen): "(" # (24..25) + - (parameters꞉ Parameters): [] # (25..25) + - (close_paren꞉ CloseParen): ")" # (25..26) + - (attributes꞉ FunctionAttributes): [] # (26..26) + - (body꞉ FunctionBody) ► (variant꞉ Block): # " {\n\t\t2 + (\n\t}\n" (26..40) + - (leading_trivia꞉ Whitespace): " " # (26..27) + - (open_brace꞉ OpenBrace): "{" # (27..28) + - (trailing_trivia꞉ EndOfLine): "\n" # (28..29) + - (statements꞉ Statements): # "\t\t2 + (\n\t" (29..38) + - (item꞉ Statement) ► (variant꞉ ExpressionStatement) ► (expression꞉ Expression): # "\t\t2 + (\n\t" (29..38) + - (variant꞉ DecimalNumberExpression): # "\t\t2" (29..32) + - (leading_trivia꞉ Whitespace): "\t\t" # (29..31) + - (literal꞉ DecimalLiteral): "2" # (31..32) + - (AdditiveExpression): # " +" (32..34) + - (leading_trivia꞉ Whitespace): " " # (32..33) + - (operator꞉ Plus): "+" # (33..34) + - (variant꞉ TupleExpression): # " (\n\t" (34..38) + - (leading_trivia꞉ Whitespace): " " # (34..35) + - (open_paren꞉ OpenParen): "(" # (35..36) + - (trailing_trivia꞉ EndOfLine): "\n" # (36..37) + - (items꞉ TupleValues): # "" (37..37) + - (item꞉ TupleValue): [] # (37..37) + - (leading_trivia꞉ Whitespace): "\t" # (37..38) + - (MISSING): "" # (38..38) + - (close_brace꞉ CloseBrace): "}" # (38..39) + - (trailing_trivia꞉ EndOfLine): "\n" # (39..40) + - (close_brace꞉ CloseBrace): "}" # (40..41) + - (trailing_trivia꞉ EndOfLine): "\n" # (41..42) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/pratt_precedence_recovery/input.sol b/crates/solidity/testing/snapshots/cst_output/SourceUnit/pratt_precedence_recovery/input.sol new file mode 100644 index 0000000000..925db46704 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/pratt_precedence_recovery/input.sol @@ -0,0 +1,5 @@ +contract A { + function a() { + 2 + ( + } +} diff --git a/crates/testlang/outputs/cargo/slang_testlang/src/generated/language/parser_support/sequence_helper.rs b/crates/testlang/outputs/cargo/slang_testlang/src/generated/language/parser_support/sequence_helper.rs index 4d46325e81..9bf13418fc 100644 --- a/crates/testlang/outputs/cargo/slang_testlang/src/generated/language/parser_support/sequence_helper.rs +++ b/crates/testlang/outputs/cargo/slang_testlang/src/generated/language/parser_support/sequence_helper.rs @@ -118,8 +118,18 @@ impl SequenceHelper { })); } - (ParserResult::PrattOperatorMatch(_), ParserResult::SkippedUntil(_)) => - unreachable!("Error recovery happens outside precedence parsing"), + (ParserResult::PrattOperatorMatch(running), ParserResult::SkippedUntil(skipped)) => { + let nodes: Vec<_> = std::mem::take(&mut running.elements) + .into_iter() + .flat_map(PrattElement::into_nodes) + .chain(skipped.nodes) + .collect(); + + self.result = State::Running(ParserResult::SkippedUntil(SkippedUntil { + nodes, + ..skipped + })); + } // Try to recover until we hit an expected boundary terminal. // If the sequence is unwinding, then a subsequent non-empty match must mean that From 880651797d9ac96d6512f30ba29599b57f8a9f73 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:34:46 -0700 Subject: [PATCH 02/13] [cargo] Bump the non-major-dependencies group with 13 updates (#1056) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the non-major-dependencies group with 13 updates: | Package | From | To | | --- | --- | --- | | [clap](https://github.com/clap-rs/clap) | `4.5.8` | `4.5.13` | | [clap_complete](https://github.com/clap-rs/clap) | `4.5.7` | `4.5.12` | | [env_logger](https://github.com/rust-cli/env_logger) | `0.11.3` | `0.11.5` | | [iai-callgrind](https://github.com/iai-callgrind/iai-callgrind) | `0.12.0` | `0.12.1` | | [iai-callgrind-runner](https://github.com/iai-callgrind/iai-callgrind) | `0.12.0` | `0.12.1` | | [indexmap](https://github.com/indexmap-rs/indexmap) | `2.2.6` | `2.3.0` | | [napi-derive](https://github.com/napi-rs/napi-rs) | `2.16.7` | `2.16.10` | | [serde](https://github.com/serde-rs/serde) | `1.0.203` | `1.0.204` | | [serde_json](https://github.com/serde-rs/json) | `1.0.119` | `1.0.121` | | [syn](https://github.com/dtolnay/syn) | `2.0.68` | `2.0.72` | | [thiserror](https://github.com/dtolnay/thiserror) | `1.0.61` | `1.0.63` | | [toml](https://github.com/toml-rs/toml) | `0.8.14` | `0.8.19` | | [trybuild](https://github.com/dtolnay/trybuild) | `1.0.96` | `1.0.99` | Updates `clap` from 4.5.8 to 4.5.13
Release notes

Sourced from clap's releases.

v4.5.13

[4.5.13] - 2024-07-31

Fixes

  • (derive) Improve error message when #[flatten]ing an optional #[group(skip)]
  • (help) Properly wrap long subcommand descriptions in help

v4.5.12

[4.5.12] - 2024-07-31

v4.5.10

[4.5.10] - 2024-07-23

v4.5.9

[4.5.9] - 2024-07-09

Fixes

  • (error) When defining a custom help flag, be sure to suggest it like we do the built-in one
Changelog

Sourced from clap's changelog.

[4.5.13] - 2024-07-31

Fixes

  • (derive) Improve error message when #[flatten]ing an optional #[group(skip)]
  • (help) Properly wrap long subcommand descriptions in help

[4.5.12] - 2024-07-31

[4.5.11] - 2024-07-25

[4.5.10] - 2024-07-23

[4.5.9] - 2024-07-09

Fixes

  • (error) When defining a custom help flag, be sure to suggest it like we do the built-in one
Commits

Updates `clap_complete` from 4.5.7 to 4.5.12
Release notes

Sourced from clap_complete's releases.

v4.5.12

[4.5.12] - 2024-07-31

v4.5.10

[4.5.10] - 2024-07-23

v4.5.9

[4.5.9] - 2024-07-09

Fixes

  • (error) When defining a custom help flag, be sure to suggest it like we do the built-in one

v4.5.8

[4.5.8] - 2024-06-28

Fixes

  • Reduce extra flushes
Changelog

Sourced from clap_complete's changelog.

[4.5.12] - 2024-07-31

[4.5.11] - 2024-07-25

[4.5.10] - 2024-07-23

[4.5.9] - 2024-07-09

Fixes

  • (error) When defining a custom help flag, be sure to suggest it like we do the built-in one

[4.5.8] - 2024-06-28

Fixes

  • Reduce extra flushes
Commits

Updates `env_logger` from 0.11.3 to 0.11.5
Release notes

Sourced from env_logger's releases.

v0.11.5

[0.11.5] - 2024-07-25

v0.11.4

[0.11.4] - 2024-07-23

Changelog

Sourced from env_logger's changelog.

[0.11.5] - 2024-07-25

[0.11.4] - 2024-07-23

Commits

Updates `iai-callgrind` from 0.12.0 to 0.12.1
Release notes

Sourced from iai-callgrind's releases.

v0.12.1

[0.12.1] - 2024-07-31

Changed

  • (#212): Update transitive dependency bytemuck 1.15.0 (yanked) -> 1.16.3
  • Update other locked dependencies:
    • cc: 1.1.5 -> 1.1.7,
    • serde_json: 1.0.120 -> 1.0.121

Full Changelog: https://github.com/iai-callgrind/iai-callgrind/compare/v0.12.0...v0.12.1

Changelog

Sourced from iai-callgrind's changelog.

[0.12.1] - 2024-07-31

Changed

  • (#212): Update transitive dependency bytemuck 1.15.0 (yanked) -> 1.16.3
  • Update other locked dependencies:
    • cc: 1.1.5 -> 1.1.7,
    • serde_json: 1.0.120 -> 1.0.121
Commits

Updates `iai-callgrind-runner` from 0.12.0 to 0.12.1
Release notes

Sourced from iai-callgrind-runner's releases.

v0.12.1

[0.12.1] - 2024-07-31

Changed

  • (#212): Update transitive dependency bytemuck 1.15.0 (yanked) -> 1.16.3
  • Update other locked dependencies:
    • cc: 1.1.5 -> 1.1.7,
    • serde_json: 1.0.120 -> 1.0.121

Full Changelog: https://github.com/iai-callgrind/iai-callgrind/compare/v0.12.0...v0.12.1

Changelog

Sourced from iai-callgrind-runner's changelog.

[0.12.1] - 2024-07-31

Changed

  • (#212): Update transitive dependency bytemuck 1.15.0 (yanked) -> 1.16.3
  • Update other locked dependencies:
    • cc: 1.1.5 -> 1.1.7,
    • serde_json: 1.0.120 -> 1.0.121
Commits

Updates `indexmap` from 2.2.6 to 2.3.0
Changelog

Sourced from indexmap's changelog.

2.3.0

  • Added trait MutableEntryKey for opt-in mutable access to map entry keys.
  • Added method MutableKeys::iter_mut2 for opt-in mutable iteration of map keys and values.
Commits

Updates `napi-derive` from 2.16.7 to 2.16.10
Release notes

Sourced from napi-derive's releases.

napi-derive@2.16.10

What Changed

Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.9...napi-derive@2.16.10

napi-derive@2.16.9

What's Changed

New Contributors

Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.8...napi-derive@2.16.9

napi-derive@2.16.8

What changed

  • fix(napi-derive): missing declare keyword for function

Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.7...napi-derive@2.16.8

Commits

Updates `serde` from 1.0.203 to 1.0.204
Release notes

Sourced from serde's releases.

v1.0.204

  • Apply #[diagnostic::on_unimplemented] attribute on Rust 1.78+ to suggest adding serde derive or enabling a "serde" feature flag in dependencies (#2767, thanks @​weiznich)
Commits

Updates `serde_json` from 1.0.119 to 1.0.121
Release notes

Sourced from serde_json's releases.

v1.0.121

v1.0.120

  • Correctly specify required version of indexmap dependency (#1152, thanks @​cforycki)
Commits

Updates `syn` from 2.0.68 to 2.0.72
Release notes

Sourced from syn's releases.

2.0.72

2.0.71

2.0.70

2.0.69

  • Correctly parenthesize labeled loops inside a break value (#1692)
  • Add Punctuated::get and get_mut (#1693)
Commits

Updates `thiserror` from 1.0.61 to 1.0.63
Release notes

Sourced from thiserror's releases.

1.0.63

  • Documentation improvements

1.0.62

  • Support referring to nested tuple struct fields inside #[error("…", …)] attribute (#309)
Commits

Updates `toml` from 0.8.14 to 0.8.19
Commits

Updates `trybuild` from 1.0.96 to 1.0.99
Release notes

Sourced from trybuild's releases.

1.0.98

  • Fix enabling of default features for workspace dependencies (#282, thanks @​gui1117)

1.0.97

  • Normalize number of types listed in "the following other types implement trait" diagnostics (#277)
Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 129 +++++++++++++++++++++++++++-------------------------- Cargo.toml | 24 +++++----- 2 files changed, 77 insertions(+), 76 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0616ff199..031acfc961 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -298,9 +298,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.8" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b3edb18336f4df585bc9aa31dd99c036dfa5dc5e9a2939a722a188f3a8970d" +checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" dependencies = [ "clap_builder", "clap_derive", @@ -308,9 +308,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.8" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1c09dd5ada6c6c78075d6fd0da3f90d8080651e2d6cc8eb2f1aaa4034ced708" +checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" dependencies = [ "anstream", "anstyle", @@ -321,23 +321,23 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.7" +version = "4.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d598e88f6874d4b888ed40c71efbcbf4076f1dfbae128a08a8c9e45f710605d" +checksum = "a8670053e87c316345e384ca1f3eba3006fc6355ed8b8a1140d104e109e3df34" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.8" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -371,7 +371,7 @@ dependencies = [ "serde", "strum", "strum_macros", - "syn 2.0.68", + "syn 2.0.72", "thiserror", ] @@ -382,7 +382,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -610,7 +610,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f34ba9a9bcb8645379e9de8cb3ecfcf4d1c85ba66d90deb3259206fa5aa193b" dependencies = [ "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -633,7 +633,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -644,7 +644,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -655,7 +655,7 @@ checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -713,7 +713,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -728,9 +728,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.3" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" dependencies = [ "anstream", "anstyle", @@ -1077,9 +1077,9 @@ dependencies = [ [[package]] name = "iai-callgrind" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cb8104440b95df18524edb6b37c59c412a4eaee28eb52cf5c893fddc79eab30" +checksum = "3cea0f8111720335c28761833ed6db5cf0878014b667064260999c7f97993569" dependencies = [ "bincode", "iai-callgrind-macros", @@ -1095,14 +1095,14 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] name = "iai-callgrind-runner" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61a004e04c161d16fcbfec3419c5cfc2589dbf8f45429cc7d16fdee1c4af386" +checksum = "d5cf673059de32d68347df93d045bf2ab215dd10b4befd7c01b3d585b2d3693d" dependencies = [ "serde", ] @@ -1164,9 +1164,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" dependencies = [ "equivalent", "hashbrown", @@ -1454,23 +1454,23 @@ checksum = "e1c0f5d67ee408a4685b61f5ab7e58605c8ae3f2b4189f0127d804ff13d5560a" [[package]] name = "napi-derive" -version = "2.16.7" +version = "2.16.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e71bc4aca481989bdf1f38b05cd1c0191d740d9552b07c8f1d24be837ed8a6e" +checksum = "b13934cae1f98599ae96d461d14ce3a9199215de1e9a9a201b64b118b3dfa329" dependencies = [ "cfg-if", "convert_case", "napi-derive-backend", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] name = "napi-derive-backend" -version = "1.0.69" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856aef3b3f02a41ee027c5fde1dbfb0434438f93ed26b803b613705580473e7d" +checksum = "632d41c6057955f455824a7585ce19bc69b2c83472d16581e8f0175fcf4759b7" dependencies = [ "convert_case", "once_cell", @@ -1478,7 +1478,7 @@ dependencies = [ "quote", "regex", "semver", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -1581,7 +1581,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -1647,7 +1647,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -1716,7 +1716,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -2076,41 +2076,42 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.203" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] name = "serde_json" -version = "1.0.119" +version = "1.0.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8eddb61f0697cc3989c5d64b452f5488e2b8a60fd7d5076a3045076ffef8cb0" +checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609" dependencies = [ "indexmap", "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -2432,7 +2433,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -2454,9 +2455,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -2579,22 +2580,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] @@ -2664,9 +2665,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.14" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", @@ -2676,18 +2677,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.14" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap", "serde", @@ -2752,9 +2753,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "trybuild" -version = "1.0.96" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a5f13f11071020bb12de7a16b925d2d58636175c20c11dc5f96cb64bb6c9b3" +checksum = "207aa50d36c4be8d8c6ea829478be44a372c6a77669937bb39c698e52f1491e8" dependencies = [ "glob", "serde", @@ -2974,7 +2975,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", "wasm-bindgen-shared", ] @@ -3008,7 +3009,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3203,9 +3204,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.6.5" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -3252,7 +3253,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.72", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 956b1a98ae..fdb552b872 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,15 +96,15 @@ cargo-edit = { version = "0.12.3" } cargo-emit = { version = "0.2.1" } cargo-xwin = { version = "0.14.2" } cargo-zigbuild = { version = "0.18.3" } -clap = { version = "4.5.8", features = ["derive", "wrap_help"] } -clap_complete = { version = "4.5.7" } +clap = { version = "4.5.13", features = ["derive", "wrap_help"] } +clap_complete = { version = "4.5.12" } console = { version = "0.15.8" } derive-new = { version = "0.6.0" } -env_logger = { version = "0.11.3" } -iai-callgrind = { version = "0.12.0" } +env_logger = { version = "0.11.5" } +iai-callgrind = { version = "0.12.1" } iai-callgrind-runner = { version = "0.12.0" } ignore = { version = "0.4.22" } -indexmap = { version = "2.2.6", features = ["serde"] } +indexmap = { version = "2.3.0", features = ["serde"] } indicatif = { version = "0.17.8", features = ["in_memory"] } indoc = { version = "2.0.5" } Inflector = { version = "0.11.4" } @@ -113,7 +113,7 @@ log = { version = "0.4.22" } markdown = { version = "0.3.0" } napi = { version = "2.16.8", features = ["compat-mode", "napi8", "serde-json"] } napi-build = { version = "2.1.3" } -napi-derive = { version = "2.16.7" } +napi-derive = { version = "2.16.10" } nom = { version = "7.1.3" } num-format = { version = "0.4.4" } once_cell = { version = "1.19.0" } @@ -123,8 +123,8 @@ rayon = { version = "1.10.0" } regex = { version = "1.10.5" } reqwest = { version = "0.12.5", features = ["blocking"] } semver = { version = "1.0.23", features = ["serde"] } -serde = { version = "1.0.203", features = ["derive", "rc"] } -serde_json = { version = "1.0.119", features = ["preserve_order"] } +serde = { version = "1.0.204", features = ["derive", "rc"] } +serde_json = { version = "1.0.121", features = ["preserve_order"] } similar-asserts = { version = "1.5.0" } smallvec = { version = "1.7.0", features = ["union"] } stack-graphs = { version = "0.13.0" } @@ -135,7 +135,7 @@ string-interner = { version = "0.17.0", features = [ ] } strum = { version = "0.26.3" } strum_macros = { version = "0.26.4" } -syn = { version = "2.0.68", features = [ +syn = { version = "2.0.72", features = [ "fold", "full", "extra-traits", @@ -144,9 +144,9 @@ syn = { version = "2.0.68", features = [ ] } tempfile = { version = "3.10.1" } tera = { version = "1.20.0" } -thiserror = { version = "1.0.61" } -toml = { version = "0.8.14" } -trybuild = { version = "1.0.96" } +thiserror = { version = "1.0.63" } +toml = { version = "0.8.19" } +trybuild = { version = "1.0.99" } url = { version = "2.4.1", features = ["serde"] } [workspace.lints.rust] From 59856ee43a317099904071c3b3cdf47bdbbad8d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 20:35:31 +0000 Subject: [PATCH 03/13] [npm] Bump @types/node from 20.14.9 to 22.0.2 (#1058) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.14.9 to 22.0.2.
Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=20.14.9&new-version=22.0.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- crates/infra/cli/package.json | 2 +- package-lock.json | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/infra/cli/package.json b/crates/infra/cli/package.json index 2f62f795cf..4ed0015c38 100644 --- a/crates/infra/cli/package.json +++ b/crates/infra/cli/package.json @@ -5,7 +5,7 @@ "@actions/github": "6.0.0", "@changesets/changelog-github": "0.5.0", "@changesets/cli": "2.27.6", - "@types/node": "20.14.9", + "@types/node": "22.0.2", "cspell": "8.9.1", "markdown-link-check": "3.12.2", "markdownlint-cli": "0.41.0", diff --git a/package-lock.json b/package-lock.json index 8e65e81e9b..ff0cd3a368 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "@actions/github": "6.0.0", "@changesets/changelog-github": "0.5.0", "@changesets/cli": "2.27.6", - "@types/node": "20.14.9", + "@types/node": "22.0.2", "cspell": "8.9.1", "markdown-link-check": "3.12.2", "markdownlint-cli": "0.41.0", @@ -2791,12 +2791,12 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.14.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", - "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "version": "22.0.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.0.2.tgz", + "integrity": "sha512-yPL6DyFwY5PiMVEwymNeqUTKsDczQBJ/5T7W/46RwLU/VH+AA8aT5TZkvBviLKLbbm0hlfftEkGrNzfRk/fofQ==", "dev": true, "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.11.1" } }, "node_modules/@types/semver": { @@ -9412,9 +9412,9 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.11.1.tgz", + "integrity": "sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ==", "dev": true }, "node_modules/unified": { From 54c9067aa6c587ff93cac6575726a9068a9bb758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Gir=C3=A1ldez?= Date: Fri, 2 Aug 2024 17:45:41 -0300 Subject: [PATCH 04/13] Query parser error reporting improvements (#1052) Fixes #1041 Fixes #1042 This PR improves on the query parse errors reported: - Compute row and column information for query parser errors (previously these were not computed and hard-coded to 0,0) - Improve reporting when the error occurs attempting to parse edge labels or node kinds: By using `cut()` and providing a `context()` we can get a better error message without fully customizing the error type used throughout the parser. --- .changeset/fluffy-kangaroos-burn.md | 5 + .changeset/old-adults-think.md | 5 + crates/metaslang/cst/src/query/parser.rs | 198 ++++++++++++++---- .../metaslang/graph_builder/tests/parser.rs | 8 +- .../cargo/tests/src/query/parser_tests.rs | 64 +++++- 5 files changed, 236 insertions(+), 44 deletions(-) create mode 100644 .changeset/fluffy-kangaroos-burn.md create mode 100644 .changeset/old-adults-think.md diff --git a/.changeset/fluffy-kangaroos-burn.md b/.changeset/fluffy-kangaroos-burn.md new file mode 100644 index 0000000000..0e72e42b81 --- /dev/null +++ b/.changeset/fluffy-kangaroos-burn.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/slang": patch +--- + +Tree Query Language: Compute row and column information for query parser errors. diff --git a/.changeset/old-adults-think.md b/.changeset/old-adults-think.md new file mode 100644 index 0000000000..53e2717b0b --- /dev/null +++ b/.changeset/old-adults-think.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/slang": patch +--- + +Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. diff --git a/crates/metaslang/cst/src/query/parser.rs b/crates/metaslang/cst/src/query/parser.rs index eade2c431a..a43ca8f205 100644 --- a/crates/metaslang/cst/src/query/parser.rs +++ b/crates/metaslang/cst/src/query/parser.rs @@ -1,13 +1,16 @@ +use std::fmt; use std::rc::Rc; use nom::branch::alt; use nom::bytes::complete::{is_not, tag, take_while, take_while1, take_while_m_n}; use nom::character::complete::{char, multispace0, multispace1, satisfy}; -use nom::combinator::{all_consuming, map_opt, map_res, opt, recognize, success, value, verify}; -use nom::error::VerboseError; +use nom::combinator::{ + all_consuming, cut, map_opt, map_res, opt, peek, recognize, success, value, verify, +}; +use nom::error::{ErrorKind, FromExternalError, ParseError}; use nom::multi::{fold_many0, many1, separated_list1}; use nom::sequence::{delimited, pair, preceded, terminated}; -use nom::{Finish, IResult, Parser}; +use nom::{Finish, IResult, Offset, Parser}; use thiserror::Error; use super::model::{ @@ -15,6 +18,7 @@ use super::model::{ OptionalASTNode, SequenceASTNode, }; use crate::cst::NodeKind; +use crate::text_index::TextIndex; use crate::{AbstractKind as _, KindTypes}; // ---------------------------------------------------------------------------- @@ -33,6 +37,75 @@ impl std::fmt::Display for QueryError { } } +struct QueryParserError { + errors: Vec<(I, QueryParserErrorKind)>, +} + +enum QueryParserErrorKind { + Char(char), + Nom(ErrorKind), + Syntax(QuerySyntaxError), +} + +enum QuerySyntaxError { + EdgeLabel(String), + NodeKind(String), + EscapedUnicode, +} + +impl ParseError for QueryParserError { + fn from_error_kind(input: I, kind: ErrorKind) -> Self { + QueryParserError { + errors: vec![(input, QueryParserErrorKind::Nom(kind))], + } + } + + fn append(input: I, kind: ErrorKind, mut other: Self) -> Self { + other.errors.push((input, QueryParserErrorKind::Nom(kind))); + other + } + + fn from_char(input: I, c: char) -> Self { + QueryParserError { + errors: vec![(input, QueryParserErrorKind::Char(c))], + } + } +} + +impl FromExternalError for QueryParserError { + fn from_external_error(input: I, _kind: ErrorKind, e: QuerySyntaxError) -> Self { + QueryParserError { + errors: vec![(input, QueryParserErrorKind::Syntax(e))], + } + } +} + +impl fmt::Display for QuerySyntaxError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + QuerySyntaxError::EdgeLabel(label) => write!(f, "'{label}' is not a valid edge label"), + QuerySyntaxError::NodeKind(kind) => write!(f, "'{kind}' is not a valid node kind"), + QuerySyntaxError::EscapedUnicode => { + write!(f, "Invalid escaped Unicode character") + } + } + } +} + +impl fmt::Display for QueryParserError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "Parse error:")?; + for (input, error) in &self.errors { + match error { + QueryParserErrorKind::Nom(e) => writeln!(f, "{e:?} at: {input}")?, + QueryParserErrorKind::Char(c) => writeln!(f, "expected '{c}' at: {input}")?, + QueryParserErrorKind::Syntax(e) => writeln!(f, "{e} at: {input}")?, + } + } + Ok(()) + } +} + // ---------------------------------------------------------------------------- // Parser @@ -41,16 +114,41 @@ pub(super) fn parse_query(input: &str) -> Result, Query .parse(input) .finish() .map(|(_, query)| query) - .map_err(|e| QueryError { - message: e.to_string(), - row: 0, - column: 0, + .map_err(|e| { + let text_index = compute_row_and_column(e.errors[0].0, input); + QueryError { + message: e.to_string(), + row: text_index.line, + column: text_index.column, + } }) } -pub(super) fn parse_matcher_alternatives( +fn compute_row_and_column(target: &str, input: &str) -> TextIndex { + let target_offset = input.offset(target); + let mut text_index = TextIndex::ZERO; + let mut from_iter = input.chars(); + let Some(mut c) = from_iter.next() else { + return text_index; + }; + let mut next_c = from_iter.next(); + loop { + if text_index.utf8 >= target_offset { + break; + } + text_index.advance(c, next_c.as_ref()); + c = match next_c { + Some(ch) => ch, + None => break, + }; + next_c = from_iter.next(); + } + text_index +} + +fn parse_matcher_alternatives( i: &str, -) -> IResult<&str, ASTNode, VerboseError<&str>> { +) -> IResult<&str, ASTNode, QueryParserError<&str>> { separated_list1(token('|'), parse_matcher_sequence::) .map(|mut children| { if children.len() == 1 { @@ -62,9 +160,9 @@ pub(super) fn parse_matcher_alternatives( .parse(i) } -pub(super) fn parse_matcher_sequence( +fn parse_matcher_sequence( i: &str, -) -> IResult<&str, ASTNode, VerboseError<&str>> { +) -> IResult<&str, ASTNode, QueryParserError<&str>> { many1(parse_quantified_matcher::) .map(|mut children| { if children.len() == 1 { @@ -76,9 +174,9 @@ pub(super) fn parse_matcher_sequence( .parse(i) } -pub(super) fn parse_quantified_matcher( +fn parse_quantified_matcher( i: &str, -) -> IResult<&str, ASTNode, VerboseError<&str>> { +) -> IResult<&str, ASTNode, QueryParserError<&str>> { alt(( ellipsis_token.map(|_| ASTNode::Ellipsis), // Cannot be quantified pair( @@ -97,9 +195,7 @@ pub(super) fn parse_quantified_matcher( .parse(i) } -pub(super) fn parse_bound_matcher( - i: &str, -) -> IResult<&str, ASTNode, VerboseError<&str>> { +fn parse_bound_matcher(i: &str) -> IResult<&str, ASTNode, QueryParserError<&str>> { pair( opt(capture_name_token), alt(( @@ -114,7 +210,7 @@ pub(super) fn parse_bound_matcher( .parse(i) } -pub(super) fn parse_edge(i: &str) -> IResult<&str, ASTNode, VerboseError<&str>> { +fn parse_edge(i: &str) -> IResult<&str, ASTNode, QueryParserError<&str>> { pair(opt(edge_label_token::), parse_node) .map(|(label, (node_selector, child))| { let node_selector = match (label, node_selector) { @@ -147,7 +243,7 @@ pub(super) fn parse_edge(i: &str) -> IResult<&str, ASTNode, Ver #[allow(clippy::type_complexity)] fn parse_node( i: &str, -) -> IResult<&str, (NodeSelector, Option>), VerboseError<&str>> { +) -> IResult<&str, (NodeSelector, Option>), QueryParserError<&str>> { delimited( token('['), pair(parse_node_selector, opt(parse_matcher_sequence::)), // NOTE: not matching alternatives here @@ -158,9 +254,9 @@ fn parse_node( fn parse_node_selector( input: &str, -) -> IResult<&str, NodeSelector, VerboseError<&str>> { +) -> IResult<&str, NodeSelector, QueryParserError<&str>> { alt(( - token('_').map(|_| NodeSelector::Anonymous), + anonymous_selector, kind_token.map(|node_kind| NodeSelector::NodeKind { node_kind }), text_token.map(|node_text| NodeSelector::NodeText { node_text }), )) @@ -175,7 +271,7 @@ pub enum CaptureQuantifier { OneOrMore, } -fn parse_trailing_quantifier(i: &str) -> IResult<&str, CaptureQuantifier, VerboseError<&str>> { +fn parse_trailing_quantifier(i: &str) -> IResult<&str, CaptureQuantifier, QueryParserError<&str>> { alt(( value(CaptureQuantifier::ZeroOrOne, token('?')), value(CaptureQuantifier::ZeroOrMore, token('*')), @@ -185,7 +281,7 @@ fn parse_trailing_quantifier(i: &str) -> IResult<&str, CaptureQuantifier, Verbos .parse(i) } -fn raw_identifier(i: &str) -> IResult<&str, String, VerboseError<&str>> { +fn raw_identifier(i: &str) -> IResult<&str, String, QueryParserError<&str>> { let identifier_head = satisfy(|c| c.is_alphabetic()); let is_identifier_tail = |c: char| c == '_' || c.is_alphanumeric(); recognize(alt(( @@ -198,33 +294,59 @@ fn raw_identifier(i: &str) -> IResult<&str, String, VerboseError<&str>> { .parse(i) } -fn capture_name_token(i: &str) -> IResult<&str, String, VerboseError<&str>> { +fn capture_name_token(i: &str) -> IResult<&str, String, QueryParserError<&str>> { terminated(preceded(char('@'), raw_identifier), multispace0).parse(i) } -fn kind_token(i: &str) -> IResult<&str, NodeKind, VerboseError<&str>> { +fn anonymous_selector( + input: &str, +) -> IResult<&str, NodeSelector, QueryParserError<&str>> { + // match a single _ character followed by whitespace or any other + // non-alphanumeric symbol; otherwise this would eat the initial underscore + // in an identifier such as `_foo` terminated( - map_res(raw_identifier, |id| { - T::TerminalKind::try_from_str(id.as_str()) - .map(NodeKind::Terminal) - .or_else(|_| { - T::NonterminalKind::try_from_str(id.as_str()).map(NodeKind::Nonterminal) - }) - }), + terminated( + char('_'), + peek(satisfy(|c| c != '_' && !c.is_alphanumeric())), + ), + multispace0, + ) + .map(|_| NodeSelector::Anonymous) + .parse(input) +} + +fn kind_token(i: &str) -> IResult<&str, NodeKind, QueryParserError<&str>> { + terminated( + preceded( + peek(satisfy(|c| c.is_alphabetic() || c == '_')), + cut(map_res(raw_identifier, |id| { + T::TerminalKind::try_from_str(id.as_str()) + .map(NodeKind::Terminal) + .or_else(|_| { + T::NonterminalKind::try_from_str(id.as_str()).map(NodeKind::Nonterminal) + }) + .or(Err(QuerySyntaxError::NodeKind(id))) + })), + ), multispace0, ) .parse(i) } -fn edge_label_token(i: &str) -> IResult<&str, T::EdgeLabel, VerboseError<&str>> { +fn edge_label_token(i: &str) -> IResult<&str, T::EdgeLabel, QueryParserError<&str>> { terminated( - map_res(raw_identifier, |id| T::EdgeLabel::try_from_str(id.as_str())), + preceded( + peek(satisfy(|c| c.is_alphabetic() || c == '_')), + cut(map_res(cut(raw_identifier), |id| { + T::EdgeLabel::try_from_str(id.as_str()).or(Err(QuerySyntaxError::EdgeLabel(id))) + })), + ), token(':'), ) .parse(i) } -fn text_token(i: &str) -> IResult<&str, String, VerboseError<&str>> { +fn text_token(i: &str) -> IResult<&str, String, QueryParserError<&str>> { #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum Fragment<'a> { EscapedChar(char), @@ -247,7 +369,9 @@ fn text_token(i: &str) -> IResult<&str, String, VerboseError<&str>> { ), ), // converted from hex - move |hex| u32::from_str_radix(hex, 16), + move |hex| { + u32::from_str_radix(hex, 16).or(Err(QuerySyntaxError::EscapedUnicode)) + }, ), // converted to a char std::char::from_u32, @@ -289,10 +413,10 @@ fn text_token(i: &str) -> IResult<&str, String, VerboseError<&str>> { .parse(i) } -fn ellipsis_token(i: &str) -> IResult<&str, &str, VerboseError<&str>> { +fn ellipsis_token(i: &str) -> IResult<&str, &str, QueryParserError<&str>> { terminated(tag("..."), multispace0).parse(i) } -fn token<'input>(c: char) -> impl Parser<&'input str, char, VerboseError<&'input str>> { +fn token<'input>(c: char) -> impl Parser<&'input str, char, QueryParserError<&'input str>> { terminated(char(c), multispace0) } diff --git a/crates/metaslang/graph_builder/tests/parser.rs b/crates/metaslang/graph_builder/tests/parser.rs index d3039c7b5b..d5a5588a50 100644 --- a/crates/metaslang/graph_builder/tests/parser.rs +++ b/crates/metaslang/graph_builder/tests/parser.rs @@ -1583,8 +1583,9 @@ fn query_parse_errors_have_file_location() { Err(ParseError::QueryError(e)) => e, Err(e) => panic!("Unexpected error: {e}"), }; + assert_eq!(err.message, "Parse error:\n'NonExistingNode' is not a valid node kind at: NonExistingNode ] ]\n \n"); assert_eq!(err.row, 2, "expected row 2, got {}", err.row); - assert_eq!(err.column, 8, "expected column 8, got {}", err.column); + assert_eq!(err.column, 19, "expected column 19, got {}", err.column); // assert_eq!(err.offset, 48, "expected offset 48, got {}", err.offset); } @@ -1604,8 +1605,9 @@ fn multiline_query_parse_errors_have_file_location() { Err(ParseError::QueryError(e)) => e, Err(e) => panic!("Unexpected error: {e}"), }; - assert_eq!(err.row, 3, "expected row 3, got {}", err.row); - assert_eq!(err.column, 8, "expected column 8, got {}", err.column); + assert_eq!(err.message, "Parse error:\n'NonExistingNode' is not a valid node kind at: NonExistingNode ] ]\n )\n \n"); + assert_eq!(err.row, 5, "expected row 5, got {}", err.row); + assert_eq!(err.column, 23, "expected column 23, got {}", err.column); // assert_eq!(err.offset, 112, "expected offset 112, got {}", err.offset); } diff --git a/crates/testlang/outputs/cargo/tests/src/query/parser_tests.rs b/crates/testlang/outputs/cargo/tests/src/query/parser_tests.rs index efd6fafa9f..796485930a 100644 --- a/crates/testlang/outputs/cargo/tests/src/query/parser_tests.rs +++ b/crates/testlang/outputs/cargo/tests/src/query/parser_tests.rs @@ -55,9 +55,65 @@ fn test_parsing_error() { let result = Query::parse(r#"@root [_ ..."#); match result { Ok(_) => panic!("Expected error"), - Err(e) => assert_eq!( - e.message, - "Parse error:\nexpected ']' at: \nAlt at: [_ ...\nAlt at: @root [_ ...\n" - ), + Err(e) => { + assert_eq!( + e.message, + "Parse error:\nexpected ']' at: \nAlt at: [_ ...\nAlt at: @root [_ ...\n" + ); + assert_eq!((e.row, e.column), (0, 12)); + } + } +} + +// See https://github.com/NomicFoundation/slang/issues/1042 +#[test] +fn test_parsing_error_with_invalid_edge_label() { + let result = Query::parse( + r#" +[Tree + ... + @name Name: [_] + ... +]"#, + ); + match result { + Ok(_) => panic!("Expected error"), + Err(e) => { + assert_eq!( + e.message, + "Parse error:\n'Name' is not a valid edge label at: Name: [_]\n ...\n]\n", + ); + assert_eq!((e.row, e.column), (3, 10)); + } + } +} + +#[test] +fn test_parsing_error_with_invalid_node_kind() { + let result = Query::parse(r#"[Tree ... [tree_node] ...]"#); + match result { + Ok(_) => panic!("Expected error"), + Err(e) => { + assert_eq!( + e.message, + "Parse error:\n'tree_node' is not a valid node kind at: tree_node] ...]\n", + ); + assert_eq!((e.row, e.column), (0, 11)); + } + } +} + +#[test] +fn test_parsing_error_with_kind_beginning_with_underscore() { + let result = Query::parse(r#"[Tree ... [_tree_node] ...]"#); + match result { + Ok(_) => panic!("Expected error"), + Err(e) => { + assert_eq!( + e.message, + "Parse error:\n'_tree_node' is not a valid node kind at: _tree_node] ...]\n", + ); + assert_eq!((e.row, e.column), (0, 11)); + } } } From 99ff53f7f96213a36e10a4b519631e074e0db18d Mon Sep 17 00:00:00 2001 From: Omar Tawfik <15987992+OmarTawfik@users.noreply.github.com> Date: Sat, 3 Aug 2024 00:57:51 -0700 Subject: [PATCH 05/13] run benchmarking in CI (#1051) This updates our workflows to reuse devcontainer image in github actions, which is needed to run benchmarking tests in CI using the same `valgrind` binaries we install in the devcontainer. Also moved the cache steps to a common action to avoid duplication. --- .github/actions/cache/restore/action.yml | 18 +++ .github/actions/cache/save/action.yml | 18 +++ .github/actions/devcontainer/run/action.yml | 25 ++++ .github/workflows/_jobs_ci.yml | 56 -------- .github/workflows/_jobs_github_pages.yml | 63 --------- .github/workflows/_jobs_publish.yml | 100 ------------- .github/workflows/_jobs_sanctuary.yml | 76 ---------- .github/workflows/benchmark.yml | 58 ++++++++ .github/workflows/ci.yml | 44 +++++- .github/workflows/deploy.yml | 40 ------ .github/workflows/publish.yml | 133 ++++++++++++++++++ .github/workflows/sanctuary.yml | 51 +++++-- Cargo.toml | 2 +- crates/infra/cli/src/commands/ci/mod.rs | 5 +- crates/infra/cli/src/commands/perf/mod.rs | 1 - .../src/commands/publish/changesets/mod.rs | 10 +- 16 files changed, 345 insertions(+), 355 deletions(-) create mode 100644 .github/actions/cache/restore/action.yml create mode 100644 .github/actions/cache/save/action.yml create mode 100644 .github/actions/devcontainer/run/action.yml delete mode 100644 .github/workflows/_jobs_ci.yml delete mode 100644 .github/workflows/_jobs_github_pages.yml delete mode 100644 .github/workflows/_jobs_publish.yml delete mode 100644 .github/workflows/_jobs_sanctuary.yml create mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/actions/cache/restore/action.yml b/.github/actions/cache/restore/action.yml new file mode 100644 index 0000000000..a510bf29da --- /dev/null +++ b/.github/actions/cache/restore/action.yml @@ -0,0 +1,18 @@ +name: "cache/restore" + +runs: + using: "composite" + steps: + - name: "Restore Cache" + uses: "actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" + with: + # __SLANG_CI_CACHE_PATHS__ (keep in sync) + key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}" + path: | + ~/.cache/hermit/ + ~/.local/share/virtualenvs/ + .hermit/ + restore-keys: | + cache-${{ github.ref_name }}- + cache-main- + cache- diff --git a/.github/actions/cache/save/action.yml b/.github/actions/cache/save/action.yml new file mode 100644 index 0000000000..c28d84cfc6 --- /dev/null +++ b/.github/actions/cache/save/action.yml @@ -0,0 +1,18 @@ +name: "cache/save" + +runs: + using: "composite" + steps: + - name: "Repossess files from devcontainer user" + shell: "bash" + run: "sudo chown -R $USER:$USER $GITHUB_WORKSPACE" + + - name: "Save Cache" + uses: "actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" + with: + # __SLANG_CI_CACHE_PATHS__ (keep in sync) + key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}" + path: | + ~/.cache/hermit/ + ~/.local/share/virtualenvs/ + .hermit/ diff --git a/.github/actions/devcontainer/run/action.yml b/.github/actions/devcontainer/run/action.yml new file mode 100644 index 0000000000..59c281ee20 --- /dev/null +++ b/.github/actions/devcontainer/run/action.yml @@ -0,0 +1,25 @@ +name: "devcontainer/run" + +inputs: + runCmd: + type: "string" + required: true + + # TODO: this is a workaround for https://github.com/devcontainers/ci/pull/295 + # Will remove and replace with 'inheritEnv' once the fix is released + env: + type: "string" + default: "" + +runs: + using: "composite" + steps: + - name: "Run in devcontainer" + uses: "devcontainers/ci@a56d055efecd725e8cfe370543b6071b79989cc8" + with: + configFile: ".devcontainer/devcontainer.json" + env: | + CI + ${{ inputs.env }} + push: "never" + runCmd: "${{ inputs.runCmd }}" diff --git a/.github/workflows/_jobs_ci.yml b/.github/workflows/_jobs_ci.yml deleted file mode 100644 index 51dc600e33..0000000000 --- a/.github/workflows/_jobs_ci.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: "jobs/ci" - -on: - # Run when invoked from other workflows: - workflow_call: {} - -jobs: - run: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - - steps: - # - # _DEVCONTAINER_PREPARATION_STEPS_ (keep in sync) - # Cache is updated in this workflow, and reused in subsequent workflows. - # Note: always start with a fresh cache when running on the main branch. - # - - - name: "Clone repository" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" - - - name: "Restore CI cache" - if: "${{ github.ref_name != 'main' }}" - uses: "actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" - with: - key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}" - restore-keys: | - cache-${{ github.ref_name }}- - cache-main- - cache- - path: | - ~/.cache/hermit/ - ~/.local/share/virtualenvs/ - .hermit/ - - # - # Run all CI steps in order: _SLANG_INFRA_CI_STEPS_ORDERED_ (keep in sync) - # - - - run: "scripts/bin/infra setup" - - run: "scripts/bin/infra check" - - run: "scripts/bin/infra test" - - run: "scripts/bin/infra lint" - - # - # Update cache files: - # _DEVCONTAINER_PREPARATION_STEPS_ (keep in sync) - # - - - name: "Save cache" - uses: "actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" - with: - key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}" - path: | - ~/.cache/hermit/ - ~/.local/share/virtualenvs/ - .hermit/ diff --git a/.github/workflows/_jobs_github_pages.yml b/.github/workflows/_jobs_github_pages.yml deleted file mode 100644 index f9cb8da407..0000000000 --- a/.github/workflows/_jobs_github_pages.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: "jobs/github-pages" - -on: - # Run when invoked from other workflows: - workflow_call: {} - -jobs: - prepare: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - - steps: - # - # _DEVCONTAINER_PREPARATION_STEPS_ (keep in sync) - # Cache is updated in the "ci" workflow, then reused here. - # - - - name: "Clone repository" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" - - - name: "Restore CI cache" - uses: "actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" - with: - key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}" - restore-keys: | - cache-${{ github.ref_name }}- - cache-main- - cache- - path: | - ~/.cache/hermit/ - ~/.local/share/virtualenvs/ - .hermit/ - - # - # Deploy to GitHub Pages: - # - - - run: "scripts/bin/infra setup pipenv" - - run: "scripts/bin/infra check mkdocs" - - - name: "Configure GitHub Pages" - uses: "actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d" - - - name: "Upload artifacts" - uses: "actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa" - with: - path: "documentation/target/site" # _SLANG_MKDOCS_DOCUMENTATION_SITE_DIR_ (keep in sync) - - deploy: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - needs: "prepare" - - permissions: - pages: "write" # to deploy to Pages - id-token: "write" # to verify the deployment originates from an appropriate source - - steps: - - name: "Deploy to GitHub Pages" - id: "deployment" - uses: "actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e" - - environment: - name: "github-pages" - url: "${{ steps.deployment.outputs.page_url }}" diff --git a/.github/workflows/_jobs_publish.yml b/.github/workflows/_jobs_publish.yml deleted file mode 100644 index 825c692fd3..0000000000 --- a/.github/workflows/_jobs_publish.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: "jobs/publish" - -on: - # Run when invoked from other workflows: - workflow_call: {} - -jobs: - changesets: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - - permissions: - contents: "write" # to create new branches and releases - pull-requests: "write" # to create new pull requests for changesets - - steps: - # - # _DEVCONTAINER_PREPARATION_STEPS_ (keep in sync) - # Cache is updated in the "ci" workflow, then reused here. - # - - - name: "Clone repository" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" - - - name: "Restore CI cache" - uses: "actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" - with: - key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}" - restore-keys: | - cache-${{ github.ref_name }}- - cache-main- - cache- - path: | - ~/.cache/hermit/ - ~/.local/share/virtualenvs/ - .hermit/ - - # - # Publish Changesets: - # - - - run: "scripts/bin/infra setup npm" - - - id: "changesets" - uses: "changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9" - with: - title: "Bump Slang Version" - commit: "Bump Slang Version" - createGithubReleases: false - version: "scripts/bin/infra publish changesets" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - outputs: - hasChangesets: "${{ steps.changesets.outputs.hasChangesets }}" - - assets: - needs: "changesets" - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - - if: "${{ needs.changesets.outputs.hasChangesets == 'false' }}" - - steps: - # - # _DEVCONTAINER_PREPARATION_STEPS_ (keep in sync) - # Cache is updated in the "ci" workflow, then reused here. - # - - - name: "Clone repository" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" - - - name: "Restore CI cache" - uses: "actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" - with: - key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}" - restore-keys: | - cache-${{ github.ref_name }}- - cache-main- - cache- - path: | - ~/.cache/hermit/ - ~/.local/share/virtualenvs/ - .hermit/ - - # - # Build and Publish: - # - - - run: "scripts/bin/infra setup cargo npm" - - - run: "scripts/bin/infra publish npm" - env: - NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" - - - run: "scripts/bin/infra publish cargo" - env: - CARGO_REGISTRY_TOKEN: "${{ secrets.CARGO_REGISTRY_TOKEN }}" - - - run: "scripts/bin/infra publish github-release" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/_jobs_sanctuary.yml b/.github/workflows/_jobs_sanctuary.yml deleted file mode 100644 index d71d1fb19f..0000000000 --- a/.github/workflows/_jobs_sanctuary.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: "jobs/sanctuary" - -on: - # Run when invoked from other workflows: - workflow_call: - inputs: - chain: - description: "Name of the chain/sanctuary to run against, e.g. 'ethereum' or 'tron'." - required: true - type: "string" - network: - description: "Name of the sub-network to run against, e.g. 'mainnet' or 'testnet'." - required: true - type: "string" - -jobs: - sanctuary: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - - strategy: - fail-fast: false # Continue running all shards even if some fail. - matrix: - shard_index: - - 0 - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 - - 8 - - 9 - - 10 - - 11 - - 12 - - 13 - - 14 - - 15 - - env: - SHARDS_COUNT: 16 # Length of the 'shard_index' array above. - - steps: - # - # _DEVCONTAINER_PREPARATION_STEPS_ (keep in sync) - # Cache is updated in the "ci" workflow, then reused here. - # - - - name: "Clone repository" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" - - - name: "Restore CI cache" - uses: "actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" - with: - key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}" - restore-keys: | - cache-${{ github.ref_name }}- - cache-main- - cache- - path: | - ~/.cache/hermit/ - ~/.local/share/virtualenvs/ - .hermit/ - - # - # Run Sanctuary Tests: - # - - - run: "scripts/bin/infra setup cargo" - - - run: | - scripts/bin/infra run --release --bin "solidity_testing_sanctuary" -- \ - --shards-count ${{ env.SHARDS_COUNT }} \ - --shard-index ${{ matrix.shard_index }} \ - "${{ inputs.chain }}" "${{ inputs.network }}" diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000000..3bb6091cdf --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,58 @@ +name: "benchmark" + +on: + # Run using manual triggers from GitHub UI: + # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow + workflow_dispatch: {} + + # Run on pushes to any branch: + push: {} + +# Queue up benchmark workflows for the same branch, so that results are reported in order: +concurrency: + group: "${{ github.workflow }}-${{ github.ref_name }}" + cancel-in-progress: false + +jobs: + benchmark: + runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) + + # Only run on the main repo (not forks): + if: "${{ github.repository == 'NomicFoundation/slang' }}" + + steps: + - name: "Checkout Repository" + uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" + + - name: "Restore Cache" + uses: "./.github/actions/cache/restore" + + # Docker privileged mode is required for running Valgrind in CI: + - name: "Add 'privileged: true' to 'devcontainer.json'" + uses: "actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea" + with: + script: | + const assert = require("assert"); + const fs = require("fs/promises"); + + const devcontainerPath = "./.devcontainer/devcontainer.json"; + + const input = await fs.readFile(devcontainerPath, "utf8"); + assert.equal(input[0], "{", "devcontainer file must start with a '{' character."); + + const output = input.replace("{", "{ \"privileged\": true,"); + await fs.writeFile(devcontainerPath, output); + + - name: "infra perf benchmark" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra perf benchmark" + env: | + BENCHER_API_TOKEN=${{ secrets.BENCHER_API_TOKEN }} + + - name: "Upload Benchmarking Data" + uses: "actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029" + with: + name: "benchmarking-data" + path: "target/iai" + if-no-files-found: "error" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6894a551b..48409544ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,24 +1,58 @@ name: "ci" on: + # Run when invoked from other workflows: + workflow_call: {} + # Run using manual triggers from GitHub UI: # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow workflow_dispatch: {} - # Run on every pull request (external branches): + # Run on every pull request: pull_request: {} - # Run on pushes to internal branches: - # Except 'main', which is handled by 'deploy.yml'. + # Run on pushes to any branch except 'main', which is handled by the 'publish' workflow: push: branches-ignore: - "main" # In the event that there is a new push to the ref, cancel any running jobs because they are now obsolete, wasting resources. concurrency: - group: "${{ github.workflow }}-${{ github.ref }}" + group: "${{ github.workflow }}-${{ github.ref_name }}" cancel-in-progress: true jobs: ci: - uses: "./.github/workflows/_jobs_ci.yml" + runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) + + steps: + - name: "Checkout Repository" + uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" + + # Cache is updated in this workflow, and reused in subsequent workflows. + # Always start with a fresh cache when running on the main branch. + - name: "Restore Cache" + if: "${{ github.ref_name != 'main' }}" + uses: "./.github/actions/cache/restore" + + # + # Run all CI steps in order: _SLANG_INFRA_CI_STEPS_ORDERED_ (keep in sync) + # + + - name: "infra check" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra check" + + - name: "infra test" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra test" + + - name: "infra lint" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra lint" + + - name: "Save Cache" + uses: "./.github/actions/cache/save" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 535ee4028f..0000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: "deploy" - -on: - # Run using manual triggers from GitHub UI: - # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow - workflow_dispatch: {} - - # Run on pushes to 'main' branch': - push: - branches: - - "main" - -# We publish multiple packages for each version. -# Wait for any deploys in-progress to complete, before starting a new one: -concurrency: - group: "${{ github.workflow }}" - cancel-in-progress: false - -jobs: - ci: - uses: "./.github/workflows/_jobs_ci.yml" - - github-pages: - uses: "./.github/workflows/_jobs_github_pages.yml" - if: "${{ github.repository == 'NomicFoundation/slang' }}" # skip running in forks - needs: "ci" - - permissions: - pages: "write" # to deploy to Pages - id-token: "write" # to verify the deployment originates from an appropriate source - - publish: - uses: "./.github/workflows/_jobs_publish.yml" - if: "${{ github.repository == 'NomicFoundation/slang' }}" # skip running in forks - needs: "ci" - - secrets: "inherit" - permissions: - contents: "write" # to create new branches and releases - pull-requests: "write" # to create new pull requests for changesets diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..ca3bea3a7e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,133 @@ +name: "publish" + +on: + # Run using manual triggers from GitHub UI: + # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow + workflow_dispatch: {} + + # Run on pushes to 'main' branch': + push: + branches: + - "main" + +# Wait for any other publish workflows in-progress to complete, before starting a new one: +concurrency: + group: "${{ github.workflow }}" + cancel-in-progress: false + +jobs: + ci: + # Only run on the main repo (not forks), and only on the 'main' branch: + if: "${{ github.repository == 'NomicFoundation/slang' && github.ref_name == 'main' }}" + uses: "./.github/workflows/ci.yml" + + buildDocs: + runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) + needs: "ci" + + steps: + - name: "Checkout Repository" + uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" + + - name: "Restore Cache" + uses: "./.github/actions/cache/restore" + + - name: "infra check mkdocs" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra check mkdocs" + + - name: "Configure Pages" + uses: "actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d" + + - name: "Upload Artifacts" + uses: "actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa" + with: + path: "documentation/target/site" # _SLANG_MKDOCS_DOCUMENTATION_SITE_DIR_ (keep in sync) + + deployDocs: + runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) + needs: "buildDocs" + + permissions: + pages: "write" # to deploy to Pages + id-token: "write" # to verify the deployment originates from an appropriate source + + steps: + - name: "Deploy Pages" + id: "deployment" + uses: "actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e" + + environment: + name: "github-pages" + url: "${{ steps.deployment.outputs.page_url }}" + + consumeChangesets: + runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) + needs: "ci" + + permissions: + contents: "write" # to create new branches and releases + pull-requests: "write" # to create new pull requests for changesets + + steps: + - name: "Checkout Repository" + uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" + + - name: "Restore Cache" + uses: "./.github/actions/cache/restore" + + - name: "infra publish changesets" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra publish changesets" + env: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + + - name: "Create/Update Changesets Pull Request" + id: "runChangesets" + uses: "changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9" + with: + title: "Bump Slang Version" + commit: "Bump Slang Version" + createGithubReleases: false + version: "git stash pop" # Stash created by 'infra publish changesets' + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + outputs: + hasChangesets: "${{ steps.runChangesets.outputs.hasChangesets }}" + + artifacts: + runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) + needs: "consumeChangesets" + + if: "${{ needs.consumeChangesets.outputs.hasChangesets == 'false' }}" + + steps: + - name: "Checkout Repository" + uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" + + - name: "Restore Cache" + uses: "./.github/actions/cache/restore" + + - name: "infra publish npm" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra publish npm" + env: | + NPM_TOKEN=${{ secrets.NPM_TOKEN }} + + - name: "infra publish cargo" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra publish cargo" + env: | + CARGO_REGISTRY_TOKEN=${{ secrets.CARGO_REGISTRY_TOKEN }} + + - name: "infra publish github-release" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra publish github-release" + env: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sanctuary.yml b/.github/workflows/sanctuary.yml index 695de9c20c..9dc977951e 100644 --- a/.github/workflows/sanctuary.yml +++ b/.github/workflows/sanctuary.yml @@ -7,18 +7,51 @@ on: inputs: chain: description: "Name of the chain/sanctuary to run against, e.g. 'ethereum' or 'tron'." - default: "ethereum" - required: true type: "string" + required: true + default: "ethereum" network: description: "Name of the sub-network to run against, e.g. 'mainnet' or 'testnet'." - default: "mainnet" - required: true type: "string" + required: true + default: "mainnet" jobs: - ci: - uses: "./.github/workflows/_jobs_sanctuary.yml" - with: - chain: "${{ inputs.chain }}" - network: "${{ inputs.network }}" + sanctuary: + runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) + + strategy: + fail-fast: false # Continue running all shards even if some fail. + matrix: + shard_index: + - 0 + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + - 11 + - 12 + - 13 + - 14 + - 15 + + env: + SHARDS_COUNT: 16 # Length of the 'shard_index' array above. + + steps: + - name: "Checkout Repository" + uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" + + - name: "Restore Cache" + uses: "./.github/actions/cache/restore" + + - name: "infra run solidity_testing_sanctuary" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra run solidity_testing_sanctuary run --release --bin solidity_testing_sanctuary -- --shards-count ${{ env.SHARDS_COUNT }} --shard-index ${{ matrix.shard_index }} ${{ inputs.chain }} ${{ inputs.network }}" diff --git a/Cargo.toml b/Cargo.toml index fdb552b872..8bb61afdec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -102,7 +102,7 @@ console = { version = "0.15.8" } derive-new = { version = "0.6.0" } env_logger = { version = "0.11.5" } iai-callgrind = { version = "0.12.1" } -iai-callgrind-runner = { version = "0.12.0" } +iai-callgrind-runner = { version = "0.12.1" } ignore = { version = "0.4.22" } indexmap = { version = "2.3.0", features = ["serde"] } indicatif = { version = "0.17.8", features = ["in_memory"] } diff --git a/crates/infra/cli/src/commands/ci/mod.rs b/crates/infra/cli/src/commands/ci/mod.rs index 02a7c9a1f0..90e4b06234 100644 --- a/crates/infra/cli/src/commands/ci/mod.rs +++ b/crates/infra/cli/src/commands/ci/mod.rs @@ -12,9 +12,10 @@ pub struct CiController; impl CiController { #[allow(clippy::unused_self)] // For symmetry with other commands pub fn execute(&self) -> Result<()> { - // Run all CI steps in order: _SLANG_INFRA_CI_STEPS_ORDERED_ (keep in sync) - + // Note: setup is ran implicitly during devcontainer initialization: SetupController::default().execute()?; + + // Run all CI steps in order: _SLANG_INFRA_CI_STEPS_ORDERED_ (keep in sync) CheckController::default().execute()?; TestController::default().execute()?; LintController::default().execute()?; diff --git a/crates/infra/cli/src/commands/perf/mod.rs b/crates/infra/cli/src/commands/perf/mod.rs index 1442881f20..03d74ac726 100644 --- a/crates/infra/cli/src/commands/perf/mod.rs +++ b/crates/infra/cli/src/commands/perf/mod.rs @@ -80,7 +80,6 @@ fn run_iai_bench(package_name: &str, bench_name: &str) -> Result<()> { .property("--project", "slang") .property("--adapter", "rust_iai_callgrind") .property("--testbed", testbed) - .flag("--html") .arg(cargo_command) .run()?; diff --git a/crates/infra/cli/src/commands/publish/changesets/mod.rs b/crates/infra/cli/src/commands/publish/changesets/mod.rs index 9d9bf9a9db..4186f025aa 100644 --- a/crates/infra/cli/src/commands/publish/changesets/mod.rs +++ b/crates/infra/cli/src/commands/publish/changesets/mod.rs @@ -81,9 +81,15 @@ pub fn publish_changesets() -> Result<()> { } } + Command::new("git") + .args(["stash", "push"]) + .flag("--include-untracked") + .property("--message", "applied changesets") + .run()?; + println!(); - println!("Source files are now updated."); - println!("The calling CI workflow will now publish them in a pull request."); + println!("Source files are now updated with the new version, and stored in a 'git stash'."); + println!("The calling CI workflow will now use this stash to create a PR if needed."); println!(); Ok(()) From 21b0bec8007e4b4a4a768a3e648ffa18594e006d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Aug 2024 01:20:03 -0700 Subject: [PATCH 06/13] [npm] Bump the non-major-dependencies group with 6 updates (#1057) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the non-major-dependencies group with 6 updates: | Package | From | To | | --- | --- | --- | | [@napi-rs/cli](https://github.com/napi-rs/napi-rs) | `2.18.3` | `2.18.4` | | [@changesets/cli](https://github.com/changesets/changesets) | `2.27.6` | `2.27.7` | | [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) | `8.9.1` | `8.13.0` | | [prettier](https://github.com/prettier/prettier) | `3.3.2` | `3.3.3` | | [typescript](https://github.com/Microsoft/TypeScript) | `5.5.2` | `5.5.4` | | [ts-jest](https://github.com/kulshekhar/ts-jest) | `29.1.5` | `29.2.3` | Updates `@napi-rs/cli` from 2.18.3 to 2.18.4
Release notes

Sourced from @​napi-rs/cli's releases.

@​napi-rs/cli@​2.18.4

What Changed

  • fix(cli): add missing declare keyword

Full Changelog: https://github.com/napi-rs/napi-rs/compare/@​napi-rs/cli@​2.18.3...@​napi-rs/cli@​2.18.4

Commits

Updates `@changesets/cli` from 2.27.6 to 2.27.7
Release notes

Sourced from @​changesets/cli's releases.

@​changesets/cli@​2.27.7

Patch Changes

  • #1047 d108fa6 Thanks @​patzick! - Fixed a crash that could occur when depending on a tagged version of another workspace package.

  • #1400 dd6e5bb Thanks @​Andarist! - Fixed a crash that prevented the CLI from running in a scenario when a workspace depends on the root workspace

  • Updated dependencies [d108fa6, dd6e5bb, dd6e5bb]:

    • @​changesets/apply-release-plan@​7.0.4
    • @​changesets/config@​3.0.2
    • @​changesets/get-dependents-graph@​2.1.1
    • @​changesets/assemble-release-plan@​6.0.3
    • @​changesets/get-release-plan@​4.0.3
Commits

Updates `cspell` from 8.9.1 to 8.13.0
Release notes

Sourced from cspell's releases.

v8.13.0

Features

Speed Improvement

On average, 8.13.0 is 1.5x - 2x faster than 8.12

Spell check the CSpell Repo: 1467 files.

Version Time
8.13.0 9.8s
8.12.1 18.0s
8.11.0 18.2s
8.10.4 19.0s

feat: Improve the speed of checking text. (#6004)

After doing a bit of perf testing, it became clear that some of the Pipe function took up a decent percent of the time.

Converting Generators to Iterables resulting in a significant speed improvement.


Fixes

refactor: Use text.matchAll instead of sequenceFromRegExpMatch (#5994)


fix: trie lookup performance (#5985)

This is currently a place holder for per work.

Initial Perf:

... (truncated)

Changelog

Sourced from cspell's changelog.

8.13.0 (2024-07-30)

8.12.1 (2024-07-22)

  • fix: make sure the version is up to date (f6ab018)

8.12.0 (2024-07-22)

8.11.0 (2024-07-16)

8.10.4 (2024-07-05)

8.10.2 (2024-07-05)

8.10.1 (2024-07-05)

8.10.0 (2024-07-02)

Commits

Updates `prettier` from 3.3.2 to 3.3.3
Release notes

Sourced from prettier's releases.

3.3.3

🔗 Changelog

Changelog

Sourced from prettier's changelog.

3.3.3

diff

Add parentheses for nullish coalescing in ternary (#16391 by @​cdignam-segment)

This change adds clarity to operator precedence.

// Input
foo ? bar ?? foo : baz;
foo ?? bar ? a : b;
a ? b : foo ?? bar;

// Prettier 3.3.2
foo ? bar ?? foo : baz;
foo ?? bar ? a : b;
a ? b : foo ?? bar;

// Prettier 3.3.3
foo ? (bar ?? foo) : baz;
(foo ?? bar) ? a : b;
a ? b : (foo ?? bar);

Add parentheses for decorator expressions (#16458 by @​y-schneider)

Prevent parentheses around member expressions or tagged template literals from being removed to follow the stricter parsing rules of TypeScript 5.5.

// Input
@(foo`tagged template`)
class X {}

// Prettier 3.3.2
@​footagged template
class X {}

// Prettier 3.3.3
@(footagged template)
class X {}

Support @let declaration syntax (#16474 by @​sosukesuzuki)

Adds support for Angular v18 @let declaration syntax.

Please see the following code example. The @let declaration allows you to define local variables within the template:

... (truncated)

Commits

Updates `typescript` from 5.5.2 to 5.5.4
Release notes

Sourced from typescript's releases.

TypeScript 5.5.4

For release notes, check out the release announcement.

For the complete list of fixed issues, check out the

Downloads are available on:

TypeScript 5.5.3

For release notes, check out the release announcement.

For the complete list of fixed issues, check out the

Downloads are available on:

Commits
  • c8a7d58 Bump version to 5.5.4 and LKG
  • c0ded04 🤖 Pick PR #58771 (Allow references to the global Symb...) into release-5.5 (#...
  • 5ba41e2 🤖 Pick PR #59208 (Write non-missing undefined on mapp...) into release-5.5 (#...
  • b075332 🤖 Pick PR #59337 (Allow declarationMap to be emitted ...) into release-5.5 (#...
  • 9dd6f91 Cherry-pick "Stop using latest Node in CI" to release-5.5 (#59348)
  • bf0ddaf 🤖 Pick PR #59070 (Delay the calculation of common sou...) into release-5.5 (#...
  • a44e2d9 🤖 Pick PR #59160 (Fixed crash on authored import type...) into release-5.5 (#...
  • f35206d 🤖 Pick PR #59325 (Don't skip markLinkedReferences on ...) into release-5.5 (#...
  • 1109550 Fix baselines on release-5.5 (#59330)
  • 8794318 🤖 Pick PR #59215 (Fix codefix crash on circular alias...) into release-5.5 (#...
  • Additional commits viewable in compare view

Updates `ts-jest` from 29.1.5 to 29.2.3
Release notes

Sourced from ts-jest's releases.

v29.2.3

Please refer to CHANGELOG.md for details.

v29.2.2

Please refer to CHANGELOG.md for details.

v29.2.1

Please refer to CHANGELOG.md for details.

v29.2.0

Please refer to CHANGELOG.md for details.

Changelog

Sourced from ts-jest's changelog.

29.2.3 (2024-07-18)

Security Fixes

  • build(deps): Update dependency ejs to ^3.1.10 (de94a56)

Code Refactoring

  • refactor(presets): maintain preset codes inside src (8474fc2)

29.2.2 (2024-07-10)

Bug Fixes

  • fix(compiler): update memory cache after changing module value (94db43f), closes #4439

29.2.1 (2024-07-10)

Bug Fixes

  • fix: move ejs to dep instead of peerDep (26e31a7)
  • fix: set allowSyntheticDefaultImports properly (ff4b302), closes #4156
  • fix(compiler): support Node16/NodeNext value for target (2f5cc0c), closes #4198

29.2.0 (2024-07-08)

Bug Fixes

  • fix: don't show warning message with Node16/NodeNext (99c4f49), closes #4266

Features

  • feat(cli): allow migrating cjs presets to transform config (22fb027)
  • feat(presets): add util functions to create ESM presets (06f78ed), close #4200
  • feat(presets): add util functions to create CJS presets (f9cc3c0), close #4200

Code refactoring

... (truncated)

Commits
  • 275b931 chore(release): 29.2.3
  • de94a56 build(deps): Update dependency ejs to ^3.1.10
  • 4d2e8d6 build(deps): Update dependency semver to v7.6.3
  • a45f451 build(deps): Update dependency @​types/node to v20.14.11
  • 27699c0 build(deps): Update dependency vite to ^5.3.4
  • 8780053 build(deps): Update ESLint packages to ^7.16.1
  • 8936a39 build(deps-dev): bump braces from 3.0.2 to 3.0.3 in /examples/ts-only
  • 1fe200a build(deps): Update dependency @​babel/core to ^7.24.9
  • 71d1ec3 build(deps): Update dependency @​testing-library/dom to ^10.3.2
  • 06567f2 build(deps-dev): bump braces from 3.0.2 to 3.0.3 in /e2e/native-esm-ts
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: OmarTawfik <15987992+OmarTawfik@users.noreply.github.com> --- crates/codegen/runtime/npm/package.json | 2 +- .../napi-bindings/generated/index.d.ts | 20 +- crates/infra/cli/package.json | 8 +- .../solidity/outputs/npm/package/package.json | 2 +- .../napi-bindings/generated/index.d.ts | 20 +- .../solidity/outputs/npm/tests/package.json | 2 +- .../testlang/outputs/npm/package/package.json | 2 +- .../napi-bindings/generated/index.d.ts | 20 +- .../testlang/outputs/npm/tests/package.json | 2 +- package-lock.json | 648 ++++++++++-------- 10 files changed, 390 insertions(+), 336 deletions(-) diff --git a/crates/codegen/runtime/npm/package.json b/crates/codegen/runtime/npm/package.json index 3dc3a1eac7..b6f007c4c1 100644 --- a/crates/codegen/runtime/npm/package.json +++ b/crates/codegen/runtime/npm/package.json @@ -3,7 +3,7 @@ "private": true, "type": "commonjs", "devDependencies": { - "@napi-rs/cli": "2.18.3" + "@napi-rs/cli": "2.18.4" }, "napi": { "triples": { diff --git a/crates/codegen/runtime/npm/src/runtime/napi-bindings/generated/index.d.ts b/crates/codegen/runtime/npm/src/runtime/napi-bindings/generated/index.d.ts index 798b0c4f8f..645beb7cb8 100644 --- a/crates/codegen/runtime/npm/src/runtime/napi-bindings/generated/index.d.ts +++ b/crates/codegen/runtime/npm/src/runtime/napi-bindings/generated/index.d.ts @@ -8,7 +8,7 @@ /* auto-generated by NAPI-RS */ -export namespace kinds { +export declare namespace kinds { export enum NonterminalKind { Stub1 = "Stub1", Stub2 = "Stub2", @@ -35,7 +35,7 @@ export namespace kinds { Stub3 = "Stub3", } } -export namespace language { +export declare namespace language { export class Language { constructor(version: string); get version(): string; @@ -44,7 +44,7 @@ export namespace language { parse(kind: kinds.NonterminalKind, input: string): parse_output.ParseOutput; } } -export namespace cst { +export declare namespace cst { export enum NodeType { Nonterminal = "Nonterminal", Terminal = "Terminal", @@ -69,7 +69,7 @@ export namespace cst { createCursor(textOffset: text_index.TextIndex): cursor.Cursor; } } -export namespace cursor { +export declare namespace cursor { export class Cursor { reset(): void; complete(): void; @@ -100,7 +100,7 @@ export namespace cursor { query(queries: Array): query.QueryMatchIterator; } } -export namespace diagnostic { +export declare namespace diagnostic { /** * Severity of the compiler diagnostic. * @@ -122,14 +122,14 @@ export namespace diagnostic { message(): string; } } -export namespace parse_error { +export declare namespace parse_error { export class ParseError { severity(): diagnostic.Severity; textRange(): text_index.TextRange; message(): string; } } -export namespace parse_output { +export declare namespace parse_output { export class ParseOutput { tree(): cst.Node; errors(): Array; @@ -138,7 +138,7 @@ export namespace parse_output { createTreeCursor(): cursor.Cursor; } } -export namespace query { +export declare namespace query { export interface QueryMatch { queryNumber: number; captures: { [key: string]: cursor.Cursor[] }; @@ -150,7 +150,7 @@ export namespace query { next(): QueryMatch | null; } } -export namespace text_index { +export declare namespace text_index { export interface TextIndex { utf8: number; utf16: number; @@ -162,7 +162,7 @@ export namespace text_index { end: TextIndex; } } -export namespace ast_internal { +export declare namespace ast_internal { export function selectSequence(node: cst.NonterminalNode): Array; export function selectChoice(node: cst.NonterminalNode): cst.Node; export function selectRepeated(node: cst.NonterminalNode): Array; diff --git a/crates/infra/cli/package.json b/crates/infra/cli/package.json index 4ed0015c38..4d4226baae 100644 --- a/crates/infra/cli/package.json +++ b/crates/infra/cli/package.json @@ -4,16 +4,16 @@ "devDependencies": { "@actions/github": "6.0.0", "@changesets/changelog-github": "0.5.0", - "@changesets/cli": "2.27.6", + "@changesets/cli": "2.27.7", "@types/node": "22.0.2", - "cspell": "8.9.1", + "cspell": "8.13.0", "markdown-link-check": "3.12.2", "markdownlint-cli": "0.41.0", "prettier-plugin-sh": "0.14.0", - "prettier": "3.3.2", + "prettier": "3.3.3", "remark-parse": "11.0.0", "remark-stringify": "11.0.0", - "typescript": "5.5.2", + "typescript": "5.5.4", "unified": "11.0.5" } } diff --git a/crates/solidity/outputs/npm/package/package.json b/crates/solidity/outputs/npm/package/package.json index d924ddeef1..898e597faf 100644 --- a/crates/solidity/outputs/npm/package/package.json +++ b/crates/solidity/outputs/npm/package/package.json @@ -29,7 +29,7 @@ ], "type": "commonjs", "devDependencies": { - "@napi-rs/cli": "2.18.3" + "@napi-rs/cli": "2.18.4" }, "dependencies": { "@nomicfoundation/slang-darwin-arm64": "0.15.1", diff --git a/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts b/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts index b77e5cbcee..0dee205b52 100644 --- a/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts +++ b/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts @@ -8,7 +8,7 @@ /* auto-generated by NAPI-RS */ -export namespace kinds { +export declare namespace kinds { export enum NonterminalKind { ABICoderPragma = "ABICoderPragma", AdditiveExpression = "AdditiveExpression", @@ -729,7 +729,7 @@ export namespace kinds { YulYearsKeyword = "YulYearsKeyword", } } -export namespace language { +export declare namespace language { export class Language { constructor(version: string); get version(): string; @@ -738,7 +738,7 @@ export namespace language { parse(kind: kinds.NonterminalKind, input: string): parse_output.ParseOutput; } } -export namespace cst { +export declare namespace cst { export enum NodeType { Nonterminal = "Nonterminal", Terminal = "Terminal", @@ -763,7 +763,7 @@ export namespace cst { createCursor(textOffset: text_index.TextIndex): cursor.Cursor; } } -export namespace cursor { +export declare namespace cursor { export class Cursor { reset(): void; complete(): void; @@ -794,7 +794,7 @@ export namespace cursor { query(queries: Array): query.QueryMatchIterator; } } -export namespace diagnostic { +export declare namespace diagnostic { /** * Severity of the compiler diagnostic. * @@ -816,14 +816,14 @@ export namespace diagnostic { message(): string; } } -export namespace parse_error { +export declare namespace parse_error { export class ParseError { severity(): diagnostic.Severity; textRange(): text_index.TextRange; message(): string; } } -export namespace parse_output { +export declare namespace parse_output { export class ParseOutput { tree(): cst.Node; errors(): Array; @@ -832,7 +832,7 @@ export namespace parse_output { createTreeCursor(): cursor.Cursor; } } -export namespace query { +export declare namespace query { export interface QueryMatch { queryNumber: number; captures: { [key: string]: cursor.Cursor[] }; @@ -844,7 +844,7 @@ export namespace query { next(): QueryMatch | null; } } -export namespace text_index { +export declare namespace text_index { export interface TextIndex { utf8: number; utf16: number; @@ -856,7 +856,7 @@ export namespace text_index { end: TextIndex; } } -export namespace ast_internal { +export declare namespace ast_internal { export function selectSequence(node: cst.NonterminalNode): Array; export function selectChoice(node: cst.NonterminalNode): cst.Node; export function selectRepeated(node: cst.NonterminalNode): Array; diff --git a/crates/solidity/outputs/npm/tests/package.json b/crates/solidity/outputs/npm/tests/package.json index 3ef934bb92..ee1f580f1d 100644 --- a/crates/solidity/outputs/npm/tests/package.json +++ b/crates/solidity/outputs/npm/tests/package.json @@ -4,7 +4,7 @@ "devDependencies": { "@types/jest": "29.5.12", "jest": "29.7.0", - "ts-jest": "29.1.5", + "ts-jest": "29.2.3", "ts-node": "10.9.2" } } diff --git a/crates/testlang/outputs/npm/package/package.json b/crates/testlang/outputs/npm/package/package.json index 7a5f47cd85..f3a6d772ea 100644 --- a/crates/testlang/outputs/npm/package/package.json +++ b/crates/testlang/outputs/npm/package/package.json @@ -3,7 +3,7 @@ "private": true, "type": "commonjs", "devDependencies": { - "@napi-rs/cli": "2.18.3" + "@napi-rs/cli": "2.18.4" }, "napi": { "triples": { diff --git a/crates/testlang/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts b/crates/testlang/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts index d21a841c3e..6c9c176629 100644 --- a/crates/testlang/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts +++ b/crates/testlang/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts @@ -8,7 +8,7 @@ /* auto-generated by NAPI-RS */ -export namespace kinds { +export declare namespace kinds { export enum NonterminalKind { AdditionExpression = "AdditionExpression", Expression = "Expression", @@ -63,7 +63,7 @@ export namespace kinds { Whitespace = "Whitespace", } } -export namespace language { +export declare namespace language { export class Language { constructor(version: string); get version(): string; @@ -72,7 +72,7 @@ export namespace language { parse(kind: kinds.NonterminalKind, input: string): parse_output.ParseOutput; } } -export namespace cst { +export declare namespace cst { export enum NodeType { Nonterminal = "Nonterminal", Terminal = "Terminal", @@ -97,7 +97,7 @@ export namespace cst { createCursor(textOffset: text_index.TextIndex): cursor.Cursor; } } -export namespace cursor { +export declare namespace cursor { export class Cursor { reset(): void; complete(): void; @@ -128,7 +128,7 @@ export namespace cursor { query(queries: Array): query.QueryMatchIterator; } } -export namespace diagnostic { +export declare namespace diagnostic { /** * Severity of the compiler diagnostic. * @@ -150,14 +150,14 @@ export namespace diagnostic { message(): string; } } -export namespace parse_error { +export declare namespace parse_error { export class ParseError { severity(): diagnostic.Severity; textRange(): text_index.TextRange; message(): string; } } -export namespace parse_output { +export declare namespace parse_output { export class ParseOutput { tree(): cst.Node; errors(): Array; @@ -166,7 +166,7 @@ export namespace parse_output { createTreeCursor(): cursor.Cursor; } } -export namespace query { +export declare namespace query { export interface QueryMatch { queryNumber: number; captures: { [key: string]: cursor.Cursor[] }; @@ -178,7 +178,7 @@ export namespace query { next(): QueryMatch | null; } } -export namespace text_index { +export declare namespace text_index { export interface TextIndex { utf8: number; utf16: number; @@ -190,7 +190,7 @@ export namespace text_index { end: TextIndex; } } -export namespace ast_internal { +export declare namespace ast_internal { export function selectSequence(node: cst.NonterminalNode): Array; export function selectChoice(node: cst.NonterminalNode): cst.Node; export function selectRepeated(node: cst.NonterminalNode): Array; diff --git a/crates/testlang/outputs/npm/tests/package.json b/crates/testlang/outputs/npm/tests/package.json index f5d4a67baf..f498b73451 100644 --- a/crates/testlang/outputs/npm/tests/package.json +++ b/crates/testlang/outputs/npm/tests/package.json @@ -4,7 +4,7 @@ "devDependencies": { "@types/jest": "29.5.12", "jest": "29.7.0", - "ts-jest": "29.1.5", + "ts-jest": "29.2.3", "ts-node": "10.9.2" } } diff --git a/package-lock.json b/package-lock.json index ff0cd3a368..19ccd04190 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "crates/codegen/runtime/npm": { "name": "@slang-private/slang-codegen-runtime", "devDependencies": { - "@napi-rs/cli": "2.18.3" + "@napi-rs/cli": "2.18.4" }, "engines": { "node": ">= 10" @@ -37,16 +37,16 @@ "devDependencies": { "@actions/github": "6.0.0", "@changesets/changelog-github": "0.5.0", - "@changesets/cli": "2.27.6", + "@changesets/cli": "2.27.7", "@types/node": "22.0.2", - "cspell": "8.9.1", + "cspell": "8.13.0", "markdown-link-check": "3.12.2", "markdownlint-cli": "0.41.0", - "prettier": "3.3.2", + "prettier": "3.3.3", "prettier-plugin-sh": "0.14.0", "remark-parse": "11.0.0", "remark-stringify": "11.0.0", - "typescript": "5.5.2", + "typescript": "5.5.4", "unified": "11.0.5" } }, @@ -66,7 +66,7 @@ "@nomicfoundation/slang-win32-x64-msvc": "0.15.1" }, "devDependencies": { - "@napi-rs/cli": "2.18.3" + "@napi-rs/cli": "2.18.4" }, "engines": { "node": ">= 10" @@ -149,14 +149,14 @@ "devDependencies": { "@types/jest": "29.5.12", "jest": "29.7.0", - "ts-jest": "29.1.5", + "ts-jest": "29.2.3", "ts-node": "10.9.2" } }, "crates/testlang/outputs/npm/package": { "name": "@slang-private/slang-testlang", "devDependencies": { - "@napi-rs/cli": "2.18.3" + "@napi-rs/cli": "2.18.4" }, "engines": { "node": ">= 10" @@ -167,7 +167,7 @@ "devDependencies": { "@types/jest": "29.5.12", "jest": "29.7.0", - "ts-jest": "29.1.5", + "ts-jest": "29.2.3", "ts-node": "10.9.2" } }, @@ -717,13 +717,13 @@ "dev": true }, "node_modules/@changesets/apply-release-plan": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-7.0.3.tgz", - "integrity": "sha512-klL6LCdmfbEe9oyfLxnidIf/stFXmrbFO/3gT5LU5pcyoZytzJe4gWpTBx3BPmyNPl16dZ1xrkcW7b98e3tYkA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-7.0.4.tgz", + "integrity": "sha512-HLFwhKWayKinWAul0Vj+76jVx1Pc2v55MGPVjZ924Y/ROeSsBMFutv9heHmCUj48lJyRfOTJG5+ar+29FUky/A==", "dev": true, "dependencies": { "@babel/runtime": "^7.20.1", - "@changesets/config": "^3.0.1", + "@changesets/config": "^3.0.2", "@changesets/get-version-range-type": "^0.4.0", "@changesets/git": "^3.0.0", "@changesets/should-skip-package": "^0.1.0", @@ -754,14 +754,14 @@ } }, "node_modules/@changesets/assemble-release-plan": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.2.tgz", - "integrity": "sha512-n9/Tdq+ze+iUtjmq0mZO3pEhJTKkku9hUxtUadW30jlN7kONqJG3O6ALeXrmc6gsi/nvoCuKjqEJ68Hk8RbMTQ==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.3.tgz", + "integrity": "sha512-bLNh9/Lgl1VwkjWZTq8JmRqH+hj7/Yzfz0jsQ/zJJ+FTmVqmqPj3szeKOri8O/hEM8JmHW019vh2gTO9iq5Cuw==", "dev": true, "dependencies": { "@babel/runtime": "^7.20.1", "@changesets/errors": "^0.2.0", - "@changesets/get-dependents-graph": "^2.1.0", + "@changesets/get-dependents-graph": "^2.1.1", "@changesets/should-skip-package": "^0.1.0", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", @@ -789,19 +789,19 @@ } }, "node_modules/@changesets/cli": { - "version": "2.27.6", - "resolved": "https://registry.npmjs.org/@changesets/cli/-/cli-2.27.6.tgz", - "integrity": "sha512-PB7KS5JkCQ4WSXlnfThn8CXAHVwYxFdZvYTimhi12fls/tzj9iimUhKsYwkrKSbw1AiVlGCZtihj5Wkt6siIjA==", + "version": "2.27.7", + "resolved": "https://registry.npmjs.org/@changesets/cli/-/cli-2.27.7.tgz", + "integrity": "sha512-6lr8JltiiXPIjDeYg4iM2MeePP6VN/JkmqBsVA5XRiy01hGS3y629LtSDvKcycj/w/5Eur1rEwby/MjcYS+e2A==", "dev": true, "dependencies": { "@babel/runtime": "^7.20.1", - "@changesets/apply-release-plan": "^7.0.3", - "@changesets/assemble-release-plan": "^6.0.2", + "@changesets/apply-release-plan": "^7.0.4", + "@changesets/assemble-release-plan": "^6.0.3", "@changesets/changelog-git": "^0.2.0", - "@changesets/config": "^3.0.1", + "@changesets/config": "^3.0.2", "@changesets/errors": "^0.2.0", - "@changesets/get-dependents-graph": "^2.1.0", - "@changesets/get-release-plan": "^4.0.2", + "@changesets/get-dependents-graph": "^2.1.1", + "@changesets/get-release-plan": "^4.0.3", "@changesets/git": "^3.0.0", "@changesets/logger": "^0.1.0", "@changesets/pre": "^2.0.0", @@ -832,13 +832,13 @@ } }, "node_modules/@changesets/config": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@changesets/config/-/config-3.0.1.tgz", - "integrity": "sha512-nCr8pOemUjvGJ8aUu8TYVjqnUL+++bFOQHBVmtNbLvKzIDkN/uiP/Z4RKmr7NNaiujIURHySDEGFPftR4GbTUA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@changesets/config/-/config-3.0.2.tgz", + "integrity": "sha512-cdEhS4t8woKCX2M8AotcV2BOWnBp09sqICxKapgLHf9m5KdENpWjyrFNMjkLqGJtUys9U+w93OxWT0czorVDfw==", "dev": true, "dependencies": { "@changesets/errors": "^0.2.0", - "@changesets/get-dependents-graph": "^2.1.0", + "@changesets/get-dependents-graph": "^2.1.1", "@changesets/logger": "^0.1.0", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", @@ -856,9 +856,9 @@ } }, "node_modules/@changesets/get-dependents-graph": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@changesets/get-dependents-graph/-/get-dependents-graph-2.1.0.tgz", - "integrity": "sha512-QOt6pQq9RVXKGHPVvyKimJDYJumx7p4DO5MO9AhRJYgAPgv0emhNqAqqysSVKHBm4sxKlGN4S1zXOIb5yCFuhQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@changesets/get-dependents-graph/-/get-dependents-graph-2.1.1.tgz", + "integrity": "sha512-LRFjjvigBSzfnPU2n/AhFsuWR5DK++1x47aq6qZ8dzYsPtS/I5mNhIGAS68IAxh1xjO9BTtz55FwefhANZ+FCA==", "dev": true, "dependencies": { "@changesets/types": "^6.0.0", @@ -879,14 +879,14 @@ } }, "node_modules/@changesets/get-release-plan": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.2.tgz", - "integrity": "sha512-rOalz7nMuMV2vyeP7KBeAhqEB7FM2GFPO5RQSoOoUKKH9L6wW3QyPA2K+/rG9kBrWl2HckPVES73/AuwPvbH3w==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.3.tgz", + "integrity": "sha512-6PLgvOIwTSdJPTtpdcr3sLtGatT+Jr22+cQwEBJBy6wP0rjB4yJ9lv583J9fVpn1bfQlBkDa8JxbS2g/n9lIyA==", "dev": true, "dependencies": { "@babel/runtime": "^7.20.1", - "@changesets/assemble-release-plan": "^6.0.2", - "@changesets/config": "^3.0.1", + "@changesets/assemble-release-plan": "^6.0.3", + "@changesets/config": "^3.0.2", "@changesets/pre": "^2.0.0", "@changesets/read": "^0.6.0", "@changesets/types": "^6.0.0", @@ -1008,16 +1008,16 @@ } }, "node_modules/@cspell/cspell-bundled-dicts": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-8.9.1.tgz", - "integrity": "sha512-etkor/qXSSqyh6lbudEGdTami0DooIi2AlQbJPUWRfowzYJRSYWPUbyQSUkFdRhCHni2oLOFbWaraRthNlLD/A==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-8.13.0.tgz", + "integrity": "sha512-vtABTJeicWtd1bO74OB1IYSY/+nhK7S5yyW2GRcq1c9dEqRkgJNcYm8SUCm4EOH2oNGzeptjjGgR8emnvCiTfQ==", "dev": true, "dependencies": { "@cspell/dict-ada": "^4.0.2", - "@cspell/dict-aws": "^4.0.2", + "@cspell/dict-aws": "^4.0.3", "@cspell/dict-bash": "^4.1.3", - "@cspell/dict-companies": "^3.1.2", - "@cspell/dict-cpp": "^5.1.10", + "@cspell/dict-companies": "^3.1.3", + "@cspell/dict-cpp": "^5.1.12", "@cspell/dict-cryptocurrencies": "^5.0.0", "@cspell/dict-csharp": "^4.0.2", "@cspell/dict-css": "^4.0.12", @@ -1026,13 +1026,13 @@ "@cspell/dict-docker": "^1.1.7", "@cspell/dict-dotnet": "^5.0.2", "@cspell/dict-elixir": "^4.0.3", - "@cspell/dict-en_us": "^4.3.22", - "@cspell/dict-en-common-misspellings": "^2.0.2", + "@cspell/dict-en_us": "^4.3.23", + "@cspell/dict-en-common-misspellings": "^2.0.3", "@cspell/dict-en-gb": "1.1.33", "@cspell/dict-filetypes": "^3.0.4", "@cspell/dict-fonts": "^4.0.0", "@cspell/dict-fsharp": "^1.0.1", - "@cspell/dict-fullstack": "^3.1.8", + "@cspell/dict-fullstack": "^3.2.0", "@cspell/dict-gaming-terms": "^1.0.5", "@cspell/dict-git": "^3.0.0", "@cspell/dict-golang": "^6.0.9", @@ -1042,28 +1042,28 @@ "@cspell/dict-html-symbol-entities": "^4.0.0", "@cspell/dict-java": "^5.0.7", "@cspell/dict-julia": "^1.0.1", - "@cspell/dict-k8s": "^1.0.5", + "@cspell/dict-k8s": "^1.0.6", "@cspell/dict-latex": "^4.0.0", "@cspell/dict-lorem-ipsum": "^4.0.0", "@cspell/dict-lua": "^4.0.3", "@cspell/dict-makefile": "^1.0.0", "@cspell/dict-monkeyc": "^1.0.6", "@cspell/dict-node": "^5.0.1", - "@cspell/dict-npm": "^5.0.16", + "@cspell/dict-npm": "^5.0.18", "@cspell/dict-php": "^4.0.8", - "@cspell/dict-powershell": "^5.0.4", + "@cspell/dict-powershell": "^5.0.5", "@cspell/dict-public-licenses": "^2.0.7", - "@cspell/dict-python": "^4.2.1", + "@cspell/dict-python": "^4.2.3", "@cspell/dict-r": "^2.0.1", "@cspell/dict-ruby": "^5.0.2", - "@cspell/dict-rust": "^4.0.4", - "@cspell/dict-scala": "^5.0.2", - "@cspell/dict-software-terms": "^3.4.6", + "@cspell/dict-rust": "^4.0.5", + "@cspell/dict-scala": "^5.0.3", + "@cspell/dict-software-terms": "^4.0.3", "@cspell/dict-sql": "^2.1.3", "@cspell/dict-svelte": "^1.0.2", "@cspell/dict-swift": "^2.0.1", "@cspell/dict-terraform": "^1.0.0", - "@cspell/dict-typescript": "^3.1.5", + "@cspell/dict-typescript": "^3.1.6", "@cspell/dict-vue": "^3.0.0" }, "engines": { @@ -1071,30 +1071,30 @@ } }, "node_modules/@cspell/cspell-json-reporter": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/@cspell/cspell-json-reporter/-/cspell-json-reporter-8.9.1.tgz", - "integrity": "sha512-sN4PZivGuH/HWScvoCeNuNc5VLSe4F+SeuoyKmsF4uRv447r9sW0/fpjASGqDTjLXpEfWaXDPoIb+0alY3gm+g==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@cspell/cspell-json-reporter/-/cspell-json-reporter-8.13.0.tgz", + "integrity": "sha512-OR6+gxWImIOegn9Zi9zlnPZtZMWFToFD8l5bDbHMaScTDygB0IJNg9ZGxWGpxpbMXLNMiefAo5inJwF6LW9F3w==", "dev": true, "dependencies": { - "@cspell/cspell-types": "8.9.1" + "@cspell/cspell-types": "8.13.0" }, "engines": { "node": ">=18" } }, "node_modules/@cspell/cspell-pipe": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/@cspell/cspell-pipe/-/cspell-pipe-8.9.1.tgz", - "integrity": "sha512-wH5Xu8W3aMEWFSpOczMtH/04clLMfDGdbYMYB7w6BeHI/LDW8DZaRhigOOhx9FRgVk/YIVbKKAKVgvFrfD5cEA==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@cspell/cspell-pipe/-/cspell-pipe-8.13.0.tgz", + "integrity": "sha512-YukXZSSUUD5OqzThpyUUusXH7E+z2YViCVUwTb6bQ/DIHHEUIlTPSF8n/xGUmOR6XeQDBxqgNasTDB5AeRXPJg==", "dev": true, "engines": { "node": ">=18" } }, "node_modules/@cspell/cspell-resolver": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/@cspell/cspell-resolver/-/cspell-resolver-8.9.1.tgz", - "integrity": "sha512-Q2SOnIi2dnQ2zqPd+tcEYfom9qlsapGyLK4Mdx2Vv29MU2RDZ9VHFDncV6yo6O58gmlYl8sXtJsVceiHgwwlkQ==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@cspell/cspell-resolver/-/cspell-resolver-8.13.0.tgz", + "integrity": "sha512-smUDfAQDrO5iodDe/7OL1i/fZhu8YrxNfbMCiazqLIYBhw2wrvS6LerBaM7HVUPZ8ZrdeYzIQ1wvEolsrJzuWw==", "dev": true, "dependencies": { "global-directory": "^4.0.1" @@ -1104,18 +1104,18 @@ } }, "node_modules/@cspell/cspell-service-bus": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/@cspell/cspell-service-bus/-/cspell-service-bus-8.9.1.tgz", - "integrity": "sha512-dPKpqkglGnwvrW9mgbHIdimDQZH3iy8uT8gm3dEO//UahxMBdMpvtdbC3R9kesQCSagvYRVE7hwJvOktSAK+Vg==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@cspell/cspell-service-bus/-/cspell-service-bus-8.13.0.tgz", + "integrity": "sha512-370hfBsAFJQ5AJkD/aJF0NITu0kbABGpEkTvutkHAwoIedLp0vNMvlWja7CnFgXxAJOABROSwMXDjG8hLBkXOQ==", "dev": true, "engines": { "node": ">=18" } }, "node_modules/@cspell/cspell-types": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/@cspell/cspell-types/-/cspell-types-8.9.1.tgz", - "integrity": "sha512-Z/pTX2i+U5KwyCYRSw8BleJtw81jFifv91DDka4nqi2oyHJ3eEUljVovNOuZ3lotn/ArHdu4rY98s1w6Z69mYw==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@cspell/cspell-types/-/cspell-types-8.13.0.tgz", + "integrity": "sha512-BnNPwycI/4v/9jFrMofUrUsYmI/Q5ZCE+HL0Yif+mS3r+twaE6Qpmtc9AnpBkLeXlUcY1aeQTASTD9smgGuxsQ==", "dev": true, "engines": { "node": ">=18" @@ -1128,9 +1128,9 @@ "dev": true }, "node_modules/@cspell/dict-aws": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@cspell/dict-aws/-/dict-aws-4.0.2.tgz", - "integrity": "sha512-aNGHWSV7dRLTIn8WJemzLoMF62qOaiUQlgnsCwH5fRCD/00gsWCwg106pnbkmK4AyabyxzneOV4dfecDJWkSxw==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@cspell/dict-aws/-/dict-aws-4.0.3.tgz", + "integrity": "sha512-0C0RQ4EM29fH0tIYv+EgDQEum0QI6OrmjENC9u98pB8UcnYxGG/SqinuPxo+TgcEuInj0Q73MsBpJ1l5xUnrsw==", "dev": true }, "node_modules/@cspell/dict-bash": { @@ -1140,15 +1140,15 @@ "dev": true }, "node_modules/@cspell/dict-companies": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@cspell/dict-companies/-/dict-companies-3.1.2.tgz", - "integrity": "sha512-OwR5i1xbYuJX7FtHQySmTy3iJtPV1rZQ3jFCxFGwrA1xRQ4rtRcDQ+sTXBCIAoJHkXa84f9J3zsngOKmMGyS/w==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@cspell/dict-companies/-/dict-companies-3.1.3.tgz", + "integrity": "sha512-qaAmfKtQLA7Sbe9zfFVpcwyG92cx6+EiWIpPURv11Ng2QMv2PKhYcterUJBooAvgqD0/qq+AsLN8MREloY5Mdw==", "dev": true }, "node_modules/@cspell/dict-cpp": { - "version": "5.1.10", - "resolved": "https://registry.npmjs.org/@cspell/dict-cpp/-/dict-cpp-5.1.10.tgz", - "integrity": "sha512-BmIF0sAz2BgGEOwzYIeEm9ALneDjd1tcTbFbo+A1Hcq3zOKP8yViSgxS9CEN30KOZIyph6Tldp531UPEpoEl0Q==", + "version": "5.1.12", + "resolved": "https://registry.npmjs.org/@cspell/dict-cpp/-/dict-cpp-5.1.12.tgz", + "integrity": "sha512-6lXLOFIa+k/qBcu0bjaE/Kc6v3sh9VhsDOXD1Dalm3zgd0QIMjp5XBmkpSdCAK3pWCPV0Se7ysVLDfCea1BuXg==", "dev": true }, "node_modules/@cspell/dict-cryptocurrencies": { @@ -1242,9 +1242,9 @@ "dev": true }, "node_modules/@cspell/dict-fullstack": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/@cspell/dict-fullstack/-/dict-fullstack-3.1.8.tgz", - "integrity": "sha512-YRlZupL7uqMCtEBK0bDP9BrcPnjDhz7m4GBqCc1EYqfXauHbLmDT8ELha7T/E7wsFKniHSjzwDZzhNXo2lusRQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@cspell/dict-fullstack/-/dict-fullstack-3.2.0.tgz", + "integrity": "sha512-sIGQwU6G3rLTo+nx0GKyirR5dQSFeTIzFTOrURw51ISf+jKG9a3OmvsVtc2OANfvEAOLOC9Wfd8WYhmsO8KRDQ==", "dev": true }, "node_modules/@cspell/dict-gaming-terms": { @@ -1302,9 +1302,9 @@ "dev": true }, "node_modules/@cspell/dict-k8s": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@cspell/dict-k8s/-/dict-k8s-1.0.5.tgz", - "integrity": "sha512-Cj+/ZV4S+MKlwfocSJZqe/2UAd/sY8YtlZjbK25VN1nCnrsKrBjfkX29vclwSj1U9aJg4Z9jw/uMjoaKu9ZrpQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@cspell/dict-k8s/-/dict-k8s-1.0.6.tgz", + "integrity": "sha512-srhVDtwrd799uxMpsPOQqeDJY+gEocgZpoK06EFrb4GRYGhv7lXo9Fb+xQMyQytzOW9dw4DNOEck++nacDuymg==", "dev": true }, "node_modules/@cspell/dict-latex": { @@ -1344,9 +1344,9 @@ "dev": true }, "node_modules/@cspell/dict-npm": { - "version": "5.0.16", - "resolved": "https://registry.npmjs.org/@cspell/dict-npm/-/dict-npm-5.0.16.tgz", - "integrity": "sha512-ZWPnLAziEcSCvV0c8k9Qj88pfMu+wZwM5Qks87ShsfBgI8uLZ9tGHravA7gmjH1Gd7Bgxy2ulvXtSqIWPh1lew==", + "version": "5.0.18", + "resolved": "https://registry.npmjs.org/@cspell/dict-npm/-/dict-npm-5.0.18.tgz", + "integrity": "sha512-weMTyxWpzz19q4wv9n183BtFvdD5fCjtze+bFKpl+4rO/YlPhHL2cXLAeexJz/VDSBecwX4ybTZYoknd1h2J4w==", "dev": true }, "node_modules/@cspell/dict-php": { @@ -1356,9 +1356,9 @@ "dev": true }, "node_modules/@cspell/dict-powershell": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/@cspell/dict-powershell/-/dict-powershell-5.0.4.tgz", - "integrity": "sha512-eosDShapDgBWN9ULF7+sRNdUtzRnUdsfEdBSchDm8FZA4HOqxUSZy3b/cX/Rdw0Fnw0AKgk0kzgXw7tS6vwJMQ==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/@cspell/dict-powershell/-/dict-powershell-5.0.5.tgz", + "integrity": "sha512-3JVyvMoDJesAATYGOxcUWPbQPUvpZmkinV3m8HL1w1RrjeMVXXuK7U1jhopSneBtLhkU+9HKFwgh9l9xL9mY2Q==", "dev": true }, "node_modules/@cspell/dict-public-licenses": { @@ -1368,9 +1368,9 @@ "dev": true }, "node_modules/@cspell/dict-python": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@cspell/dict-python/-/dict-python-4.2.1.tgz", - "integrity": "sha512-9X2jRgyM0cxBoFQRo4Zc8oacyWnXi+0/bMI5FGibZNZV4y/o9UoFEr6agjU260/cXHTjIdkX233nN7eb7dtyRg==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@cspell/dict-python/-/dict-python-4.2.3.tgz", + "integrity": "sha512-C1CPX9wwEGgcHv/p7KfjuIOp1G6KNyx5gWYweAd6/KPv+ZpeM1v572zFUTmpO8WDuAfKFf00nqYL8/GmCENWBw==", "dev": true, "dependencies": { "@cspell/dict-data-science": "^2.0.1" @@ -1389,21 +1389,21 @@ "dev": true }, "node_modules/@cspell/dict-rust": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@cspell/dict-rust/-/dict-rust-4.0.4.tgz", - "integrity": "sha512-v9/LcZknt/Xq7m1jdTWiQEtmkVVKdE1etAfGL2sgcWpZYewEa459HeWndNA0gfzQrpWX9sYay18mt7pqClJEdA==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@cspell/dict-rust/-/dict-rust-4.0.5.tgz", + "integrity": "sha512-DIvlPRDemjKQy8rCqftAgGNZxY5Bg+Ps7qAIJjxkSjmMETyDgl0KTVuaJPt7EK4jJt6uCZ4ILy96npsHDPwoXA==", "dev": true }, "node_modules/@cspell/dict-scala": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@cspell/dict-scala/-/dict-scala-5.0.2.tgz", - "integrity": "sha512-v97ClgidZt99JUm7OjhQugDHmhx4U8fcgunHvD/BsXWjXNj4cTr0m0YjofyZoL44WpICsNuFV9F/sv9OM5HUEw==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@cspell/dict-scala/-/dict-scala-5.0.3.tgz", + "integrity": "sha512-4yGb4AInT99rqprxVNT9TYb1YSpq58Owzq7zi3ZS5T0u899Y4VsxsBiOgHnQ/4W+ygi+sp+oqef8w8nABR2lkg==", "dev": true }, "node_modules/@cspell/dict-software-terms": { - "version": "3.4.8", - "resolved": "https://registry.npmjs.org/@cspell/dict-software-terms/-/dict-software-terms-3.4.8.tgz", - "integrity": "sha512-r3gvmSGd8wZp4bbofTey/2Tu3gdBc5kxTRoFo1MaCh5vMLiBOSCLvyZgzr0DcMl8c5dxL7nFpNwbWZJxmKmtUA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@cspell/dict-software-terms/-/dict-software-terms-4.0.3.tgz", + "integrity": "sha512-65QAVMc3YlcI7PcqWRY5ox53tTWC8aktUZdJYCVs4VDBPUCTSDnTSmSreeg4F5Z468clv9KF/S0PkxbLjgW72A==", "dev": true }, "node_modules/@cspell/dict-sql": { @@ -1431,9 +1431,9 @@ "dev": true }, "node_modules/@cspell/dict-typescript": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/@cspell/dict-typescript/-/dict-typescript-3.1.5.tgz", - "integrity": "sha512-EkIwwNV/xqEoBPJml2S16RXj65h1kvly8dfDLgXerrKw6puybZdvAHerAph6/uPTYdtLcsPyJYkPt5ISOJYrtw==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/@cspell/dict-typescript/-/dict-typescript-3.1.6.tgz", + "integrity": "sha512-1beC6O4P/j23VuxX+i0+F7XqPVc3hhiAzGJHEKqnWf5cWAXQtg0xz3xQJ5MvYx2a7iLaSa+lu7+05vG9UHyu9Q==", "dev": true }, "node_modules/@cspell/dict-vue": { @@ -1443,9 +1443,9 @@ "dev": true }, "node_modules/@cspell/dynamic-import": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/@cspell/dynamic-import/-/dynamic-import-8.9.1.tgz", - "integrity": "sha512-ao4IDqQ8MyRqiB3NHA8R7ThRsuDLXdSCFm7Pvz8EqDnWaX3NAuClzgT3EoxJlw9pyyPQX3tW5Vg7ft3GSsBFUw==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@cspell/dynamic-import/-/dynamic-import-8.13.0.tgz", + "integrity": "sha512-M1cIy6rqWs36M8HFghKsGz/m/WPpK7IIICBptCKoSc5F9VWCjq69UJKrhDMaMOAfJevrmomW5NqF4uhYxg7lNQ==", "dev": true, "dependencies": { "import-meta-resolve": "^4.1.0" @@ -1455,18 +1455,18 @@ } }, "node_modules/@cspell/strong-weak-map": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/@cspell/strong-weak-map/-/strong-weak-map-8.9.1.tgz", - "integrity": "sha512-onD/UPJW7rBQrRDqYNvPUAoWoBp1G2g+mijAD7EkuseyAKTKlKz624rXpHUOTqI814owmhFMNSf2QyYy8gFM6Q==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@cspell/strong-weak-map/-/strong-weak-map-8.13.0.tgz", + "integrity": "sha512-+SvzzupsnKm6+OfK8t2KL2uY0RzTDhjTVEaEIug8IgwlHSf4waYgQ2MJ4ZJPww7OvNEcBmUAeh6Z1+cwiqMycQ==", "dev": true, "engines": { "node": ">=18" } }, "node_modules/@cspell/url": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/@cspell/url/-/url-8.9.1.tgz", - "integrity": "sha512-2AncPKGq9fnytwnL7V4KfoSjiEU0m8tVDFerGiDMNmTMWiQ4zj0kTATai118XT1eBVKiyrAotYRLSrsuUo9U3g==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@cspell/url/-/url-8.13.0.tgz", + "integrity": "sha512-+MEFtLb/VJK5WEwmtLCqfghkDBnPNK5XdUNt24tKfwinAlf4VSMxCmplqPwRjXVIbT5C4stSUY/ZrPadEWjw8Q==", "dev": true, "engines": { "node": ">=18.0" @@ -2380,9 +2380,9 @@ } }, "node_modules/@napi-rs/cli": { - "version": "2.18.3", - "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.18.3.tgz", - "integrity": "sha512-L0f4kP0dyG8W5Qtc7MtP73VvLLrOLyRcUEBzknIfu8Jk4Jfhrsx1ItMHgyalYqMSslWdY3ojEfAaU5sx1VyeQQ==", + "version": "2.18.4", + "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.18.4.tgz", + "integrity": "sha512-SgJeA4df9DE2iAEpr3M2H0OKl/yjtg1BnRI5/JyowS71tUWhrfSu2LT0V3vlHET+g1hBVlrO60PmEXwUEKp8Mg==", "dev": true, "bin": { "napi": "scripts/index.js" @@ -3521,9 +3521,9 @@ } }, "node_modules/comment-json": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.2.3.tgz", - "integrity": "sha512-SsxdiOf064DWoZLH799Ata6u7iV658A11PlWtZATDlXPpKGJnbJZ5Z24ybixAi+LUUqJ/GKowAejtC5GFUG7Tw==", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.2.4.tgz", + "integrity": "sha512-E5AjpSW+O+N5T2GsOQMHLLsJvrYw6G/AFt9GvU6NguEAfzKShh7hRiLtVo6S9KbRpFMGqE5ojo0/hE+sdteWvQ==", "dev": true, "dependencies": { "array-timsort": "^1.0.3", @@ -3666,29 +3666,30 @@ } }, "node_modules/cspell": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/cspell/-/cspell-8.9.1.tgz", - "integrity": "sha512-tNUITJbyeX/JnhBtMtbZ5hDbkNIHB72iQx3Uw51sWvo8YmIhaP6ma1W8PPNteu8CSlI7r8Z412wpjyR0Mnsr6A==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/cspell/-/cspell-8.13.0.tgz", + "integrity": "sha512-sByh0pN9NTBA9eGOsuN6r0c8vwD6LVwH4rhHfCMQ1Gjw5ckH9Obp8JxwrIM0fxm14EXQDcKaAewRfHYx2d1jRg==", "dev": true, "dependencies": { - "@cspell/cspell-json-reporter": "8.9.1", - "@cspell/cspell-pipe": "8.9.1", - "@cspell/cspell-types": "8.9.1", - "@cspell/dynamic-import": "8.9.1", + "@cspell/cspell-json-reporter": "8.13.0", + "@cspell/cspell-pipe": "8.13.0", + "@cspell/cspell-types": "8.13.0", + "@cspell/dynamic-import": "8.13.0", + "@cspell/url": "8.13.0", "chalk": "^5.3.0", "chalk-template": "^1.1.0", "commander": "^12.1.0", - "cspell-gitignore": "8.9.1", - "cspell-glob": "8.9.1", - "cspell-io": "8.9.1", - "cspell-lib": "8.9.1", + "cspell-dictionary": "8.13.0", + "cspell-gitignore": "8.13.0", + "cspell-glob": "8.13.0", + "cspell-io": "8.13.0", + "cspell-lib": "8.13.0", "fast-glob": "^3.3.2", "fast-json-stable-stringify": "^2.1.0", - "file-entry-cache": "^8.0.0", + "file-entry-cache": "^9.0.0", "get-stdin": "^9.0.0", - "semver": "^7.6.2", - "strip-ansi": "^7.1.0", - "vscode-uri": "^3.0.8" + "semver": "^7.6.3", + "strip-ansi": "^7.1.0" }, "bin": { "cspell": "bin.mjs", @@ -3702,42 +3703,43 @@ } }, "node_modules/cspell-config-lib": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/cspell-config-lib/-/cspell-config-lib-8.9.1.tgz", - "integrity": "sha512-gSXAazmeX+CCpFCsNQQqHRO/nn01kMnCoB0v+7AM0Bip2iDXRl+LmUEJGNcnFaiJG3liaZ8+S5/qCDbza010VQ==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/cspell-config-lib/-/cspell-config-lib-8.13.0.tgz", + "integrity": "sha512-KsTzkv5OLb2PSDq+3yVeS6fCsLvqgEFDJ79I+3VZqWyAmixi2LZMdaobbXXItJRNiDuQ9RnbG2UM9smcJCQTUA==", "dev": true, "dependencies": { - "@cspell/cspell-types": "8.9.1", - "comment-json": "^4.2.3", - "yaml": "^2.4.5" + "@cspell/cspell-types": "8.13.0", + "comment-json": "^4.2.4", + "yaml": "^2.5.0" }, "engines": { "node": ">=18" } }, "node_modules/cspell-dictionary": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/cspell-dictionary/-/cspell-dictionary-8.9.1.tgz", - "integrity": "sha512-sJy9gApLxJNE+YqWeulCTj3XC/ME4aacOHEl/SZ5bsaxkGx3KzBlzCMG7LfqUjOM8rwfBPsYO7zWPCiJQgxGPg==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/cspell-dictionary/-/cspell-dictionary-8.13.0.tgz", + "integrity": "sha512-+ZmB7ReBkAba9S0CmYOMm6EVsqyNlRg8V7I0PP9ttMriaGJ4yO+9IIsn6wI79pYB4DaDNBxblLgs12eMWOlNeQ==", "dev": true, "dependencies": { - "@cspell/cspell-pipe": "8.9.1", - "@cspell/cspell-types": "8.9.1", - "cspell-trie-lib": "8.9.1", - "fast-equals": "^5.0.1", - "gensequence": "^7.0.0" + "@cspell/cspell-pipe": "8.13.0", + "@cspell/cspell-types": "8.13.0", + "cspell-trie-lib": "8.13.0", + "fast-equals": "^5.0.1" }, "engines": { "node": ">=18" } }, "node_modules/cspell-gitignore": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/cspell-gitignore/-/cspell-gitignore-8.9.1.tgz", - "integrity": "sha512-5RL0mnptiSlF0e+nnJBTlfyN3V/ECsig7jJ0Vw0AImaR7UdFmfxbeQmiZmealapcjhBJ7hnn9ILtemID4y4wxg==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/cspell-gitignore/-/cspell-gitignore-8.13.0.tgz", + "integrity": "sha512-tu3h6JbejYkGgn9VgW1VAoYchFg3tUtLAzL9oVnkPc58n7gwQpz1cLSKzGpmWyXzjFd6pX0aywnkcOBeWaudMQ==", "dev": true, "dependencies": { - "cspell-glob": "8.9.1", + "@cspell/url": "8.13.0", + "cspell-glob": "8.13.0", + "cspell-io": "8.13.0", "find-up-simple": "^1.0.0" }, "bin": { @@ -3748,11 +3750,12 @@ } }, "node_modules/cspell-glob": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/cspell-glob/-/cspell-glob-8.9.1.tgz", - "integrity": "sha512-b60WfczgG3NgGp5pyS4NfwSu7FEF7AmkP1btJqj17UAWsm/idUdGdOgaZazZuPgQJbcQvOlpBQP0+SEi8Jo3QA==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/cspell-glob/-/cspell-glob-8.13.0.tgz", + "integrity": "sha512-4xghVAHGSwDEOB+OsXDmQoBVfo/NtUpxPlmd89vaZtqv1CmnlUzmglEb13jYx6oFydDaY+mSRKw2V0unATnpBA==", "dev": true, "dependencies": { + "@cspell/url": "8.13.0", "micromatch": "^4.0.7" }, "engines": { @@ -3760,13 +3763,13 @@ } }, "node_modules/cspell-grammar": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/cspell-grammar/-/cspell-grammar-8.9.1.tgz", - "integrity": "sha512-BqaDp3Z+baLZyb3A5h/zWESsO7e8vUaOlrDt1RRVEnpboIUnj7iNkcFmDp3s9PTpBCURlgHHs8SR/+c49aKDGg==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/cspell-grammar/-/cspell-grammar-8.13.0.tgz", + "integrity": "sha512-vrfIO2LqZPPA7Pe8xPPJwXKiXq9nWJxH5JesdVFQZ+DtkklzC07J8OrGTFFo0/r9/CfQMNqqs0XbtRcoa+xRYg==", "dev": true, "dependencies": { - "@cspell/cspell-pipe": "8.9.1", - "@cspell/cspell-types": "8.9.1" + "@cspell/cspell-pipe": "8.13.0", + "@cspell/cspell-types": "8.13.0" }, "bin": { "cspell-grammar": "bin.mjs" @@ -3776,39 +3779,39 @@ } }, "node_modules/cspell-io": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/cspell-io/-/cspell-io-8.9.1.tgz", - "integrity": "sha512-O2F79Rzj28Mvmj4AQLkDWOXWaLnvkJhxPm/Yb3viKlbhwmL5BWUi0APbWA3dtyF+ImX1W27YrNFyvT/PGNZ5Dw==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/cspell-io/-/cspell-io-8.13.0.tgz", + "integrity": "sha512-9rcHUWHmNum7w7eCVJrUZgvJpL30OAYum8Ij9NenqwGhim95tPQc2CtHZ2aibJ6G4c4Aape9ytSgNxoIYG97DQ==", "dev": true, "dependencies": { - "@cspell/cspell-service-bus": "8.9.1", - "@cspell/url": "8.9.1" + "@cspell/cspell-service-bus": "8.13.0", + "@cspell/url": "8.13.0" }, "engines": { "node": ">=18" } }, "node_modules/cspell-lib": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/cspell-lib/-/cspell-lib-8.9.1.tgz", - "integrity": "sha512-xrtoXvSjkMcwE1yUcyjiqLFPZiK0CNQjOKKS9PQaaK7ZBoERPQ7grz05uFCYdboSXt0FhlP8tC9E5oEt+xtGCA==", - "dev": true, - "dependencies": { - "@cspell/cspell-bundled-dicts": "8.9.1", - "@cspell/cspell-pipe": "8.9.1", - "@cspell/cspell-resolver": "8.9.1", - "@cspell/cspell-types": "8.9.1", - "@cspell/dynamic-import": "8.9.1", - "@cspell/strong-weak-map": "8.9.1", - "@cspell/url": "8.9.1", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/cspell-lib/-/cspell-lib-8.13.0.tgz", + "integrity": "sha512-WTVswCFQduFrEBKTj0EKB5GeEfMwQou23DEcudyWIc2sFoovYF0d/Fr6J69HbGIvwQq1ToPM4eayoQK0/Qn6Mg==", + "dev": true, + "dependencies": { + "@cspell/cspell-bundled-dicts": "8.13.0", + "@cspell/cspell-pipe": "8.13.0", + "@cspell/cspell-resolver": "8.13.0", + "@cspell/cspell-types": "8.13.0", + "@cspell/dynamic-import": "8.13.0", + "@cspell/strong-weak-map": "8.13.0", + "@cspell/url": "8.13.0", "clear-module": "^4.1.2", - "comment-json": "^4.2.3", - "cspell-config-lib": "8.9.1", - "cspell-dictionary": "8.9.1", - "cspell-glob": "8.9.1", - "cspell-grammar": "8.9.1", - "cspell-io": "8.9.1", - "cspell-trie-lib": "8.9.1", + "comment-json": "^4.2.4", + "cspell-config-lib": "8.13.0", + "cspell-dictionary": "8.13.0", + "cspell-glob": "8.13.0", + "cspell-grammar": "8.13.0", + "cspell-io": "8.13.0", + "cspell-trie-lib": "8.13.0", "env-paths": "^3.0.0", "fast-equals": "^5.0.1", "gensequence": "^7.0.0", @@ -3823,13 +3826,13 @@ } }, "node_modules/cspell-trie-lib": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/cspell-trie-lib/-/cspell-trie-lib-8.9.1.tgz", - "integrity": "sha512-rUED/lNlFcsRfkMal6+zLz7JW3/cV79KGhwxnwu1fjNS0nlLSAUGTTiAQBQSR+pU/UW+BTkmULHVuNh+DUN93w==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/cspell-trie-lib/-/cspell-trie-lib-8.13.0.tgz", + "integrity": "sha512-3v9q5nUF0Y88bQQLmSXUcf7izsu+Dj/g5Dk0hqqykcsobqq4EN2dmfZH+Ej1Q5h3DCiwPemGb7IPg8pfqTHpAg==", "dev": true, "dependencies": { - "@cspell/cspell-pipe": "8.9.1", - "@cspell/cspell-types": "8.9.1", + "@cspell/cspell-pipe": "8.13.0", + "@cspell/cspell-types": "8.13.0", "gensequence": "^7.0.0" }, "engines": { @@ -4140,6 +4143,21 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.640", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.640.tgz", @@ -4404,15 +4422,45 @@ } }, "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-9.0.0.tgz", + "integrity": "sha512-6MgEugi8p2tiUhqO7GnPsmbCCzj0YRCwwaTbpGRyKZesjRSzkqkAE9fPp7V2yMs5hwfgbQLgdvSSkGNg1s5Uvw==", "dev": true, "dependencies": { - "flat-cache": "^4.0.0" + "flat-cache": "^5.0.0" }, "engines": { - "node": ">=16.0.0" + "node": ">=18" + } + }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" } }, "node_modules/fill-range": { @@ -4463,23 +4511,22 @@ } }, "node_modules/flat-cache": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.0.tgz", - "integrity": "sha512-EryKbCE/wxpxKniQlyas6PY1I9vwtF3uCBweX+N8KYTCn3Y12RTGtQAJ/bd5pl7kxUAc8v/R3Ake/N17OZiFqA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-5.0.0.tgz", + "integrity": "sha512-JrqFmyUl2PnPi1OvLyTVHnQvwQ0S+e6lGSwu8OkAZlSaNIZciTY2H/cOOROxsBA1m/LZNHDsqAgDZt6akWcjsQ==", "dev": true, "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4", - "rimraf": "^5.0.5" + "flatted": "^3.3.1", + "keyv": "^4.5.4" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/flatted": { - "version": "3.2.9", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", - "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true }, "node_modules/foreground-child": { @@ -5236,22 +5283,92 @@ "node": ">=8" } }, - "node_modules/jackspeak": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", - "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "node_modules/jake": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", + "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", "dev": true, "dependencies": { - "@isaacs/cliui": "^8.0.2" + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "bin": { + "jake": "bin/cli.js" }, "engines": { - "node": ">=14" + "node": ">=10" + } + }, + "node_modules/jake/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jake/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jake/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jake/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jake/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jake/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/jest": { @@ -8379,9 +8496,9 @@ } }, "node_modules/prettier": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", - "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -8696,70 +8813,6 @@ "node": ">=0.10.0" } }, - "node_modules/rimraf": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", - "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", - "dev": true, - "dependencies": { - "glob": "^10.3.7" - }, - "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", - "dev": true, - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/run-con": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.3.2.tgz", @@ -8811,9 +8864,9 @@ "dev": true }, "node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -9246,12 +9299,13 @@ } }, "node_modules/ts-jest": { - "version": "29.1.5", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.5.tgz", - "integrity": "sha512-UuClSYxM7byvvYfyWdFI+/2UxMmwNyJb0NPkZPQE2hew3RurV7l7zURgOHAd/1I1ZdPpe3GUsXNXAcN8TFKSIg==", + "version": "29.2.3", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.3.tgz", + "integrity": "sha512-yCcfVdiBFngVz9/keHin9EnsrQtQtEu3nRykNy9RVp+FiPFFbPJ3Sg6Qg4+TkmH0vMP5qsTKgXSsk80HRwvdgQ==", "dev": true, "dependencies": { "bs-logger": "0.x", + "ejs": "^3.1.10", "fast-json-stable-stringify": "2.x", "jest-util": "^29.0.0", "json5": "^2.2.3", @@ -9381,9 +9435,9 @@ } }, "node_modules/typescript": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", - "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -9598,9 +9652,9 @@ } }, "node_modules/vscode-languageserver-textdocument": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz", - "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==", "dev": true }, "node_modules/vscode-uri": { @@ -9797,9 +9851,9 @@ "dev": true }, "node_modules/yaml": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", - "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", + "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==", "dev": true, "bin": { "yaml": "bin.mjs" From 3dc076f198e6dadd1fe4b437156c202218c367b2 Mon Sep 17 00:00:00 2001 From: Antony Blakey Date: Sat, 3 Aug 2024 20:02:25 +1000 Subject: [PATCH 07/13] Add .envrc to allow direnv to pick up paths (#1059) This PR adds a `.envrc` file to the root of the project, that adds `./bin/` and `./scripts/bin` to `$PATH`. If you have direnv installed this makes `hermit` work and the `infra` script accessible. --- .envrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..4eb6e8dc9d --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +# Used by `direnv` to initialize the hermit environment: https://direnv.net/ + +source bin/activate-hermit From 6b05496cbd19b5a7f65033fb223c1bcd3d448738 Mon Sep 17 00:00:00 2001 From: Omar Tawfik <15987992+OmarTawfik@users.noreply.github.com> Date: Mon, 5 Aug 2024 04:15:24 -0700 Subject: [PATCH 08/13] fix Yul stack assignments operator (#1062) This statement uses `=:` and `= :` operators, with no LHS. More details: https://docs.soliditylang.org/en/v0.4.26/assembly.html Closes #1060 --- .changeset/itchy-candles-remain.md | 5 ++ .../inputs/language/src/definition.rs | 36 ++++++-- .../src/generated/kinds/generated/mod.rs | 6 +- .../src/generated/language/generated/mod.rs | 80 +++++++++++++++-- .../napi_interface/generated/ast_selectors.rs | 20 ++++- .../yul_stack_assignment_statement.rs | 5 ++ .../src/generated/ast/generated/ast_types.ts | 85 +++++++++++++++---- .../napi-bindings/generated/index.d.ts | 6 +- .../outputs/spec/generated/grammar.ebnf | 25 ++++-- .../01-file-structure/09-punctuation.md | 6 ++ .../public/06-yul/01-yul-statements.md | 22 +++-- .../generated/0.4.11-failure.yml | 2 +- .../generated/0.4.12-failure.yml | 2 +- .../generated/0.4.11-success.yml | 52 +++++------- .../generated/0.5.0-failure.yml | 14 +-- .../generated/0.6.0-failure.yml | 14 +-- .../generated/0.8.10-failure.yml | 14 +-- .../generated/0.8.18-failure.yml | 14 +-- .../generated/0.8.24-failure.yml | 14 +-- .../generated/0.8.7-failure.yml | 14 +-- .../multiple_stack_assignments/input.sol | 6 +- .../generated/0.4.11-success.yml | 16 ++++ .../generated/0.5.0-failure.yml | 17 ++++ .../equal_colon_separated/input.sol | 1 + .../generated/0.4.11-success.yml | 14 ++- .../generated/0.5.0-failure.yml | 6 +- .../single_variable/input.sol | 2 +- .../generated/0.4.11-success.yml | 2 +- .../generated/0.4.11-success.yml | 2 +- 29 files changed, 361 insertions(+), 141 deletions(-) create mode 100644 .changeset/itchy-candles-remain.md create mode 100644 crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/generated/0.4.11-success.yml create mode 100644 crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/generated/0.5.0-failure.yml create mode 100644 crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/input.sol diff --git a/.changeset/itchy-candles-remain.md b/.changeset/itchy-candles-remain.md new file mode 100644 index 0000000000..ea77cc2867 --- /dev/null +++ b/.changeset/itchy-candles-remain.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/slang": patch +--- + +fix stack assignments operator `=:`. diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index 9028c8fd4f..1d2386d9a2 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -1906,6 +1906,13 @@ codegen_language_macros::compile!(Language( name = Equal, definitions = [TokenDefinition(scanner = Atom("="))] ), + Token( + name = EqualColon, + definitions = [TokenDefinition( + enabled = Till("0.5.0"), + scanner = Atom("=:") + )] + ), Token( name = EqualEqual, definitions = [TokenDefinition(scanner = Atom("=="))] @@ -4235,25 +4242,38 @@ codegen_language_macros::compile!(Language( expression = Required(YulExpression) ) ), + Enum( + name = YulAssignmentOperator, + variants = [ + EnumVariant(reference = YulColonAndEqual, enabled = Till("0.5.5")), + EnumVariant(reference = ColonEqual) + ] + ), + Struct( + name = YulColonAndEqual, + enabled = Till("0.5.5"), + fields = (colon = Required(Colon), equal = Required(Equal)) + ), Struct( name = YulStackAssignmentStatement, enabled = Till("0.5.0"), fields = ( - assignment = Required(YulAssignmentOperator), - expression = Required(YulExpression) + assignment = Required(YulStackAssignmentOperator), + variable = Required(YulIdentifier) ) ), Enum( - name = YulAssignmentOperator, + name = YulStackAssignmentOperator, + enabled = Till("0.5.0"), variants = [ - EnumVariant(reference = YulColonEqual, enabled = Till("0.5.5")), - EnumVariant(reference = ColonEqual) + EnumVariant(reference = YulEqualAndColon), + EnumVariant(reference = EqualColon) ] ), Struct( - name = YulColonEqual, - enabled = Till("0.5.5"), - fields = (colon = Required(Colon), equal = Required(Equal)) + name = YulEqualAndColon, + enabled = Till("0.5.0"), + fields = (equal = Required(Equal), colon = Required(Colon)) ), Struct( name = YulIfStatement, diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds/generated/mod.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds/generated/mod.rs index 1608715d27..910ed154a2 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds/generated/mod.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds/generated/mod.rs @@ -205,9 +205,10 @@ pub enum NonterminalKind { YulBlock, YulBreakStatement, YulBuiltInFunction, - YulColonEqual, + YulColonAndEqual, YulContinueStatement, YulDefaultCase, + YulEqualAndColon, YulExpression, YulForStatement, YulFunctionCallExpression, @@ -222,6 +223,7 @@ pub enum NonterminalKind { YulPathComponent, YulPaths, YulReturnsDeclaration, + YulStackAssignmentOperator, YulStackAssignmentStatement, YulStatement, YulStatements, @@ -383,6 +385,7 @@ pub enum EdgeLabel { Value, ValueType, VarKeyword, + Variable, VariableType, Variables, Version, @@ -468,6 +471,7 @@ pub enum TerminalKind { EndOfLine, EnumKeyword, Equal, + EqualColon, EqualEqual, EqualGreaterThan, ErrorKeyword, diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs index 2ea359954f..a9d45e2ed1 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs @@ -5864,7 +5864,7 @@ impl Language { fn yul_assignment_operator(&self, input: &mut ParserContext<'_>) -> ParserResult { ChoiceHelper::run(input, |mut choice, input| { if !self.version_is_at_least_0_5_5 { - let result = self.yul_colon_equal(input); + let result = self.yul_colon_and_equal(input); choice.consider(input, result)?; } let result = self.parse_terminal_with_trivia::( @@ -6369,7 +6369,7 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn yul_colon_equal(&self, input: &mut ParserContext<'_>) -> ParserResult { + fn yul_colon_and_equal(&self, input: &mut ParserContext<'_>) -> ParserResult { if !self.version_is_at_least_0_5_5 { SequenceHelper::run(|mut seq| { seq.elem_labeled( @@ -6391,7 +6391,7 @@ impl Language { } else { ParserResult::disabled() } - .with_kind(NonterminalKind::YulColonEqual) + .with_kind(NonterminalKind::YulColonAndEqual) } #[allow(unused_assignments, unused_parens)] @@ -6420,6 +6420,32 @@ impl Language { .with_kind(NonterminalKind::YulDefaultCase) } + #[allow(unused_assignments, unused_parens)] + fn yul_equal_and_colon(&self, input: &mut ParserContext<'_>) -> ParserResult { + if !self.version_is_at_least_0_5_0 { + SequenceHelper::run(|mut seq| { + seq.elem_labeled( + EdgeLabel::Equal, + self.parse_terminal_with_trivia::( + input, + TerminalKind::Equal, + ), + )?; + seq.elem_labeled( + EdgeLabel::Colon, + self.parse_terminal_with_trivia::( + input, + TerminalKind::Colon, + ), + )?; + seq.finish() + }) + } else { + ParserResult::disabled() + } + .with_kind(NonterminalKind::YulEqualAndColon) + } + #[allow(unused_assignments, unused_parens)] fn yul_expression(&self, input: &mut ParserContext<'_>) -> ParserResult { let parse_postfix_yul_function_call_expression = |input: &mut ParserContext<'_>| { @@ -6766,12 +6792,41 @@ impl Language { .with_kind(NonterminalKind::YulReturnsDeclaration) } + #[allow(unused_assignments, unused_parens)] + fn yul_stack_assignment_operator(&self, input: &mut ParserContext<'_>) -> ParserResult { + if !self.version_is_at_least_0_5_0 { + ChoiceHelper::run(input, |mut choice, input| { + let result = self.yul_equal_and_colon(input); + choice.consider(input, result)?; + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::EqualColon, + ); + choice.consider(input, result)?; + choice.finish(input) + }) + .with_label(EdgeLabel::Variant) + } else { + ParserResult::disabled() + } + .with_kind(NonterminalKind::YulStackAssignmentOperator) + } + #[allow(unused_assignments, unused_parens)] fn yul_stack_assignment_statement(&self, input: &mut ParserContext<'_>) -> ParserResult { if !self.version_is_at_least_0_5_0 { SequenceHelper::run(|mut seq| { - seq.elem_labeled(EdgeLabel::Assignment, self.yul_assignment_operator(input))?; - seq.elem_labeled(EdgeLabel::Expression, self.yul_expression(input))?; + seq.elem_labeled( + EdgeLabel::Assignment, + self.yul_stack_assignment_operator(input), + )?; + seq.elem_labeled( + EdgeLabel::Variable, + self.parse_terminal_with_trivia::( + input, + TerminalKind::YulIdentifier, + ), + )?; seq.finish() }) } else { @@ -9463,11 +9518,12 @@ impl Language { NonterminalKind::YulBlock => Self::yul_block.parse(self, input), NonterminalKind::YulBreakStatement => Self::yul_break_statement.parse(self, input), NonterminalKind::YulBuiltInFunction => Self::yul_built_in_function.parse(self, input), - NonterminalKind::YulColonEqual => Self::yul_colon_equal.parse(self, input), + NonterminalKind::YulColonAndEqual => Self::yul_colon_and_equal.parse(self, input), NonterminalKind::YulContinueStatement => { Self::yul_continue_statement.parse(self, input) } NonterminalKind::YulDefaultCase => Self::yul_default_case.parse(self, input), + NonterminalKind::YulEqualAndColon => Self::yul_equal_and_colon.parse(self, input), NonterminalKind::YulExpression => Self::yul_expression.parse(self, input), NonterminalKind::YulForStatement => Self::yul_for_statement.parse(self, input), NonterminalKind::YulFunctionCallExpression => { @@ -9490,6 +9546,9 @@ impl Language { NonterminalKind::YulReturnsDeclaration => { Self::yul_returns_declaration.parse(self, input) } + NonterminalKind::YulStackAssignmentOperator => { + Self::yul_stack_assignment_operator.parse(self, input) + } NonterminalKind::YulStackAssignmentStatement => { Self::yul_stack_assignment_statement.parse(self, input) } @@ -11092,7 +11151,14 @@ impl Lexer for Language { } None => Some(TerminalKind::Colon), }, - Some('=') => Some(TerminalKind::Equal), + Some('=') => match input.next() { + Some(':') => Some(TerminalKind::EqualColon), + Some(_) => { + input.undo(); + Some(TerminalKind::Equal) + } + None => Some(TerminalKind::Equal), + }, Some('{') => Some(TerminalKind::OpenBrace), Some('}') => Some(TerminalKind::CloseBrace), Some(_) => { diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/generated/ast_selectors.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/generated/ast_selectors.rs index c4c753cc45..042540c9cd 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/generated/ast_selectors.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/generated/ast_selectors.rs @@ -192,10 +192,11 @@ pub fn select_sequence( NonterminalKind::YulVariableAssignmentStatement => { selector.yul_variable_assignment_statement_sequence()? } + NonterminalKind::YulColonAndEqual => selector.yul_colon_and_equal_sequence()?, NonterminalKind::YulStackAssignmentStatement => { selector.yul_stack_assignment_statement_sequence()? } - NonterminalKind::YulColonEqual => selector.yul_colon_equal_sequence()?, + NonterminalKind::YulEqualAndColon => selector.yul_equal_and_colon_sequence()?, NonterminalKind::YulIfStatement => selector.yul_if_statement_sequence()?, NonterminalKind::YulForStatement => selector.yul_for_statement_sequence()?, NonterminalKind::YulSwitchStatement => selector.yul_switch_statement_sequence()?, @@ -1629,24 +1630,35 @@ impl Selector { } } +impl Selector { + fn yul_colon_and_equal_sequence( + &mut self, + ) -> Result>>> { + Ok(vec![ + Some(self.select(EdgeLabel::Colon)?), + Some(self.select(EdgeLabel::Equal)?), + ]) + } +} + impl Selector { fn yul_stack_assignment_statement_sequence( &mut self, ) -> Result>>> { Ok(vec![ Some(self.select(EdgeLabel::Assignment)?), - Some(self.select(EdgeLabel::Expression)?), + Some(self.select(EdgeLabel::Variable)?), ]) } } impl Selector { - fn yul_colon_equal_sequence( + fn yul_equal_and_colon_sequence( &mut self, ) -> Result>>> { Ok(vec![ - Some(self.select(EdgeLabel::Colon)?), Some(self.select(EdgeLabel::Equal)?), + Some(self.select(EdgeLabel::Colon)?), ]) } } diff --git a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/yul_stack_assignment_statement.rs b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/yul_stack_assignment_statement.rs index 0d796f4e13..fb1addea0d 100644 --- a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/yul_stack_assignment_statement.rs +++ b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/yul_stack_assignment_statement.rs @@ -4,6 +4,11 @@ use anyhow::Result; use crate::cst_output::runner::run; +#[test] +fn equal_colon_separated() -> Result<()> { + run("YulStackAssignmentStatement", "equal_colon_separated") +} + #[test] fn single_variable() -> Result<()> { run("YulStackAssignmentStatement", "single_variable") diff --git a/crates/solidity/outputs/npm/package/src/generated/ast/generated/ast_types.ts b/crates/solidity/outputs/npm/package/src/generated/ast/generated/ast_types.ts index c7e41f7362..d63728090b 100644 --- a/crates/solidity/outputs/npm/package/src/generated/ast/generated/ast_types.ts +++ b/crates/solidity/outputs/npm/package/src/generated/ast/generated/ast_types.ts @@ -3431,13 +3431,36 @@ export class YulVariableAssignmentStatement { } } +export class YulColonAndEqual { + private readonly fetch = once(() => { + const [$colon, $equal] = ast_internal.selectSequence(this.cst); + + return { + colon: $colon as TerminalNode, + equal: $equal as TerminalNode, + }; + }); + + public constructor(public readonly cst: NonterminalNode) { + assertKind(this.cst.kind, NonterminalKind.YulColonAndEqual); + } + + public get colon(): TerminalNode { + return this.fetch().colon; + } + + public get equal(): TerminalNode { + return this.fetch().equal; + } +} + export class YulStackAssignmentStatement { private readonly fetch = once(() => { - const [$assignment, $expression] = ast_internal.selectSequence(this.cst); + const [$assignment, $variable] = ast_internal.selectSequence(this.cst); return { - assignment: new YulAssignmentOperator($assignment as NonterminalNode), - expression: new YulExpression($expression as NonterminalNode), + assignment: new YulStackAssignmentOperator($assignment as NonterminalNode), + variable: $variable as TerminalNode, }; }); @@ -3445,36 +3468,36 @@ export class YulStackAssignmentStatement { assertKind(this.cst.kind, NonterminalKind.YulStackAssignmentStatement); } - public get assignment(): YulAssignmentOperator { + public get assignment(): YulStackAssignmentOperator { return this.fetch().assignment; } - public get expression(): YulExpression { - return this.fetch().expression; + public get variable(): TerminalNode { + return this.fetch().variable; } } -export class YulColonEqual { +export class YulEqualAndColon { private readonly fetch = once(() => { - const [$colon, $equal] = ast_internal.selectSequence(this.cst); + const [$equal, $colon] = ast_internal.selectSequence(this.cst); return { - colon: $colon as TerminalNode, equal: $equal as TerminalNode, + colon: $colon as TerminalNode, }; }); public constructor(public readonly cst: NonterminalNode) { - assertKind(this.cst.kind, NonterminalKind.YulColonEqual); - } - - public get colon(): TerminalNode { - return this.fetch().colon; + assertKind(this.cst.kind, NonterminalKind.YulEqualAndColon); } public get equal(): TerminalNode { return this.fetch().equal; } + + public get colon(): TerminalNode { + return this.fetch().colon; + } } export class YulIfStatement { @@ -4930,7 +4953,7 @@ export class YulStatement { } export class YulAssignmentOperator { - private readonly fetch: () => YulColonEqual | TerminalNode = once(() => { + private readonly fetch: () => YulColonAndEqual | TerminalNode = once(() => { const variant = ast_internal.selectChoice(this.cst); if (variant.type == NodeType.Terminal) { @@ -4938,8 +4961,8 @@ export class YulAssignmentOperator { } switch (variant.kind) { - case NonterminalKind.YulColonEqual: - return new YulColonEqual(variant as NonterminalNode); + case NonterminalKind.YulColonAndEqual: + return new YulColonAndEqual(variant as NonterminalNode); default: assert.fail(`Unexpected variant: ${variant.kind}`); @@ -4950,7 +4973,33 @@ export class YulAssignmentOperator { assertKind(this.cst.kind, NonterminalKind.YulAssignmentOperator); } - public get variant(): YulColonEqual | TerminalNode { + public get variant(): YulColonAndEqual | TerminalNode { + return this.fetch(); + } +} + +export class YulStackAssignmentOperator { + private readonly fetch: () => YulEqualAndColon | TerminalNode = once(() => { + const variant = ast_internal.selectChoice(this.cst); + + if (variant.type == NodeType.Terminal) { + return variant as TerminalNode; + } + + switch (variant.kind) { + case NonterminalKind.YulEqualAndColon: + return new YulEqualAndColon(variant as NonterminalNode); + + default: + assert.fail(`Unexpected variant: ${variant.kind}`); + } + }); + + public constructor(public readonly cst: NonterminalNode) { + assertKind(this.cst.kind, NonterminalKind.YulStackAssignmentOperator); + } + + public get variant(): YulEqualAndColon | TerminalNode { return this.fetch(); } } diff --git a/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts b/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts index 0dee205b52..f6faf7b08e 100644 --- a/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts +++ b/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts @@ -196,9 +196,10 @@ export declare namespace kinds { YulBlock = "YulBlock", YulBreakStatement = "YulBreakStatement", YulBuiltInFunction = "YulBuiltInFunction", - YulColonEqual = "YulColonEqual", + YulColonAndEqual = "YulColonAndEqual", YulContinueStatement = "YulContinueStatement", YulDefaultCase = "YulDefaultCase", + YulEqualAndColon = "YulEqualAndColon", YulExpression = "YulExpression", YulForStatement = "YulForStatement", YulFunctionCallExpression = "YulFunctionCallExpression", @@ -213,6 +214,7 @@ export declare namespace kinds { YulPathComponent = "YulPathComponent", YulPaths = "YulPaths", YulReturnsDeclaration = "YulReturnsDeclaration", + YulStackAssignmentOperator = "YulStackAssignmentOperator", YulStackAssignmentStatement = "YulStackAssignmentStatement", YulStatement = "YulStatement", YulStatements = "YulStatements", @@ -352,6 +354,7 @@ export declare namespace kinds { Value = "Value", ValueType = "ValueType", VarKeyword = "VarKeyword", + Variable = "Variable", VariableType = "VariableType", Variables = "Variables", Version = "Version", @@ -416,6 +419,7 @@ export declare namespace kinds { EndOfLine = "EndOfLine", EnumKeyword = "EnumKeyword", Equal = "Equal", + EqualColon = "EqualColon", EqualEqual = "EqualEqual", EqualGreaterThan = "EqualGreaterThan", ErrorKeyword = "ErrorKeyword", diff --git a/crates/solidity/outputs/spec/generated/grammar.ebnf b/crates/solidity/outputs/spec/generated/grammar.ebnf index 3339ca03bd..0265bf652a 100644 --- a/crates/solidity/outputs/spec/generated/grammar.ebnf +++ b/crates/solidity/outputs/spec/generated/grammar.ebnf @@ -532,6 +532,9 @@ COLON_EQUAL = ":="; EQUAL = "="; +(* Deprecated in 0.5.0 *) +EQUAL_COLON = "=:"; + EQUAL_EQUAL = "=="; EQUAL_GREATER_THAN = "=>"; @@ -1658,16 +1661,24 @@ YulVariableAssignmentStatement = (* variables: *) YulPaths (* assignment: *) YulAssignmentOperator (* expression: *) YulExpression; -(* Deprecated in 0.5.0 *) -YulStackAssignmentStatement = (* assignment: *) YulAssignmentOperator - (* expression: *) YulExpression; - -YulAssignmentOperator = (* variant: *) YulColonEqual (* Deprecated in 0.5.5 *) +YulAssignmentOperator = (* variant: *) YulColonAndEqual (* Deprecated in 0.5.5 *) | (* variant: *) COLON_EQUAL; (* Deprecated in 0.5.5 *) -YulColonEqual = (* colon: *) COLON - (* equal: *) EQUAL; +YulColonAndEqual = (* colon: *) COLON + (* equal: *) EQUAL; + +(* Deprecated in 0.5.0 *) +YulStackAssignmentStatement = (* assignment: *) YulStackAssignmentOperator + (* variable: *) YUL_IDENTIFIER; + +(* Deprecated in 0.5.0 *) +YulStackAssignmentOperator = (* variant: *) YulEqualAndColon + | (* variant: *) EQUAL_COLON; + +(* Deprecated in 0.5.0 *) +YulEqualAndColon = (* equal: *) EQUAL + (* colon: *) COLON; YulIfStatement = (* if_keyword: *) YUL_IF_KEYWORD (* condition: *) YulExpression diff --git a/crates/solidity/outputs/spec/generated/public/01-file-structure/09-punctuation.md b/crates/solidity/outputs/spec/generated/public/01-file-structure/09-punctuation.md index 1cd087f1e9..54011f0edd 100644 --- a/crates/solidity/outputs/spec/generated/public/01-file-structure/09-punctuation.md +++ b/crates/solidity/outputs/spec/generated/public/01-file-structure/09-punctuation.md @@ -82,6 +82,12 @@
EQUAL = "=";
+```{ .ebnf #EqualColon } + +``` + +
(* Deprecated in 0.5.0 *)
EQUAL_COLON = "=:";
+ ```{ .ebnf #EqualEqual } ``` diff --git a/crates/solidity/outputs/spec/generated/public/06-yul/01-yul-statements.md b/crates/solidity/outputs/spec/generated/public/06-yul/01-yul-statements.md index 22f958f869..3023e54066 100644 --- a/crates/solidity/outputs/spec/generated/public/06-yul/01-yul-statements.md +++ b/crates/solidity/outputs/spec/generated/public/06-yul/01-yul-statements.md @@ -70,23 +70,35 @@
YulVariableAssignmentStatement = (* variables: *) YulPaths
(* assignment: *) YulAssignmentOperator
(* expression: *) YulExpression;
+```{ .ebnf #YulAssignmentOperator } + +``` + +
YulAssignmentOperator = (* variant: *) YulColonAndEqual (* Deprecated in 0.5.5 *)
| (* variant: *) COLON_EQUAL;
+ +```{ .ebnf #YulColonAndEqual } + +``` + +
(* Deprecated in 0.5.5 *)
YulColonAndEqual = (* colon: *) COLON
(* equal: *) EQUAL;
+ ```{ .ebnf #YulStackAssignmentStatement } ``` -
(* Deprecated in 0.5.0 *)
YulStackAssignmentStatement = (* assignment: *) YulAssignmentOperator
(* expression: *) YulExpression;
+
(* Deprecated in 0.5.0 *)
YulStackAssignmentStatement = (* assignment: *) YulStackAssignmentOperator
(* variable: *) YUL_IDENTIFIER;
-```{ .ebnf #YulAssignmentOperator } +```{ .ebnf #YulStackAssignmentOperator } ``` -
YulAssignmentOperator = (* variant: *) YulColonEqual (* Deprecated in 0.5.5 *)
| (* variant: *) COLON_EQUAL;
+
(* Deprecated in 0.5.0 *)
YulStackAssignmentOperator = (* variant: *) YulEqualAndColon
| (* variant: *) EQUAL_COLON;
-```{ .ebnf #YulColonEqual } +```{ .ebnf #YulEqualAndColon } ``` -
(* Deprecated in 0.5.5 *)
YulColonEqual = (* colon: *) COLON
(* equal: *) EQUAL;
+
(* Deprecated in 0.5.0 *)
YulEqualAndColon = (* equal: *) EQUAL
(* colon: *) COLON;
```{ .ebnf #YulIfStatement } diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.11-failure.yml index be3ae26ea3..f98690e44f 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.11-failure.yml @@ -10,7 +10,7 @@ Source: > Errors: # 1 total - > - Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBlockHashKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulInvalidKeyword or YulIsZeroKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulSha3Keyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStopKeyword or YulSubKeyword or YulSuicideKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. + Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or Equal or EqualColon or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulSha3Keyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStopKeyword or YulSubKeyword or YulSuicideKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/input.sol:4:10] │ 4 │ ╭─▶ result := [mul(a, b) diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.12-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.12-failure.yml index 8e41079264..26e0a0083d 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.12-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.12-failure.yml @@ -10,7 +10,7 @@ Source: > Errors: # 1 total - > - Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBlockHashKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulSha3Keyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSuicideKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. + Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or Equal or EqualColon or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulSha3Keyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSuicideKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/input.sol:4:10] │ 4 │ ╭─▶ result := [mul(a, b) diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.4.11-success.yml index 6c63c2a847..e4c5da638f 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.4.11-success.yml @@ -5,18 +5,18 @@ Source: > 2 │ 1 │ 2..5 3 │ 2 │ 6..9 4 │ 3 │ 10..13 - 5 │ := success │ 14..26 - 6 │ := success │ 27..39 - 7 │ := success │ 40..52 + 5 │ =: success │ 14..26 + 6 │ =: success │ 27..39 + 7 │ =: success │ 40..52 8 │ } │ 53..54 Errors: [] Tree: - - (YulBlock): # "{\n 1\n 2\n 3\n := success\n := success\n := succe..." (0..55) + - (YulBlock): # "{\n 1\n 2\n 3\n =: success\n =: success\n =: succe..." (0..55) - (open_brace꞉ OpenBrace): "{" # (0..1) - (trailing_trivia꞉ EndOfLine): "\n" # (1..2) - - (statements꞉ YulStatements): # " 1\n 2\n 3\n := success\n := success\n := success..." (2..53) + - (statements꞉ YulStatements): # " 1\n 2\n 3\n =: success\n =: success\n =: success..." (2..53) - (item꞉ YulStatement) ► (variant꞉ YulExpression) ► (variant꞉ YulLiteral): # " 1\n" (2..6) - (leading_trivia꞉ Whitespace): " " # (2..4) - (variant꞉ YulDecimalLiteral): "1" # (4..5) @@ -29,32 +29,26 @@ Tree: - (leading_trivia꞉ Whitespace): " " # (10..12) - (variant꞉ YulDecimalLiteral): "3" # (12..13) - (trailing_trivia꞉ EndOfLine): "\n" # (13..14) - - (item꞉ YulStatement) ► (variant꞉ YulStackAssignmentStatement): # " := success\n" (14..27) - - (assignment꞉ YulAssignmentOperator): # " :=" (14..18) + - (item꞉ YulStatement) ► (variant꞉ YulStackAssignmentStatement): # " =: success\n" (14..27) + - (assignment꞉ YulStackAssignmentOperator): # " =:" (14..18) - (leading_trivia꞉ Whitespace): " " # (14..16) - - (variant꞉ ColonEqual): ":=" # (16..18) - - (expression꞉ YulExpression) ► (variant꞉ YulPath): # " success\n" (18..27) - - (item꞉ YulPathComponent): # " success\n" (18..27) - - (leading_trivia꞉ Whitespace): " " # (18..19) - - (variant꞉ YulIdentifier): "success" # (19..26) - - (trailing_trivia꞉ EndOfLine): "\n" # (26..27) - - (item꞉ YulStatement) ► (variant꞉ YulStackAssignmentStatement): # " := success\n" (27..40) - - (assignment꞉ YulAssignmentOperator): # " :=" (27..31) + - (variant꞉ EqualColon): "=:" # (16..18) + - (leading_trivia꞉ Whitespace): " " # (18..19) + - (variable꞉ YulIdentifier): "success" # (19..26) + - (trailing_trivia꞉ EndOfLine): "\n" # (26..27) + - (item꞉ YulStatement) ► (variant꞉ YulStackAssignmentStatement): # " =: success\n" (27..40) + - (assignment꞉ YulStackAssignmentOperator): # " =:" (27..31) - (leading_trivia꞉ Whitespace): " " # (27..29) - - (variant꞉ ColonEqual): ":=" # (29..31) - - (expression꞉ YulExpression) ► (variant꞉ YulPath): # " success\n" (31..40) - - (item꞉ YulPathComponent): # " success\n" (31..40) - - (leading_trivia꞉ Whitespace): " " # (31..32) - - (variant꞉ YulIdentifier): "success" # (32..39) - - (trailing_trivia꞉ EndOfLine): "\n" # (39..40) - - (item꞉ YulStatement) ► (variant꞉ YulStackAssignmentStatement): # " := success\n" (40..53) - - (assignment꞉ YulAssignmentOperator): # " :=" (40..44) + - (variant꞉ EqualColon): "=:" # (29..31) + - (leading_trivia꞉ Whitespace): " " # (31..32) + - (variable꞉ YulIdentifier): "success" # (32..39) + - (trailing_trivia꞉ EndOfLine): "\n" # (39..40) + - (item꞉ YulStatement) ► (variant꞉ YulStackAssignmentStatement): # " =: success\n" (40..53) + - (assignment꞉ YulStackAssignmentOperator): # " =:" (40..44) - (leading_trivia꞉ Whitespace): " " # (40..42) - - (variant꞉ ColonEqual): ":=" # (42..44) - - (expression꞉ YulExpression) ► (variant꞉ YulPath): # " success\n" (44..53) - - (item꞉ YulPathComponent): # " success\n" (44..53) - - (leading_trivia꞉ Whitespace): " " # (44..45) - - (variant꞉ YulIdentifier): "success" # (45..52) - - (trailing_trivia꞉ EndOfLine): "\n" # (52..53) + - (variant꞉ EqualColon): "=:" # (42..44) + - (leading_trivia꞉ Whitespace): " " # (44..45) + - (variable꞉ YulIdentifier): "success" # (45..52) + - (trailing_trivia꞉ EndOfLine): "\n" # (52..53) - (close_brace꞉ CloseBrace): "}" # (53..54) - (trailing_trivia꞉ EndOfLine): "\n" # (54..55) diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.5.0-failure.yml index 5ca8dcf85e..c56d6d7e3d 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.5.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.5.0-failure.yml @@ -5,9 +5,9 @@ Source: > 2 │ 1 │ 2..5 3 │ 2 │ 6..9 4 │ 3 │ 10..13 - 5 │ := success │ 14..26 - 6 │ := success │ 27..39 - 7 │ := success │ 40..52 + 5 │ =: success │ 14..26 + 6 │ =: success │ 27..39 + 7 │ =: success │ 40..52 8 │ } │ 53..54 Errors: # 1 total @@ -15,15 +15,15 @@ Errors: # 1 total Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol:5:3] │ - 5 │ ╭─▶ := success + 5 │ ╭─▶ =: success ┆ ┆ - 7 │ ├─▶ := success + 7 │ ├─▶ =: success │ │ │ ╰────────────────── Error occurred here. ───╯ Tree: - - (YulBlock): # "{\n 1\n 2\n 3\n := success\n := success\n := succe..." (0..55) + - (YulBlock): # "{\n 1\n 2\n 3\n =: success\n =: success\n =: succe..." (0..55) - (open_brace꞉ OpenBrace): "{" # (0..1) - (trailing_trivia꞉ EndOfLine): "\n" # (1..2) - (statements꞉ YulStatements): # " 1\n 2\n 3\n" (2..14) @@ -40,6 +40,6 @@ Tree: - (variant꞉ YulDecimalLiteral): "3" # (12..13) - (trailing_trivia꞉ EndOfLine): "\n" # (13..14) - (leading_trivia꞉ Whitespace): " " # (14..16) - - (UNRECOGNIZED): ":= success\n := success\n := success\n" # (16..53) + - (UNRECOGNIZED): "=: success\n =: success\n =: success\n" # (16..53) - (close_brace꞉ CloseBrace): "}" # (53..54) - (trailing_trivia꞉ EndOfLine): "\n" # (54..55) diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.6.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.6.0-failure.yml index 1b126e3865..7a5deebe13 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.6.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.6.0-failure.yml @@ -5,9 +5,9 @@ Source: > 2 │ 1 │ 2..5 3 │ 2 │ 6..9 4 │ 3 │ 10..13 - 5 │ := success │ 14..26 - 6 │ := success │ 27..39 - 7 │ := success │ 40..52 + 5 │ =: success │ 14..26 + 6 │ =: success │ 27..39 + 7 │ =: success │ 40..52 8 │ } │ 53..54 Errors: # 1 total @@ -15,15 +15,15 @@ Errors: # 1 total Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLeaveKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol:5:3] │ - 5 │ ╭─▶ := success + 5 │ ╭─▶ =: success ┆ ┆ - 7 │ ├─▶ := success + 7 │ ├─▶ =: success │ │ │ ╰────────────────── Error occurred here. ───╯ Tree: - - (YulBlock): # "{\n 1\n 2\n 3\n := success\n := success\n := succe..." (0..55) + - (YulBlock): # "{\n 1\n 2\n 3\n =: success\n =: success\n =: succe..." (0..55) - (open_brace꞉ OpenBrace): "{" # (0..1) - (trailing_trivia꞉ EndOfLine): "\n" # (1..2) - (statements꞉ YulStatements): # " 1\n 2\n 3\n" (2..14) @@ -40,6 +40,6 @@ Tree: - (variant꞉ YulDecimalLiteral): "3" # (12..13) - (trailing_trivia꞉ EndOfLine): "\n" # (13..14) - (leading_trivia꞉ Whitespace): " " # (14..16) - - (UNRECOGNIZED): ":= success\n := success\n := success\n" # (16..53) + - (UNRECOGNIZED): "=: success\n =: success\n =: success\n" # (16..53) - (close_brace꞉ CloseBrace): "}" # (53..54) - (trailing_trivia꞉ EndOfLine): "\n" # (54..55) diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.10-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.10-failure.yml index 770c6a3a0c..1e429c2819 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.10-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.10-failure.yml @@ -5,9 +5,9 @@ Source: > 2 │ 1 │ 2..5 3 │ 2 │ 6..9 4 │ 3 │ 10..13 - 5 │ := success │ 14..26 - 6 │ := success │ 27..39 - 7 │ := success │ 40..52 + 5 │ =: success │ 14..26 + 6 │ =: success │ 27..39 + 7 │ =: success │ 40..52 8 │ } │ 53..54 Errors: # 1 total @@ -15,15 +15,15 @@ Errors: # 1 total Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBaseFeeKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLeaveKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol:5:3] │ - 5 │ ╭─▶ := success + 5 │ ╭─▶ =: success ┆ ┆ - 7 │ ├─▶ := success + 7 │ ├─▶ =: success │ │ │ ╰────────────────── Error occurred here. ───╯ Tree: - - (YulBlock): # "{\n 1\n 2\n 3\n := success\n := success\n := succe..." (0..55) + - (YulBlock): # "{\n 1\n 2\n 3\n =: success\n =: success\n =: succe..." (0..55) - (open_brace꞉ OpenBrace): "{" # (0..1) - (trailing_trivia꞉ EndOfLine): "\n" # (1..2) - (statements꞉ YulStatements): # " 1\n 2\n 3\n" (2..14) @@ -40,6 +40,6 @@ Tree: - (variant꞉ YulDecimalLiteral): "3" # (12..13) - (trailing_trivia꞉ EndOfLine): "\n" # (13..14) - (leading_trivia꞉ Whitespace): " " # (14..16) - - (UNRECOGNIZED): ":= success\n := success\n := success\n" # (16..53) + - (UNRECOGNIZED): "=: success\n =: success\n =: success\n" # (16..53) - (close_brace꞉ CloseBrace): "}" # (53..54) - (trailing_trivia꞉ EndOfLine): "\n" # (54..55) diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.18-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.18-failure.yml index ca97c7f9f4..b9cee7fafc 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.18-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.18-failure.yml @@ -5,9 +5,9 @@ Source: > 2 │ 1 │ 2..5 3 │ 2 │ 6..9 4 │ 3 │ 10..13 - 5 │ := success │ 14..26 - 6 │ := success │ 27..39 - 7 │ := success │ 40..52 + 5 │ =: success │ 14..26 + 6 │ =: success │ 27..39 + 7 │ =: success │ 40..52 8 │ } │ 53..54 Errors: # 1 total @@ -15,15 +15,15 @@ Errors: # 1 total Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBaseFeeKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLeaveKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulPrevRandaoKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol:5:3] │ - 5 │ ╭─▶ := success + 5 │ ╭─▶ =: success ┆ ┆ - 7 │ ├─▶ := success + 7 │ ├─▶ =: success │ │ │ ╰────────────────── Error occurred here. ───╯ Tree: - - (YulBlock): # "{\n 1\n 2\n 3\n := success\n := success\n := succe..." (0..55) + - (YulBlock): # "{\n 1\n 2\n 3\n =: success\n =: success\n =: succe..." (0..55) - (open_brace꞉ OpenBrace): "{" # (0..1) - (trailing_trivia꞉ EndOfLine): "\n" # (1..2) - (statements꞉ YulStatements): # " 1\n 2\n 3\n" (2..14) @@ -40,6 +40,6 @@ Tree: - (variant꞉ YulDecimalLiteral): "3" # (12..13) - (trailing_trivia꞉ EndOfLine): "\n" # (13..14) - (leading_trivia꞉ Whitespace): " " # (14..16) - - (UNRECOGNIZED): ":= success\n := success\n := success\n" # (16..53) + - (UNRECOGNIZED): "=: success\n =: success\n =: success\n" # (16..53) - (close_brace꞉ CloseBrace): "}" # (53..54) - (trailing_trivia꞉ EndOfLine): "\n" # (54..55) diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.24-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.24-failure.yml index 085d5c3c5b..4468da3e94 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.24-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.24-failure.yml @@ -5,9 +5,9 @@ Source: > 2 │ 1 │ 2..5 3 │ 2 │ 6..9 4 │ 3 │ 10..13 - 5 │ := success │ 14..26 - 6 │ := success │ 27..39 - 7 │ := success │ 40..52 + 5 │ =: success │ 14..26 + 6 │ =: success │ 27..39 + 7 │ =: success │ 40..52 8 │ } │ 53..54 Errors: # 1 total @@ -15,15 +15,15 @@ Errors: # 1 total Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBaseFeeKeyword or YulBlobBaseFeeKeyword or YulBlobHashKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLeaveKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMCopyKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulPrevRandaoKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTLoadKeyword or YulTStoreKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol:5:3] │ - 5 │ ╭─▶ := success + 5 │ ╭─▶ =: success ┆ ┆ - 7 │ ├─▶ := success + 7 │ ├─▶ =: success │ │ │ ╰────────────────── Error occurred here. ───╯ Tree: - - (YulBlock): # "{\n 1\n 2\n 3\n := success\n := success\n := succe..." (0..55) + - (YulBlock): # "{\n 1\n 2\n 3\n =: success\n =: success\n =: succe..." (0..55) - (open_brace꞉ OpenBrace): "{" # (0..1) - (trailing_trivia꞉ EndOfLine): "\n" # (1..2) - (statements꞉ YulStatements): # " 1\n 2\n 3\n" (2..14) @@ -40,6 +40,6 @@ Tree: - (variant꞉ YulDecimalLiteral): "3" # (12..13) - (trailing_trivia꞉ EndOfLine): "\n" # (13..14) - (leading_trivia꞉ Whitespace): " " # (14..16) - - (UNRECOGNIZED): ":= success\n := success\n := success\n" # (16..53) + - (UNRECOGNIZED): "=: success\n =: success\n =: success\n" # (16..53) - (close_brace꞉ CloseBrace): "}" # (53..54) - (trailing_trivia꞉ EndOfLine): "\n" # (54..55) diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.7-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.7-failure.yml index 770c6a3a0c..1e429c2819 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.7-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/generated/0.8.7-failure.yml @@ -5,9 +5,9 @@ Source: > 2 │ 1 │ 2..5 3 │ 2 │ 6..9 4 │ 3 │ 10..13 - 5 │ := success │ 14..26 - 6 │ := success │ 27..39 - 7 │ := success │ 40..52 + 5 │ =: success │ 14..26 + 6 │ =: success │ 27..39 + 7 │ =: success │ 40..52 8 │ } │ 53..54 Errors: # 1 total @@ -15,15 +15,15 @@ Errors: # 1 total Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBaseFeeKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLeaveKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol:5:3] │ - 5 │ ╭─▶ := success + 5 │ ╭─▶ =: success ┆ ┆ - 7 │ ├─▶ := success + 7 │ ├─▶ =: success │ │ │ ╰────────────────── Error occurred here. ───╯ Tree: - - (YulBlock): # "{\n 1\n 2\n 3\n := success\n := success\n := succe..." (0..55) + - (YulBlock): # "{\n 1\n 2\n 3\n =: success\n =: success\n =: succe..." (0..55) - (open_brace꞉ OpenBrace): "{" # (0..1) - (trailing_trivia꞉ EndOfLine): "\n" # (1..2) - (statements꞉ YulStatements): # " 1\n 2\n 3\n" (2..14) @@ -40,6 +40,6 @@ Tree: - (variant꞉ YulDecimalLiteral): "3" # (12..13) - (trailing_trivia꞉ EndOfLine): "\n" # (13..14) - (leading_trivia꞉ Whitespace): " " # (14..16) - - (UNRECOGNIZED): ":= success\n := success\n := success\n" # (16..53) + - (UNRECOGNIZED): "=: success\n =: success\n =: success\n" # (16..53) - (close_brace꞉ CloseBrace): "}" # (53..54) - (trailing_trivia꞉ EndOfLine): "\n" # (54..55) diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol index 9e243996e5..511a42b5b4 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/multiple_stack_assignments/input.sol @@ -2,7 +2,7 @@ 1 2 3 - := success - := success - := success + =: success + =: success + =: success } diff --git a/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/generated/0.4.11-success.yml new file mode 100644 index 0000000000..b9d9774399 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/generated/0.4.11-success.yml @@ -0,0 +1,16 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ = : success │ 0..11 + +Errors: [] + +Tree: + - (YulStackAssignmentStatement): # "= : success\n" (0..12) + - (assignment꞉ YulStackAssignmentOperator) ► (variant꞉ YulEqualAndColon): # "= :" (0..3) + - (equal꞉ Equal): "=" # (0..1) + - (leading_trivia꞉ Whitespace): " " # (1..2) + - (colon꞉ Colon): ":" # (2..3) + - (leading_trivia꞉ Whitespace): " " # (3..4) + - (variable꞉ YulIdentifier): "success" # (4..11) + - (trailing_trivia꞉ EndOfLine): "\n" # (11..12) diff --git a/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/generated/0.5.0-failure.yml new file mode 100644 index 0000000000..13d3aa868a --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/generated/0.5.0-failure.yml @@ -0,0 +1,17 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ = : success │ 0..11 + +Errors: # 1 total + - > + Error: Expected end of file. + ╭─[crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/input.sol:1:1] + │ + 1 │ = : success + │ ──────┬───── + │ ╰─────── Error occurred here. + ───╯ + +Tree: + - (UNRECOGNIZED): "= : success\n" # (0..12) diff --git a/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/input.sol b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/input.sol new file mode 100644 index 0000000000..f2238dd1e6 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/equal_colon_separated/input.sol @@ -0,0 +1 @@ += : success diff --git a/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/generated/0.4.11-success.yml index 0a69b5894f..96ffd28707 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/generated/0.4.11-success.yml @@ -1,15 +1,13 @@ # This file is generated automatically by infrastructure scripts. Please don't edit by hand. Source: > - 1 │ := success │ 0..10 + 1 │ =: success │ 0..10 Errors: [] Tree: - - (YulStackAssignmentStatement): # ":= success\n" (0..11) - - (assignment꞉ YulAssignmentOperator) ► (variant꞉ ColonEqual): ":=" # (0..2) - - (expression꞉ YulExpression) ► (variant꞉ YulPath): # " success\n" (2..11) - - (item꞉ YulPathComponent): # " success\n" (2..11) - - (leading_trivia꞉ Whitespace): " " # (2..3) - - (variant꞉ YulIdentifier): "success" # (3..10) - - (trailing_trivia꞉ EndOfLine): "\n" # (10..11) + - (YulStackAssignmentStatement): # "=: success\n" (0..11) + - (assignment꞉ YulStackAssignmentOperator) ► (variant꞉ EqualColon): "=:" # (0..2) + - (leading_trivia꞉ Whitespace): " " # (2..3) + - (variable꞉ YulIdentifier): "success" # (3..10) + - (trailing_trivia꞉ EndOfLine): "\n" # (10..11) diff --git a/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/generated/0.5.0-failure.yml index d1e17893f7..0de1a8336f 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/generated/0.5.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/generated/0.5.0-failure.yml @@ -1,17 +1,17 @@ # This file is generated automatically by infrastructure scripts. Please don't edit by hand. Source: > - 1 │ := success │ 0..10 + 1 │ =: success │ 0..10 Errors: # 1 total - > Error: Expected end of file. ╭─[crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/input.sol:1:1] │ - 1 │ := success + 1 │ =: success │ ─────┬───── │ ╰─────── Error occurred here. ───╯ Tree: - - (UNRECOGNIZED): ":= success\n" # (0..11) + - (UNRECOGNIZED): "=: success\n" # (0..11) diff --git a/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/input.sol b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/input.sol index 937bbb2187..09a79bb71d 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/input.sol +++ b/crates/solidity/testing/snapshots/cst_output/YulStackAssignmentStatement/single_variable/input.sol @@ -1 +1 @@ -:= success +=: success diff --git a/crates/solidity/testing/snapshots/cst_output/YulVariableAssignmentStatement/colon_equal_separated/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/YulVariableAssignmentStatement/colon_equal_separated/generated/0.4.11-success.yml index d25c9af2dc..3c61b84dc9 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulVariableAssignmentStatement/colon_equal_separated/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulVariableAssignmentStatement/colon_equal_separated/generated/0.4.11-success.yml @@ -14,7 +14,7 @@ Tree: - (leading_trivia꞉ SingleLineComment): '// ColonEqual was two separate tokens before "0.5....' # (0..53) - (leading_trivia꞉ EndOfLine): "\n" # (53..54) - (variant꞉ YulIdentifier): "foo" # (54..57) - - (assignment꞉ YulAssignmentOperator) ► (variant꞉ YulColonEqual): # " : =" (57..61) + - (assignment꞉ YulAssignmentOperator) ► (variant꞉ YulColonAndEqual): # " : =" (57..61) - (leading_trivia꞉ Whitespace): " " # (57..58) - (colon꞉ Colon): ":" # (58..59) - (leading_trivia꞉ Whitespace): " " # (59..60) diff --git a/crates/solidity/testing/snapshots/cst_output/YulVariableDeclarationStatement/colon_equal_separated/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/YulVariableDeclarationStatement/colon_equal_separated/generated/0.4.11-success.yml index 639bdcbbb1..acab1a0242 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulVariableDeclarationStatement/colon_equal_separated/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulVariableDeclarationStatement/colon_equal_separated/generated/0.4.11-success.yml @@ -15,7 +15,7 @@ Tree: - (leading_trivia꞉ Whitespace): " " # (57..58) - (item꞉ YulIdentifier): "foo" # (58..61) - (value꞉ YulVariableDeclarationValue): # " : = 0\n" (61..68) - - (assignment꞉ YulAssignmentOperator) ► (variant꞉ YulColonEqual): # " : =" (61..65) + - (assignment꞉ YulAssignmentOperator) ► (variant꞉ YulColonAndEqual): # " : =" (61..65) - (leading_trivia꞉ Whitespace): " " # (61..62) - (colon꞉ Colon): ":" # (62..63) - (leading_trivia꞉ Whitespace): " " # (63..64) From 8efd6e9b3cf7671dda751bbed017236af0bf066b Mon Sep 17 00:00:00 2001 From: Omar Tawfik <15987992+OmarTawfik@users.noreply.github.com> Date: Mon, 5 Aug 2024 04:16:25 -0700 Subject: [PATCH 09/13] use nextest for running cargo tests (#1054) Makes it easier to debug failures in CI, as failures are grouped at the end, across all crates. --- Cargo.toml | 1 + crates/infra/cli/src/commands/check/mod.rs | 19 ++++-- crates/infra/cli/src/commands/test/mod.rs | 22 ++++--- crates/infra/utils/src/cargo/workspace.rs | 75 +++++++++++----------- 4 files changed, 66 insertions(+), 51 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8bb61afdec..429b3f6c3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,6 +94,7 @@ ariadne = { version = "0.2.0" } bencher_cli = { git = "https://github.com/bencherdev/bencher", branch = "main" } cargo-edit = { version = "0.12.3" } cargo-emit = { version = "0.2.1" } +cargo-nextest = { version = "0.9.72" } cargo-xwin = { version = "0.14.2" } cargo-zigbuild = { version = "0.18.3" } clap = { version = "4.5.13", features = ["derive", "wrap_help"] } diff --git a/crates/infra/cli/src/commands/check/mod.rs b/crates/infra/cli/src/commands/check/mod.rs index bd99d0d7d6..c20c749e0d 100644 --- a/crates/infra/cli/src/commands/check/mod.rs +++ b/crates/infra/cli/src/commands/check/mod.rs @@ -1,6 +1,7 @@ use anyhow::Result; use clap::{Parser, ValueEnum}; -use infra_utils::cargo::CargoWorkspace; +use infra_utils::cargo::CargoWorkspaceCommands; +use infra_utils::commands::Command; use infra_utils::terminal::Terminal; use strum::IntoEnumIterator; @@ -47,18 +48,24 @@ impl OrderedCommand for CheckCommand { fn check_cargo() -> Result<()> { // 'cargo clippy' will run both 'cargo check', and 'clippy' lints: - CargoWorkspace::get_command("clippy")? + Command::new("cargo") + .arg("clippy") + .flag("--workspace") + .flag("--all-features") .flag("--all-targets") + .flag("--no-deps") + .add_build_rustflags() .run() } fn check_rustdoc() -> Result<()> { - CargoWorkspace::get_command("doc")? + Command::new("cargo") + .arg("doc") + .flag("--workspace") + .flag("--all-features") .flag("--no-deps") .flag("--document-private-items") - .flag("--lib") - .flag("--bins") - .flag("--examples") + .add_build_rustflags() .run() } diff --git a/crates/infra/cli/src/commands/test/mod.rs b/crates/infra/cli/src/commands/test/mod.rs index f6cd8cdc73..fff501e32e 100644 --- a/crates/infra/cli/src/commands/test/mod.rs +++ b/crates/infra/cli/src/commands/test/mod.rs @@ -1,8 +1,7 @@ use anyhow::Result; use clap::{Parser, ValueEnum}; -use infra_utils::cargo::CargoWorkspace; +use infra_utils::cargo::{CargoWorkspace, CargoWorkspaceCommands}; use infra_utils::commands::Command; -use infra_utils::github::GitHub; use infra_utils::terminal::Terminal; use crate::utils::{ClapExtensions, OrderedCommand}; @@ -39,13 +38,18 @@ impl OrderedCommand for TestCommand { } fn test_cargo() -> Result<()> { - let mut command = CargoWorkspace::get_command("test")?.flag("--quiet"); - - if GitHub::is_running_in_ci() { - command = command.flag("--no-fail-fast"); - } - - command.run() + CargoWorkspace::install_binary("cargo-nextest")?; + + Command::new("cargo") + .args(["nextest", "run"]) + .flag("--workspace") + .flag("--all-features") + .flag("--lib") + .flag("--bins") + .flag("--examples") + .flag("--no-fail-fast") + .add_build_rustflags() + .run() } fn test_npm() -> Result<()> { diff --git a/crates/infra/utils/src/cargo/workspace.rs b/crates/infra/utils/src/cargo/workspace.rs index 7234f68fdd..ba7e7e0f07 100644 --- a/crates/infra/utils/src/cargo/workspace.rs +++ b/crates/infra/utils/src/cargo/workspace.rs @@ -109,45 +109,48 @@ impl CargoWorkspace { .arg(new_version.to_string()) .run() } +} - pub fn get_command(subcommand: impl AsRef) -> Result { - let subcommand = subcommand.as_ref(); +pub trait CargoWorkspaceCommands { + #[must_use] + fn add_build_rustflags(self) -> Self; +} - let mut command = Command::new("cargo") - .arg(subcommand) - .flag("--workspace") - .flag("--all-features"); - - if GitHub::is_running_in_ci() { - // Using `$RUSTFLAGS' or '--' overrides any rustflags from `.cargo/config.toml'. - // Using this syntax instead, as it is concatenated with the existing flags: - command = command.property( - "--config", - format!( - "build.rustflags = {rustflags}", - rustflags = serde_json::to_string(&[ - // Deny any warnings in CI: - "-Dwarnings", - // Lint against leftover `dbg/todo!` macros in CI: - "-Wclippy::dbg_macro", - "-Wclippy::todo" - ])?, - ), - ); - // Rustdoc requires specifying RUSTDOCFLAGS, instead: - // See . - command = command.property( - "--config", - format!( - "build.rustdocflags = {rustdocflags}", - rustdocflags = serde_json::to_string(&[ - // Deny any warnings in CI: - "-Dwarnings" - ])?, - ), - ); +impl CargoWorkspaceCommands for Command { + fn add_build_rustflags(self) -> Self { + if !GitHub::is_running_in_ci() { + // Nothing to add locally: + return self; } - Ok(command) + // Using `$RUSTFLAGS' or '--' overrides any rustflags from `.cargo/config.toml'. + // Using this syntax instead, as it is concatenated with the existing flags: + self.property( + "--config", + format!( + "build.rustflags = {rustflags}", + rustflags = serde_json::to_string(&[ + // Deny any warnings in CI: + "-Dwarnings", + // Lint against leftover `dbg/todo!` macros in CI: + "-Wclippy::dbg_macro", + "-Wclippy::todo" + ]) + .unwrap(), + ), + ) + // Rustdoc requires specifying RUSTDOCFLAGS, instead: + // See . + .property( + "--config", + format!( + "build.rustdocflags = {rustdocflags}", + rustdocflags = serde_json::to_string(&[ + // Deny any warnings in CI: + "-Dwarnings" + ]) + .unwrap(), + ), + ) } } From fa38d832927d26ff4a6ff90a6efa333e7f93598c Mon Sep 17 00:00:00 2001 From: Omar Tawfik <15987992+OmarTawfik@users.noreply.github.com> Date: Mon, 5 Aug 2024 04:54:29 -0700 Subject: [PATCH 10/13] add versioning to mkdocs (#1063) Closes #1022 ![image](https://github.com/user-attachments/assets/751e2118-20a5-45d2-937c-22fbd877edd5) ![image](https://github.com/user-attachments/assets/ad96e31f-6bb5-403e-81f7-1c8f0c091af9) --- .github/workflows/publish.yml | 73 +--- Pipfile | 5 +- Pipfile.lock | 367 ++++++++++-------- crates/infra/cli/src/commands/check/mod.rs | 2 +- crates/infra/cli/src/commands/lint/mod.rs | 5 +- crates/infra/cli/src/commands/mod.rs | 20 +- .../cli/src/commands/publish/cargo/mod.rs | 59 +-- .../src/commands/publish/changesets/mod.rs | 154 ++++---- .../commands/publish/github_release/mod.rs | 50 ++- .../cli/src/commands/publish/mkdocs/mod.rs | 30 ++ crates/infra/cli/src/commands/publish/mod.rs | 73 ++-- .../infra/cli/src/commands/publish/npm/mod.rs | 47 ++- .../infra/cli/src/commands/setup/git/mod.rs | 22 ++ crates/infra/cli/src/commands/setup/mod.rs | 5 + .../cli/src/commands/setup/pipenv/mod.rs | 51 +-- crates/infra/cli/src/toolchains/mkdocs/mod.rs | 65 +++- crates/infra/cli/src/toolchains/mod.rs | 1 + crates/infra/cli/src/toolchains/pipenv/mod.rs | 53 +++ crates/infra/cli/src/utils.rs | 25 +- crates/infra/utils/src/git/mod.rs | 2 - documentation/mkdocs.yml | 10 +- documentation/overrides/main.html | 8 + 22 files changed, 637 insertions(+), 490 deletions(-) create mode 100644 crates/infra/cli/src/commands/publish/mkdocs/mod.rs create mode 100644 crates/infra/cli/src/commands/setup/git/mod.rs create mode 100644 crates/infra/cli/src/toolchains/pipenv/mod.rs create mode 100644 documentation/overrides/main.html diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ca3bea3a7e..caf8bd0a9c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,48 +21,7 @@ jobs: if: "${{ github.repository == 'NomicFoundation/slang' && github.ref_name == 'main' }}" uses: "./.github/workflows/ci.yml" - buildDocs: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - needs: "ci" - - steps: - - name: "Checkout Repository" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" - - - name: "Restore Cache" - uses: "./.github/actions/cache/restore" - - - name: "infra check mkdocs" - uses: "./.github/actions/devcontainer/run" - with: - runCmd: "./scripts/bin/infra check mkdocs" - - - name: "Configure Pages" - uses: "actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d" - - - name: "Upload Artifacts" - uses: "actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa" - with: - path: "documentation/target/site" # _SLANG_MKDOCS_DOCUMENTATION_SITE_DIR_ (keep in sync) - - deployDocs: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - needs: "buildDocs" - - permissions: - pages: "write" # to deploy to Pages - id-token: "write" # to verify the deployment originates from an appropriate source - - steps: - - name: "Deploy Pages" - id: "deployment" - uses: "actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e" - - environment: - name: "github-pages" - url: "${{ steps.deployment.outputs.page_url }}" - - consumeChangesets: + publish: runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) needs: "ci" @@ -95,23 +54,23 @@ jobs: env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - outputs: - hasChangesets: "${{ steps.runChangesets.outputs.hasChangesets }}" - - artifacts: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - needs: "consumeChangesets" - - if: "${{ needs.consumeChangesets.outputs.hasChangesets == 'false' }}" - - steps: - - name: "Checkout Repository" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" + - name: "infra publish mkdocs --target main-branch" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra publish mkdocs --target main-branch" + env: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - - name: "Restore Cache" - uses: "./.github/actions/cache/restore" + - name: "infra publish mkdocs --target latest-release" + if: "${{ steps.runChangesets.outputs.hasChangesets == 'false' }}" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra publish mkdocs --target latest-release" + env: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - name: "infra publish npm" + if: "${{ steps.runChangesets.outputs.hasChangesets == 'false' }}" uses: "./.github/actions/devcontainer/run" with: runCmd: "./scripts/bin/infra publish npm" @@ -119,6 +78,7 @@ jobs: NPM_TOKEN=${{ secrets.NPM_TOKEN }} - name: "infra publish cargo" + if: "${{ steps.runChangesets.outputs.hasChangesets == 'false' }}" uses: "./.github/actions/devcontainer/run" with: runCmd: "./scripts/bin/infra publish cargo" @@ -126,6 +86,7 @@ jobs: CARGO_REGISTRY_TOKEN=${{ secrets.CARGO_REGISTRY_TOKEN }} - name: "infra publish github-release" + if: "${{ steps.runChangesets.outputs.hasChangesets == 'false' }}" uses: "./.github/actions/devcontainer/run" with: runCmd: "./scripts/bin/infra publish github-release" diff --git a/Pipfile b/Pipfile index 8a02a0fab0..dc1723087d 100644 --- a/Pipfile +++ b/Pipfile @@ -8,9 +8,10 @@ name = "pypi" pipenv = "==2024.0.1" # Used for the published GitHub pages site: -mkdocs = "==1.5.3" +mike = "==2.1.2" +mkdocs = "==1.6.0" mkdocs-literate-nav = "==0.6.1" -mkdocs-material = "==9.5.17" +mkdocs-material = "==9.5.31" mkdocs-minify-plugin = "==0.8.0" mkdocs-pymdownx-material-extras = "==2.5.6" diff --git a/Pipfile.lock b/Pipfile.lock index 4867adc646..e7175d1e86 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "276d18feecc01cedb21c29befdcc5aa24529ab2665b8730ae48c257dea1a21d6" + "sha256": "c0b716b16983d211b53377d943b3c868b8410510092623e7df4d9ff79b9bb931" }, "pipfile-spec": 6, "requires": {}, @@ -16,18 +16,17 @@ "default": { "babel": { "hashes": [ - "sha256:6919867db036398ba21eb5c7a0f6b28ab8cbc3ae7a73a44ebe34ae74a4e7d363", - "sha256:efb1a25b7118e67ce3a259bed20545c29cb68be8ad2c784c83689981b7a57287" + "sha256:08706bdad8d0a3413266ab61bd6c34d0c28d6e1e7badf40a2cebe67644e2e1fb", + "sha256:8daf0e265d05768bc6c7a314cf1321e9a123afc328cc635c18622a2f30a04413" ], - "markers": "python_version >= '3.7'", - "version": "==2.14.0" + "markers": "python_version >= '3.8'", + "version": "==2.15.0" }, "certifi": { "hashes": [ "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b", "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90" ], - "index": "pypi", "markers": "python_version >= '3.6'", "version": "==2024.7.4" }, @@ -171,12 +170,6 @@ ], "version": "==2.1.0" }, - "htmlmin": { - "hashes": [ - "sha256:50c1ef4630374a5d723900096a961cff426dff46b48f34d194a81bbe14eca178" - ], - "version": "==0.1.12" - }, "htmlmin2": { "hashes": [ "sha256:75609f2a42e64f7ce57dbff28a39890363bde9e7e5885db633317efbdf8c79a2" @@ -191,13 +184,29 @@ "markers": "python_version >= '3.5'", "version": "==3.7" }, + "importlib-metadata": { + "hashes": [ + "sha256:11901fa0c2f97919b288679932bb64febaeacf289d18ac84dd68cb2e74213369", + "sha256:72e8d4399996132204f9a16dcc751af254a48f8d1b20b9ff0f98d4a8f901e73d" + ], + "markers": "python_version >= '3.8'", + "version": "==8.2.0" + }, + "importlib-resources": { + "hashes": [ + "sha256:50d10f043df931902d4194ea07ec57960f66a80449ff867bfe782b4c486ba78c", + "sha256:cdb2b453b8046ca4e3798eb1d84f3cce1446a0e8e7b5ef4efb600f19fc398145" + ], + "markers": "python_version >= '3.8'", + "version": "==6.4.0" + }, "jinja2": { "hashes": [ - "sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa", - "sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90" + "sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369", + "sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d" ], "markers": "python_version >= '3.7'", - "version": "==3.1.3" + "version": "==3.1.4" }, "jsmin": { "hashes": [ @@ -287,14 +296,30 @@ "markers": "python_version >= '3.6'", "version": "==1.3.4" }, + "mike": { + "hashes": [ + "sha256:d59cc8054c50f9c8a046cfd47f9b700cf9ff1b2b19f420bd8812ca6f94fa8bd3", + "sha256:d61d9b423ab412d634ca2bd520136d5114e3cc73f4bbd1aa6a0c6625c04918c0" + ], + "index": "pypi", + "version": "==2.1.2" + }, "mkdocs": { "hashes": [ - "sha256:3b3a78e736b31158d64dbb2f8ba29bd46a379d0c6e324c2246c3bc3d2189cfc1", - "sha256:eb7c99214dcb945313ba30426c2451b735992c73c2e10838f76d09e39ff4d0e2" + "sha256:1eb5cb7676b7d89323e62b56235010216319217d4af5ddc543a91beb8d125ea7", + "sha256:a73f735824ef83a4f3bcb7a231dcab23f5a838f88b7efc54a0eef5fbdbc3c512" ], "index": "pypi", - "markers": "python_version >= '3.7'", - "version": "==1.5.3" + "markers": "python_version >= '3.8'", + "version": "==1.6.0" + }, + "mkdocs-get-deps": { + "hashes": [ + "sha256:162b3d129c7fad9b19abfdcb9c1458a651628e4b1dea628ac68790fb3061c60c", + "sha256:2bf11d0b133e77a0dd036abeeb06dec8775e46efa526dc70667d8863eefc6134" + ], + "markers": "python_version >= '3.8'", + "version": "==0.2.0" }, "mkdocs-literate-nav": { "hashes": [ @@ -307,12 +332,12 @@ }, "mkdocs-material": { "hashes": [ - "sha256:06ae1275a72db1989cf6209de9e9ecdfbcfdbc24c58353877b2bb927dbe413e4", - "sha256:14a2a60119a785e70e765dd033e6211367aca9fc70230e577c1cf6a326949571" + "sha256:1b1f49066fdb3824c1e96d6bacd2d4375de4ac74580b47e79ff44c4d835c5fcb", + "sha256:31833ec664772669f5856f4f276bf3fdf0e642a445e64491eda459249c3a1ca8" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==9.5.17" + "version": "==9.5.31" }, "mkdocs-material-extensions": { "hashes": [ @@ -342,11 +367,11 @@ }, "packaging": { "hashes": [ - "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5", - "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9" + "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002", + "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124" ], - "markers": "python_version >= '3.7'", - "version": "==24.0" + "markers": "python_version >= '3.8'", + "version": "==24.1" }, "paginate": { "hashes": [ @@ -381,19 +406,27 @@ }, "pygments": { "hashes": [ - "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c", - "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367" + "sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199", + "sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a" ], - "markers": "python_version >= '3.7'", - "version": "==2.17.2" + "markers": "python_version >= '3.8'", + "version": "==2.18.0" }, "pymdown-extensions": { "hashes": [ - "sha256:c70e146bdd83c744ffc766b4671999796aba18842b268510a329f7f64700d584", - "sha256:f5cc7000d7ff0d1ce9395d216017fa4df3dde800afb1fb72d1c7d3fd35e710f4" + "sha256:6ff740bcd99ec4172a938970d42b96128bdc9d4b9bcad72494f29921dc69b753", + "sha256:d323f7e90d83c86113ee78f3fe62fc9dee5f56b54d912660703ea1816fed5626" ], "markers": "python_version >= '3.8'", - "version": "==10.7.1" + "version": "==10.9" + }, + "pyparsing": { + "hashes": [ + "sha256:a1bac0ce561155ecc3ed78ca94d3c9378656ad4c94c1270de543f621420f94ad", + "sha256:f9db75911801ed778fe61bb643079ff86601aca99fcae6345aa67292038fb742" + ], + "markers": "python_full_version >= '3.6.8'", + "version": "==3.1.2" }, "python-dateutil": { "hashes": [ @@ -470,119 +503,104 @@ }, "regex": { "hashes": [ - "sha256:0694219a1d54336fd0445ea382d49d36882415c0134ee1e8332afd1529f0baa5", - "sha256:086dd15e9435b393ae06f96ab69ab2d333f5d65cbe65ca5a3ef0ec9564dfe770", - "sha256:094ba386bb5c01e54e14434d4caabf6583334090865b23ef58e0424a6286d3dc", - "sha256:09da66917262d9481c719599116c7dc0c321ffcec4b1f510c4f8a066f8768105", - "sha256:0ecf44ddf9171cd7566ef1768047f6e66975788258b1c6c6ca78098b95cf9a3d", - "sha256:0fda75704357805eb953a3ee15a2b240694a9a514548cd49b3c5124b4e2ad01b", - "sha256:11a963f8e25ab5c61348d090bf1b07f1953929c13bd2309a0662e9ff680763c9", - "sha256:150c39f5b964e4d7dba46a7962a088fbc91f06e606f023ce57bb347a3b2d4630", - "sha256:1b9d811f72210fa9306aeb88385b8f8bcef0dfbf3873410413c00aa94c56c2b6", - "sha256:1e0eabac536b4cc7f57a5f3d095bfa557860ab912f25965e08fe1545e2ed8b4c", - "sha256:22a86d9fff2009302c440b9d799ef2fe322416d2d58fc124b926aa89365ec482", - "sha256:22f3470f7524b6da61e2020672df2f3063676aff444db1daa283c2ea4ed259d6", - "sha256:263ef5cc10979837f243950637fffb06e8daed7f1ac1e39d5910fd29929e489a", - "sha256:283fc8eed679758de38fe493b7d7d84a198b558942b03f017b1f94dda8efae80", - "sha256:29171aa128da69afdf4bde412d5bedc335f2ca8fcfe4489038577d05f16181e5", - "sha256:298dc6354d414bc921581be85695d18912bea163a8b23cac9a2562bbcd5088b1", - "sha256:2aae8101919e8aa05ecfe6322b278f41ce2994c4a430303c4cd163fef746e04f", - "sha256:2f4e475a80ecbd15896a976aa0b386c5525d0ed34d5c600b6d3ebac0a67c7ddf", - "sha256:34e4af5b27232f68042aa40a91c3b9bb4da0eeb31b7632e0091afc4310afe6cb", - "sha256:37f8e93a81fc5e5bd8db7e10e62dc64261bcd88f8d7e6640aaebe9bc180d9ce2", - "sha256:3a17d3ede18f9cedcbe23d2daa8a2cd6f59fe2bf082c567e43083bba3fb00347", - "sha256:3b1de218d5375cd6ac4b5493e0b9f3df2be331e86520f23382f216c137913d20", - "sha256:43f7cd5754d02a56ae4ebb91b33461dc67be8e3e0153f593c509e21d219c5060", - "sha256:4558410b7a5607a645e9804a3e9dd509af12fb72b9825b13791a37cd417d73a5", - "sha256:4719bb05094d7d8563a450cf8738d2e1061420f79cfcc1fa7f0a44744c4d8f73", - "sha256:4bfc2b16e3ba8850e0e262467275dd4d62f0d045e0e9eda2bc65078c0110a11f", - "sha256:518440c991f514331f4850a63560321f833979d145d7d81186dbe2f19e27ae3d", - "sha256:51f4b32f793812714fd5307222a7f77e739b9bc566dc94a18126aba3b92b98a3", - "sha256:531ac6cf22b53e0696f8e1d56ce2396311254eb806111ddd3922c9d937151dae", - "sha256:5cd05d0f57846d8ba4b71d9c00f6f37d6b97d5e5ef8b3c3840426a475c8f70f4", - "sha256:5dd58946bce44b53b06d94aa95560d0b243eb2fe64227cba50017a8d8b3cd3e2", - "sha256:60080bb3d8617d96f0fb7e19796384cc2467447ef1c491694850ebd3670bc457", - "sha256:636ba0a77de609d6510235b7f0e77ec494d2657108f777e8765efc060094c98c", - "sha256:67d3ccfc590e5e7197750fcb3a2915b416a53e2de847a728cfa60141054123d4", - "sha256:68191f80a9bad283432385961d9efe09d783bcd36ed35a60fb1ff3f1ec2efe87", - "sha256:7502534e55c7c36c0978c91ba6f61703faf7ce733715ca48f499d3dbbd7657e0", - "sha256:7aa47c2e9ea33a4a2a05f40fcd3ea36d73853a2aae7b4feab6fc85f8bf2c9704", - "sha256:7d2af3f6b8419661a0c421584cfe8aaec1c0e435ce7e47ee2a97e344b98f794f", - "sha256:7e316026cc1095f2a3e8cc012822c99f413b702eaa2ca5408a513609488cb62f", - "sha256:88ad44e220e22b63b0f8f81f007e8abbb92874d8ced66f32571ef8beb0643b2b", - "sha256:88d1f7bef20c721359d8675f7d9f8e414ec5003d8f642fdfd8087777ff7f94b5", - "sha256:89723d2112697feaa320c9d351e5f5e7b841e83f8b143dba8e2d2b5f04e10923", - "sha256:8a0ccf52bb37d1a700375a6b395bff5dd15c50acb745f7db30415bae3c2b0715", - "sha256:8c2c19dae8a3eb0ea45a8448356ed561be843b13cbc34b840922ddf565498c1c", - "sha256:905466ad1702ed4acfd67a902af50b8db1feeb9781436372261808df7a2a7bca", - "sha256:9852b76ab558e45b20bf1893b59af64a28bd3820b0c2efc80e0a70a4a3ea51c1", - "sha256:98a2636994f943b871786c9e82bfe7883ecdaba2ef5df54e1450fa9869d1f756", - "sha256:9aa1a67bbf0f957bbe096375887b2505f5d8ae16bf04488e8b0f334c36e31360", - "sha256:9eda5f7a50141291beda3edd00abc2d4a5b16c29c92daf8d5bd76934150f3edc", - "sha256:a6d1047952c0b8104a1d371f88f4ab62e6275567d4458c1e26e9627ad489b445", - "sha256:a9b6d73353f777630626f403b0652055ebfe8ff142a44ec2cf18ae470395766e", - "sha256:a9cc99d6946d750eb75827cb53c4371b8b0fe89c733a94b1573c9dd16ea6c9e4", - "sha256:ad83e7545b4ab69216cef4cc47e344d19622e28aabec61574b20257c65466d6a", - "sha256:b014333bd0217ad3d54c143de9d4b9a3ca1c5a29a6d0d554952ea071cff0f1f8", - "sha256:b43523d7bc2abd757119dbfb38af91b5735eea45537ec6ec3a5ec3f9562a1c53", - "sha256:b521dcecebc5b978b447f0f69b5b7f3840eac454862270406a39837ffae4e697", - "sha256:b77e27b79448e34c2c51c09836033056a0547aa360c45eeeb67803da7b0eedaf", - "sha256:b7a635871143661feccce3979e1727c4e094f2bdfd3ec4b90dfd4f16f571a87a", - "sha256:b7fca9205b59c1a3d5031f7e64ed627a1074730a51c2a80e97653e3e9fa0d415", - "sha256:ba1b30765a55acf15dce3f364e4928b80858fa8f979ad41f862358939bdd1f2f", - "sha256:ba99d8077424501b9616b43a2d208095746fb1284fc5ba490139651f971d39d9", - "sha256:c25a8ad70e716f96e13a637802813f65d8a6760ef48672aa3502f4c24ea8b400", - "sha256:c3c4a78615b7762740531c27cf46e2f388d8d727d0c0c739e72048beb26c8a9d", - "sha256:c40281f7d70baf6e0db0c2f7472b31609f5bc2748fe7275ea65a0b4601d9b392", - "sha256:c7ad32824b7f02bb3c9f80306d405a1d9b7bb89362d68b3c5a9be53836caebdb", - "sha256:cb3fe77aec8f1995611f966d0c656fdce398317f850d0e6e7aebdfe61f40e1cd", - "sha256:cc038b2d8b1470364b1888a98fd22d616fba2b6309c5b5f181ad4483e0017861", - "sha256:cc37b9aeebab425f11f27e5e9e6cf580be7206c6582a64467a14dda211abc232", - "sha256:cc6bb9aa69aacf0f6032c307da718f61a40cf970849e471254e0e91c56ffca95", - "sha256:d126361607b33c4eb7b36debc173bf25d7805847346dd4d99b5499e1fef52bc7", - "sha256:d15b274f9e15b1a0b7a45d2ac86d1f634d983ca40d6b886721626c47a400bf39", - "sha256:d166eafc19f4718df38887b2bbe1467a4f74a9830e8605089ea7a30dd4da8887", - "sha256:d498eea3f581fbe1b34b59c697512a8baef88212f92e4c7830fcc1499f5b45a5", - "sha256:d6f7e255e5fa94642a0724e35406e6cb7001c09d476ab5fce002f652b36d0c39", - "sha256:d78bd484930c1da2b9679290a41cdb25cc127d783768a0369d6b449e72f88beb", - "sha256:d865984b3f71f6d0af64d0d88f5733521698f6c16f445bb09ce746c92c97c586", - "sha256:d902a43085a308cef32c0d3aea962524b725403fd9373dea18110904003bac97", - "sha256:d94a1db462d5690ebf6ae86d11c5e420042b9898af5dcf278bd97d6bda065423", - "sha256:da695d75ac97cb1cd725adac136d25ca687da4536154cdc2815f576e4da11c69", - "sha256:db2a0b1857f18b11e3b0e54ddfefc96af46b0896fb678c85f63fb8c37518b3e7", - "sha256:df26481f0c7a3f8739fecb3e81bc9da3fcfae34d6c094563b9d4670b047312e1", - "sha256:e14b73607d6231f3cc4622809c196b540a6a44e903bcfad940779c80dffa7be7", - "sha256:e2610e9406d3b0073636a3a2e80db05a02f0c3169b5632022b4e81c0364bcda5", - "sha256:e692296c4cc2873967771345a876bcfc1c547e8dd695c6b89342488b0ea55cd8", - "sha256:e693e233ac92ba83a87024e1d32b5f9ab15ca55ddd916d878146f4e3406b5c91", - "sha256:e81469f7d01efed9b53740aedd26085f20d49da65f9c1f41e822a33992cb1590", - "sha256:e8c7e08bb566de4faaf11984af13f6bcf6a08f327b13631d41d62592681d24fe", - "sha256:ed19b3a05ae0c97dd8f75a5d8f21f7723a8c33bbc555da6bbe1f96c470139d3c", - "sha256:efb2d82f33b2212898f1659fb1c2e9ac30493ac41e4d53123da374c3b5541e64", - "sha256:f44dd4d68697559d007462b0a3a1d9acd61d97072b71f6d1968daef26bc744bd", - "sha256:f72cbae7f6b01591f90814250e636065850c5926751af02bb48da94dfced7baa", - "sha256:f7bc09bc9c29ebead055bcba136a67378f03d66bf359e87d0f7c759d6d4ffa31", - "sha256:ff100b203092af77d1a5a7abe085b3506b7eaaf9abf65b73b7d6905b6cb76988" + "sha256:01b689e887f612610c869421241e075c02f2e3d1ae93a037cb14f88ab6a8934c", + "sha256:04ce29e2c5fedf296b1a1b0acc1724ba93a36fb14031f3abfb7abda2806c1535", + "sha256:0ffe3f9d430cd37d8fa5632ff6fb36d5b24818c5c986893063b4e5bdb84cdf24", + "sha256:18300a1d78cf1290fa583cd8b7cde26ecb73e9f5916690cf9d42de569c89b1ce", + "sha256:185e029368d6f89f36e526764cf12bf8d6f0e3a2a7737da625a76f594bdfcbfc", + "sha256:19c65b00d42804e3fbea9708f0937d157e53429a39b7c61253ff15670ff62cb5", + "sha256:228b0d3f567fafa0633aee87f08b9276c7062da9616931382993c03808bb68ce", + "sha256:23acc72f0f4e1a9e6e9843d6328177ae3074b4182167e34119ec7233dfeccf53", + "sha256:25419b70ba00a16abc90ee5fce061228206173231f004437730b67ac77323f0d", + "sha256:2dfbb8baf8ba2c2b9aa2807f44ed272f0913eeeba002478c4577b8d29cde215c", + "sha256:2f1baff13cc2521bea83ab2528e7a80cbe0ebb2c6f0bfad15be7da3aed443908", + "sha256:33e2614a7ce627f0cdf2ad104797d1f68342d967de3695678c0cb84f530709f8", + "sha256:3426de3b91d1bc73249042742f45c2148803c111d1175b283270177fdf669024", + "sha256:382281306e3adaaa7b8b9ebbb3ffb43358a7bbf585fa93821300a418bb975281", + "sha256:3d974d24edb231446f708c455fd08f94c41c1ff4f04bcf06e5f36df5ef50b95a", + "sha256:3f3b6ca8eae6d6c75a6cff525c8530c60e909a71a15e1b731723233331de4169", + "sha256:3fac296f99283ac232d8125be932c5cd7644084a30748fda013028c815ba3364", + "sha256:416c0e4f56308f34cdb18c3f59849479dde5b19febdcd6e6fa4d04b6c31c9faa", + "sha256:438d9f0f4bc64e8dea78274caa5af971ceff0f8771e1a2333620969936ba10be", + "sha256:43affe33137fcd679bdae93fb25924979517e011f9dea99163f80b82eadc7e53", + "sha256:44fc61b99035fd9b3b9453f1713234e5a7c92a04f3577252b45feefe1b327759", + "sha256:45104baae8b9f67569f0f1dca5e1f1ed77a54ae1cd8b0b07aba89272710db61e", + "sha256:4fdd1384619f406ad9037fe6b6eaa3de2749e2e12084abc80169e8e075377d3b", + "sha256:538d30cd96ed7d1416d3956f94d54e426a8daf7c14527f6e0d6d425fcb4cca52", + "sha256:558a57cfc32adcf19d3f791f62b5ff564922942e389e3cfdb538a23d65a6b610", + "sha256:5eefee9bfe23f6df09ffb6dfb23809f4d74a78acef004aa904dc7c88b9944b05", + "sha256:64bd50cf16bcc54b274e20235bf8edbb64184a30e1e53873ff8d444e7ac656b2", + "sha256:65fd3d2e228cae024c411c5ccdffae4c315271eee4a8b839291f84f796b34eca", + "sha256:66b4c0731a5c81921e938dcf1a88e978264e26e6ac4ec96a4d21ae0354581ae0", + "sha256:68a8f8c046c6466ac61a36b65bb2395c74451df2ffb8458492ef49900efed293", + "sha256:6a1141a1dcc32904c47f6846b040275c6e5de0bf73f17d7a409035d55b76f289", + "sha256:6b9fc7e9cc983e75e2518496ba1afc524227c163e43d706688a6bb9eca41617e", + "sha256:6f51f9556785e5a203713f5efd9c085b4a45aecd2a42573e2b5041881b588d1f", + "sha256:7214477bf9bd195894cf24005b1e7b496f46833337b5dedb7b2a6e33f66d962c", + "sha256:731fcd76bbdbf225e2eb85b7c38da9633ad3073822f5ab32379381e8c3c12e94", + "sha256:74007a5b25b7a678459f06559504f1eec2f0f17bca218c9d56f6a0a12bfffdad", + "sha256:7a5486ca56c8869070a966321d5ab416ff0f83f30e0e2da1ab48815c8d165d46", + "sha256:7c479f5ae937ec9985ecaf42e2e10631551d909f203e31308c12d703922742f9", + "sha256:7df9ea48641da022c2a3c9c641650cd09f0cd15e8908bf931ad538f5ca7919c9", + "sha256:7e37e809b9303ec3a179085415cb5f418ecf65ec98cdfe34f6a078b46ef823ee", + "sha256:80c811cfcb5c331237d9bad3bea2c391114588cf4131707e84d9493064d267f9", + "sha256:836d3cc225b3e8a943d0b02633fb2f28a66e281290302a79df0e1eaa984ff7c1", + "sha256:84c312cdf839e8b579f504afcd7b65f35d60b6285d892b19adea16355e8343c9", + "sha256:86b17ba823ea76256b1885652e3a141a99a5c4422f4a869189db328321b73799", + "sha256:871e3ab2838fbcb4e0865a6e01233975df3a15e6fce93b6f99d75cacbd9862d1", + "sha256:88ecc3afd7e776967fa16c80f974cb79399ee8dc6c96423321d6f7d4b881c92b", + "sha256:8bc593dcce679206b60a538c302d03c29b18e3d862609317cb560e18b66d10cf", + "sha256:8fd5afd101dcf86a270d254364e0e8dddedebe6bd1ab9d5f732f274fa00499a5", + "sha256:945352286a541406f99b2655c973852da7911b3f4264e010218bbc1cc73168f2", + "sha256:973335b1624859cb0e52f96062a28aa18f3a5fc77a96e4a3d6d76e29811a0e6e", + "sha256:994448ee01864501912abf2bad9203bffc34158e80fe8bfb5b031f4f8e16da51", + "sha256:9cfd009eed1a46b27c14039ad5bbc5e71b6367c5b2e6d5f5da0ea91600817506", + "sha256:a2ec4419a3fe6cf8a4795752596dfe0adb4aea40d3683a132bae9c30b81e8d73", + "sha256:a4997716674d36a82eab3e86f8fa77080a5d8d96a389a61ea1d0e3a94a582cf7", + "sha256:a512eed9dfd4117110b1881ba9a59b31433caed0c4101b361f768e7bcbaf93c5", + "sha256:a82465ebbc9b1c5c50738536fdfa7cab639a261a99b469c9d4c7dcbb2b3f1e57", + "sha256:ae2757ace61bc4061b69af19e4689fa4416e1a04840f33b441034202b5cd02d4", + "sha256:b16582783f44fbca6fcf46f61347340c787d7530d88b4d590a397a47583f31dd", + "sha256:ba2537ef2163db9e6ccdbeb6f6424282ae4dea43177402152c67ef869cf3978b", + "sha256:bf7a89eef64b5455835f5ed30254ec19bf41f7541cd94f266ab7cbd463f00c41", + "sha256:c0abb5e4e8ce71a61d9446040c1e86d4e6d23f9097275c5bd49ed978755ff0fe", + "sha256:c414cbda77dbf13c3bc88b073a1a9f375c7b0cb5e115e15d4b73ec3a2fbc6f59", + "sha256:c51edc3541e11fbe83f0c4d9412ef6c79f664a3745fab261457e84465ec9d5a8", + "sha256:c5e69fd3eb0b409432b537fe3c6f44ac089c458ab6b78dcec14478422879ec5f", + "sha256:c918b7a1e26b4ab40409820ddccc5d49871a82329640f5005f73572d5eaa9b5e", + "sha256:c9bb87fdf2ab2370f21e4d5636e5317775e5d51ff32ebff2cf389f71b9b13750", + "sha256:ca5b2028c2f7af4e13fb9fc29b28d0ce767c38c7facdf64f6c2cd040413055f1", + "sha256:d0a07763776188b4db4c9c7fb1b8c494049f84659bb387b71c73bbc07f189e96", + "sha256:d33a0021893ede5969876052796165bab6006559ab845fd7b515a30abdd990dc", + "sha256:d55588cba7553f0b6ec33130bc3e114b355570b45785cebdc9daed8c637dd440", + "sha256:dac8e84fff5d27420f3c1e879ce9929108e873667ec87e0c8eeb413a5311adfe", + "sha256:eaef80eac3b4cfbdd6de53c6e108b4c534c21ae055d1dbea2de6b3b8ff3def38", + "sha256:eb462f0e346fcf41a901a126b50f8781e9a474d3927930f3490f38a6e73b6950", + "sha256:eb563dd3aea54c797adf513eeec819c4213d7dbfc311874eb4fd28d10f2ff0f2", + "sha256:f273674b445bcb6e4409bf8d1be67bc4b58e8b46fd0d560055d515b8830063cd", + "sha256:f6442f0f0ff81775eaa5b05af8a0ffa1dda36e9cf6ec1e0d3d245e8564b684ce", + "sha256:fb168b5924bef397b5ba13aabd8cf5df7d3d93f10218d7b925e360d436863f66", + "sha256:fbf8c2f00904eaf63ff37718eb13acf8e178cb940520e47b2f05027f5bb34ce3", + "sha256:fe4ebef608553aff8deb845c7f4f1d0740ff76fa672c011cc0bacb2a00fbde86" ], - "markers": "python_version >= '3.7'", - "version": "==2023.12.25" + "markers": "python_version >= '3.8'", + "version": "==2024.7.24" }, "requests": { "hashes": [ - "sha256:f2c3881dddb70d056c5bd7600a4fae312b2a300e39be6a118d30b90bd27262b5", - "sha256:fa5490319474c82ef1d2c9bc459d3652e3ae4ef4c4ebdd18a21145a47ca4b6b8" + "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760", + "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6" ], - "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==2.32.0" + "version": "==2.32.3" }, "setuptools": { "hashes": [ - "sha256:937a48c7cdb7a21eb53cd7f9b59e525503aa8abaf3584c730dc5f7a5bec3a650", - "sha256:a58a8fde0541dab0419750bcc521fbdf8585f6e5cb41909df3a472ef7b81ca95" + "sha256:5a03e1860cf56bb6ef48ce186b0e557fdba433237481a9a625176c2831be15d1", + "sha256:8d243eff56d095e5817f796ede6ae32941278f542e0f941867cc05ae52b162ec" ], "markers": "python_version >= '3.8'", - "version": "==70.1.1" + "version": "==72.1.0" }, "six": { "hashes": [ @@ -597,10 +615,16 @@ "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472", "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168" ], - "index": "pypi", "markers": "python_version >= '3.8'", "version": "==2.2.2" }, + "verspec": { + "hashes": [ + "sha256:741877d5633cc9464c45a469ae2a31e801e6dbbaa85b9675d481cda100f11c31", + "sha256:c4504ca697b2056cdb4bfa7121461f5a0e81809255b41c03dda4ba823637c01e" + ], + "version": "==0.1.0" + }, "virtualenv": { "hashes": [ "sha256:4c43a2a236279d9ea36a0d76f98d84bd6ca94ac4e0f4a3b9d46d05e10fea542a", @@ -611,38 +635,41 @@ }, "watchdog": { "hashes": [ - "sha256:11e12fafb13372e18ca1bbf12d50f593e7280646687463dd47730fd4f4d5d257", - "sha256:2895bf0518361a9728773083908801a376743bcc37dfa252b801af8fd281b1ca", - "sha256:39cb34b1f1afbf23e9562501673e7146777efe95da24fab5707b88f7fb11649b", - "sha256:45cc09cc4c3b43fb10b59ef4d07318d9a3ecdbff03abd2e36e77b6dd9f9a5c85", - "sha256:4986db5e8880b0e6b7cd52ba36255d4793bf5cdc95bd6264806c233173b1ec0b", - "sha256:5369136a6474678e02426bd984466343924d1df8e2fd94a9b443cb7e3aa20d19", - "sha256:557ba04c816d23ce98a06e70af6abaa0485f6d94994ec78a42b05d1c03dcbd50", - "sha256:6a4db54edea37d1058b08947c789a2354ee02972ed5d1e0dca9b0b820f4c7f92", - "sha256:6a80d5cae8c265842c7419c560b9961561556c4361b297b4c431903f8c33b269", - "sha256:6a9c71a0b02985b4b0b6d14b875a6c86ddea2fdbebd0c9a720a806a8bbffc69f", - "sha256:6c47bdd680009b11c9ac382163e05ca43baf4127954c5f6d0250e7d772d2b80c", - "sha256:6e949a8a94186bced05b6508faa61b7adacc911115664ccb1923b9ad1f1ccf7b", - "sha256:73c7a935e62033bd5e8f0da33a4dcb763da2361921a69a5a95aaf6c93aa03a87", - "sha256:76ad8484379695f3fe46228962017a7e1337e9acadafed67eb20aabb175df98b", - "sha256:8350d4055505412a426b6ad8c521bc7d367d1637a762c70fdd93a3a0d595990b", - "sha256:87e9df830022488e235dd601478c15ad73a0389628588ba0b028cb74eb72fed8", - "sha256:8f9a542c979df62098ae9c58b19e03ad3df1c9d8c6895d96c0d51da17b243b1c", - "sha256:8fec441f5adcf81dd240a5fe78e3d83767999771630b5ddfc5867827a34fa3d3", - "sha256:9a03e16e55465177d416699331b0f3564138f1807ecc5f2de9d55d8f188d08c7", - "sha256:ba30a896166f0fee83183cec913298151b73164160d965af2e93a20bbd2ab605", - "sha256:c17d98799f32e3f55f181f19dd2021d762eb38fdd381b4a748b9f5a36738e935", - "sha256:c522392acc5e962bcac3b22b9592493ffd06d1fc5d755954e6be9f4990de932b", - "sha256:d0f9bd1fd919134d459d8abf954f63886745f4660ef66480b9d753a7c9d40927", - "sha256:d18d7f18a47de6863cd480734613502904611730f8def45fc52a5d97503e5101", - "sha256:d31481ccf4694a8416b681544c23bd271f5a123162ab603c7d7d2dd7dd901a07", - "sha256:e3e7065cbdabe6183ab82199d7a4f6b3ba0a438c5a512a68559846ccb76a78ec", - "sha256:eed82cdf79cd7f0232e2fdc1ad05b06a5e102a43e331f7d041e5f0e0a34a51c4", - "sha256:f970663fa4f7e80401a7b0cbeec00fa801bf0287d93d48368fc3e6fa32716245", - "sha256:f9b2fdca47dc855516b2d66eef3c39f2672cbf7e7a42e7e67ad2cbfcd6ba107d" + "sha256:0144c0ea9997b92615af1d94afc0c217e07ce2c14912c7b1a5731776329fcfc7", + "sha256:03e70d2df2258fb6cb0e95bbdbe06c16e608af94a3ffbd2b90c3f1e83eb10767", + "sha256:093b23e6906a8b97051191a4a0c73a77ecc958121d42346274c6af6520dec175", + "sha256:123587af84260c991dc5f62a6e7ef3d1c57dfddc99faacee508c71d287248459", + "sha256:17e32f147d8bf9657e0922c0940bcde863b894cd871dbb694beb6704cfbd2fb5", + "sha256:206afc3d964f9a233e6ad34618ec60b9837d0582b500b63687e34011e15bb429", + "sha256:4107ac5ab936a63952dea2a46a734a23230aa2f6f9db1291bf171dac3ebd53c6", + "sha256:4513ec234c68b14d4161440e07f995f231be21a09329051e67a2118a7a612d2d", + "sha256:611be3904f9843f0529c35a3ff3fd617449463cb4b73b1633950b3d97fa4bfb7", + "sha256:62c613ad689ddcb11707f030e722fa929f322ef7e4f18f5335d2b73c61a85c28", + "sha256:667f3c579e813fcbad1b784db7a1aaa96524bed53437e119f6a2f5de4db04235", + "sha256:6e8c70d2cd745daec2a08734d9f63092b793ad97612470a0ee4cbb8f5f705c57", + "sha256:7577b3c43e5909623149f76b099ac49a1a01ca4e167d1785c76eb52fa585745a", + "sha256:998d2be6976a0ee3a81fb8e2777900c28641fb5bfbd0c84717d89bca0addcdc5", + "sha256:a3c2c317a8fb53e5b3d25790553796105501a235343f5d2bf23bb8649c2c8709", + "sha256:ab998f567ebdf6b1da7dc1e5accfaa7c6992244629c0fdaef062f43249bd8dee", + "sha256:ac7041b385f04c047fcc2951dc001671dee1b7e0615cde772e84b01fbf68ee84", + "sha256:bca36be5707e81b9e6ce3208d92d95540d4ca244c006b61511753583c81c70dd", + "sha256:c9904904b6564d4ee8a1ed820db76185a3c96e05560c776c79a6ce5ab71888ba", + "sha256:cad0bbd66cd59fc474b4a4376bc5ac3fc698723510cbb64091c2a793b18654db", + "sha256:d10a681c9a1d5a77e75c48a3b8e1a9f2ae2928eda463e8d33660437705659682", + "sha256:d4925e4bf7b9bddd1c3de13c9b8a2cdb89a468f640e66fbfabaf735bd85b3e35", + "sha256:d7b9f5f3299e8dd230880b6c55504a1f69cf1e4316275d1b215ebdd8187ec88d", + "sha256:da2dfdaa8006eb6a71051795856bedd97e5b03e57da96f98e375682c48850645", + "sha256:dddba7ca1c807045323b6af4ff80f5ddc4d654c8bce8317dde1bd96b128ed253", + "sha256:e7921319fe4430b11278d924ef66d4daa469fafb1da679a2e48c935fa27af193", + "sha256:e93f451f2dfa433d97765ca2634628b789b49ba8b504fdde5837cdcf25fdb53b", + "sha256:eebaacf674fa25511e8867028d281e602ee6500045b57f43b08778082f7f8b44", + "sha256:ef0107bbb6a55f5be727cfc2ef945d5676b97bffb8425650dadbb184be9f9a2b", + "sha256:f0de0f284248ab40188f23380b03b59126d1479cd59940f2a34f8852db710625", + "sha256:f27279d060e2ab24c0aa98363ff906d2386aa6c4dc2f1a374655d4e02a6c5e5e", + "sha256:f8affdf3c0f0466e69f5b3917cdd042f89c8c63aebdb9f7c078996f607cdb0f5" ], "markers": "python_version >= '3.8'", - "version": "==4.0.0" + "version": "==4.0.1" }, "yamllint": { "hashes": [ @@ -652,6 +679,14 @@ "index": "pypi", "markers": "python_version >= '3.8'", "version": "==1.35.1" + }, + "zipp": { + "hashes": [ + "sha256:bf1dcf6450f873a13e952a29504887c89e6de7506209e5b1bcc3460135d4de19", + "sha256:f091755f667055f2d02b32c53771a7a6c8b47e1fdbc4b72a8b9072b3eef8015c" + ], + "markers": "python_version >= '3.8'", + "version": "==3.19.2" } }, "develop": {} diff --git a/crates/infra/cli/src/commands/check/mod.rs b/crates/infra/cli/src/commands/check/mod.rs index c20c749e0d..4f439fc367 100644 --- a/crates/infra/cli/src/commands/check/mod.rs +++ b/crates/infra/cli/src/commands/check/mod.rs @@ -78,5 +78,5 @@ fn check_npm() -> Result<()> { } fn check_mkdocs() -> Result<()> { - Mkdocs::build() + Mkdocs::check() } diff --git a/crates/infra/cli/src/commands/lint/mod.rs b/crates/infra/cli/src/commands/lint/mod.rs index 9d3ee7ee08..cb34c055f2 100644 --- a/crates/infra/cli/src/commands/lint/mod.rs +++ b/crates/infra/cli/src/commands/lint/mod.rs @@ -7,6 +7,7 @@ use infra_utils::github::GitHub; use infra_utils::paths::{FileWalker, PathExtensions}; use infra_utils::terminal::Terminal; +use crate::toolchains::pipenv::PipEnv; use crate::utils::{ClapExtensions, OrderedCommand}; #[derive(Clone, Debug, Default, Parser)] @@ -143,9 +144,7 @@ fn run_yamllint() -> Result<()> { path }); - return Command::new("python3") - .property("-m", "pipenv") - .args(["run", "yamllint"]) + return PipEnv::run("yamllint") .flag("--strict") .property("--config-file", config_file.unwrap_str()) .run_xargs(yaml_files); diff --git a/crates/infra/cli/src/commands/mod.rs b/crates/infra/cli/src/commands/mod.rs index 55446870c8..30b8e9fd41 100644 --- a/crates/infra/cli/src/commands/mod.rs +++ b/crates/infra/cli/src/commands/mod.rs @@ -71,16 +71,16 @@ impl Cli { impl AppCommand { pub fn execute(&self) -> Result<()> { match self { - AppCommand::Setup(command) => command.execute(), - AppCommand::Check(command) => command.execute(), - AppCommand::Test(command) => command.execute(), - AppCommand::Lint(command) => command.execute(), - AppCommand::Ci(command) => command.execute(), - AppCommand::Run(command) => command.execute(), - AppCommand::Watch(command) => command.execute(), - AppCommand::Perf(command) => command.execute(), - AppCommand::Publish(command) => command.execute(), - AppCommand::Completions(command) => command.execute(), + AppCommand::Setup(controller) => controller.execute(), + AppCommand::Check(controller) => controller.execute(), + AppCommand::Test(controller) => controller.execute(), + AppCommand::Lint(controller) => controller.execute(), + AppCommand::Ci(controller) => controller.execute(), + AppCommand::Run(controller) => controller.execute(), + AppCommand::Watch(controller) => controller.execute(), + AppCommand::Perf(controller) => controller.execute(), + AppCommand::Publish(controller) => controller.execute(), + AppCommand::Completions(controller) => controller.execute(), } } } diff --git a/crates/infra/cli/src/commands/publish/cargo/mod.rs b/crates/infra/cli/src/commands/publish/cargo/mod.rs index f67cbad9b6..1e32d3389c 100644 --- a/crates/infra/cli/src/commands/publish/cargo/mod.rs +++ b/crates/infra/cli/src/commands/publish/cargo/mod.rs @@ -2,14 +2,14 @@ use std::iter::once; use std::path::Path; use anyhow::Result; +use clap::Parser; use infra_utils::cargo::CargoWorkspace; use infra_utils::commands::Command; use infra_utils::git::TemporaryChangeset; -use infra_utils::github::GitHub; use infra_utils::paths::PathExtensions; use itertools::Itertools; -use crate::commands::publish::DryRun; +use crate::utils::DryRun; const USER_FACING_CRATES: &[&str] = &[ // Sorted by dependency order (from dependencies to dependents): @@ -19,36 +19,44 @@ const USER_FACING_CRATES: &[&str] = &[ "slang_solidity", ]; -pub fn publish_cargo(dry_run: DryRun) -> Result<()> { - let mut changeset = TemporaryChangeset::new( - "infra/cargo-publish", - "prepare Cargo packages for publishing", - )?; +#[derive(Clone, Debug, Parser)] +pub struct CargoController { + #[command(flatten)] + dry_run: DryRun, +} + +impl CargoController { + pub fn execute(&self) -> Result<()> { + let mut changeset = TemporaryChangeset::new( + "infra/cargo-publish", + "prepare Cargo packages for publishing", + )?; - let mut changed_crates = vec![]; + let mut changed_crates = vec![]; - for crate_name in USER_FACING_CRATES { - if prepare_for_publish(crate_name, &mut changeset)? { - changed_crates.push(crate_name); + for crate_name in USER_FACING_CRATES { + if prepare_for_publish(crate_name, &mut changeset)? { + changed_crates.push(crate_name); + } } - } - if changed_crates.is_empty() { - println!("No crates to publish."); - return Ok(()); - } + if changed_crates.is_empty() { + println!("No crates to publish."); + return Ok(()); + } - update_cargo_lock(&mut changeset)?; + update_cargo_lock(&mut changeset)?; - changeset.commit_changes()?; + changeset.commit_changes()?; - for crate_name in &changed_crates { - run_cargo_publish(crate_name, dry_run)?; - } + for crate_name in &changed_crates { + run_cargo_publish(crate_name, self.dry_run)?; + } - changeset.revert_changes()?; + changeset.revert_changes()?; - Ok(()) + Ok(()) + } } fn prepare_for_publish(crate_name: &str, changeset: &mut TemporaryChangeset) -> Result { @@ -120,10 +128,7 @@ fn run_cargo_publish(crate_name: &str, dry_run: DryRun) -> Result<()> { .property("--package", crate_name) .flag("--all-features"); - if dry_run.is_yes() || !GitHub::is_running_in_ci() { - println!( - "Attempting a dry run, since we are not running in CI or a dry run was requested." - ); + if dry_run.get() { command = command.flag("--dry-run"); } diff --git a/crates/infra/cli/src/commands/publish/changesets/mod.rs b/crates/infra/cli/src/commands/publish/changesets/mod.rs index 4186f025aa..8208e5d25e 100644 --- a/crates/infra/cli/src/commands/publish/changesets/mod.rs +++ b/crates/infra/cli/src/commands/publish/changesets/mod.rs @@ -1,96 +1,104 @@ +//! This repository versions and releases all its artifacts together, generating the same changelog. +//! Unfortunately, changesets does not support combining changelogs from multiple packages into one. +//! +//! So, we let changesets bump the version of the single NPM package we ship, and generate its changelog. +//! Then our build process copies the new version and the single changelog to other packages and crates. +//! +//! Additionally, changesets can only bump versions of packages in the root workspace. +//! However, NAPI platform-specific packages cannot be added to the workspace, because other platforms will fail "npm install". +//! So we have to bump the versions over ourselves anyways. + use anyhow::Result; +use clap::Parser; use infra_utils::cargo::CargoWorkspace; use infra_utils::commands::Command; use infra_utils::paths::{FileWalker, PathExtensions}; use crate::toolchains::napi::{NapiConfig, NapiResolver}; -/// This repository versions and releases all its artifacts together, generating the same changelog. -/// Unfortunately, changesets does not support combining changelogs from multiple packages into one. -/// -/// So, we let changesets bump the version of the single NPM package we ship, and generate its changelog. -/// Then our build process copies the new version and the single changelog to other packages and crates. -/// -/// Additionally, changesets can only bump versions of packages in the root workspace. -/// However, NAPI platform-specific packages cannot be added to the workspace, because other platforms will fail "npm install". -/// So we have to bump the versions over ourselves anyways. -pub fn publish_changesets() -> Result<()> { - let resolver = NapiResolver::Solidity; - let package_dir = resolver.main_package_dir(); - - let package_version = NapiConfig::local_version(&package_dir)?; - println!("Package version: {package_version}"); - - let workspace_version = CargoWorkspace::local_version()?; - println!("Workspace version: {workspace_version}"); - - assert_eq!( - package_version, workspace_version, - "Package version does not match workspace version." - ); - - // This command will: - // 1) Consume/delete any changeset files currently in "$REPO_ROOT/.changeset" - // 2) Update the CHANGELOG.md file for the NPM package. - // 3) Bump the version in its package.json accordingly. - - Command::new("changeset").arg("version").run()?; - - let updated_version = NapiConfig::local_version(&package_dir)?; - println!("Updated version: {updated_version}"); - - if package_version == updated_version { - println!("No version changes. Skipping."); - return Ok(()); - } +#[derive(Clone, Debug, Parser)] +pub struct ChangesetsController {} + +impl ChangesetsController { + #[allow(clippy::unused_self)] // for compatibility with other controllers: + pub fn execute(&self) -> Result<()> { + let resolver = NapiResolver::Solidity; + let package_dir = resolver.main_package_dir(); + + let package_version = NapiConfig::local_version(&package_dir)?; + println!("Package version: {package_version}"); - // Format the updated package files: + let workspace_version = CargoWorkspace::local_version()?; + println!("Workspace version: {workspace_version}"); - let package_dir = resolver.main_package_dir(); - Command::new("prettier") - .property("--write", package_dir.unwrap_str()) - .run()?; + assert_eq!( + package_version, workspace_version, + "Package version does not match workspace version." + ); - // Update NPM lock file: + // This command will: + // 1) Consume/delete any changeset files currently in "$REPO_ROOT/.changeset" + // 2) Update the CHANGELOG.md file for the NPM package. + // 3) Bump the version in its package.json accordingly. - Command::new("npm") - .arg("install") - .flag("--package-lock-only") - .run()?; + Command::new("changeset").arg("version").run()?; + + let updated_version = NapiConfig::local_version(&package_dir)?; + println!("Updated version: {updated_version}"); + + if package_version == updated_version { + println!("No version changes. Skipping."); + return Ok(()); + } - // Update Cargo workspace: + // Format the updated package files: - println!("Updating Cargo workspace version."); - CargoWorkspace::update_version(&updated_version)?; + let package_dir = resolver.main_package_dir(); + Command::new("prettier") + .property("--write", package_dir.unwrap_str()) + .run()?; - // Update Cargo lock file: + // Update NPM lock file: - Command::new("cargo") - .arg("update") - .flag("--workspace") - .run()?; + Command::new("npm") + .arg("install") + .flag("--package-lock-only") + .run()?; - // Update other CHANGELOG files: + // Update Cargo workspace: - let source_changelog = package_dir.join("CHANGELOG.md"); + println!("Updating Cargo workspace version."); + CargoWorkspace::update_version(&updated_version)?; - for destination_changelog in FileWalker::from_repo_root().find(["**/CHANGELOG.md"])? { - if source_changelog != destination_changelog { - println!("Updating: {destination_changelog:?}"); - std::fs::copy(&source_changelog, &destination_changelog)?; + // Update Cargo lock file: + + Command::new("cargo") + .arg("update") + .flag("--workspace") + .run()?; + + // Update other CHANGELOG files: + + let source_changelog = package_dir.join("CHANGELOG.md"); + + for destination_changelog in FileWalker::from_repo_root().find(["**/CHANGELOG.md"])? { + if source_changelog != destination_changelog { + println!("Updating: {destination_changelog:?}"); + std::fs::copy(&source_changelog, &destination_changelog)?; + } } - } - Command::new("git") - .args(["stash", "push"]) - .flag("--include-untracked") - .property("--message", "applied changesets") - .run()?; + Command::new("git") + .args(["stash", "push"]) + .flag("--include-untracked") + .property("--message", "applied changesets") + .run()?; - println!(); - println!("Source files are now updated with the new version, and stored in a 'git stash'."); - println!("The calling CI workflow will now use this stash to create a PR if needed."); - println!(); + println!(); + println!("Source files are now updated with the new version, and stored in a 'git stash'."); + println!("The calling CI workflow will now use this stash to create a PR if needed."); + println!(); - Ok(()) + Ok(()) + } } diff --git a/crates/infra/cli/src/commands/publish/github_release/mod.rs b/crates/infra/cli/src/commands/publish/github_release/mod.rs index 5ecba370f2..db6d2ab72e 100644 --- a/crates/infra/cli/src/commands/publish/github_release/mod.rs +++ b/crates/infra/cli/src/commands/publish/github_release/mod.rs @@ -1,6 +1,7 @@ use std::path::Path; use anyhow::Result; +use clap::Parser; use infra_utils::cargo::CargoWorkspace; use infra_utils::github::GitHub; use infra_utils::paths::PathExtensions; @@ -8,34 +9,41 @@ use itertools::Itertools; use markdown::{Block, Span}; use semver::Version; -use crate::commands::publish::DryRun; +use crate::utils::DryRun; -pub fn publish_github_release(dry_run: DryRun) -> Result<()> { - let current_version = CargoWorkspace::local_version()?; - println!("Current version: {current_version}"); +#[derive(Clone, Debug, Parser)] +pub struct GithubReleaseController { + #[command(flatten)] + dry_run: DryRun, +} - let previous_version = GitHub::latest_release_version()?; - println!("Latest published version: {previous_version}"); +impl GithubReleaseController { + pub fn execute(&self) -> Result<()> { + let current_version = CargoWorkspace::local_version()?; + println!("Current version: {current_version}"); - if current_version == previous_version { - println!("Skipping release, since the workspace version is already published."); - return Ok(()); - } + let previous_version = GitHub::latest_release_version()?; + println!("Latest published version: {previous_version}"); - let notes = extract_latest_changelogs(¤t_version, &previous_version)?; - let tag_name = format!("v{current_version}"); + if current_version == previous_version { + println!("Skipping release, since the workspace version is already published."); + return Ok(()); + } - println!("Creating release '{tag_name}' with contents:"); - println!(); - println!("{}", notes.lines().map(|l| format!(" │ {l}")).join("\n")); - println!(); + let notes = extract_latest_changelogs(¤t_version, &previous_version)?; + let tag_name = format!("v{current_version}"); - if dry_run.is_yes() || !GitHub::is_running_in_ci() { - println!("Skipping release, since we are not running in CI or a dry run was requested."); - return Ok(()); - } + println!("Creating release '{tag_name}' with contents:"); + println!(); + println!("{}", notes.lines().map(|l| format!(" │ {l}")).join("\n")); + println!(); - GitHub::create_new_release(tag_name, notes) + if self.dry_run.get() { + return Ok(()); + } + + GitHub::create_new_release(tag_name, notes) + } } fn extract_latest_changelogs( diff --git a/crates/infra/cli/src/commands/publish/mkdocs/mod.rs b/crates/infra/cli/src/commands/publish/mkdocs/mod.rs new file mode 100644 index 0000000000..fcd505917e --- /dev/null +++ b/crates/infra/cli/src/commands/publish/mkdocs/mod.rs @@ -0,0 +1,30 @@ +use anyhow::Result; +use clap::{Parser, ValueEnum}; + +use crate::toolchains::mkdocs::Mkdocs; +use crate::utils::DryRun; + +#[derive(Clone, Debug, Parser)] +pub struct MkdocsController { + /// The target version to publish. + #[arg(long)] + target: PublishTarget, + + #[command(flatten)] + dry_run: DryRun, +} + +#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, ValueEnum)] +enum PublishTarget { + MainBranch, + LatestRelease, +} + +impl MkdocsController { + pub fn execute(&self) -> Result<()> { + match self.target { + PublishTarget::MainBranch => Mkdocs::publish_main_branch(self.dry_run), + PublishTarget::LatestRelease => Mkdocs::publish_latest_release(self.dry_run), + } + } +} diff --git a/crates/infra/cli/src/commands/publish/mod.rs b/crates/infra/cli/src/commands/publish/mod.rs index 3386e7579f..7d4660a1ef 100644 --- a/crates/infra/cli/src/commands/publish/mod.rs +++ b/crates/infra/cli/src/commands/publish/mod.rs @@ -1,71 +1,52 @@ mod cargo; mod changesets; mod github_release; +mod mkdocs; mod npm; use anyhow::Result; -use clap::{Parser, ValueEnum}; -use infra_utils::terminal::Terminal; +use clap::{Parser, Subcommand}; -use crate::commands::publish::cargo::publish_cargo; -use crate::commands::publish::changesets::publish_changesets; -use crate::commands::publish::github_release::publish_github_release; -use crate::commands::publish::npm::publish_npm; -use crate::utils::ClapExtensions; +use crate::commands::publish::cargo::CargoController; +use crate::commands::publish::changesets::ChangesetsController; +use crate::commands::publish::github_release::GithubReleaseController; +use crate::commands::publish::mkdocs::MkdocsController; +use crate::commands::publish::npm::NpmController; #[derive(Clone, Debug, Parser)] pub struct PublishController { + #[command(subcommand)] command: PublishCommand, - - #[arg(long)] - dry_run: bool, -} - -#[derive(Clone, Copy)] -enum DryRun { - Yes, - No, -} - -impl DryRun { - fn is_yes(self) -> bool { - matches!(self, DryRun::Yes) - } -} - -impl From for DryRun { - fn from(value: bool) -> Self { - if value { - DryRun::Yes - } else { - DryRun::No - } - } } -#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, ValueEnum)] -enum PublishCommand { +#[derive(Clone, Debug, Subcommand)] +pub enum PublishCommand { /// Consume pending changesets, update changelogs and package versions, then send a PR. - Changesets, + Changesets(ChangesetsController), + /// Publish the documentation to GitHub pages. + Mkdocs(MkdocsController), /// Publish source packages to [npmjs.com]. - Npm, + Npm(NpmController), /// Publish source crates to [crates.io]. - Cargo, + Cargo(CargoController), /// Publish a new release in the GitHub repository. - GithubRelease, + GithubRelease(GithubReleaseController), } impl PublishController { pub fn execute(&self) -> Result<()> { - Terminal::step(format!("publish {name}", name = self.command.clap_name())); - - let dry_run = DryRun::from(self.dry_run); + self.command.execute() + } +} - match self.command { - PublishCommand::Changesets => publish_changesets(), - PublishCommand::Npm => publish_npm(dry_run), - PublishCommand::Cargo => publish_cargo(dry_run), - PublishCommand::GithubRelease => publish_github_release(dry_run), +impl PublishCommand { + pub fn execute(&self) -> Result<()> { + match self { + PublishCommand::Changesets(controller) => controller.execute(), + PublishCommand::Mkdocs(controller) => controller.execute(), + PublishCommand::Npm(controller) => controller.execute(), + PublishCommand::Cargo(controller) => controller.execute(), + PublishCommand::GithubRelease(controller) => controller.execute(), } } } diff --git a/crates/infra/cli/src/commands/publish/npm/mod.rs b/crates/infra/cli/src/commands/publish/npm/mod.rs index 6c52c523b4..8ee151063b 100644 --- a/crates/infra/cli/src/commands/publish/npm/mod.rs +++ b/crates/infra/cli/src/commands/publish/npm/mod.rs @@ -1,36 +1,44 @@ use std::path::Path; use anyhow::Result; +use clap::Parser; use infra_utils::commands::Command; -use infra_utils::github::GitHub; use infra_utils::paths::PathExtensions; -use crate::commands::publish::DryRun; use crate::toolchains::napi::{ NapiCompiler, NapiConfig, NapiPackageKind, NapiProfile, NapiResolver, }; +use crate::utils::DryRun; -pub fn publish_npm(dry_run: DryRun) -> Result<()> { - let resolver = NapiResolver::Solidity; +#[derive(Clone, Debug, Parser)] +pub struct NpmController { + #[command(flatten)] + dry_run: DryRun, +} - NapiCompiler::run(resolver, NapiProfile::Release)?; +impl NpmController { + pub fn execute(&self) -> Result<()> { + let resolver = NapiResolver::Solidity; - // Publish platform-specific packages first, as the main package now depends on their latest version: + NapiCompiler::run(resolver, NapiProfile::Release)?; - for platform_dir in resolver.platforms_dir().collect_children()? { - let platform = platform_dir.unwrap_name().to_owned(); - publish_package( - resolver, - &platform_dir, - &NapiPackageKind::Platform(platform), - dry_run, - )?; - } + // Publish platform-specific packages first, as the main package now depends on their latest version: - // Then publish the main package, that depends on the previously published platform-specific packages: + for platform_dir in resolver.platforms_dir().collect_children()? { + let platform = platform_dir.unwrap_name().to_owned(); + publish_package( + resolver, + &platform_dir, + &NapiPackageKind::Platform(platform), + self.dry_run, + )?; + } - let package_dir = resolver.main_package_dir(); - publish_package(resolver, &package_dir, &NapiPackageKind::Main, dry_run) + // Then publish the main package, that depends on the previously published platform-specific packages: + + let package_dir = resolver.main_package_dir(); + publish_package(resolver, &package_dir, &NapiPackageKind::Main, self.dry_run) + } } fn publish_package( @@ -58,8 +66,7 @@ fn publish_package( .args(["publish", output_dir.unwrap_str()]) .property("--access", "public"); - if dry_run.is_yes() || !GitHub::is_running_in_ci() { - println!("Doing a dry run, since we are not running in CI or a dry run was requested."); + if dry_run.get() { command = command.flag("--dry-run"); } diff --git a/crates/infra/cli/src/commands/setup/git/mod.rs b/crates/infra/cli/src/commands/setup/git/mod.rs new file mode 100644 index 0000000000..dfc8c11507 --- /dev/null +++ b/crates/infra/cli/src/commands/setup/git/mod.rs @@ -0,0 +1,22 @@ +use anyhow::Result; +use infra_utils::commands::Command; +use infra_utils::github::GitHub; + +pub fn setup_git() -> Result<()> { + if !GitHub::is_running_in_ci() { + println!("No need to modify local dev environments."); + return Ok(()); + } + + Command::new("git") + .arg("config") + .property("user.name", "github-actions") + .run()?; + + Command::new("git") + .arg("config") + .property("user.email", "github-actions@users.noreply.github.com") + .run()?; + + Ok(()) +} diff --git a/crates/infra/cli/src/commands/setup/mod.rs b/crates/infra/cli/src/commands/setup/mod.rs index 481bcbad78..1663ef984c 100644 --- a/crates/infra/cli/src/commands/setup/mod.rs +++ b/crates/infra/cli/src/commands/setup/mod.rs @@ -1,4 +1,5 @@ mod cargo; +mod git; mod npm; mod pipenv; mod shell_completions; @@ -8,6 +9,7 @@ use clap::{Parser, ValueEnum}; use infra_utils::terminal::Terminal; use crate::commands::setup::cargo::setup_cargo; +use crate::commands::setup::git::setup_git; use crate::commands::setup::npm::setup_npm; use crate::commands::setup::pipenv::setup_pipenv; use crate::commands::setup::shell_completions::setup_shell_completions; @@ -27,6 +29,8 @@ impl SetupController { #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, ValueEnum)] enum SetupCommand { + /// Prepare the local git client/repository. + Git, /// Install Cargo dependencies. Cargo, /// Install NPM dependencies. @@ -42,6 +46,7 @@ impl OrderedCommand for SetupCommand { Terminal::step(format!("setup {name}", name = self.clap_name())); match self { + SetupCommand::Git => setup_git(), SetupCommand::Cargo => setup_cargo(), SetupCommand::Npm => setup_npm(), SetupCommand::Pipenv => setup_pipenv(), diff --git a/crates/infra/cli/src/commands/setup/pipenv/mod.rs b/crates/infra/cli/src/commands/setup/pipenv/mod.rs index fd6b01ca59..6258afaf59 100644 --- a/crates/infra/cli/src/commands/setup/pipenv/mod.rs +++ b/crates/infra/cli/src/commands/setup/pipenv/mod.rs @@ -1,52 +1,7 @@ -use std::collections::HashMap; -use std::path::Path; +use anyhow::Result; -use anyhow::{Context, Result}; -use infra_utils::commands::Command; -use infra_utils::github::GitHub; -use infra_utils::paths::PathExtensions; -use serde::Deserialize; +use crate::toolchains::pipenv::PipEnv; pub fn setup_pipenv() -> Result<()> { - // Install the 'pipenv' binary using the version defined in the `Pipfile`. - install_pipenv_binary()?; - - // Use it to install other dependencies: - install_project_packages()?; - - Ok(()) -} - -#[derive(Deserialize)] -struct Pipfile { - packages: HashMap, -} - -fn install_pipenv_binary() -> Result<()> { - let pip_file_toml = Path::repo_path("Pipfile").read_to_string()?; - let pip_file: Pipfile = toml::from_str(&pip_file_toml)?; - - // This should be a value like "==YYYY.MM.DD" - let version = pip_file - .packages - .get("pipenv") - .context("Failed to find 'pipenv' in 'Pipfile' packages.")?; - - // pip3 install "pipenv==YYYY.MM.DD" - Command::new("pip3") - .arg("install") - .arg(format!("pipenv{version}")) - .run() -} - -fn install_project_packages() -> Result<()> { - let mut command = Command::new("python3") - .property("-m", "pipenv") - .arg("install"); - - if GitHub::is_running_in_ci() { - command = command.flag("--deploy"); - } - - command.run() + PipEnv::install_packages() } diff --git a/crates/infra/cli/src/toolchains/mkdocs/mod.rs b/crates/infra/cli/src/toolchains/mkdocs/mod.rs index 2565891d6e..6d1487e43d 100644 --- a/crates/infra/cli/src/toolchains/mkdocs/mod.rs +++ b/crates/infra/cli/src/toolchains/mkdocs/mod.rs @@ -1,36 +1,77 @@ use std::path::Path; use anyhow::Result; +use infra_utils::cargo::CargoWorkspace; use infra_utils::commands::Command; use infra_utils::paths::PathExtensions; +use crate::toolchains::pipenv::PipEnv; +use crate::utils::DryRun; + pub struct Mkdocs; impl Mkdocs { - pub fn build() -> Result<()> { - mkdocs_command() - .arg("build") - .flag("--clean") - .flag("--strict") - .run() + pub fn check() -> Result<()> { + mkdocs().arg("build").flag("--clean").flag("--strict").run() } pub fn watch() -> Result<()> { // _MKDOCS_WATCH_PORT_ | keep in sync with the port number defined in "$REPO_ROOT/.devcontainer/devcontainer.json" const PORT: usize = 5353; - mkdocs_command() + mkdocs() .arg("serve") .flag("--clean") .flag("--watch-theme") .property("--dev-addr", format!("localhost:{PORT}")) .run() } + + pub fn publish_main_branch(dry_run: DryRun) -> Result<()> { + fetch_latest_remote()?; + + let mut command = mike().args(["deploy", "main"]); + + if !dry_run.get() { + command = command.flag("--push"); + } + + command.run() + } + + pub fn publish_latest_release(dry_run: DryRun) -> Result<()> { + fetch_latest_remote()?; + + let version = CargoWorkspace::local_version()?.to_string(); + + if mike().args(["list", &version]).run().is_ok() { + println!("Version '{version}' is already published."); + return Ok(()); + } + + let mut command = mike() + .args(["deploy", &version, "latest"]) + .flag("--update-aliases"); + + if !dry_run.get() { + command = command.flag("--push"); + } + + command.run() + } +} + +fn fetch_latest_remote() -> Result<()> { + Command::new("git") + .args(["fetch", "origin", "gh-pages"]) + .property("--depth", "1") + .run() +} + +fn mkdocs() -> Command { + PipEnv::run("mkdocs").current_dir(Path::repo_path("documentation")) } -fn mkdocs_command() -> Command { - Command::new("python3") - .property("-m", "pipenv") - .args(["run", "mkdocs"]) - .current_dir(Path::repo_path("documentation")) +fn mike() -> Command { + PipEnv::run("mike").current_dir(Path::repo_path("documentation")) } diff --git a/crates/infra/cli/src/toolchains/mod.rs b/crates/infra/cli/src/toolchains/mod.rs index 1c4e299b68..4220506bae 100644 --- a/crates/infra/cli/src/toolchains/mod.rs +++ b/crates/infra/cli/src/toolchains/mod.rs @@ -1,2 +1,3 @@ pub mod mkdocs; pub mod napi; +pub mod pipenv; diff --git a/crates/infra/cli/src/toolchains/pipenv/mod.rs b/crates/infra/cli/src/toolchains/pipenv/mod.rs new file mode 100644 index 0000000000..10c460b239 --- /dev/null +++ b/crates/infra/cli/src/toolchains/pipenv/mod.rs @@ -0,0 +1,53 @@ +use std::collections::HashMap; +use std::path::Path; + +use anyhow::{Context, Result}; +use infra_utils::commands::Command; +use infra_utils::github::GitHub; +use infra_utils::paths::PathExtensions; +use serde::Deserialize; + +pub struct PipEnv; + +impl PipEnv { + pub fn install_packages() -> Result<()> { + let pip_file_toml = Path::repo_path("Pipfile").read_to_string()?; + let pip_file: Pipfile = toml::from_str(&pip_file_toml)?; + + // This should be a value like "==YYYY.MM.DD" + let version = pip_file + .packages + .get("pipenv") + .context("Failed to find 'pipenv' in 'Pipfile' packages.")?; + + // pip3 install "pipenv==YYYY.MM.DD" + Command::new("pip3") + .arg("install") + .arg(format!("pipenv{version}")) + .run()?; + + let mut command = Command::new("python3") + .property("-m", "pipenv") + .arg("install"); + + if GitHub::is_running_in_ci() { + command = command.flag("--deploy"); + } + + command.run()?; + + Ok(()) + } + + #[must_use] + pub fn run(name: impl Into) -> Command { + Command::new("python3") + .property("-m", "pipenv") + .args(["run", &name.into()]) + } +} + +#[derive(Deserialize)] +struct Pipfile { + packages: HashMap, +} diff --git a/crates/infra/cli/src/utils.rs b/crates/infra/cli/src/utils.rs index 944c25a7bd..df673fd7fa 100644 --- a/crates/infra/cli/src/utils.rs +++ b/crates/infra/cli/src/utils.rs @@ -1,5 +1,6 @@ use anyhow::{Ok, Result}; -use clap::ValueEnum; +use clap::{Parser, ValueEnum}; +use infra_utils::github::GitHub; pub trait OrderedCommand: Clone + Ord + PartialEq + ValueEnum { fn execute(&self) -> Result<()>; @@ -37,3 +38,25 @@ impl ClapExtensions for T { .to_owned(); } } + +#[derive(Clone, Copy, Debug, Parser)] +pub struct DryRun { + /// Attempt a dry run, instead of actually executing the command. + #[arg(long)] + dry_run: bool, +} + +impl DryRun { + pub fn get(self) -> bool { + if self.dry_run { + println!("Performing a dry run, since it was requested on the command line."); + true + } else if !GitHub::is_running_in_ci() { + println!("Performing a dry run, since we are not running in CI."); + true + } else { + println!("Performing a full run. You can pass '--dry-run' to simulate the execution."); + false + } + } +} diff --git a/crates/infra/utils/src/git/mod.rs b/crates/infra/utils/src/git/mod.rs index d628d1774b..d0850dac66 100644 --- a/crates/infra/utils/src/git/mod.rs +++ b/crates/infra/utils/src/git/mod.rs @@ -62,8 +62,6 @@ impl TemporaryChangeset { Command::new("git").arg("diff").flag("--cached").run()?; Command::new("git") - .property("-c", "user.name=github-actions") - .property("-c", "user.email=github-actions@users.noreply.github.com") .arg("commit") .property("--message", &self.message) .run()?; diff --git a/documentation/mkdocs.yml b/documentation/mkdocs.yml index 0aff27f51c..7f99f747dd 100644 --- a/documentation/mkdocs.yml +++ b/documentation/mkdocs.yml @@ -11,8 +11,8 @@ site_description: > Written in Rust and distributed in multiple languages. repo_name: "NomicFoundation/slang" -repo_url: "https://github.com/NomicFoundation/slang" -site_url: "https://NomicFoundation.github.io/slang" +repo_url: "https://github.com/NomicFoundation/slang/" +site_url: "https://NomicFoundation.github.io/slang/" edit_uri: "edit/main/documentation/public" docs_dir: "./public" @@ -59,6 +59,10 @@ extra: link: "https://twitter.com/nomicfoundation/" - icon: "fontawesome/solid/link" link: "https://nomic.foundation/" + version: + provider: "mike" + alias: true + default: "latest" # # Extensions: @@ -93,6 +97,8 @@ plugins: - "literate-nav": nav_file: ".navigation.md" # use a dot file name, to be excluded from public pages markdown_extensions: [] + - "mike": + canonical_version: "latest" - "minify": minify_html: true minify_js: true diff --git a/documentation/overrides/main.html b/documentation/overrides/main.html new file mode 100644 index 0000000000..a0461e1a0f --- /dev/null +++ b/documentation/overrides/main.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{% block outdated %} + You're not viewing the latest released version. + + Click here to go to the latest. + +{% endblock %} From 7e467ce199cb07acb443da9f542fbcc74f2a5321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Gir=C3=A1ldez?= Date: Wed, 7 Aug 2024 04:54:53 -0300 Subject: [PATCH 11/13] Remove `...` ellipsis from query syntax and add explicit adjacency operator (#1030) This PR changes the CST query syntax by: - Removing the `...` ellipsis operator and adding it implicitly at the edges and between elements in a matching sequence. So that `[Foo [A] [B]]` is equivalent to `[Foo ... [A] ... [B] ...]`. - Adding the `.` adjacency (anchor) operator to explicitly indicate that a matched node should be the first (eg. `[Foo . [A]]`) or last child (eg. `[Foo [A] .]`), or that two matched nodes should be consecutive (eg. `[Foo [A] . [B]]`). The adjacency operator is allowed in sub-sequences of alternative options or quantified sequences, but not at the beginning or end of the pattern, where the adjacency is implicit. So: `[Foo ([Bar] | [X] . [Y])]` is allowed, but `[Foo ([Bar] | . [X])]` is not. - Trivia kinds cannot be used in node matchers. The PR also introduces some semantic changes to query execution: - Trivia nodes are skipped over when executing a query and they cannot be matched against. - Only the first implicit ellipsis operator is allowed to match multiple nodes in a sequence of siblings, unless there is an explicit node match in between. This prevents the engine from returning duplicate results when two ellipsis operators are effectively adjacent (for example when they are separated by an optional matcher). For example, given a sequence such as `ABCD`, the query `[_] ["B"]? [_]` will operationally be equivalent to `[_] ... ["B"]? ... [_]`. With the previous semantics, this would have returned 4 results, matching: 1. zero nodes for the first ellipsis, the optional matches the `B` and the second ellipsis takes the `C` 2. zero nodes for the first ellipsis, zero nodes for the optional, and the second ellipsis takes both `BC` 3. first ellipsis takes `B`, optional matches nothing, and second ellipsis takes `C` 4. first ellipsis takes both `BC`, and optional and second ellipsis take no nodes After this PR, only two results are possible, corresponding to the cases i. and iv. above, since the second ellipsis is allowed to match nodes _only_ if the optional succeeds in matching at least some node. The two returned results are distinct though, because the user may want to capture the optional with the query `[_] @x ["B"]? [_]`. By unification semantics the optional can match zero or one nodes, which is consistent with the results obtained without capturing. --------- Co-authored-by: Omar Tawfik <15987992+OmarTawfik@users.noreply.github.com> --- .changeset/few-taxis-retire.md | 5 + .changeset/gentle-shirts-deliver.md | 5 + crates/metaslang/cst/src/query/engine.rs | 373 ++++++++++++++---- crates/metaslang/cst/src/query/model.rs | 10 +- crates/metaslang/cst/src/query/parser.rs | 184 ++++++--- .../inputs/language/bindings/rules.msgb | 200 ++++------ .../bindings/generated/binding_rules.rs | 200 ++++------ .../outputs/cargo/tests/src/binding_rules.rs | 22 ++ .../src/bindings_assertions/assertions.rs | 38 +- .../outputs/cargo/tests/src/bindings_rules.rs | 10 - .../src/doc_examples/tree_query_language.rs | 144 +++++-- .../tests/src/doc_examples/using_queries.rs | 15 +- .../solidity/outputs/cargo/tests/src/lib.rs | 2 +- .../tests/src/doc-examples/using-queries.ts | 15 +- .../outputs/cargo/tests/src/graph/mod.rs | 4 +- .../cargo/tests/src/query/engine_tests.rs | 267 ++++++++++++- .../cargo/tests/src/query/parser_tests.rs | 89 +++-- .../outputs/npm/tests/src/tests/query.ts | 2 +- .../public/user-guide/tree-query-language.md | 42 +- 19 files changed, 1127 insertions(+), 500 deletions(-) create mode 100644 .changeset/few-taxis-retire.md create mode 100644 .changeset/gentle-shirts-deliver.md create mode 100644 crates/solidity/outputs/cargo/tests/src/binding_rules.rs delete mode 100644 crates/solidity/outputs/cargo/tests/src/bindings_rules.rs diff --git a/.changeset/few-taxis-retire.md b/.changeset/few-taxis-retire.md new file mode 100644 index 0000000000..7b924c5feb --- /dev/null +++ b/.changeset/few-taxis-retire.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/slang": minor +--- + +Tree Query Language: queries now ignore trivia nodes. diff --git a/.changeset/gentle-shirts-deliver.md b/.changeset/gentle-shirts-deliver.md new file mode 100644 index 0000000000..77e5b8b740 --- /dev/null +++ b/.changeset/gentle-shirts-deliver.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/slang": minor +--- + +Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. diff --git a/crates/metaslang/cst/src/query/engine.rs b/crates/metaslang/cst/src/query/engine.rs index ff5f1284a1..995dfa2b89 100644 --- a/crates/metaslang/cst/src/query/engine.rs +++ b/crates/metaslang/cst/src/query/engine.rs @@ -9,7 +9,7 @@ use super::model::{ }; use crate::cst::NodeKind; use crate::query::CaptureQuantifier; -use crate::KindTypes; +use crate::{KindTypes, TerminalKind as _}; impl Cursor { pub fn query(self, queries: Vec>) -> QueryMatchIterator { @@ -46,6 +46,8 @@ impl Cursor { NodeSelector::EdgeLabelAndNodeText { .. } => false, }, + Node::::Terminal(terminal) if terminal.kind.is_trivia() => false, + Node::::Terminal(terminal) => match node_selector { NodeSelector::Anonymous => true, NodeSelector::NodeKind { node_kind } => { @@ -79,31 +81,67 @@ impl ASTNode { Self::Sequence(matcher) => matcher.children[0].can_match(cursor), Self::OneOrMore(matcher) => matcher.child.can_match(cursor), Self::Optional(_) => true, - Self::Ellipsis => true, + Self::Adjacency => true, } } - fn create_matcher(&self, cursor: Cursor) -> MatcherRef { + // The `require_explicit_match` parameter modifies the behaviour of this and + // later matchers. If this value is true, this and later matchers should not + // match sibling nodes implicitly. + // Currently this only modifies the behaviour of the ellipsis matcher, which + // otherwise will attempt to consume any number of sibling nodes. + // In a sequence of matchers, this value is set to true by the ellipsis + // operator itself, to consume all available sibling nodes and prevent later + // ellipsis matchers from doing so. + // Conversely, it's set to false by the `NodeMatcher`, both when recursing + // into its children and for later matchers after itself, as it handles an + // explicit match requested by the user. + // All other matchers should propagate the received value forward. + // + // The whole point of propagating this flag is to prevent a weird + // interaction between ellipsis operators working on the same set of sibling + // nodes. While two consecutive ellipsis operators should never happen, we + // have the `OptionalMatcher` which will not consume any nodes in the nil + // case. This means that `... [_]? ...` will effectively work (in one case) + // as `... ...`. If we allow both ellipsis operators to consume any number + // of nodes, for a sequence of N nodes we get N+1 identical query results + // when the operators take turns matching each prefix and complementary + // suffix of the list of nodes. By only allowing the first ellipsis operator + // to consume an arbitrary number of nodes, we reduce the returned matches + // to a single one. + // + fn create_matcher(&self, cursor: Cursor, require_explicit_match: bool) -> MatcherRef { match self { - Self::Capture(matcher) => { - Box::new(CaptureMatcher::::new(Rc::clone(matcher), cursor)) - } + Self::Capture(matcher) => Box::new(CaptureMatcher::::new( + Rc::clone(matcher), + cursor, + require_explicit_match, + )), Self::NodeMatch(matcher) => { + // By definition this matcher matches nodes explicitly Box::new(NodeMatchMatcher::::new(Rc::clone(matcher), cursor)) } - Self::Sequence(matcher) => { - Box::new(SequenceMatcher::::new(Rc::clone(matcher), cursor)) - } - Self::Alternatives(matcher) => { - Box::new(AlternativesMatcher::::new(Rc::clone(matcher), cursor)) - } - Self::Optional(matcher) => { - Box::new(OptionalMatcher::::new(Rc::clone(matcher), cursor)) - } - Self::OneOrMore(matcher) => { - Box::new(OneOrMoreMatcher::::new(Rc::clone(matcher), cursor)) - } - Self::Ellipsis => Box::new(EllipsisMatcher::::new(cursor)), + Self::Sequence(matcher) => Box::new(SequenceMatcher::::new( + Rc::clone(matcher), + cursor, + require_explicit_match, + )), + Self::Alternatives(matcher) => Box::new(AlternativesMatcher::::new( + Rc::clone(matcher), + cursor, + require_explicit_match, + )), + Self::Optional(matcher) => Box::new(OptionalMatcher::::new( + Rc::clone(matcher), + cursor, + require_explicit_match, + )), + Self::OneOrMore(matcher) => Box::new(OneOrMoreMatcher::::new( + Rc::clone(matcher), + cursor, + require_explicit_match, + )), + Self::Adjacency => Box::new(AdjacencyMatcher::::new(cursor, require_explicit_match)), } } } @@ -112,7 +150,7 @@ pub struct QueryMatch { pub queries: Rc>>, pub query_number: usize, pub root_cursor: Cursor, - // These correspond to the capture definitions in tne query + // These correspond to the capture definitions in the query pub captures: BTreeMap>>, } @@ -179,7 +217,8 @@ impl QueryMatchIterator { while self.query_number < self.queries.len() { let ast_node = &self.queries[self.query_number].ast_node; if ast_node.can_match(&self.cursor) { - self.matcher = Some(ast_node.create_matcher(self.cursor.clone())); + // The first matcher in the query should allow implicit matches + self.matcher = Some(ast_node.create_matcher(self.cursor.clone(), false)); return; }; self.query_number += 1; @@ -216,11 +255,28 @@ impl Iterator for QueryMatchIterator { } } +#[derive(Clone)] +struct MatcherResult { + // if cursor.is_completed() -> end of input + // if !cursor.is_completed() -> there is more input to go + cursor: Cursor, + + // Controls whether next matchers can match nodes implicitly. For matchers + // applied on a sequence of sibling nodes, this will be: + // - initially false, allowing the first found ellipsis matcher to consume + // an arbitrary number of nodes + // - true after the execution of an ellipsis, thus preventing later ellipsis + // from consuming nodes + // - propagated forward by other matchers, until + // - an actual `NodeMatcher` successfully matches a node, which then flips + // this value back to false + require_explicit_match: bool, +} + trait Matcher { // None -> failed to match, you must backtrack. DO NOT call again - // Some(cursor) if cursor.is_complete -> matched, end of input - // Some(cursor) if !cursor.is_complete -> matched, more input to go - fn next(&mut self) -> Option>; + // Some(result) -> matched, check result.cursor and pass require_explicit_match forward + fn next(&mut self) -> Option>; fn record_captures(&self, captures: &mut BTreeMap>>); } type MatcherRef = Box>; @@ -232,8 +288,14 @@ struct CaptureMatcher { } impl CaptureMatcher { - fn new(matcher: Rc>, cursor: Cursor) -> Self { - let child = matcher.child.create_matcher(cursor.clone()); + fn new( + matcher: Rc>, + cursor: Cursor, + require_explicit_match: bool, + ) -> Self { + let child = matcher + .child + .create_matcher(cursor.clone(), require_explicit_match); Self { matcher, cursor, @@ -243,7 +305,7 @@ impl CaptureMatcher { } impl Matcher for CaptureMatcher { - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { self.child.next() } @@ -275,7 +337,7 @@ impl NodeMatchMatcher { } impl Matcher for NodeMatchMatcher { - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { if self.cursor.is_completed() { return None; } @@ -293,25 +355,39 @@ impl Matcher for NodeMatchMatcher { if let Some(child) = self.matcher.child.as_ref() { let mut child_cursor = self.cursor.clone(); if !child_cursor.go_to_first_child() { + // We have child matchers, but no children. return None; } - self.child = Some(child.create_matcher(child_cursor)); + // Start traversing the children nodes allowing an ellipsis + // operator to match implicitly. + self.child = Some(child.create_matcher(child_cursor, false)); } else { + // We have no child matchers, we can return the result now. let mut return_cursor = self.cursor.clone(); return_cursor.irrevocably_go_to_next_sibling(); - return Some(return_cursor); + return Some(MatcherResult { + cursor: return_cursor, + require_explicit_match: false, + }); } } if let Some(child) = self.child.as_mut() { - while let Some(cursor) = child.as_mut().next() { + // Match our children with the child matcher repeatedly. + while let Some(MatcherResult { cursor, .. }) = child.as_mut().next() { if cursor.is_completed() { + // If match found and exhausted our children list, return + // the match *from our own cursor* let mut return_cursor = self.cursor.clone(); return_cursor.irrevocably_go_to_next_sibling(); - return Some(return_cursor); + return Some(MatcherResult { + cursor: return_cursor, + require_explicit_match: false, + }); } } + // No more matches from the child matcher, we will backtrack at this point. self.child = None; } @@ -325,43 +401,107 @@ impl Matcher for NodeMatchMatcher { } } +enum SequenceItem { + ChildMatcher(usize), + Ellipsis, +} + struct SequenceMatcher { matcher: Rc>, children: Vec>, cursor: Cursor, is_initialised: bool, + template: Vec, + require_explicit_match: bool, } -impl SequenceMatcher { - fn new(matcher: Rc>, cursor: Cursor) -> Self { +impl SequenceMatcher { + fn new( + matcher: Rc>, + cursor: Cursor, + require_explicit_match: bool, + ) -> Self { + // Produce a template of instructions to create the matchers for the + // sequence by inserting ellipsis matchers at the start, end, and in + // between each of the child matchers, unless we find an adjacency + // operator. If the sequence is adjacent (eg. option in alt or + // quantified group sequence) then we should not add matchers at the + // edges. + let (mut template, last_adjacent) = matcher.children.iter().enumerate().fold( + (Vec::new(), matcher.adjacent), + |(mut acc, last_adjacent), (index, child)| { + if matches!(child, ASTNode::Adjacency) { + if last_adjacent { + unreachable!("Found two consecutive adjacency operators") + } + acc.push(SequenceItem::ChildMatcher(index)); + (acc, true) + } else { + if !last_adjacent { + acc.push(SequenceItem::Ellipsis); + } + acc.push(SequenceItem::ChildMatcher(index)); + (acc, false) + } + }, + ); + if !last_adjacent && !matcher.adjacent { + template.push(SequenceItem::Ellipsis); + } Self { matcher, children: vec![], cursor, is_initialised: false, + template, + require_explicit_match, + } + } + + fn create_matcher( + &self, + index: usize, + cursor: Cursor, + require_explicit_match: bool, + ) -> MatcherRef { + let item = &self.template[index]; + match item { + SequenceItem::Ellipsis => { + Box::new(EllipsisMatcher::new(cursor, require_explicit_match)) + } + SequenceItem::ChildMatcher(index) => { + self.matcher.children[*index].create_matcher(cursor, require_explicit_match) + } } } } impl Matcher for SequenceMatcher { - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { if !self.is_initialised { self.is_initialised = true; let child_cursor = self.cursor.clone(); - let child = self.matcher.children[0].create_matcher(child_cursor); + let child = self.create_matcher(0, child_cursor, self.require_explicit_match); self.children.push(child); } while !self.children.is_empty() { - if let Some(child_cursor) = self.children.last_mut().unwrap().next() { - if self.children.len() == self.matcher.children.len() { - return Some(child_cursor); + if let Some(child_matcher_result) = self.children.last_mut().unwrap().next() { + if self.children.len() == self.template.len() { + // Last child, return its result as our own + return Some(child_matcher_result); } - - let child = self.matcher.children[self.children.len()].create_matcher(child_cursor); + // Create the next child matcher propagating the + // `require_explicit_match` flag forward. + let child = self.create_matcher( + self.children.len(), + child_matcher_result.cursor, + child_matcher_result.require_explicit_match, + ); self.children.push(child); } else { + // Backtrack self.children.pop(); } } @@ -381,26 +521,35 @@ struct AlternativesMatcher { next_child_number: usize, child: Option>, cursor: Cursor, + require_explicit_match: bool, } impl AlternativesMatcher { - fn new(matcher: Rc>, cursor: Cursor) -> Self { + fn new( + matcher: Rc>, + cursor: Cursor, + require_explicit_match: bool, + ) -> Self { Self { matcher, next_child_number: 0, child: None, cursor, + require_explicit_match, } } } impl Matcher for AlternativesMatcher { - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { loop { if self.child.is_none() { + // Create the next available child matcher forwarding the + // `require_explicit_match` flag, or give up if we have no more match self.matcher.children.get(self.next_child_number) { Some(child) => { - let child = child.create_matcher(self.cursor.clone()); + let child = + child.create_matcher(self.cursor.clone(), self.require_explicit_match); self.child = Some(child); self.next_child_number += 1; } @@ -409,7 +558,7 @@ impl Matcher for AlternativesMatcher { } match self.child.as_mut().unwrap().next() { - Some(cursor) => return Some(cursor), + Some(child_matcher_result) => return Some(child_matcher_result), None => self.child = None, } } @@ -425,37 +574,52 @@ struct OptionalMatcher { child: Option>, cursor: Cursor, have_nonempty_match: bool, + require_explicit_match: bool, } impl OptionalMatcher { - fn new(matcher: Rc>, cursor: Cursor) -> Self { + fn new( + matcher: Rc>, + cursor: Cursor, + require_explicit_match: bool, + ) -> Self { Self { matcher, child: None, cursor, have_nonempty_match: false, + require_explicit_match, } } } impl Matcher for OptionalMatcher { - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { if let Some(child) = self.child.as_mut() { - match child.next() { - r#match @ Some(_) => { - self.have_nonempty_match = true; - r#match - } - None => { - self.child = None; - None - } + // Second visit, we have a child matcher created + if let Some(child_matcher_result) = child.next() { + self.have_nonempty_match = true; + Some(child_matcher_result) + } else { + self.child = None; + None } } else { + // First visit, we don't have a child matcher yet, so create it + // forwarding our `require_explicit_match` flag let child_cursor = self.cursor.clone(); - let child = self.matcher.child.create_matcher(child_cursor); + let child = self + .matcher + .child + .create_matcher(child_cursor, self.require_explicit_match); self.child = Some(child); - Some(self.cursor.clone()) + + // Return a match result for the empty case, forwarding the + // `require_explicit_match` flag. + Some(MatcherResult { + cursor: self.cursor.clone(), + require_explicit_match: self.require_explicit_match, + }) } } @@ -471,36 +635,43 @@ impl Matcher for OptionalMatcher { struct OneOrMoreMatcher { matcher: Rc>, children: Vec>, - cursor_for_next_repetition: Option>, + result_for_next_repetition: Option>, } impl OneOrMoreMatcher { - fn new(matcher: Rc>, cursor: Cursor) -> Self { - let cursor_for_next_repetition = Some(cursor); + fn new( + matcher: Rc>, + cursor: Cursor, + require_explicit_match: bool, + ) -> Self { + let result_for_next_repetition = Some(MatcherResult { + cursor, + require_explicit_match, + }); Self { matcher, children: vec![], - cursor_for_next_repetition, + result_for_next_repetition, } } } impl Matcher for OneOrMoreMatcher { - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { loop { - if let Some(cursor_for_next_repetition) = self.cursor_for_next_repetition.take() { + if let Some(last_result) = self.result_for_next_repetition.take() { let next_child = self .matcher .child - .create_matcher(cursor_for_next_repetition); + .create_matcher(last_result.cursor, last_result.require_explicit_match); self.children.push(next_child); } else { let tail = self.children.last_mut().unwrap(); - if let Some(cursor) = tail.next() { - if !cursor.is_completed() { - self.cursor_for_next_repetition = Some(cursor.clone()); + if let Some(child_matcher_result) = tail.next() { + if !child_matcher_result.cursor.is_completed() { + self.result_for_next_repetition = Some(child_matcher_result.clone()); } - return Some(cursor); + return Some(child_matcher_result); } self.children.pop(); if self.children.is_empty() { @@ -517,29 +688,50 @@ impl Matcher for OneOrMoreMatcher { } } +/// Matches any number of sibling nodes and is used in between other matchers +/// when matching sequences, unless an explicit adjacency operator is found. +/// If `require_explicit_match` is true, then this matcher can only return a +/// result for the empty case. This usually means that in the same sequence of +/// siblings we found a previous ellipsis matcher which will be able to consume +/// an arbitrary number of nodes. Then, the value is false if this is the first +/// `EllipsisMatcher` in a sibling list, or there was an explicit match (by a +/// `NodeMatcher`) in a previous matcher of the sequence. struct EllipsisMatcher { cursor: Cursor, has_returned_initial_empty_value: bool, + require_explicit_match: bool, } impl EllipsisMatcher { - fn new(cursor: Cursor) -> Self { + fn new(cursor: Cursor, require_explicit_match: bool) -> Self { Self { cursor, has_returned_initial_empty_value: false, + require_explicit_match, } } } impl Matcher for EllipsisMatcher { - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { + // First visit, we always return a match for empty case if !self.has_returned_initial_empty_value { self.has_returned_initial_empty_value = true; - return Some(self.cursor.clone()); + // We need later matchers to avoid consuming nodes + return Some(MatcherResult { + cursor: self.cursor.clone(), + require_explicit_match: true, + }); } - if self.cursor.irrevocably_go_to_next_sibling() { - return Some(self.cursor.clone()); + // Subsequent visits: we only consume nodes if an explicit match is not + // required, ie. if this is the *first* ellipsis operator in a sibling + // sequence or there was an explicit match before us. + if !self.require_explicit_match && self.cursor.irrevocably_go_to_next_sibling() { + return Some(MatcherResult { + cursor: self.cursor.clone(), + require_explicit_match: true, + }); } None @@ -547,3 +739,36 @@ impl Matcher for EllipsisMatcher { fn record_captures(&self, _: &mut BTreeMap>>) {} } + +/// Greedily consumes available trivia nodes only +struct AdjacencyMatcher { + cursor: Option>, + require_explicit_match: bool, +} + +impl AdjacencyMatcher { + fn new(cursor: Cursor, require_explicit_match: bool) -> Self { + Self { + cursor: Some(cursor), + require_explicit_match, + } + } +} + +impl Matcher for AdjacencyMatcher { + fn next(&mut self) -> Option> { + if let Some(mut cursor) = self.cursor.take() { + while !cursor.is_completed() && cursor.node().is_trivia() { + cursor.irrevocably_go_to_next_sibling(); + } + Some(MatcherResult { + cursor, + require_explicit_match: self.require_explicit_match, + }) + } else { + None + } + } + + fn record_captures(&self, _: &mut BTreeMap>>) {} +} diff --git a/crates/metaslang/cst/src/query/model.rs b/crates/metaslang/cst/src/query/model.rs index a2f3a8dd1c..4a61405d9a 100644 --- a/crates/metaslang/cst/src/query/model.rs +++ b/crates/metaslang/cst/src/query/model.rs @@ -81,7 +81,7 @@ impl Query { capture_quantifiers, )?; } - ASTNode::Ellipsis => {} + ASTNode::Adjacency => {} } Ok(()) } @@ -113,7 +113,7 @@ pub enum ASTNode { Alternatives(Rc>), Sequence(Rc>), OneOrMore(Rc>), - Ellipsis, + Adjacency, } impl ASTNode { @@ -167,7 +167,7 @@ impl fmt::Display for ASTNode { Self::OneOrMore(one_or_more) => { write!(f, "({})+", one_or_more.child) } - Self::Ellipsis => write!(f, "..."), + Self::Adjacency => write!(f, "."), } } } @@ -256,6 +256,10 @@ pub struct NodeMatchASTNode { #[derive(Debug)] pub struct SequenceASTNode { pub children: Vec>, + // By default sequences can match any number of nodes at the beginning and + // end of it. Setting this value to true prevents it and instead forces + // strict adjacency at the edges. + pub adjacent: bool, } #[derive(Debug)] diff --git a/crates/metaslang/cst/src/query/parser.rs b/crates/metaslang/cst/src/query/parser.rs index a43ca8f205..6f490ac9a2 100644 --- a/crates/metaslang/cst/src/query/parser.rs +++ b/crates/metaslang/cst/src/query/parser.rs @@ -2,10 +2,10 @@ use std::fmt; use std::rc::Rc; use nom::branch::alt; -use nom::bytes::complete::{is_not, tag, take_while, take_while1, take_while_m_n}; -use nom::character::complete::{char, multispace0, multispace1, satisfy}; +use nom::bytes::complete::{is_not, take_while, take_while1, take_while_m_n}; +use nom::character::complete::{char, multispace0, multispace1, none_of, satisfy}; use nom::combinator::{ - all_consuming, cut, map_opt, map_res, opt, peek, recognize, success, value, verify, + all_consuming, cut, eof, map_opt, map_res, opt, peek, recognize, success, value, verify, }; use nom::error::{ErrorKind, FromExternalError, ParseError}; use nom::multi::{fold_many0, many1, separated_list1}; @@ -19,7 +19,7 @@ use super::model::{ }; use crate::cst::NodeKind; use crate::text_index::TextIndex; -use crate::{AbstractKind as _, KindTypes}; +use crate::{AbstractKind as _, KindTypes, TerminalKind as _}; // ---------------------------------------------------------------------------- // Parse errors @@ -47,10 +47,21 @@ enum QueryParserErrorKind { Syntax(QuerySyntaxError), } +#[derive(Clone)] enum QuerySyntaxError { EdgeLabel(String), NodeKind(String), EscapedUnicode, + DeprecatedEllipsis, + ForbiddenTriviaKind, +} + +impl QueryParserError { + fn from_query_syntax_error(input: I, error: QuerySyntaxError) -> Self { + QueryParserError { + errors: vec![(input, QueryParserErrorKind::Syntax(error))], + } + } } impl ParseError for QueryParserError { @@ -74,9 +85,7 @@ impl ParseError for QueryParserError { impl FromExternalError for QueryParserError { fn from_external_error(input: I, _kind: ErrorKind, e: QuerySyntaxError) -> Self { - QueryParserError { - errors: vec![(input, QueryParserErrorKind::Syntax(e))], - } + Self::from_query_syntax_error(input, e) } } @@ -88,6 +97,12 @@ impl fmt::Display for QuerySyntaxError { QuerySyntaxError::EscapedUnicode => { write!(f, "Invalid escaped Unicode character") } + QuerySyntaxError::DeprecatedEllipsis => { + write!(f, "The ellipsis `...` operator is deprecated, and replaced with a new adjacency `.` operator. For more information, check the Tree Query Language guide: https://nomicfoundation.github.io/slang/user-guide/tree-query-language/") + } + QuerySyntaxError::ForbiddenTriviaKind => { + write!(f, "Matching trivia nodes directly is forbidden. For more information, check the Tree Query Language guide: https://nomicfoundation.github.io/slang/user-guide/tree-query-language/") + } } } } @@ -149,7 +164,7 @@ fn compute_row_and_column(target: &str, input: &str) -> TextIndex { fn parse_matcher_alternatives( i: &str, ) -> IResult<&str, ASTNode, QueryParserError<&str>> { - separated_list1(token('|'), parse_matcher_sequence::) + separated_list1(token('|'), parse_matcher_alt_sequence::) .map(|mut children| { if children.len() == 1 { children.pop().unwrap() @@ -163,38 +178,76 @@ fn parse_matcher_alternatives( fn parse_matcher_sequence( i: &str, ) -> IResult<&str, ASTNode, QueryParserError<&str>> { - many1(parse_quantified_matcher::) - .map(|mut children| { - if children.len() == 1 { - children.pop().unwrap() - } else { - ASTNode::Sequence(Rc::new(SequenceASTNode { children })) - } - }) - .parse(i) + verify( + many1(parse_sequence_item::), + |children: &[ASTNode]| { + // It doesn't make sense for a sequence to be a single adjacency operator + children.len() > 1 || !matches!(children[0], ASTNode::Adjacency) + }, + ) + .map(|children| { + ASTNode::Sequence(Rc::new(SequenceASTNode { + children, + adjacent: false, + })) + }) + .parse(i) } -fn parse_quantified_matcher( +fn parse_matcher_alt_sequence( i: &str, ) -> IResult<&str, ASTNode, QueryParserError<&str>> { + verify( + many1(parse_sequence_item::), + |children: &[ASTNode]| { + // Alternative sequences cannot start or end with an adjacency + // operator, because it is implicitly adjacent to the previous and + // next matchers + !matches!(children[0], ASTNode::Adjacency) + && !matches!(children[children.len() - 1], ASTNode::Adjacency) + }, + ) + .map(|mut children| { + if children.len() == 1 { + // Alternative sequences of length 1 can be simplified to the child pattern + children.pop().unwrap() + } else { + ASTNode::Sequence(Rc::new(SequenceASTNode { + children, + adjacent: true, + })) + } + }) + .parse(i) +} + +fn parse_sequence_item(i: &str) -> IResult<&str, ASTNode, QueryParserError<&str>> { alt(( - ellipsis_token.map(|_| ASTNode::Ellipsis), // Cannot be quantified - pair( - parse_bound_matcher, - parse_trailing_quantifier, // admits epsilon - ) - .map(|(child, quantifier)| match quantifier { - CaptureQuantifier::ZeroOrOne => ASTNode::Optional(Rc::new(OptionalASTNode { child })), - CaptureQuantifier::ZeroOrMore => ASTNode::Optional(Rc::new(OptionalASTNode { - child: ASTNode::OneOrMore(Rc::new(OneOrMoreASTNode { child })), - })), - CaptureQuantifier::OneOrMore => ASTNode::OneOrMore(Rc::new(OneOrMoreASTNode { child })), - CaptureQuantifier::One => child, - }), + ellipsis_token, + adjacency_operator::, + parse_quantified_matcher::, )) .parse(i) } +fn parse_quantified_matcher( + i: &str, +) -> IResult<&str, ASTNode, QueryParserError<&str>> { + pair( + parse_bound_matcher, + parse_trailing_quantifier, // admits epsilon + ) + .map(|(child, quantifier)| match quantifier { + CaptureQuantifier::ZeroOrOne => ASTNode::Optional(Rc::new(OptionalASTNode { child })), + CaptureQuantifier::ZeroOrMore => ASTNode::Optional(Rc::new(OptionalASTNode { + child: ASTNode::OneOrMore(Rc::new(OneOrMoreASTNode { child })), + })), + CaptureQuantifier::OneOrMore => ASTNode::OneOrMore(Rc::new(OneOrMoreASTNode { child })), + CaptureQuantifier::One => child, + }) + .parse(i) +} + fn parse_bound_matcher(i: &str) -> IResult<&str, ASTNode, QueryParserError<&str>> { pair( opt(capture_name_token), @@ -307,7 +360,10 @@ fn anonymous_selector( terminated( terminated( char('_'), - peek(satisfy(|c| c != '_' && !c.is_alphanumeric())), + peek( + eof.map(|_| ' ') + .or(satisfy(|c| c != '_' && !c.is_alphanumeric())), + ), ), multispace0, ) @@ -319,14 +375,21 @@ fn kind_token(i: &str) -> IResult<&str, NodeKind, QueryParserEr terminated( preceded( peek(satisfy(|c| c.is_alphabetic() || c == '_')), - cut(map_res(raw_identifier, |id| { - T::TerminalKind::try_from_str(id.as_str()) - .map(NodeKind::Terminal) - .or_else(|_| { - T::NonterminalKind::try_from_str(id.as_str()).map(NodeKind::Nonterminal) - }) - .or(Err(QuerySyntaxError::NodeKind(id))) - })), + cut(map_res( + raw_identifier, + |id| match T::TerminalKind::try_from_str(id.as_str()) { + Ok(kind) => { + if kind.is_trivia() { + Err(QuerySyntaxError::ForbiddenTriviaKind) + } else { + Ok(NodeKind::Terminal(kind)) + } + } + Err(_) => T::NonterminalKind::try_from_str(id.as_str()) + .map(NodeKind::Nonterminal) + .or(Err(QuerySyntaxError::NodeKind(id))), + }, + )), ), multispace0, ) @@ -413,10 +476,43 @@ fn text_token(i: &str) -> IResult<&str, String, QueryParserError<&str>> { .parse(i) } -fn ellipsis_token(i: &str) -> IResult<&str, &str, QueryParserError<&str>> { - terminated(tag("..."), multispace0).parse(i) -} - fn token<'input>(c: char) -> impl Parser<&'input str, char, QueryParserError<&'input str>> { terminated(char(c), multispace0) } + +fn adjacency_operator(i: &str) -> IResult<&str, ASTNode, QueryParserError<&str>> { + // An adjacency operator is a single '.' character, and cannot be followed + // by another adjacency operator + pair(token('.'), cut(peek(none_of(". \t\r\n")))) + .map(|_| ASTNode::Adjacency) + .parse(i) +} + +fn recognize_as_failure( + error: QuerySyntaxError, + mut parser: F, +) -> impl FnMut(I) -> IResult> +where + F: nom::Parser>, +{ + use nom::Err::Failure; + move |input: I| { + let i = input.clone(); + match parser.parse(i) { + Ok((_, _)) => Err(Failure(QueryParserError::from_query_syntax_error( + input, + error.clone(), + ))), + Err(e) => Err(e), + } + } +} + +fn ellipsis_token(i: &str) -> IResult<&str, O, QueryParserError<&str>> { + use nom::bytes::complete::tag; + recognize_as_failure( + QuerySyntaxError::DeprecatedEllipsis, + terminated(tag("..."), multispace0), + ) + .parse(i) +} diff --git a/crates/solidity/inputs/language/bindings/rules.msgb b/crates/solidity/inputs/language/bindings/rules.msgb index 524d8c64c3..ad683dc7c9 100644 --- a/crates/solidity/inputs/language/bindings/rules.msgb +++ b/crates/solidity/inputs/language/bindings/rules.msgb @@ -94,8 +94,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; Top-level definitions... -@source_unit [SourceUnit ... [SourceUnitMembers - ... +@source_unit [SourceUnit [SourceUnitMembers [SourceUnitMember @unit_member ( [ContractDefinition] | [InterfaceDefinition] @@ -108,8 +107,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i | [UserDefinedValueTypeDefinition] | [EventDefinition] )] - ... -] ...] { +]] { edge @unit_member.lexical_scope -> @source_unit.lexical_scope ;; ... are available in the file's lexical scope @@ -124,7 +122,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Named definitions (contracts, functions, libraries, etc.) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@contract [ContractDefinition ... @name name: [Identifier] ...] { +@contract [ContractDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -147,7 +145,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge type_member -> @contract.type_members } -@interface [InterfaceDefinition ... @name name: [Identifier] ...] { +@interface [InterfaceDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -170,7 +168,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge type_member -> @interface.type_members } -@library [LibraryDefinition ... @name name: [Identifier] ...] { +@library [LibraryDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -183,7 +181,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge member -> @library.members } -@function [FunctionDefinition ... name: [FunctionName ... @name [Identifier] ...] ...] { +@function [FunctionDefinition name: [FunctionName @name [Identifier]]] { node def attr (def) node_definition = @name @@ -221,16 +219,16 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; The identifier path constructs a path of nodes connected from right to left -[IdentifierPath ... @name [Identifier] ...] { +[IdentifierPath @name [Identifier]] { node @name.ref attr (@name.ref) node_reference = @name } -@id_path [IdentifierPath ... @name [Identifier] (trailing_trivia:[_])*] { +@id_path [IdentifierPath @name [Identifier] .] { edge @id_path.right -> @name.ref } -[IdentifierPath ... @left_name [Identifier] [Period] @right_name [Identifier] ...] { +[IdentifierPath @left_name [Identifier] . [Period] . @right_name [Identifier]] { node member attr (member) push_symbol = "." @@ -238,7 +236,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge member -> @left_name.ref } -@id_path [IdentifierPath (leading_trivia:[_])* @name [Identifier] ...] { +@id_path [IdentifierPath . @name [Identifier]] { edge @name.ref -> @id_path.left } @@ -252,11 +250,11 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i node @param.def } -@param [Parameter ... @type_name [TypeName] ...] { +@param [Parameter @type_name [TypeName]] { edge @type_name.type_ref -> @param.lexical_scope } -@param [Parameter ... @type_name [TypeName] ... @name [Identifier]] { +@param [Parameter @type_name [TypeName] @name [Identifier]] { node def attr (def) node_definition = @name @@ -269,11 +267,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge typeof -> @type_name.output } -@function [FunctionDefinition ... parameters: [ParametersDeclaration - ... - [Parameters ... @param item: [Parameter] ...] - ... -] ...] { +@function [FunctionDefinition parameters: [ParametersDeclaration + [Parameters @param item: [Parameter]] +]] { edge @param.lexical_scope -> @function.lexical_scope ;; Input parameters are available in the function scope @@ -281,11 +277,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i attr (@function.lexical_scope -> @param.def) precedence = 1 } -@function [FunctionDefinition ... returns: [ReturnsDeclaration - ... - [ParametersDeclaration ... [Parameters ... @param item: [Parameter] ...] ...] - ... -] ...] { +@function [FunctionDefinition returns: [ReturnsDeclaration + [ParametersDeclaration [Parameters @param item: [Parameter]]] +]] { edge @param.lexical_scope -> @function.lexical_scope ;; Return parameters are available in the function scope @@ -299,29 +293,23 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; NB. free-functions (ie. those defined at the file's level) are already ;; covered above -@contract [ContractDefinition ... members: [ContractMembers - ... +@contract [ContractDefinition members: [ContractMembers item: [ContractMember @function variant: [FunctionDefinition]] - ... -] ...] { +]] { edge @function.lexical_scope -> @contract.lexical_scope edge @contract.members -> @function.def } -@interface [InterfaceDefinition ... members: [InterfaceMembers - ... +@interface [InterfaceDefinition members: [InterfaceMembers item: [ContractMember @function variant: [FunctionDefinition]] - ... -] ...] { +]] { edge @function.lexical_scope -> @interface.lexical_scope edge @interface.members -> @function.def } -@library [LibraryDefinition ... members: [LibraryMembers - ... +@library [LibraryDefinition members: [LibraryMembers item: [ContractMember @function variant: [FunctionDefinition]] - ... -] ...] { +]] { edge @function.lexical_scope -> @library.lexical_scope edge @library.members -> @function.def } @@ -351,20 +339,20 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; The first statement in a block -@block [Block ... [Statements @stmt [Statement] ...] ...] { +@block [Block [Statements . @stmt [Statement]]] { if (version-matches ">= 0.5.0") { edge @stmt.lexical_scope -> @block.lexical_scope } } ;; Two consecutive statements -[Statements ... @left_stmt [Statement] @right_stmt [Statement] ...] { +[Statements @left_stmt [Statement] . @right_stmt [Statement]] { if (version-matches ">= 0.5.0") { edge @right_stmt.lexical_scope -> @left_stmt.lexical_scope } } -@block [Block ... [Statements ... @stmt [Statement]...] ...] { +@block [Block [Statements @stmt [Statement]]] { ;; Hoist statement definitions for Solidity < 0.5.0 if (version-matches "< 0.5.0") { ;; definitions are carried over to the block @@ -390,7 +378,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; Connect the function body's block lexical scope to the function -@function [FunctionDefinition ... [FunctionBody @block [Block]] ...] { +@function [FunctionDefinition [FunctionBody @block [Block]]] { edge @block.lexical_scope -> @function.lexical_scope } @@ -400,11 +388,8 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @stmt [Statement [VariableDeclarationStatement - ... [VariableDeclarationType @var_type [TypeName]] - ... @name name: [Identifier] - ... ]] { node def attr (def) node_definition = @name @@ -419,26 +404,23 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge typeof -> @var_type.output } -@stmt [Statement [TupleDeconstructionStatement ... [TupleDeconstructionElements - ... - [TupleDeconstructionElement [TupleMember variant: [UntypedTupleMember ... @name name: [Identifier]]]] - ... -] ...]] { +@stmt [Statement [TupleDeconstructionStatement [TupleDeconstructionElements + [TupleDeconstructionElement [TupleMember variant: [UntypedTupleMember + @name name: [Identifier] + ]]] +]]] { node def attr (def) node_definition = @name edge @stmt.defs -> def } -@stmt [Statement [TupleDeconstructionStatement ... [TupleDeconstructionElements - ... +@stmt [Statement [TupleDeconstructionStatement [TupleDeconstructionElements [TupleDeconstructionElement [TupleMember variant: [TypedTupleMember - ... @member_type type_name: [TypeName] - ... - @name name: [Identifier]]]] - ... -] ...]] { + @name name: [Identifier] + ]]] +]]] { node def attr (def) node_definition = @name @@ -463,11 +445,8 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @state_var [StateVariableDefinition - ... @type_name type_name: [TypeName] - ... @name name: [Identifier] - ... ] { node def attr (def) node_definition = @name @@ -485,11 +464,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; NB. Even though the grammar allows it, state variables can only be declared ;; inside contracts, and not interfaces or libraries. So, we will only bind ;; contract state variables. -@contract [ContractDefinition ... members: [ContractMembers - ... +@contract [ContractDefinition members: [ContractMembers item: [ContractMember @state_var variant: [StateVariableDefinition]] - ... -] ...] { +]] { edge @state_var.lexical_scope -> @contract.lexical_scope edge @contract.lexical_scope -> @state_var.def } @@ -499,7 +476,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Enum definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@enum [EnumDefinition ... @name name: [Identifier] ...] { +@enum [EnumDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -513,9 +490,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @enum [EnumDefinition - ... - members: [EnumMembers ... @item [Identifier] ...] - ... + members: [EnumMembers @item [Identifier]] ] { node def attr (def) node_definition = @item @@ -527,27 +502,21 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; NB. top-level enums (ie. those defined at the file's level) are already ;; covered above -@contract [ContractDefinition ... members: [ContractMembers - ... +@contract [ContractDefinition members: [ContractMembers item: [ContractMember @enum variant: [EnumDefinition]] - ... -] ...] { +]] { edge @contract.type_members -> @enum.def } -@interface [InterfaceDefinition ... members: [InterfaceMembers - ... +@interface [InterfaceDefinition members: [InterfaceMembers item: [ContractMember @enum variant: [EnumDefinition]] - ... -] ...] { +]] { edge @interface.type_members -> @enum.def } -@library [LibraryDefinition ... members: [LibraryMembers - ... +@library [LibraryDefinition members: [LibraryMembers item: [ContractMember @enum variant: [EnumDefinition]] - ... -] ...] { +]] { edge @library.members -> @enum.def } @@ -556,7 +525,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Structure definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@struct [StructDefinition ... @name name: [Identifier] ...] { +@struct [StructDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -573,16 +542,14 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge member -> @struct.members } -@struct [StructDefinition ... [StructMembers ... @member item: [StructMember] ...] ...] { +@struct [StructDefinition [StructMembers @member item: [StructMember]]] { node @member.lexical_scope edge @member.lexical_scope -> @struct.lexical_scope } -@struct [StructDefinition ... [StructMembers - ... - @member item: [StructMember ... @type_name [TypeName] ... @name name: [Identifier] ...] - ... -] ...] { +@struct [StructDefinition [StructMembers + @member item: [StructMember @type_name [TypeName] @name name: [Identifier]] +]] { node def attr (def) node_definition = @name @@ -601,29 +568,23 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; NB. top-level enums (ie. those defined at the file's level) are already ;; covered above -@contract [ContractDefinition ... members: [ContractMembers - ... +@contract [ContractDefinition members: [ContractMembers item: [ContractMember @struct variant: [StructDefinition]] - ... -] ...] { +]] { edge @struct.lexical_scope -> @contract.lexical_scope edge @contract.type_members -> @struct.def } -@interface [InterfaceDefinition ... members: [InterfaceMembers - ... +@interface [InterfaceDefinition members: [InterfaceMembers item: [ContractMember @struct variant: [StructDefinition]] - ... -] ...] { +]] { edge @struct.lexical_scope -> @interface.lexical_scope edge @interface.type_members -> @struct.def } -@library [LibraryDefinition ... members: [LibraryMembers - ... +@library [LibraryDefinition members: [LibraryMembers item: [ContractMember @struct variant: [StructDefinition]] - ... -] ...] { +]] { edge @struct.lexical_scope -> @library.lexical_scope edge @library.members -> @struct.def } @@ -640,38 +601,32 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; General case for nested expressions -@expr [Expression ... variant: [_ ... @child [Expression] ...] ...] { +@expr [Expression variant: [_ @child [Expression]]] { edge @child.lexical_scope -> @expr.lexical_scope } ;; Expressions as statements -@stmt [Statement ... variant: [_ ... @expr [Expression] ...] ...] { +@stmt [Statement variant: [_ @expr [Expression]]] { edge @expr.lexical_scope -> @stmt.lexical_scope } ;; Expressions used for variable declarations -@stmt [Statement ... variant: [VariableDeclarationStatement - ... - value: [VariableDeclarationValue ... @expr [Expression] ...] - ... -] ...] { +@stmt [Statement variant: [VariableDeclarationStatement + value: [VariableDeclarationValue @expr [Expression]] +]] { edge @expr.lexical_scope -> @stmt.lexical_scope } ;; Expressions used for state variable declarations @state_var [StateVariableDefinition - ... - value: [StateVariableDefinitionValue ... @expr [Expression]] - ... + value: [StateVariableDefinitionValue @expr [Expression]] ] { edge @expr.lexical_scope -> @state_var.lexical_scope } ;; Tuple expressions @tuple_expr [Expression [TupleExpression - ... - items: [TupleValues ... [TupleValue @expr [Expression]] ...] - ... + items: [TupleValues [TupleValue @expr [Expression]]] ]] { edge @expr.lexical_scope -> @tuple_expr.lexical_scope } @@ -679,7 +634,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Identifier expressions -@expr [Expression ... @name variant: [Identifier]] { +@expr [Expression @name variant: [Identifier]] { node ref attr (ref) node_reference = @name @@ -691,13 +646,10 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Member access expressions ;; TODO: implement variant for `.address` member -@expr [Expression ... [MemberAccessExpression - ... +@expr [Expression [MemberAccessExpression @operand operand: [Expression] - ... @name member: [Identifier] - ... -...]] { +]] { node ref attr (ref) node_reference = @name @@ -720,14 +672,12 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @args [ArgumentsDeclaration [PositionalArgumentsDeclaration - ... - [PositionalArguments ... @argument [Expression] ...] - ... + [PositionalArguments @argument [Expression]] ]] { edge @argument.lexical_scope -> @args.lexical_scope } -@named_arg [NamedArgument ... @name [Identifier] [Colon] @value [Expression]] { +@named_arg [NamedArgument @name [Identifier] [Colon] @value [Expression]] { node @named_arg.lexical_scope edge @value.lexical_scope -> @named_arg.lexical_scope @@ -739,22 +689,18 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @args [ArgumentsDeclaration [NamedArgumentsDeclaration - ... - [NamedArgumentGroup ... [NamedArguments ... @argument [NamedArgument] ...] ...] - ... + [NamedArgumentGroup [NamedArguments @argument [NamedArgument]]] ]] { edge @argument.lexical_scope -> @args.lexical_scope } -@funcall [Expression [FunctionCallExpression ... @args [ArgumentsDeclaration]]] { +@funcall [Expression [FunctionCallExpression @args [ArgumentsDeclaration]]] { edge @args.lexical_scope -> @funcall.lexical_scope } ;;; Type expressions -@type_expr [Expression [TypeExpression ... @type [TypeName] ...]] { +@type_expr [Expression [TypeExpression @type [TypeName]]] { edge @type.type_ref -> @type_expr.lexical_scope } - - diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs index 0c47769020..28e97320f8 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs @@ -99,8 +99,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; Top-level definitions... -@source_unit [SourceUnit ... [SourceUnitMembers - ... +@source_unit [SourceUnit [SourceUnitMembers [SourceUnitMember @unit_member ( [ContractDefinition] | [InterfaceDefinition] @@ -113,8 +112,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i | [UserDefinedValueTypeDefinition] | [EventDefinition] )] - ... -] ...] { +]] { edge @unit_member.lexical_scope -> @source_unit.lexical_scope ;; ... are available in the file's lexical scope @@ -129,7 +127,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Named definitions (contracts, functions, libraries, etc.) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@contract [ContractDefinition ... @name name: [Identifier] ...] { +@contract [ContractDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -152,7 +150,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge type_member -> @contract.type_members } -@interface [InterfaceDefinition ... @name name: [Identifier] ...] { +@interface [InterfaceDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -175,7 +173,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge type_member -> @interface.type_members } -@library [LibraryDefinition ... @name name: [Identifier] ...] { +@library [LibraryDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -188,7 +186,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge member -> @library.members } -@function [FunctionDefinition ... name: [FunctionName ... @name [Identifier] ...] ...] { +@function [FunctionDefinition name: [FunctionName @name [Identifier]]] { node def attr (def) node_definition = @name @@ -226,16 +224,16 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; The identifier path constructs a path of nodes connected from right to left -[IdentifierPath ... @name [Identifier] ...] { +[IdentifierPath @name [Identifier]] { node @name.ref attr (@name.ref) node_reference = @name } -@id_path [IdentifierPath ... @name [Identifier] (trailing_trivia:[_])*] { +@id_path [IdentifierPath @name [Identifier] .] { edge @id_path.right -> @name.ref } -[IdentifierPath ... @left_name [Identifier] [Period] @right_name [Identifier] ...] { +[IdentifierPath @left_name [Identifier] . [Period] . @right_name [Identifier]] { node member attr (member) push_symbol = "." @@ -243,7 +241,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge member -> @left_name.ref } -@id_path [IdentifierPath (leading_trivia:[_])* @name [Identifier] ...] { +@id_path [IdentifierPath . @name [Identifier]] { edge @name.ref -> @id_path.left } @@ -257,11 +255,11 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i node @param.def } -@param [Parameter ... @type_name [TypeName] ...] { +@param [Parameter @type_name [TypeName]] { edge @type_name.type_ref -> @param.lexical_scope } -@param [Parameter ... @type_name [TypeName] ... @name [Identifier]] { +@param [Parameter @type_name [TypeName] @name [Identifier]] { node def attr (def) node_definition = @name @@ -274,11 +272,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge typeof -> @type_name.output } -@function [FunctionDefinition ... parameters: [ParametersDeclaration - ... - [Parameters ... @param item: [Parameter] ...] - ... -] ...] { +@function [FunctionDefinition parameters: [ParametersDeclaration + [Parameters @param item: [Parameter]] +]] { edge @param.lexical_scope -> @function.lexical_scope ;; Input parameters are available in the function scope @@ -286,11 +282,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i attr (@function.lexical_scope -> @param.def) precedence = 1 } -@function [FunctionDefinition ... returns: [ReturnsDeclaration - ... - [ParametersDeclaration ... [Parameters ... @param item: [Parameter] ...] ...] - ... -] ...] { +@function [FunctionDefinition returns: [ReturnsDeclaration + [ParametersDeclaration [Parameters @param item: [Parameter]]] +]] { edge @param.lexical_scope -> @function.lexical_scope ;; Return parameters are available in the function scope @@ -304,29 +298,23 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; NB. free-functions (ie. those defined at the file's level) are already ;; covered above -@contract [ContractDefinition ... members: [ContractMembers - ... +@contract [ContractDefinition members: [ContractMembers item: [ContractMember @function variant: [FunctionDefinition]] - ... -] ...] { +]] { edge @function.lexical_scope -> @contract.lexical_scope edge @contract.members -> @function.def } -@interface [InterfaceDefinition ... members: [InterfaceMembers - ... +@interface [InterfaceDefinition members: [InterfaceMembers item: [ContractMember @function variant: [FunctionDefinition]] - ... -] ...] { +]] { edge @function.lexical_scope -> @interface.lexical_scope edge @interface.members -> @function.def } -@library [LibraryDefinition ... members: [LibraryMembers - ... +@library [LibraryDefinition members: [LibraryMembers item: [ContractMember @function variant: [FunctionDefinition]] - ... -] ...] { +]] { edge @function.lexical_scope -> @library.lexical_scope edge @library.members -> @function.def } @@ -356,20 +344,20 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; The first statement in a block -@block [Block ... [Statements @stmt [Statement] ...] ...] { +@block [Block [Statements . @stmt [Statement]]] { if (version-matches ">= 0.5.0") { edge @stmt.lexical_scope -> @block.lexical_scope } } ;; Two consecutive statements -[Statements ... @left_stmt [Statement] @right_stmt [Statement] ...] { +[Statements @left_stmt [Statement] . @right_stmt [Statement]] { if (version-matches ">= 0.5.0") { edge @right_stmt.lexical_scope -> @left_stmt.lexical_scope } } -@block [Block ... [Statements ... @stmt [Statement]...] ...] { +@block [Block [Statements @stmt [Statement]]] { ;; Hoist statement definitions for Solidity < 0.5.0 if (version-matches "< 0.5.0") { ;; definitions are carried over to the block @@ -395,7 +383,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; Connect the function body's block lexical scope to the function -@function [FunctionDefinition ... [FunctionBody @block [Block]] ...] { +@function [FunctionDefinition [FunctionBody @block [Block]]] { edge @block.lexical_scope -> @function.lexical_scope } @@ -405,11 +393,8 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @stmt [Statement [VariableDeclarationStatement - ... [VariableDeclarationType @var_type [TypeName]] - ... @name name: [Identifier] - ... ]] { node def attr (def) node_definition = @name @@ -424,26 +409,23 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge typeof -> @var_type.output } -@stmt [Statement [TupleDeconstructionStatement ... [TupleDeconstructionElements - ... - [TupleDeconstructionElement [TupleMember variant: [UntypedTupleMember ... @name name: [Identifier]]]] - ... -] ...]] { +@stmt [Statement [TupleDeconstructionStatement [TupleDeconstructionElements + [TupleDeconstructionElement [TupleMember variant: [UntypedTupleMember + @name name: [Identifier] + ]]] +]]] { node def attr (def) node_definition = @name edge @stmt.defs -> def } -@stmt [Statement [TupleDeconstructionStatement ... [TupleDeconstructionElements - ... +@stmt [Statement [TupleDeconstructionStatement [TupleDeconstructionElements [TupleDeconstructionElement [TupleMember variant: [TypedTupleMember - ... @member_type type_name: [TypeName] - ... - @name name: [Identifier]]]] - ... -] ...]] { + @name name: [Identifier] + ]]] +]]] { node def attr (def) node_definition = @name @@ -468,11 +450,8 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @state_var [StateVariableDefinition - ... @type_name type_name: [TypeName] - ... @name name: [Identifier] - ... ] { node def attr (def) node_definition = @name @@ -490,11 +469,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; NB. Even though the grammar allows it, state variables can only be declared ;; inside contracts, and not interfaces or libraries. So, we will only bind ;; contract state variables. -@contract [ContractDefinition ... members: [ContractMembers - ... +@contract [ContractDefinition members: [ContractMembers item: [ContractMember @state_var variant: [StateVariableDefinition]] - ... -] ...] { +]] { edge @state_var.lexical_scope -> @contract.lexical_scope edge @contract.lexical_scope -> @state_var.def } @@ -504,7 +481,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Enum definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@enum [EnumDefinition ... @name name: [Identifier] ...] { +@enum [EnumDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -518,9 +495,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @enum [EnumDefinition - ... - members: [EnumMembers ... @item [Identifier] ...] - ... + members: [EnumMembers @item [Identifier]] ] { node def attr (def) node_definition = @item @@ -532,27 +507,21 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; NB. top-level enums (ie. those defined at the file's level) are already ;; covered above -@contract [ContractDefinition ... members: [ContractMembers - ... +@contract [ContractDefinition members: [ContractMembers item: [ContractMember @enum variant: [EnumDefinition]] - ... -] ...] { +]] { edge @contract.type_members -> @enum.def } -@interface [InterfaceDefinition ... members: [InterfaceMembers - ... +@interface [InterfaceDefinition members: [InterfaceMembers item: [ContractMember @enum variant: [EnumDefinition]] - ... -] ...] { +]] { edge @interface.type_members -> @enum.def } -@library [LibraryDefinition ... members: [LibraryMembers - ... +@library [LibraryDefinition members: [LibraryMembers item: [ContractMember @enum variant: [EnumDefinition]] - ... -] ...] { +]] { edge @library.members -> @enum.def } @@ -561,7 +530,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Structure definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@struct [StructDefinition ... @name name: [Identifier] ...] { +@struct [StructDefinition @name name: [Identifier]] { node def attr (def) node_definition = @name @@ -578,16 +547,14 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge member -> @struct.members } -@struct [StructDefinition ... [StructMembers ... @member item: [StructMember] ...] ...] { +@struct [StructDefinition [StructMembers @member item: [StructMember]]] { node @member.lexical_scope edge @member.lexical_scope -> @struct.lexical_scope } -@struct [StructDefinition ... [StructMembers - ... - @member item: [StructMember ... @type_name [TypeName] ... @name name: [Identifier] ...] - ... -] ...] { +@struct [StructDefinition [StructMembers + @member item: [StructMember @type_name [TypeName] @name name: [Identifier]] +]] { node def attr (def) node_definition = @name @@ -606,29 +573,23 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; NB. top-level enums (ie. those defined at the file's level) are already ;; covered above -@contract [ContractDefinition ... members: [ContractMembers - ... +@contract [ContractDefinition members: [ContractMembers item: [ContractMember @struct variant: [StructDefinition]] - ... -] ...] { +]] { edge @struct.lexical_scope -> @contract.lexical_scope edge @contract.type_members -> @struct.def } -@interface [InterfaceDefinition ... members: [InterfaceMembers - ... +@interface [InterfaceDefinition members: [InterfaceMembers item: [ContractMember @struct variant: [StructDefinition]] - ... -] ...] { +]] { edge @struct.lexical_scope -> @interface.lexical_scope edge @interface.type_members -> @struct.def } -@library [LibraryDefinition ... members: [LibraryMembers - ... +@library [LibraryDefinition members: [LibraryMembers item: [ContractMember @struct variant: [StructDefinition]] - ... -] ...] { +]] { edge @struct.lexical_scope -> @library.lexical_scope edge @library.members -> @struct.def } @@ -645,38 +606,32 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } ;; General case for nested expressions -@expr [Expression ... variant: [_ ... @child [Expression] ...] ...] { +@expr [Expression variant: [_ @child [Expression]]] { edge @child.lexical_scope -> @expr.lexical_scope } ;; Expressions as statements -@stmt [Statement ... variant: [_ ... @expr [Expression] ...] ...] { +@stmt [Statement variant: [_ @expr [Expression]]] { edge @expr.lexical_scope -> @stmt.lexical_scope } ;; Expressions used for variable declarations -@stmt [Statement ... variant: [VariableDeclarationStatement - ... - value: [VariableDeclarationValue ... @expr [Expression] ...] - ... -] ...] { +@stmt [Statement variant: [VariableDeclarationStatement + value: [VariableDeclarationValue @expr [Expression]] +]] { edge @expr.lexical_scope -> @stmt.lexical_scope } ;; Expressions used for state variable declarations @state_var [StateVariableDefinition - ... - value: [StateVariableDefinitionValue ... @expr [Expression]] - ... + value: [StateVariableDefinitionValue @expr [Expression]] ] { edge @expr.lexical_scope -> @state_var.lexical_scope } ;; Tuple expressions @tuple_expr [Expression [TupleExpression - ... - items: [TupleValues ... [TupleValue @expr [Expression]] ...] - ... + items: [TupleValues [TupleValue @expr [Expression]]] ]] { edge @expr.lexical_scope -> @tuple_expr.lexical_scope } @@ -684,7 +639,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Identifier expressions -@expr [Expression ... @name variant: [Identifier]] { +@expr [Expression @name variant: [Identifier]] { node ref attr (ref) node_reference = @name @@ -696,13 +651,10 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Member access expressions ;; TODO: implement variant for `.address` member -@expr [Expression ... [MemberAccessExpression - ... +@expr [Expression [MemberAccessExpression @operand operand: [Expression] - ... @name member: [Identifier] - ... -...]] { +]] { node ref attr (ref) node_reference = @name @@ -725,14 +677,12 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @args [ArgumentsDeclaration [PositionalArgumentsDeclaration - ... - [PositionalArguments ... @argument [Expression] ...] - ... + [PositionalArguments @argument [Expression]] ]] { edge @argument.lexical_scope -> @args.lexical_scope } -@named_arg [NamedArgument ... @name [Identifier] [Colon] @value [Expression]] { +@named_arg [NamedArgument @name [Identifier] [Colon] @value [Expression]] { node @named_arg.lexical_scope edge @value.lexical_scope -> @named_arg.lexical_scope @@ -744,24 +694,20 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @args [ArgumentsDeclaration [NamedArgumentsDeclaration - ... - [NamedArgumentGroup ... [NamedArguments ... @argument [NamedArgument] ...] ...] - ... + [NamedArgumentGroup [NamedArguments @argument [NamedArgument]]] ]] { edge @argument.lexical_scope -> @args.lexical_scope } -@funcall [Expression [FunctionCallExpression ... @args [ArgumentsDeclaration]]] { +@funcall [Expression [FunctionCallExpression @args [ArgumentsDeclaration]]] { edge @args.lexical_scope -> @funcall.lexical_scope } ;;; Type expressions -@type_expr [Expression [TypeExpression ... @type [TypeName] ...]] { +@type_expr [Expression [TypeExpression @type [TypeName]]] { edge @type.type_ref -> @type_expr.lexical_scope } - - "#####; diff --git a/crates/solidity/outputs/cargo/tests/src/binding_rules.rs b/crates/solidity/outputs/cargo/tests/src/binding_rules.rs new file mode 100644 index 0000000000..e8bbc239ab --- /dev/null +++ b/crates/solidity/outputs/cargo/tests/src/binding_rules.rs @@ -0,0 +1,22 @@ +use std::path::PathBuf; + +use metaslang_graph_builder::ast::File; +use slang_solidity::bindings; +use slang_solidity::cst::KindTypes; + +#[test] +fn test_binding_rules_parse_successfully() { + let binding_rules = bindings::get_binding_rules(); + let graph_builder = File::::from_str(binding_rules); + + assert!( + graph_builder.is_ok(), + "Parsing binding rules failed:\n{}", + graph_builder + .err() + .map(|err| err + .display_pretty(&PathBuf::from("rules.msgb"), binding_rules) + .to_string()) + .unwrap_or_default() + ); +} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/assertions.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/assertions.rs index 564073e092..ed4f390516 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/assertions.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/assertions.rs @@ -7,7 +7,7 @@ use regex::Regex; use semver::{Version, VersionReq}; use slang_solidity::bindings::Bindings; use slang_solidity::cursor::Cursor; -use slang_solidity::query::Query; +use slang_solidity::kinds::TerminalKind; use thiserror::Error; #[derive(Debug, Error)] @@ -149,24 +149,30 @@ impl<'a> fmt::Display for DisplayCursor<'a> { /// // ^ref:2 /// // Result { +pub fn collect_assertions( + mut cursor: Cursor, + version: &Version, +) -> Result { let mut assertions = Assertions::new(); - let query = Query::parse("@comment [SingleLineComment]").unwrap(); - for result in cursor.query(vec![query]) { - let captures = result.captures; - let Some(comment) = captures.get("comment").and_then(|v| v.first()) else { - continue; - }; - - match find_assertion_in_comment(comment, version)? { - Some(Assertion::Definition(assertion)) => { - assertions.insert_definition_assertion(assertion)?; - } - Some(Assertion::Reference(assertion)) => { - assertions.insert_reference_assertion(assertion); + loop { + if cursor + .node() + .is_terminal_with_kind(TerminalKind::SingleLineComment) + { + match find_assertion_in_comment(&cursor, version)? { + Some(Assertion::Definition(assertion)) => { + assertions.insert_definition_assertion(assertion)?; + } + Some(Assertion::Reference(assertion)) => { + assertions.insert_reference_assertion(assertion); + } + None => (), } - None => (), + } + + if !cursor.go_to_next() { + break; } } diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_rules.rs b/crates/solidity/outputs/cargo/tests/src/bindings_rules.rs deleted file mode 100644 index 67f1019801..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_rules.rs +++ /dev/null @@ -1,10 +0,0 @@ -use metaslang_graph_builder::ast::File; -use slang_solidity::bindings; -use slang_solidity::cst::KindTypes; - -#[test] -fn test_bindings_rules_parsing() { - let graph_builder = File::::from_str(bindings::get_binding_rules()); - - assert!(graph_builder.is_ok()); -} diff --git a/crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs b/crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs index e36df96531..3a8142ec86 100644 --- a/crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs +++ b/crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs @@ -73,7 +73,7 @@ fn query_syntax() { let query = Query::parse( &" // --8<-- [start:query-syntax-4] - [MultiplicativeExpression left_operand:[_] [_] ...] + [MultiplicativeExpression left_operand:[_] [_]] // --8<-- [end:query-syntax-4] " .remove_mkdoc_snippet_markers(), @@ -84,7 +84,7 @@ fn query_syntax() { let query = Query::parse( &" // --8<-- [start:query-syntax-5] - [MultiplicativeExpression ... [Expression [StringExpression]] ...] + [MultiplicativeExpression [Expression [StringExpression]]] // --8<-- [end:query-syntax-5] " .remove_mkdoc_snippet_markers(), @@ -107,7 +107,7 @@ fn capturing_nodes() { let query = Query::parse( &" // --8<-- [start:capturing-nodes-1] - [StructDefinition ... @struct_name name:[Identifier] ...] + [StructDefinition @struct_name name:[Identifier]] // --8<-- [end:capturing-nodes-1] " .remove_mkdoc_snippet_markers(), @@ -120,21 +120,12 @@ fn capturing_nodes() { &" // --8<-- [start:capturing-nodes-2] [ContractDefinition - ... @contract_name name:[Identifier] - ... members:[ContractMembers - ... [ContractMember - [EventDefinition - ... - @event_name name:[Identifier] - ... - ] + [EventDefinition @event_name name:[Identifier]] ] - ... ] - ... ] // --8<-- [end:capturing-nodes-2] " @@ -154,7 +145,7 @@ fn quantification() { let query = Query::parse( &" // --8<-- [start:quantification-1] - [SourceUnit ... (leading_trivia:[_])+] + [SourceUnit members:[_ ([_ @import [ImportDirective]])+]] // --8<-- [end:quantification-1] " .remove_mkdoc_snippet_markers(), @@ -164,18 +155,15 @@ fn quantification() { assert_matches( &query, NonterminalKind::SourceUnit, - "// comment 1\n// comment 2\n/* comment 3 */", + "import 'test.sol';\nimport * as Utils from 'lib/utils.sol'\n\ncontract Test {}", ); let query = Query::parse( &" // --8<-- [start:quantification-2] - [ContractDefinition - ... - (@docline [SingleLineNatSpecComment])+ - ... + [StructDefinition @name name:[_] - ... + members:[_ ([_ @member [Identifier]])+] ] // --8<-- [end:quantification-2] " @@ -187,8 +175,10 @@ fn quantification() { &query, NonterminalKind::SourceUnit, " - /// A doc comment - contract A {} + struct Test { + int x; + int y; + } ", ); @@ -196,20 +186,13 @@ fn quantification() { &" // --8<-- [start:quantification-3] [FunctionCallExpression - ... arguments:[ArgumentsDeclaration variant:[PositionalArgumentsDeclaration - ... arguments:[PositionalArguments - ... (@arg [Expression variant:[StringExpression]])? - ... ] - ... ] - ... ] - ... ] // --8<-- [end:quantification-3] " @@ -227,7 +210,7 @@ fn quantification() { let matches: Vec<_> = iter.collect(); - matches[3].captures.get("arg").unwrap(); + matches[0].captures.get("arg").unwrap(); } #[test] @@ -240,7 +223,6 @@ fn alternations() { (@function variant:[Identifier] | @method variant:[MemberAccessExpression]) ] - ... ] // --8<-- [end:alternations-1] " @@ -292,3 +274,103 @@ fn alternations() { "break" ); } + +#[test] +fn adjacency() { + let query = Query::parse( + &r#" + // --8<-- [start:adjacency-1] + [FunctionDefinition + [ParametersDeclaration + [Parameters . @first_param [Parameter]] + ] + ] + // --8<-- [end:adjacency-1] + "# + .remove_mkdoc_snippet_markers(), + ) + .unwrap(); + + let iter = assert_matches( + &query, + NonterminalKind::FunctionDefinition, + "function test(int x, int y);", + ); + + let matches: Vec<_> = iter.collect(); + assert_eq!(matches.len(), 1); + assert_eq!( + matches[0].captures.get("first_param").unwrap()[0] + .node() + .unparse(), + "int x" + ); + + let query = Query::parse( + &r#" + // --8<-- [start:adjacency-2] + [FunctionDefinition + [ParametersDeclaration + [Parameters @last_param [Parameter] .] + ] + ] + // --8<-- [end:adjacency-2] + "# + .remove_mkdoc_snippet_markers(), + ) + .unwrap(); + + let iter = assert_matches( + &query, + NonterminalKind::FunctionDefinition, + "function test(int x, int y);", + ); + + let matches: Vec<_> = iter.collect(); + assert_eq!(matches.len(), 1); + assert_eq!( + matches[0].captures.get("last_param").unwrap()[0] + .node() + .unparse(), + " int y" + ); + + let query = Query::parse( + &r#" + // --8<-- [start:adjacency-3] + [Statements @stmt1 [Statement] . @stmt2 [Statement]] + // --8<-- [end:adjacency-3] + "# + .remove_mkdoc_snippet_markers(), + ) + .unwrap(); + + let iter = assert_matches(&query, NonterminalKind::Statements, "int x; int y; x + y;"); + + let matches: Vec<_> = iter.collect(); + assert_eq!(matches.len(), 2); + assert_eq!( + matches[0].captures.get("stmt1").unwrap()[0] + .node() + .unparse(), + "int x;" + ); + assert_eq!( + matches[0].captures.get("stmt2").unwrap()[0] + .node() + .unparse(), + " int y;" + ); + assert_eq!( + matches[1].captures.get("stmt1").unwrap()[0] + .node() + .unparse(), + " int y;" + ); + assert_eq!( + matches[1].captures.get("stmt2").unwrap()[0] + .node() + .unparse(), + " x + y;" + ); +} diff --git a/crates/solidity/outputs/cargo/tests/src/doc_examples/using_queries.rs b/crates/solidity/outputs/cargo/tests/src/doc_examples/using_queries.rs index 2f1439dea5..6447cb8fc3 100644 --- a/crates/solidity/outputs/cargo/tests/src/doc_examples/using_queries.rs +++ b/crates/solidity/outputs/cargo/tests/src/doc_examples/using_queries.rs @@ -64,8 +64,8 @@ fn using_queries() -> Result<()> { // --8<-- [start:multiple-patterns] let mut names = vec![]; - let struct_def = Query::parse("[StructDefinition ... @name [Identifier] ...]").unwrap(); - let enum_def = Query::parse("[EnumDefinition ... @name [Identifier] ...]").unwrap(); + let struct_def = Query::parse("[StructDefinition @name [Identifier]]").unwrap(); + let enum_def = Query::parse("[EnumDefinition @name [Identifier]]").unwrap(); for r#match in cursor.query(vec![struct_def, enum_def]) { let index = r#match.query_number; @@ -96,7 +96,7 @@ fn using_queries() -> Result<()> { let mut names = vec![]; - let query = Query::parse("[TypedTupleMember ... @type type_name:[_] ...]").unwrap(); + let query = Query::parse("[TypedTupleMember @type type_name:[_]]").unwrap(); for r#match in cursor.query(vec![query]) { let captures = r#match.captures; @@ -144,15 +144,8 @@ fn tx_origin_query() -> Result<()> { // --8<-- [start:tx-origin] let query = Query::parse( r#"@txorigin [MemberAccessExpression - ... - [Expression - ... - @start ["tx"] - ... - ] - ... + [Expression @start ["tx"]] ["origin"] - ... ]"#, ) .unwrap(); diff --git a/crates/solidity/outputs/cargo/tests/src/lib.rs b/crates/solidity/outputs/cargo/tests/src/lib.rs index 17fdb1a6c0..d0dbbc5f2e 100644 --- a/crates/solidity/outputs/cargo/tests/src/lib.rs +++ b/crates/solidity/outputs/cargo/tests/src/lib.rs @@ -2,9 +2,9 @@ use metaslang_bindings as _; +mod binding_rules; mod bindings_assertions; mod bindings_output; -mod bindings_rules; mod cst_output; mod doc_examples; mod generated; diff --git a/crates/solidity/outputs/npm/tests/src/doc-examples/using-queries.ts b/crates/solidity/outputs/npm/tests/src/doc-examples/using-queries.ts index b3e532af6c..da826ca4c5 100644 --- a/crates/solidity/outputs/npm/tests/src/doc-examples/using-queries.ts +++ b/crates/solidity/outputs/npm/tests/src/doc-examples/using-queries.ts @@ -58,8 +58,8 @@ test("using queries", async () => { // --8<-- [start:multiple-patterns] const names = []; - const struct_def = Query.parse("[StructDefinition ... @name [Identifier] ...]"); - const enum_def = Query.parse("[EnumDefinition ... @name [Identifier] ...]"); + const struct_def = Query.parse("[StructDefinition @name [Identifier]]"); + const enum_def = Query.parse("[EnumDefinition @name [Identifier]]"); const matches = cursor.query([struct_def, enum_def]); let match = null; @@ -89,7 +89,7 @@ test("using queries", async () => { const names = []; - const query = Query.parse("[TypedTupleMember ... @type type_name:[_] ...]"); + const query = Query.parse("[TypedTupleMember @type type_name:[_]]"); const matches = cursor.query([query]); let match = null; @@ -137,15 +137,8 @@ test("using queries", async () => { // --8<-- [start:tx-origin] const query = Query.parse(` @txorigin [MemberAccessExpression - ... - [Expression - ... - @start ["tx"] - ... - ] - ... + [Expression @start ["tx"]] ["origin"] - ... ]`); const matches = cursor.query([query]); diff --git a/crates/testlang/outputs/cargo/tests/src/graph/mod.rs b/crates/testlang/outputs/cargo/tests/src/graph/mod.rs index a8eaa45605..8b5f7b171a 100644 --- a/crates/testlang/outputs/cargo/tests/src/graph/mod.rs +++ b/crates/testlang/outputs/cargo/tests/src/graph/mod.rs @@ -20,11 +20,11 @@ fn builds_a_graph() { node @tree_node.def } - @tree [Tree ... @root node: [TreeNode] ...] { + @tree [Tree @root node: [TreeNode]] { edge @root.def -> @tree.def } - @parent [TreeNode ... members: [_ ... [_ @child variant: [TreeNode]] ...] ...] { + @parent [TreeNode members: [_ [_ @child variant: [TreeNode]]]] { edge @child.def -> @parent.def } "; diff --git a/crates/testlang/outputs/cargo/tests/src/query/engine_tests.rs b/crates/testlang/outputs/cargo/tests/src/query/engine_tests.rs index 0c6c464075..53568507c6 100644 --- a/crates/testlang/outputs/cargo/tests/src/query/engine_tests.rs +++ b/crates/testlang/outputs/cargo/tests/src/query/engine_tests.rs @@ -115,11 +115,32 @@ fn common_test_tree() -> Edge { ) } +fn common_test_tree_with_trivia() -> Edge { + cst_tree!( + TreeNode [ + Node: DelimitedIdentifier "A", + Whitespace " ", + DelimitedIdentifier "B", + Whitespace " ", + EndOfLine "\n", + DelimitedIdentifier "C", + TreeNodeChild [ + Whitespace " ", + DelimitedIdentifier "D", + EndOfLine "\n", + Whitespace " ", + Node: DelimitedIdentifier "E", + Whitespace " ", + ], + ] + ) +} + #[test] fn test_spread() { run_query_test( &common_test_tree(), - "[TreeNode ... @x1 [DelimitedIdentifier] ... @x2 [DelimitedIdentifier] ...]", + "[TreeNode @x1 [DelimitedIdentifier] @x2 [DelimitedIdentifier]]", query_matches! { {x1: ["A"], x2: ["B"]} {x1: ["A"], x2: ["C"]} @@ -132,7 +153,7 @@ fn test_spread() { fn test_adjacent() { run_query_test( &common_test_tree(), - "[TreeNode ... @y1 [DelimitedIdentifier] @y2 [DelimitedIdentifier] ...]", + "[TreeNode @y1 [DelimitedIdentifier] . @y2 [DelimitedIdentifier]]", query_matches! { {y1: ["A"], y2: ["B"]} {y1: ["B"], y2: ["C"]} @@ -140,11 +161,35 @@ fn test_adjacent() { ); } +#[test] +fn test_adjacency_skips_trivia() { + run_query_test( + &common_test_tree_with_trivia(), + "[TreeNode @y1 [DelimitedIdentifier] . @y2 [DelimitedIdentifier]]", + query_matches! { + {y1: ["A"], y2: ["B"]} + {y1: ["B"], y2: ["C"]} + }, + ); +} + +#[test] +fn test_anonymous_node_matcher_skips_trivia() { + run_query_test( + &common_test_tree_with_trivia(), + "[TreeNodeChild @x [_]]", + query_matches! { + {x: ["D"]} + {x: ["E"]} + }, + ); +} + #[test] fn test_child() { run_query_test( &common_test_tree(), - "[TreeNodeChild ... @x [DelimitedIdentifier] ...]", + "[TreeNodeChild @x [DelimitedIdentifier]]", query_matches! { {x: ["D"]} {x: ["E"]} @@ -156,7 +201,7 @@ fn test_child() { fn test_parent_and_child() { run_query_test( &common_test_tree(), - "[TreeNode ... @p node:[_] ... [TreeNodeChild ... @c [DelimitedIdentifier] ...]]", + "[TreeNode @p node:[_] [TreeNodeChild @c [DelimitedIdentifier]]]", query_matches! { {c: ["D"], p: ["A"]} {c: ["E"], p: ["A"]} @@ -168,7 +213,7 @@ fn test_parent_and_child() { fn test_named() { run_query_test( &common_test_tree(), - "[TreeNode ... @x node:[DelimitedIdentifier] ...]", + "[TreeNode @x node:[DelimitedIdentifier]]", query_matches! { {x: ["A"]} }, @@ -179,7 +224,7 @@ fn test_named() { fn test_multilevel_adjacent() { run_query_test( &common_test_tree(), - "[_ ... @x [DelimitedIdentifier] @y [DelimitedIdentifier] ...]", + "[_ @x [DelimitedIdentifier] . @y [DelimitedIdentifier]]", query_matches! { {x: ["A"], y: ["B"]} {x: ["B"], y: ["C"]} @@ -192,7 +237,7 @@ fn test_multilevel_adjacent() { fn test_multilevel_named() { run_query_test( &common_test_tree(), - "[_ ... @x node:[_] ...]", + "[_ @x node:[_]]", query_matches! { {x: ["A"]} {x: ["E"]} @@ -204,7 +249,7 @@ fn test_multilevel_named() { fn test_text_value() { run_query_test( &common_test_tree(), - r#"[TreeNode ... @z1 [DelimitedIdentifier] ["B"] @z2 [DelimitedIdentifier] ...]"#, + r#"[TreeNode @z1 [DelimitedIdentifier] . ["B"] . @z2 [DelimitedIdentifier]]"#, query_matches! { {z1: ["A"], z2: ["C"]} }, @@ -215,7 +260,7 @@ fn test_text_value() { fn test_one_or_more() { run_query_test( &common_test_tree(), - "[TreeNode ... (@x [DelimitedIdentifier])+ [_] ]", + "[TreeNode (@x [DelimitedIdentifier])+ . [_] .]", query_matches! { {x: ["A", "B", "C"]} {x: ["B", "C"]} @@ -228,7 +273,7 @@ fn test_one_or_more() { fn test_zero_or_more() { run_query_test( &common_test_tree(), - "[TreeNode ... (@y [DelimitedIdentifier])* [_] ]", + "[TreeNode (@y [DelimitedIdentifier])* . [_] .]", query_matches! { {y: ["A", "B", "C"]} {y: ["B", "C"]} @@ -242,7 +287,7 @@ fn test_zero_or_more() { fn test_optional() { run_query_test( &common_test_tree(), - "[TreeNode ... (@z [DelimitedIdentifier])? [_] ]", + "[TreeNode (@z [DelimitedIdentifier])? . [_] .]", query_matches! { {z: ["C"]} {} @@ -254,9 +299,207 @@ fn test_optional() { fn test_nested() { run_query_test( &common_test_tree(), - "@root [TreeNode ... @z [DelimitedIdentifier] [_] ]", + "@root [TreeNode @z [DelimitedIdentifier] . [_] .]", query_matches! { {root: ["ABCDE"], z: ["C"]} }, ); } + +#[test] +fn test_alternatives() { + run_query_test( + &common_test_tree(), + "(@x node:[_] | @y [DelimitedIdentifier] . @z [DelimitedIdentifier])", + query_matches! { + {x: ["A"]} + {y: ["A"], z: ["B"]} + {y: ["B"], z: ["C"]} + {y: ["D"], z: ["E"]} + {x: ["E"]} + }, + ); +} + +#[test] +fn test_adjacency_at_beginning_skips_trivia() { + run_query_test( + &common_test_tree_with_trivia(), + "[TreeNodeChild . @x [DelimitedIdentifier]]", + query_matches! { + {x: ["D"]} + }, + ); +} + +#[test] +fn test_adjacency_at_end_skips_trivia() { + run_query_test( + &common_test_tree_with_trivia(), + "[TreeNodeChild @x [DelimitedIdentifier] .]", + query_matches! { + {x: ["E"]} + }, + ); +} + +fn flat_tree() -> Edge { + cst_tree!( + TreeNode [ + Node: DelimitedIdentifier "A", + Whitespace " ", + DelimitedIdentifier "B", + DelimitedIdentifier "C", + DelimitedIdentifier "D", + ] + ) +} + +#[test] +fn test_ellipsis_followed_by_optional_grouping() { + run_query_test( + &flat_tree(), + "[TreeNode @x [DelimitedIdentifier] (@y [DelimitedIdentifier] . @z [DelimitedIdentifier])?]", + query_matches! { + {x: ["A"], y: ["B"], z: ["C"]} + {x: ["A"], y: ["C"], z: ["D"]} + {x: ["A"]} + {x: ["B"], y: ["C"], z: ["D"]} + {x: ["B"]} + {x: ["C"]} + {x: ["D"]} + }, + ); +} + +#[test] +fn test_adjacency_followed_by_optional_grouping() { + run_query_test( + &flat_tree(), + "[TreeNode @x [DelimitedIdentifier] . (@y [DelimitedIdentifier] . @z [DelimitedIdentifier])?]", + query_matches! { + {x: ["A"]} + {x: ["A"], y: ["B"], z: ["C"]} + {x: ["B"]} + {x: ["B"], y: ["C"], z: ["D"]} + {x: ["C"]} + {x: ["D"]} + }, + ); +} + +#[test] +fn test_captures_followed_by_non_captured_matchers() { + run_query_test( + &flat_tree(), + "[TreeNode @x [DelimitedIdentifier] [DelimitedIdentifier]]", + query_matches! { + {x: ["A"]} + {x: ["A"]} + {x: ["A"]} + {x: ["B"]} + {x: ["B"]} + {x: ["C"]} + }, + ); +} + +#[test] +fn test_captures_followed_by_anonymous_matchers() { + run_query_test( + &flat_tree(), + "[TreeNode @x [DelimitedIdentifier] [_]]", + query_matches! { + {x: ["A"]} + {x: ["A"]} + {x: ["A"]} + {x: ["B"]} + {x: ["B"]} + {x: ["C"]} + }, + ); +} + +#[test] +fn test_captures_followed_by_non_captured_optional_matchers() { + run_query_test( + &flat_tree(), + "[TreeNode @x [DelimitedIdentifier] [DelimitedIdentifier]?]", + query_matches! { + {x: ["A"]} + {x: ["A"]} + {x: ["A"]} + {x: ["A"]} + {x: ["B"]} + {x: ["B"]} + {x: ["B"]} + {x: ["C"]} + {x: ["C"]} + {x: ["D"]} + }, + ); +} + +#[test] +fn test_captures_followed_by_captured_optional_matchers() { + run_query_test( + &flat_tree(), + "[TreeNode @x [DelimitedIdentifier] @y [DelimitedIdentifier]?]", + query_matches! { + {x: ["A"], y: ["B"]} + {x: ["A"], y: ["C"]} + {x: ["A"], y: ["D"]} + {x: ["A"]} + {x: ["B"], y: ["C"]} + {x: ["B"], y: ["D"]} + {x: ["B"]} + {x: ["C"], y: ["D"]} + {x: ["C"]} + {x: ["D"]} + }, + ); +} + +fn sample_deep_tree() -> Edge { + cst_tree!( + Tree [ + Keyword: TreeKeyword "tree", + Name: Identifier "$t1", + Node: TreeNode [ + OpenBracket "[", + Members: TreeNodeChildren [ + TreeNodeChild [ + Variant: DelimitedIdentifier "A", + ], + TreeNodeChild [ + Variant: TreeNode [ + OpenBracket "[", + Members: TreeNodeChildren [ + TreeNodeChild [ + Variant: DelimitedIdentifier "B" + ], + TreeNodeChild [ + Variant: DelimitedIdentifier "C" + ], + ], + CloseBracket "]", + ] + ] + ], + CloseBracket "]", + ], + Semicolon: Semicolon ";" + ] + ) +} + +#[test] +fn test_deeply_nested_matchers() { + run_query_test( + &sample_deep_tree(), + "@parent [TreeNode members: [TreeNodeChildren [TreeNodeChild @child variant: [TreeNode]]]]", + query_matches! { + {parent: ["[A[BC]]"], child: ["[BC]"]} + }, + ); +} diff --git a/crates/testlang/outputs/cargo/tests/src/query/parser_tests.rs b/crates/testlang/outputs/cargo/tests/src/query/parser_tests.rs index 796485930a..3ed6dc0cc0 100644 --- a/crates/testlang/outputs/cargo/tests/src/query/parser_tests.rs +++ b/crates/testlang/outputs/cargo/tests/src/query/parser_tests.rs @@ -16,8 +16,8 @@ fn test_text_escaping() { } #[test] -fn test_ellipsis() { - run_parser_test(r#"[_ ...]"#, r#"[_ ...]"#); +fn test_adjacency() { + run_parser_test(r#"[_ . [_]]"#, r#"[_ . [_]]"#); } #[test] @@ -52,15 +52,12 @@ fn test_zero_or_more_canonicalisation() { // Test the error message on parse failure #[test] fn test_parsing_error() { - let result = Query::parse(r#"@root [_ ..."#); + let result = Query::parse(r#"@root [_"#); match result { Ok(_) => panic!("Expected error"), Err(e) => { - assert_eq!( - e.message, - "Parse error:\nexpected ']' at: \nAlt at: [_ ...\nAlt at: @root [_ ...\n" - ); - assert_eq!((e.row, e.column), (0, 12)); + assert_eq!(e.message, "Parse error:\nexpected ']' at: \nAlt at: [_\n"); + assert_eq!((e.row, e.column), (0, 8)); } } } @@ -68,52 +65,96 @@ fn test_parsing_error() { // See https://github.com/NomicFoundation/slang/issues/1042 #[test] fn test_parsing_error_with_invalid_edge_label() { - let result = Query::parse( - r#" -[Tree - ... - @name Name: [_] - ... -]"#, - ); + let result = Query::parse(r#"[Tree @name Name: [_]]"#); match result { Ok(_) => panic!("Expected error"), Err(e) => { assert_eq!( e.message, - "Parse error:\n'Name' is not a valid edge label at: Name: [_]\n ...\n]\n", + "Parse error:\n'Name' is not a valid edge label at: Name: [_]]\n", ); - assert_eq!((e.row, e.column), (3, 10)); + assert_eq!((e.row, e.column), (0, 12)); } } } #[test] fn test_parsing_error_with_invalid_node_kind() { - let result = Query::parse(r#"[Tree ... [tree_node] ...]"#); + let result = Query::parse(r#"[Tree [tree_node]]"#); match result { Ok(_) => panic!("Expected error"), Err(e) => { assert_eq!( e.message, - "Parse error:\n'tree_node' is not a valid node kind at: tree_node] ...]\n", + "Parse error:\n'tree_node' is not a valid node kind at: tree_node]]\n", ); - assert_eq!((e.row, e.column), (0, 11)); + assert_eq!((e.row, e.column), (0, 7)); } } } #[test] fn test_parsing_error_with_kind_beginning_with_underscore() { - let result = Query::parse(r#"[Tree ... [_tree_node] ...]"#); + let result = Query::parse(r#"[Tree [_tree_node]]"#); match result { Ok(_) => panic!("Expected error"), Err(e) => { assert_eq!( e.message, - "Parse error:\n'_tree_node' is not a valid node kind at: _tree_node] ...]\n", + "Parse error:\n'_tree_node' is not a valid node kind at: _tree_node]]\n", ); - assert_eq!((e.row, e.column), (0, 11)); + assert_eq!((e.row, e.column), (0, 7)); } } } + +#[test] +fn test_fails_parsing_ellipsis() { + let result = Query::parse(r#"[_ ...]"#); + match result { + Ok(_) => panic!("Expected parse failure"), + Err(e) => assert_eq!( + e.message, + "Parse error:\nThe ellipsis `...` operator is deprecated, and replaced with a new adjacency `.` operator. For more information, check the Tree Query Language guide: https://nomicfoundation.github.io/slang/user-guide/tree-query-language/ at: ...]\n", + ), + } +} + +#[test] +fn test_fails_consecutive_adjacency_operators() { + let result = Query::parse(r#"[_ [DelimitedIdentifier] . .]"#); + match result { + Ok(_) => panic!("Expected parse failure"), + Err(e) => assert_eq!(e.message, "Parse error:\nNoneOf at: .]\n"), + } +} + +#[test] +fn test_fails_sole_adjacency() { + let result = Query::parse(r#"[_ .]"#); + match result { + Ok(_) => panic!("Expected parse failure"), + Err(e) => assert_eq!( + e.message, + "Parse error:\nexpected ']' at: .]\nAlt at: [_ .]\n" + ), + } +} + +#[test] +fn test_fails_adjacency_at_edge_of_alt_option() { + let result = Query::parse(r#"([TreeNode] | . [DelimitedIdentifier])+"#); + assert!(result.is_err(), "Expected parse failure"); +} + +#[test] +fn test_fails_parsing_trivia_node_selector() { + let result = Query::parse(r#"[EndOfLine]"#); + match result { + Ok(_) => panic!("Expected parse failure"), + Err(e) => assert_eq!( + e.message, + "Parse error:\nMatching trivia nodes directly is forbidden. For more information, check the Tree Query Language guide: https://nomicfoundation.github.io/slang/user-guide/tree-query-language/ at: EndOfLine]\n" + ), + } +} diff --git a/crates/testlang/outputs/npm/tests/src/tests/query.ts b/crates/testlang/outputs/npm/tests/src/tests/query.ts index 2405e6bacb..4f328e3215 100644 --- a/crates/testlang/outputs/npm/tests/src/tests/query.ts +++ b/crates/testlang/outputs/npm/tests/src/tests/query.ts @@ -8,7 +8,7 @@ test("simple query", () => { const tree_source = `tree [A [B C] D];`; const parse_output = language.parse(NonterminalKind.Tree, tree_source); - const query_source = `[TreeNodeChild ... @id [DelimitedIdentifier]]`; + const query_source = `[TreeNodeChild @id [DelimitedIdentifier]]`; const query = Query.parse(query_source); const matches = parse_output.createTreeCursor().query([query]); diff --git a/documentation/public/user-guide/tree-query-language.md b/documentation/public/user-guide/tree-query-language.md index bfca807e70..3b682e4e17 100644 --- a/documentation/public/user-guide/tree-query-language.md +++ b/documentation/public/user-guide/tree-query-language.md @@ -6,8 +6,8 @@ A _query_ is a pattern that matches a certain set of nodes in a tree. The expression to match a given node consists of a pair of brackets (`[]`) containing two things: the node's kind, and optionally, a series of other patterns that match the node's children. For -example, this pattern would match any `MultiplicativeExpression` node whose children -are exactly two `Expression` nodes, with an `Asterisk` node in between (no whitespace): +example, this pattern would match any `MultiplicativeExpression` node that has +two children `Expression` nodes, with an `Asterisk` node in between: ```{ .scheme } --8<-- "crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs:query-syntax-1" @@ -36,7 +36,7 @@ node with two children, one of any kind labeled `left_operand` and one of any ki --8<-- "crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs:query-syntax-4" ``` -Children can also be elided. For example, this would produce multiple matches for a +Children can be elided. For example, this would produce multiple matches for a `MultiplicativeExpression` where at least _one_ of the children is an expression of a `StringExpression` variant, where each match is associated with each of the `StringExpression` children: @@ -44,6 +44,10 @@ is associated with each of the `StringExpression` children: --8<-- "crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs:query-syntax-5" ``` +Trivia nodes (whitespace, comments, etc.) will be skipped over when running a +query. Furthermore, trivia nodes cannot be explicitly (or implicitly with `_`) +matched by queries. + ### Capturing Nodes When matching patterns, you may want to process specific nodes within the @@ -72,13 +76,13 @@ by a `?`, `*` or `+` operator. The `?` operator matches _zero or one_ repetition of a pattern, the `*` operator matches _zero or more_, and the `+` operator matches _one or more_. -For example, this pattern would match a sequence of one or more comments at the top of the file: +For example, this pattern would match a sequence of one or more import directives at the top of the file: ```{ .scheme } --8<-- "crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs:quantification-1" ``` -This pattern would match a contract definition with at least one doc comment, capturing them: +This pattern would match a structure definition with one or more members, capturing their names: ```{ .scheme } --8<-- "crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs:quantification-2" @@ -93,7 +97,7 @@ present: ### Alternations -An alternation is written as a sequence of patterns separated by '|' and surrounded by parentheses. +An alternation is written as a sequence of patterns separated by `|` and surrounded by parentheses. For example, this pattern would match a call to either a variable or an object property. In the case of a variable, capture it as `@function`, and in the case of a property, capture it as `@method`: @@ -107,3 +111,29 @@ This pattern would match a set of possible keyword terminals, capturing them as ```{ .scheme } --8<-- "crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs:alternations-2" ``` + +### Adjacency + +By using the adjacency operator `.` you can constrain a pattern to only match +the first or the last child nodes. + +For example, the following pattern would match only the first parameter +declaration in a function definition: + +```{ .scheme } +--8<-- "crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs:adjacency-1" +``` + +And conversely the following will match only the last parameter: + +```{ .scheme } +--8<-- "crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs:adjacency-2" +``` + +If the adjacency operator is used in between two patterns it constrains matches +on both patterns to occur consecutively, ie. without any other sibling node in +between. For example, this pattern matches pairs of consecutive statements: + +```{ .scheme } +--8<-- "crates/solidity/outputs/cargo/tests/src/doc_examples/tree_query_language.rs:adjacency-3" +``` From c86b86e255df0bfc85dd62fb3d471cd0b37224d9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:48:55 +0000 Subject: [PATCH 12/13] Bump Slang Version (#1017) This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @nomicfoundation/slang@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/slang-darwin-arm64@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/slang-darwin-x64@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/slang-linux-arm64-gnu@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/slang-linux-arm64-musl@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/slang-linux-x64-gnu@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/slang-linux-x64-musl@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/slang-win32-arm64-msvc@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/slang-win32-ia32-msvc@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/slang-win32-x64-msvc@0.16.0 ### Minor Changes - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` Co-authored-by: github-actions[bot] --- .changeset/dirty-lemons-grin.md | 5 -- .changeset/few-taxis-retire.md | 5 -- .changeset/fluffy-kangaroos-burn.md | 5 -- .changeset/gentle-shirts-deliver.md | 5 -- .changeset/giant-wasps-invite.md | 5 -- .changeset/healthy-suits-greet.md | 5 -- .changeset/itchy-candles-remain.md | 5 -- .changeset/old-adults-think.md | 5 -- .changeset/plenty-feet-exercise.md | 5 -- CHANGELOG.md | 24 +++++++ Cargo.lock | 62 +++++++++--------- Cargo.toml | 64 +++++++++---------- crates/codegen/runtime/npm/CHANGELOG.md | 24 +++++++ crates/metaslang/cst/CHANGELOG.md | 24 +++++++ crates/metaslang/graph_builder/CHANGELOG.md | 24 +++++++ .../outputs/cargo/slang_solidity/CHANGELOG.md | 24 +++++++ .../solidity/outputs/npm/package/CHANGELOG.md | 24 +++++++ .../solidity/outputs/npm/package/package.json | 20 +++--- .../platforms/darwin-arm64/CHANGELOG.md | 24 +++++++ .../platforms/darwin-arm64/package.json | 2 +- .../package/platforms/darwin-x64/CHANGELOG.md | 24 +++++++ .../package/platforms/darwin-x64/package.json | 2 +- .../platforms/linux-arm64-gnu/CHANGELOG.md | 24 +++++++ .../platforms/linux-arm64-gnu/package.json | 2 +- .../platforms/linux-arm64-musl/CHANGELOG.md | 24 +++++++ .../platforms/linux-arm64-musl/package.json | 2 +- .../platforms/linux-x64-gnu/CHANGELOG.md | 24 +++++++ .../platforms/linux-x64-gnu/package.json | 2 +- .../platforms/linux-x64-musl/CHANGELOG.md | 24 +++++++ .../platforms/linux-x64-musl/package.json | 2 +- .../platforms/win32-arm64-msvc/CHANGELOG.md | 24 +++++++ .../platforms/win32-arm64-msvc/package.json | 2 +- .../platforms/win32-ia32-msvc/CHANGELOG.md | 24 +++++++ .../platforms/win32-ia32-msvc/package.json | 2 +- .../platforms/win32-x64-msvc/CHANGELOG.md | 24 +++++++ .../platforms/win32-x64-msvc/package.json | 2 +- .../testlang/outputs/npm/package/CHANGELOG.md | 24 +++++++ package-lock.json | 38 +++++------ 38 files changed, 485 insertions(+), 146 deletions(-) delete mode 100644 .changeset/dirty-lemons-grin.md delete mode 100644 .changeset/few-taxis-retire.md delete mode 100644 .changeset/fluffy-kangaroos-burn.md delete mode 100644 .changeset/gentle-shirts-deliver.md delete mode 100644 .changeset/giant-wasps-invite.md delete mode 100644 .changeset/healthy-suits-greet.md delete mode 100644 .changeset/itchy-candles-remain.md delete mode 100644 .changeset/old-adults-think.md delete mode 100644 .changeset/plenty-feet-exercise.md diff --git a/.changeset/dirty-lemons-grin.md b/.changeset/dirty-lemons-grin.md deleted file mode 100644 index a6c40283c9..0000000000 --- a/.changeset/dirty-lemons-grin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@nomicfoundation/slang": patch ---- - -upgrade to rust `1.79.0`. diff --git a/.changeset/few-taxis-retire.md b/.changeset/few-taxis-retire.md deleted file mode 100644 index 7b924c5feb..0000000000 --- a/.changeset/few-taxis-retire.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@nomicfoundation/slang": minor ---- - -Tree Query Language: queries now ignore trivia nodes. diff --git a/.changeset/fluffy-kangaroos-burn.md b/.changeset/fluffy-kangaroos-burn.md deleted file mode 100644 index 0e72e42b81..0000000000 --- a/.changeset/fluffy-kangaroos-burn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@nomicfoundation/slang": patch ---- - -Tree Query Language: Compute row and column information for query parser errors. diff --git a/.changeset/gentle-shirts-deliver.md b/.changeset/gentle-shirts-deliver.md deleted file mode 100644 index 77e5b8b740..0000000000 --- a/.changeset/gentle-shirts-deliver.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@nomicfoundation/slang": minor ---- - -Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. diff --git a/.changeset/giant-wasps-invite.md b/.changeset/giant-wasps-invite.md deleted file mode 100644 index 329e66e384..0000000000 --- a/.changeset/giant-wasps-invite.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@nomicfoundation/slang": patch ---- - -support Yul multiple variables declaration diff --git a/.changeset/healthy-suits-greet.md b/.changeset/healthy-suits-greet.md deleted file mode 100644 index a3b1a1b3d3..0000000000 --- a/.changeset/healthy-suits-greet.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@nomicfoundation/slang": patch ---- - -inline `MemberAccess` enum into the parent `MemberAccessExpression` diff --git a/.changeset/itchy-candles-remain.md b/.changeset/itchy-candles-remain.md deleted file mode 100644 index ea77cc2867..0000000000 --- a/.changeset/itchy-candles-remain.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@nomicfoundation/slang": patch ---- - -fix stack assignments operator `=:`. diff --git a/.changeset/old-adults-think.md b/.changeset/old-adults-think.md deleted file mode 100644 index 53e2717b0b..0000000000 --- a/.changeset/old-adults-think.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@nomicfoundation/slang": patch ---- - -Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. diff --git a/.changeset/plenty-feet-exercise.md b/.changeset/plenty-feet-exercise.md deleted file mode 100644 index 2a2e0d4745..0000000000 --- a/.changeset/plenty-feet-exercise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@nomicfoundation/slang": patch ---- - -fix `ExponentiationExpression` associativity before `0.8.0` diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/Cargo.lock b/Cargo.lock index 031acfc961..0efa09ea5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -348,7 +348,7 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "codegen_ebnf" -version = "0.15.1" +version = "0.16.0" dependencies = [ "Inflector", "codegen_language_definition", @@ -358,7 +358,7 @@ dependencies = [ [[package]] name = "codegen_language_definition" -version = "0.15.1" +version = "0.16.0" dependencies = [ "Inflector", "codegen_language_internal_macros", @@ -377,7 +377,7 @@ dependencies = [ [[package]] name = "codegen_language_internal_macros" -version = "0.15.1" +version = "0.16.0" dependencies = [ "itertools 0.13.0", "proc-macro2", @@ -387,14 +387,14 @@ dependencies = [ [[package]] name = "codegen_language_macros" -version = "0.15.1" +version = "0.16.0" dependencies = [ "codegen_language_definition", ] [[package]] name = "codegen_language_tests" -version = "0.15.1" +version = "0.16.0" dependencies = [ "codegen_language_definition", "codegen_language_macros", @@ -406,7 +406,7 @@ dependencies = [ [[package]] name = "codegen_runtime_cargo" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "ariadne", @@ -424,7 +424,7 @@ dependencies = [ [[package]] name = "codegen_runtime_generator" -version = "0.15.1" +version = "0.16.0" dependencies = [ "Inflector", "anyhow", @@ -442,7 +442,7 @@ dependencies = [ [[package]] name = "codegen_runtime_node_addon" -version = "0.15.1" +version = "0.16.0" dependencies = [ "metaslang_cst", "napi", @@ -458,7 +458,7 @@ dependencies = [ [[package]] name = "codegen_runtime_npm" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "codegen_runtime_generator", @@ -466,7 +466,7 @@ dependencies = [ [[package]] name = "codegen_spec" -version = "0.15.1" +version = "0.16.0" dependencies = [ "Inflector", "anyhow", @@ -479,7 +479,7 @@ dependencies = [ [[package]] name = "codegen_testing" -version = "0.15.1" +version = "0.16.0" dependencies = [ "Inflector", "anyhow", @@ -1195,7 +1195,7 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_cli" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "clap", @@ -1215,7 +1215,7 @@ dependencies = [ [[package]] name = "infra_utils" -version = "0.15.1" +version = "0.16.0" dependencies = [ "Inflector", "anyhow", @@ -1362,7 +1362,7 @@ dependencies = [ [[package]] name = "metaslang_bindings" -version = "0.15.1" +version = "0.16.0" dependencies = [ "metaslang_cst", "metaslang_graph_builder", @@ -1374,7 +1374,7 @@ dependencies = [ [[package]] name = "metaslang_cst" -version = "0.15.1" +version = "0.16.0" dependencies = [ "nom", "serde", @@ -1383,7 +1383,7 @@ dependencies = [ [[package]] name = "metaslang_graph_builder" -version = "0.15.1" +version = "0.16.0" dependencies = [ "env_logger", "indoc", @@ -2176,7 +2176,7 @@ dependencies = [ [[package]] name = "slang_solidity" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "ariadne", @@ -2196,7 +2196,7 @@ dependencies = [ [[package]] name = "slang_solidity_node_addon" -version = "0.15.1" +version = "0.16.0" dependencies = [ "metaslang_cst", "napi", @@ -2212,7 +2212,7 @@ dependencies = [ [[package]] name = "slang_testlang" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "ariadne", @@ -2232,7 +2232,7 @@ dependencies = [ [[package]] name = "slang_testlang_node_addon" -version = "0.15.1" +version = "0.16.0" dependencies = [ "metaslang_cst", "napi", @@ -2273,7 +2273,7 @@ dependencies = [ [[package]] name = "solidity_cargo_tests" -version = "0.15.1" +version = "0.16.0" dependencies = [ "Inflector", "anyhow", @@ -2294,7 +2294,7 @@ dependencies = [ [[package]] name = "solidity_language" -version = "0.15.1" +version = "0.16.0" dependencies = [ "codegen_language_definition", "codegen_language_macros", @@ -2303,7 +2303,7 @@ dependencies = [ [[package]] name = "solidity_npm_package" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "codegen_runtime_generator", @@ -2313,7 +2313,7 @@ dependencies = [ [[package]] name = "solidity_spec" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "codegen_spec", @@ -2323,7 +2323,7 @@ dependencies = [ [[package]] name = "solidity_testing_perf" -version = "0.15.1" +version = "0.16.0" dependencies = [ "iai-callgrind", "semver", @@ -2332,7 +2332,7 @@ dependencies = [ [[package]] name = "solidity_testing_sanctuary" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "clap", @@ -2352,11 +2352,11 @@ dependencies = [ [[package]] name = "solidity_testing_snapshots" -version = "0.15.1" +version = "0.16.0" [[package]] name = "solidity_testing_solc" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "ariadne", @@ -2552,7 +2552,7 @@ dependencies = [ [[package]] name = "testlang_cargo_tests" -version = "0.15.1" +version = "0.16.0" dependencies = [ "metaslang_graph_builder", "semver", @@ -2561,7 +2561,7 @@ dependencies = [ [[package]] name = "testlang_language" -version = "0.15.1" +version = "0.16.0" dependencies = [ "codegen_language_definition", "codegen_language_macros", @@ -2570,7 +2570,7 @@ dependencies = [ [[package]] name = "testlang_npm_package" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "codegen_runtime_generator", diff --git a/Cargo.toml b/Cargo.toml index 429b3f6c3a..984919b7ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.15.1" +version = "0.16.0" rust-version = "1.79.0" # __RUST_STABLE_VERSION_MARKER__ (keep in sync) edition = "2021" publish = false @@ -48,41 +48,41 @@ members = [ # # Internal # -codegen_ebnf = { path = "crates/codegen/ebnf", version = "0.15.1" } -codegen_language_definition = { path = "crates/codegen/language/definition", version = "0.15.1" } -codegen_language_internal_macros = { path = "crates/codegen/language/internal_macros", version = "0.15.1" } -codegen_language_macros = { path = "crates/codegen/language/macros", version = "0.15.1" } -codegen_language_tests = { path = "crates/codegen/language/tests", version = "0.15.1" } -codegen_runtime_cargo = { path = "crates/codegen/runtime/cargo", version = "0.15.1" } -codegen_runtime_generator = { path = "crates/codegen/runtime/generator", version = "0.15.1" } -codegen_runtime_node_addon = { path = "crates/codegen/runtime/node_addon", version = "0.15.1" } -codegen_runtime_npm = { path = "crates/codegen/runtime/npm", version = "0.15.1" } -codegen_spec = { path = "crates/codegen/spec", version = "0.15.1" } -codegen_testing = { path = "crates/codegen/testing", version = "0.15.1" } +codegen_ebnf = { path = "crates/codegen/ebnf", version = "0.16.0" } +codegen_language_definition = { path = "crates/codegen/language/definition", version = "0.16.0" } +codegen_language_internal_macros = { path = "crates/codegen/language/internal_macros", version = "0.16.0" } +codegen_language_macros = { path = "crates/codegen/language/macros", version = "0.16.0" } +codegen_language_tests = { path = "crates/codegen/language/tests", version = "0.16.0" } +codegen_runtime_cargo = { path = "crates/codegen/runtime/cargo", version = "0.16.0" } +codegen_runtime_generator = { path = "crates/codegen/runtime/generator", version = "0.16.0" } +codegen_runtime_node_addon = { path = "crates/codegen/runtime/node_addon", version = "0.16.0" } +codegen_runtime_npm = { path = "crates/codegen/runtime/npm", version = "0.16.0" } +codegen_spec = { path = "crates/codegen/spec", version = "0.16.0" } +codegen_testing = { path = "crates/codegen/testing", version = "0.16.0" } -infra_cli = { path = "crates/infra/cli", version = "0.15.1" } -infra_utils = { path = "crates/infra/utils", version = "0.15.1" } +infra_cli = { path = "crates/infra/cli", version = "0.16.0" } +infra_utils = { path = "crates/infra/utils", version = "0.16.0" } -metaslang_bindings = { path = "crates/metaslang/bindings", version = "0.15.1" } -metaslang_graph_builder = { path = "crates/metaslang/graph_builder", version = "0.15.1" } -metaslang_cst = { path = "crates/metaslang/cst", version = "0.15.1" } +metaslang_bindings = { path = "crates/metaslang/bindings", version = "0.16.0" } +metaslang_graph_builder = { path = "crates/metaslang/graph_builder", version = "0.16.0" } +metaslang_cst = { path = "crates/metaslang/cst", version = "0.16.0" } -slang_solidity = { path = "crates/solidity/outputs/cargo/slang_solidity", version = "0.15.1" } -slang_solidity_node_addon = { path = "crates/solidity/outputs/cargo/slang_solidity_node_addon", version = "0.15.1" } -solidity_cargo_tests = { path = "crates/solidity/outputs/cargo/tests", version = "0.15.1" } -solidity_language = { path = "crates/solidity/inputs/language", version = "0.15.1" } -solidity_npm_package = { path = "crates/solidity/outputs/npm/package", version = "0.15.1" } -solidity_spec = { path = "crates/solidity/outputs/spec", version = "0.15.1" } -solidity_testing_perf = { path = "crates/solidity/testing/perf", version = "0.15.1" } -solidity_testing_sanctuary = { path = "crates/solidity/testing/sanctuary", version = "0.15.1" } -solidity_testing_snapshots = { path = "crates/solidity/testing/snapshots", version = "0.15.1" } -solidity_testing_solc = { path = "crates/solidity/testing/solc", version = "0.15.1" } +slang_solidity = { path = "crates/solidity/outputs/cargo/slang_solidity", version = "0.16.0" } +slang_solidity_node_addon = { path = "crates/solidity/outputs/cargo/slang_solidity_node_addon", version = "0.16.0" } +solidity_cargo_tests = { path = "crates/solidity/outputs/cargo/tests", version = "0.16.0" } +solidity_language = { path = "crates/solidity/inputs/language", version = "0.16.0" } +solidity_npm_package = { path = "crates/solidity/outputs/npm/package", version = "0.16.0" } +solidity_spec = { path = "crates/solidity/outputs/spec", version = "0.16.0" } +solidity_testing_perf = { path = "crates/solidity/testing/perf", version = "0.16.0" } +solidity_testing_sanctuary = { path = "crates/solidity/testing/sanctuary", version = "0.16.0" } +solidity_testing_snapshots = { path = "crates/solidity/testing/snapshots", version = "0.16.0" } +solidity_testing_solc = { path = "crates/solidity/testing/solc", version = "0.16.0" } -slang_testlang = { path = "crates/testlang/outputs/cargo/slang_testlang", version = "0.15.1" } -slang_testlang_node_addon = { path = "crates/testlang/outputs/cargo/slang_testlang_node_addon", version = "0.15.1" } -testlang_cargo_tests = { path = "crates/testlang/outputs/cargo/tests", version = "0.15.1" } -testlang_language = { path = "crates/testlang/inputs/language", version = "0.15.1" } -testlang_npm_package = { path = "crates/testlang/outputs/npm/package", version = "0.15.1" } +slang_testlang = { path = "crates/testlang/outputs/cargo/slang_testlang", version = "0.16.0" } +slang_testlang_node_addon = { path = "crates/testlang/outputs/cargo/slang_testlang_node_addon", version = "0.16.0" } +testlang_cargo_tests = { path = "crates/testlang/outputs/cargo/tests", version = "0.16.0" } +testlang_language = { path = "crates/testlang/inputs/language", version = "0.16.0" } +testlang_npm_package = { path = "crates/testlang/outputs/npm/package", version = "0.16.0" } # # External diff --git a/crates/codegen/runtime/npm/CHANGELOG.md b/crates/codegen/runtime/npm/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/codegen/runtime/npm/CHANGELOG.md +++ b/crates/codegen/runtime/npm/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/metaslang/cst/CHANGELOG.md b/crates/metaslang/cst/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/metaslang/cst/CHANGELOG.md +++ b/crates/metaslang/cst/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/metaslang/graph_builder/CHANGELOG.md b/crates/metaslang/graph_builder/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/metaslang/graph_builder/CHANGELOG.md +++ b/crates/metaslang/graph_builder/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/cargo/slang_solidity/CHANGELOG.md b/crates/solidity/outputs/cargo/slang_solidity/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/CHANGELOG.md +++ b/crates/solidity/outputs/cargo/slang_solidity/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/CHANGELOG.md b/crates/solidity/outputs/npm/package/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/package.json b/crates/solidity/outputs/npm/package/package.json index 898e597faf..edbc8fcc54 100644 --- a/crates/solidity/outputs/npm/package/package.json +++ b/crates/solidity/outputs/npm/package/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang", - "version": "0.15.1", + "version": "0.16.0", "description": "A modular set of compiler APIs empowering the next generation of Solidity code analysis and developer tooling. Written in Rust and distributed in multiple languages.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", @@ -32,15 +32,15 @@ "@napi-rs/cli": "2.18.4" }, "dependencies": { - "@nomicfoundation/slang-darwin-arm64": "0.15.1", - "@nomicfoundation/slang-win32-arm64-msvc": "0.15.1", - "@nomicfoundation/slang-linux-arm64-gnu": "0.15.1", - "@nomicfoundation/slang-linux-arm64-musl": "0.15.1", - "@nomicfoundation/slang-win32-ia32-msvc": "0.15.1", - "@nomicfoundation/slang-darwin-x64": "0.15.1", - "@nomicfoundation/slang-win32-x64-msvc": "0.15.1", - "@nomicfoundation/slang-linux-x64-gnu": "0.15.1", - "@nomicfoundation/slang-linux-x64-musl": "0.15.1" + "@nomicfoundation/slang-darwin-arm64": "0.16.0", + "@nomicfoundation/slang-win32-arm64-msvc": "0.16.0", + "@nomicfoundation/slang-linux-arm64-gnu": "0.16.0", + "@nomicfoundation/slang-linux-arm64-musl": "0.16.0", + "@nomicfoundation/slang-win32-ia32-msvc": "0.16.0", + "@nomicfoundation/slang-darwin-x64": "0.16.0", + "@nomicfoundation/slang-win32-x64-msvc": "0.16.0", + "@nomicfoundation/slang-linux-x64-gnu": "0.16.0", + "@nomicfoundation/slang-linux-x64-musl": "0.16.0" }, "napi": { "triples": { diff --git a/crates/solidity/outputs/npm/package/platforms/darwin-arm64/CHANGELOG.md b/crates/solidity/outputs/npm/package/platforms/darwin-arm64/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/platforms/darwin-arm64/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/platforms/darwin-arm64/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/platforms/darwin-arm64/package.json b/crates/solidity/outputs/npm/package/platforms/darwin-arm64/package.json index 975b3505f8..8db56c73ef 100644 --- a/crates/solidity/outputs/npm/package/platforms/darwin-arm64/package.json +++ b/crates/solidity/outputs/npm/package/platforms/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang-darwin-arm64", - "version": "0.15.1", + "version": "0.16.0", "description": "Platform-specific binaries for @nomicfoundation/slang.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", diff --git a/crates/solidity/outputs/npm/package/platforms/darwin-x64/CHANGELOG.md b/crates/solidity/outputs/npm/package/platforms/darwin-x64/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/platforms/darwin-x64/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/platforms/darwin-x64/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/platforms/darwin-x64/package.json b/crates/solidity/outputs/npm/package/platforms/darwin-x64/package.json index 78d24b158b..04c8f63a14 100644 --- a/crates/solidity/outputs/npm/package/platforms/darwin-x64/package.json +++ b/crates/solidity/outputs/npm/package/platforms/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang-darwin-x64", - "version": "0.15.1", + "version": "0.16.0", "description": "Platform-specific binaries for @nomicfoundation/slang.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", diff --git a/crates/solidity/outputs/npm/package/platforms/linux-arm64-gnu/CHANGELOG.md b/crates/solidity/outputs/npm/package/platforms/linux-arm64-gnu/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/platforms/linux-arm64-gnu/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/platforms/linux-arm64-gnu/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/platforms/linux-arm64-gnu/package.json b/crates/solidity/outputs/npm/package/platforms/linux-arm64-gnu/package.json index c752f24b85..debf7fccf9 100644 --- a/crates/solidity/outputs/npm/package/platforms/linux-arm64-gnu/package.json +++ b/crates/solidity/outputs/npm/package/platforms/linux-arm64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang-linux-arm64-gnu", - "version": "0.15.1", + "version": "0.16.0", "description": "Platform-specific binaries for @nomicfoundation/slang.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", diff --git a/crates/solidity/outputs/npm/package/platforms/linux-arm64-musl/CHANGELOG.md b/crates/solidity/outputs/npm/package/platforms/linux-arm64-musl/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/platforms/linux-arm64-musl/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/platforms/linux-arm64-musl/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/platforms/linux-arm64-musl/package.json b/crates/solidity/outputs/npm/package/platforms/linux-arm64-musl/package.json index f4214cb200..32181c6cbb 100644 --- a/crates/solidity/outputs/npm/package/platforms/linux-arm64-musl/package.json +++ b/crates/solidity/outputs/npm/package/platforms/linux-arm64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang-linux-arm64-musl", - "version": "0.15.1", + "version": "0.16.0", "description": "Platform-specific binaries for @nomicfoundation/slang.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", diff --git a/crates/solidity/outputs/npm/package/platforms/linux-x64-gnu/CHANGELOG.md b/crates/solidity/outputs/npm/package/platforms/linux-x64-gnu/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/platforms/linux-x64-gnu/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/platforms/linux-x64-gnu/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/platforms/linux-x64-gnu/package.json b/crates/solidity/outputs/npm/package/platforms/linux-x64-gnu/package.json index 00cd5f4405..8d85963c25 100644 --- a/crates/solidity/outputs/npm/package/platforms/linux-x64-gnu/package.json +++ b/crates/solidity/outputs/npm/package/platforms/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang-linux-x64-gnu", - "version": "0.15.1", + "version": "0.16.0", "description": "Platform-specific binaries for @nomicfoundation/slang.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", diff --git a/crates/solidity/outputs/npm/package/platforms/linux-x64-musl/CHANGELOG.md b/crates/solidity/outputs/npm/package/platforms/linux-x64-musl/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/platforms/linux-x64-musl/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/platforms/linux-x64-musl/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/platforms/linux-x64-musl/package.json b/crates/solidity/outputs/npm/package/platforms/linux-x64-musl/package.json index ebaea9503c..2cc2b28443 100644 --- a/crates/solidity/outputs/npm/package/platforms/linux-x64-musl/package.json +++ b/crates/solidity/outputs/npm/package/platforms/linux-x64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang-linux-x64-musl", - "version": "0.15.1", + "version": "0.16.0", "description": "Platform-specific binaries for @nomicfoundation/slang.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", diff --git a/crates/solidity/outputs/npm/package/platforms/win32-arm64-msvc/CHANGELOG.md b/crates/solidity/outputs/npm/package/platforms/win32-arm64-msvc/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/platforms/win32-arm64-msvc/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/platforms/win32-arm64-msvc/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/platforms/win32-arm64-msvc/package.json b/crates/solidity/outputs/npm/package/platforms/win32-arm64-msvc/package.json index 4bba3f9954..1e6e9b537c 100644 --- a/crates/solidity/outputs/npm/package/platforms/win32-arm64-msvc/package.json +++ b/crates/solidity/outputs/npm/package/platforms/win32-arm64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang-win32-arm64-msvc", - "version": "0.15.1", + "version": "0.16.0", "description": "Platform-specific binaries for @nomicfoundation/slang.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", diff --git a/crates/solidity/outputs/npm/package/platforms/win32-ia32-msvc/CHANGELOG.md b/crates/solidity/outputs/npm/package/platforms/win32-ia32-msvc/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/platforms/win32-ia32-msvc/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/platforms/win32-ia32-msvc/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/platforms/win32-ia32-msvc/package.json b/crates/solidity/outputs/npm/package/platforms/win32-ia32-msvc/package.json index 774b9292b8..41c01ec5b6 100644 --- a/crates/solidity/outputs/npm/package/platforms/win32-ia32-msvc/package.json +++ b/crates/solidity/outputs/npm/package/platforms/win32-ia32-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang-win32-ia32-msvc", - "version": "0.15.1", + "version": "0.16.0", "description": "Platform-specific binaries for @nomicfoundation/slang.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", diff --git a/crates/solidity/outputs/npm/package/platforms/win32-x64-msvc/CHANGELOG.md b/crates/solidity/outputs/npm/package/platforms/win32-x64-msvc/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/solidity/outputs/npm/package/platforms/win32-x64-msvc/CHANGELOG.md +++ b/crates/solidity/outputs/npm/package/platforms/win32-x64-msvc/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/crates/solidity/outputs/npm/package/platforms/win32-x64-msvc/package.json b/crates/solidity/outputs/npm/package/platforms/win32-x64-msvc/package.json index fb17b3707e..661ab41f98 100644 --- a/crates/solidity/outputs/npm/package/platforms/win32-x64-msvc/package.json +++ b/crates/solidity/outputs/npm/package/platforms/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/slang-win32-x64-msvc", - "version": "0.15.1", + "version": "0.16.0", "description": "Platform-specific binaries for @nomicfoundation/slang.", "homepage": "https://nomicfoundation.github.io/slang/", "license": "MIT", diff --git a/crates/testlang/outputs/npm/package/CHANGELOG.md b/crates/testlang/outputs/npm/package/CHANGELOG.md index 5d4cd3e294..e0bf4672ae 100644 --- a/crates/testlang/outputs/npm/package/CHANGELOG.md +++ b/crates/testlang/outputs/npm/package/CHANGELOG.md @@ -1,5 +1,29 @@ # changelog +## 0.16.0 + +### Minor Changes + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. + +- [#1030](https://github.com/NomicFoundation/slang/pull/1030) [`7e467ce`](https://github.com/NomicFoundation/slang/commit/7e467ce199cb07acb443da9f542fbcc74f2a5321) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. + +### Patch Changes + +- [#1015](https://github.com/NomicFoundation/slang/pull/1015) [`369ee30`](https://github.com/NomicFoundation/slang/commit/369ee309325ef57c7cd6f29e2f7adc4f9ec09c88) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. + +- [#1048](https://github.com/NomicFoundation/slang/pull/1048) [`c408caa`](https://github.com/NomicFoundation/slang/commit/c408caae1826095cc2f2c01caf9be58ab5ff8eee) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration + +- [#1047](https://github.com/NomicFoundation/slang/pull/1047) [`2b32045`](https://github.com/NomicFoundation/slang/commit/2b3204549af27ea3782da2a9a2de470db13a7402) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` + +- [#1062](https://github.com/NomicFoundation/slang/pull/1062) [`6b05496`](https://github.com/NomicFoundation/slang/commit/6b05496cbd19b5a7f65033fb223c1bcd3d448738) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. + +- [#1052](https://github.com/NomicFoundation/slang/pull/1052) [`54c9067`](https://github.com/NomicFoundation/slang/commit/54c9067aa6c587ff93cac6575726a9068a9bb758) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. + +- [#1037](https://github.com/NomicFoundation/slang/pull/1037) [`2a74f91`](https://github.com/NomicFoundation/slang/commit/2a74f91ed8e67fc3d315afd49f593dfef52f0e4d) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` + ## 0.15.1 ### Patch Changes diff --git a/package-lock.json b/package-lock.json index 19ccd04190..65ce9616a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,18 +52,18 @@ }, "crates/solidity/outputs/npm/package": { "name": "@nomicfoundation/slang", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "dependencies": { - "@nomicfoundation/slang-darwin-arm64": "0.15.1", - "@nomicfoundation/slang-darwin-x64": "0.15.1", - "@nomicfoundation/slang-linux-arm64-gnu": "0.15.1", - "@nomicfoundation/slang-linux-arm64-musl": "0.15.1", - "@nomicfoundation/slang-linux-x64-gnu": "0.15.1", - "@nomicfoundation/slang-linux-x64-musl": "0.15.1", - "@nomicfoundation/slang-win32-arm64-msvc": "0.15.1", - "@nomicfoundation/slang-win32-ia32-msvc": "0.15.1", - "@nomicfoundation/slang-win32-x64-msvc": "0.15.1" + "@nomicfoundation/slang-darwin-arm64": "0.16.0", + "@nomicfoundation/slang-darwin-x64": "0.16.0", + "@nomicfoundation/slang-linux-arm64-gnu": "0.16.0", + "@nomicfoundation/slang-linux-arm64-musl": "0.16.0", + "@nomicfoundation/slang-linux-x64-gnu": "0.16.0", + "@nomicfoundation/slang-linux-x64-musl": "0.16.0", + "@nomicfoundation/slang-win32-arm64-msvc": "0.16.0", + "@nomicfoundation/slang-win32-ia32-msvc": "0.16.0", + "@nomicfoundation/slang-win32-x64-msvc": "0.16.0" }, "devDependencies": { "@napi-rs/cli": "2.18.4" @@ -74,7 +74,7 @@ }, "crates/solidity/outputs/npm/package/platforms/darwin-arm64": { "name": "@nomicfoundation/slang-darwin-arm64", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "engines": { "node": ">= 10" @@ -82,7 +82,7 @@ }, "crates/solidity/outputs/npm/package/platforms/darwin-x64": { "name": "@nomicfoundation/slang-darwin-x64", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "engines": { "node": ">= 10" @@ -90,7 +90,7 @@ }, "crates/solidity/outputs/npm/package/platforms/linux-arm64-gnu": { "name": "@nomicfoundation/slang-linux-arm64-gnu", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "engines": { "node": ">= 10" @@ -98,7 +98,7 @@ }, "crates/solidity/outputs/npm/package/platforms/linux-arm64-musl": { "name": "@nomicfoundation/slang-linux-arm64-musl", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "engines": { "node": ">= 10" @@ -106,7 +106,7 @@ }, "crates/solidity/outputs/npm/package/platforms/linux-x64-gnu": { "name": "@nomicfoundation/slang-linux-x64-gnu", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "engines": { "node": ">= 10" @@ -114,7 +114,7 @@ }, "crates/solidity/outputs/npm/package/platforms/linux-x64-musl": { "name": "@nomicfoundation/slang-linux-x64-musl", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "engines": { "node": ">= 10" @@ -122,7 +122,7 @@ }, "crates/solidity/outputs/npm/package/platforms/win32-arm64-msvc": { "name": "@nomicfoundation/slang-win32-arm64-msvc", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "engines": { "node": ">= 10" @@ -130,7 +130,7 @@ }, "crates/solidity/outputs/npm/package/platforms/win32-ia32-msvc": { "name": "@nomicfoundation/slang-win32-ia32-msvc", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "engines": { "node": ">= 10" @@ -138,7 +138,7 @@ }, "crates/solidity/outputs/npm/package/platforms/win32-x64-msvc": { "name": "@nomicfoundation/slang-win32-x64-msvc", - "version": "0.15.1", + "version": "0.16.0", "license": "MIT", "engines": { "node": ">= 10" From cb36a4b9b0d600961f84cc15e2ed5db710edc6e7 Mon Sep 17 00:00:00 2001 From: Omar Tawfik <15987992+OmarTawfik@users.noreply.github.com> Date: Wed, 7 Aug 2024 03:47:18 -0700 Subject: [PATCH 13/13] unblock release pipeline (#1065) Release pipeline is [currently failing](https://github.com/NomicFoundation/slang/actions/runs/10281343571/job/28451407526) due to a tiny bug in `Command::run()`, where it returns a `Result<()>` even though it is panicking on error. This PR fixes that, and fixes all callsites to not expect a result. Just a mechanical find/replace. The only functional change (the bug fix) is in `crates/infra/cli/src/toolchains/mkdocs/mod.rs` to use `Command::evaluate()` instead to check for the sub-process result. --- crates/infra/cli/src/commands/check/mod.rs | 18 ++++---- .../infra/cli/src/commands/completions/mod.rs | 6 +-- crates/infra/cli/src/commands/lint/mod.rs | 46 +++++++++++-------- crates/infra/cli/src/commands/mod.rs | 20 ++++---- crates/infra/cli/src/commands/perf/mod.rs | 15 +++--- .../cli/src/commands/publish/cargo/mod.rs | 12 ++--- .../src/commands/publish/changesets/mod.rs | 10 ++-- .../cli/src/commands/publish/mkdocs/mod.rs | 6 ++- .../infra/cli/src/commands/publish/npm/mod.rs | 4 +- crates/infra/cli/src/commands/run/mod.rs | 5 +- .../infra/cli/src/commands/setup/cargo/mod.rs | 30 +++++------- .../infra/cli/src/commands/setup/git/mod.rs | 11 ++--- crates/infra/cli/src/commands/setup/mod.rs | 8 ++-- .../infra/cli/src/commands/setup/npm/mod.rs | 7 ++- crates/infra/cli/src/commands/test/mod.rs | 14 ++++-- crates/infra/cli/src/commands/watch/mod.rs | 10 ++-- crates/infra/cli/src/toolchains/mkdocs/mod.rs | 26 ++++++----- crates/infra/cli/src/toolchains/napi/cli.rs | 2 +- .../infra/cli/src/toolchains/napi/compiler.rs | 4 +- crates/infra/cli/src/toolchains/napi/glibc.rs | 2 +- crates/infra/cli/src/toolchains/pipenv/mod.rs | 4 +- crates/infra/utils/src/cargo/workspace.rs | 8 +++- crates/infra/utils/src/commands/mod.rs | 24 +++++----- crates/infra/utils/src/git/mod.rs | 12 ++--- crates/infra/utils/src/github/mod.rs | 6 ++- .../testing/sanctuary/src/datasets.rs | 19 ++++---- crates/solidity/testing/sanctuary/src/main.rs | 2 +- 27 files changed, 172 insertions(+), 159 deletions(-) diff --git a/crates/infra/cli/src/commands/check/mod.rs b/crates/infra/cli/src/commands/check/mod.rs index 4f439fc367..957b9782a2 100644 --- a/crates/infra/cli/src/commands/check/mod.rs +++ b/crates/infra/cli/src/commands/check/mod.rs @@ -40,13 +40,15 @@ impl OrderedCommand for CheckCommand { match self { CheckCommand::Cargo => check_cargo(), CheckCommand::Rustdoc => check_rustdoc(), - CheckCommand::Npm => check_npm(), + CheckCommand::Npm => check_npm()?, CheckCommand::Mkdocs => check_mkdocs(), - } + }; + + Ok(()) } } -fn check_cargo() -> Result<()> { +fn check_cargo() { // 'cargo clippy' will run both 'cargo check', and 'clippy' lints: Command::new("cargo") .arg("clippy") @@ -55,10 +57,10 @@ fn check_cargo() -> Result<()> { .flag("--all-targets") .flag("--no-deps") .add_build_rustflags() - .run() + .run(); } -fn check_rustdoc() -> Result<()> { +fn check_rustdoc() { Command::new("cargo") .arg("doc") .flag("--workspace") @@ -66,7 +68,7 @@ fn check_rustdoc() -> Result<()> { .flag("--no-deps") .flag("--document-private-items") .add_build_rustflags() - .run() + .run(); } fn check_npm() -> Result<()> { @@ -77,6 +79,6 @@ fn check_npm() -> Result<()> { Ok(()) } -fn check_mkdocs() -> Result<()> { - Mkdocs::check() +fn check_mkdocs() { + Mkdocs::check(); } diff --git a/crates/infra/cli/src/commands/completions/mod.rs b/crates/infra/cli/src/commands/completions/mod.rs index 951f9dbe1f..64613e2632 100644 --- a/crates/infra/cli/src/commands/completions/mod.rs +++ b/crates/infra/cli/src/commands/completions/mod.rs @@ -1,4 +1,3 @@ -use anyhow::Result; use clap::{CommandFactory, Parser}; use clap_complete::Generator; @@ -11,13 +10,10 @@ pub struct CompletionController { } impl CompletionController { - #[allow(clippy::unnecessary_wraps)] // for consistency with other commands - pub fn execute(&self) -> Result<()> { + pub fn execute(&self) { let mut command = crate::commands::Cli::command(); command.build(); // Required to generate completions self.shell.generate(&command, &mut std::io::stdout()); - - Ok(()) } } diff --git a/crates/infra/cli/src/commands/lint/mod.rs b/crates/infra/cli/src/commands/lint/mod.rs index cb34c055f2..45d4d62aae 100644 --- a/crates/infra/cli/src/commands/lint/mod.rs +++ b/crates/infra/cli/src/commands/lint/mod.rs @@ -49,31 +49,33 @@ impl OrderedCommand for LintCommand { match self { LintCommand::Cspell => run_cspell(), LintCommand::Prettier => run_prettier(), - LintCommand::MarkdownLinkCheck => run_markdown_link_check(), - LintCommand::MarkdownLint => run_markdown_lint(), + LintCommand::MarkdownLinkCheck => run_markdown_link_check()?, + LintCommand::MarkdownLint => run_markdown_lint()?, LintCommand::Rustfmt => run_rustfmt(), - LintCommand::Shellcheck => run_shellcheck(), + LintCommand::Shellcheck => run_shellcheck()?, LintCommand::Tsc => run_tsc(), - LintCommand::Yamllint => run_yamllint(), - } + LintCommand::Yamllint => run_yamllint()?, + }; + + Ok(()) } } -fn run_cspell() -> Result<()> { +fn run_cspell() { Command::new("cspell") .arg("lint") .flag("--show-context") .flag("--show-suggestions") .flag("--dot") .flag("--gitignore") - .run() + .run(); } -fn run_prettier() -> Result<()> { +fn run_prettier() { if GitHub::is_running_in_ci() { - Command::new("prettier").property("--check", ".").run() + Command::new("prettier").property("--check", ".").run(); } else { - Command::new("prettier").property("--write", ".").run() + Command::new("prettier").property("--write", ".").run(); } } @@ -82,9 +84,11 @@ fn run_markdown_link_check() -> Result<()> { let markdown_files = FileWalker::from_repo_root().find(["**/*.md"])?; - return Command::new("markdown-link-check") + Command::new("markdown-link-check") .property("--config", config_file.unwrap_str()) .run_xargs(markdown_files); + + Ok(()) } fn run_markdown_lint() -> Result<()> { @@ -99,10 +103,12 @@ fn run_markdown_lint() -> Result<()> { command = command.flag("--fix"); } - command.run_xargs(markdown_files) + command.run_xargs(markdown_files); + + Ok(()) } -fn run_rustfmt() -> Result<()> { +fn run_rustfmt() { let mut command = Command::new("cargo-fmt") .arg(format!("+{}", env!("RUST_NIGHTLY_VERSION"))) .flag("--all") @@ -112,7 +118,7 @@ fn run_rustfmt() -> Result<()> { command = command.flag("--check"); } - command.run() + command.run(); } fn run_shellcheck() -> Result<()> { @@ -123,13 +129,15 @@ fn run_shellcheck() -> Result<()> { path }); - Command::new("shellcheck").run_xargs(bash_files) + Command::new("shellcheck").run_xargs(bash_files); + + Ok(()) } -fn run_tsc() -> Result<()> { +fn run_tsc() { let root_project = Path::repo_path("tsconfig.json"); - return Command::new("tsc") + Command::new("tsc") .property("--build", root_project.unwrap_str()) .run(); } @@ -144,8 +152,10 @@ fn run_yamllint() -> Result<()> { path }); - return PipEnv::run("yamllint") + PipEnv::run("yamllint") .flag("--strict") .property("--config-file", config_file.unwrap_str()) .run_xargs(yaml_files); + + Ok(()) } diff --git a/crates/infra/cli/src/commands/mod.rs b/crates/infra/cli/src/commands/mod.rs index 30b8e9fd41..991c0df823 100644 --- a/crates/infra/cli/src/commands/mod.rs +++ b/crates/infra/cli/src/commands/mod.rs @@ -71,16 +71,18 @@ impl Cli { impl AppCommand { pub fn execute(&self) -> Result<()> { match self { - AppCommand::Setup(controller) => controller.execute(), - AppCommand::Check(controller) => controller.execute(), - AppCommand::Test(controller) => controller.execute(), - AppCommand::Lint(controller) => controller.execute(), - AppCommand::Ci(controller) => controller.execute(), + AppCommand::Setup(controller) => controller.execute()?, + AppCommand::Check(controller) => controller.execute()?, + AppCommand::Test(controller) => controller.execute()?, + AppCommand::Lint(controller) => controller.execute()?, + AppCommand::Ci(controller) => controller.execute()?, AppCommand::Run(controller) => controller.execute(), - AppCommand::Watch(controller) => controller.execute(), - AppCommand::Perf(controller) => controller.execute(), - AppCommand::Publish(controller) => controller.execute(), + AppCommand::Watch(controller) => controller.execute()?, + AppCommand::Perf(controller) => controller.execute()?, + AppCommand::Publish(controller) => controller.execute()?, AppCommand::Completions(controller) => controller.execute(), - } + }; + + Ok(()) } } diff --git a/crates/infra/cli/src/commands/perf/mod.rs b/crates/infra/cli/src/commands/perf/mod.rs index 03d74ac726..936d5d4b0e 100644 --- a/crates/infra/cli/src/commands/perf/mod.rs +++ b/crates/infra/cli/src/commands/perf/mod.rs @@ -32,7 +32,7 @@ impl PerfController { // Bencher supports multiple languages/frameworks: https://bencher.dev/docs/explanation/adapters/ // We currently only have one benchmark suite (Rust/iai), but we can add more here in the future. - run_iai_bench("solidity_testing_perf", "iai")?; + run_iai_bench("solidity_testing_perf", "iai"); } }; @@ -62,10 +62,11 @@ fn install_perf_tools() -> Result<()> { Ok(()) } -fn run_iai_bench(package_name: &str, bench_name: &str) -> Result<()> { - if std::env::var("BENCHER_API_TOKEN").is_err() { - bail!("BENCHER_API_TOKEN is not set. Please set it to your Bencher API token: https://bencher.dev/console"); - } +fn run_iai_bench(package_name: &str, bench_name: &str) { + assert!( + std::env::var("BENCHER_API_TOKEN").is_ok(), + "BENCHER_API_TOKEN is not set. Please set it to your Bencher API token: https://bencher.dev/console", + ); let cargo_command = format!("cargo bench --package {package_name} --bench {bench_name}"); @@ -81,7 +82,7 @@ fn run_iai_bench(package_name: &str, bench_name: &str) -> Result<()> { .property("--adapter", "rust_iai_callgrind") .property("--testbed", testbed) .arg(cargo_command) - .run()?; + .run(); let reports_dir = Path::repo_path("target/iai") .join(package_name) @@ -97,6 +98,4 @@ Reports/Logs: {reports_dir:?} - DHAT traces (dhat.*.out) can be viewed using the [dhat/dh_view.html] tool from the Valgrind release [https://valgrind.org/downloads/]. "); - - Ok(()) } diff --git a/crates/infra/cli/src/commands/publish/cargo/mod.rs b/crates/infra/cli/src/commands/publish/cargo/mod.rs index 1e32d3389c..3db271c7ea 100644 --- a/crates/infra/cli/src/commands/publish/cargo/mod.rs +++ b/crates/infra/cli/src/commands/publish/cargo/mod.rs @@ -50,7 +50,7 @@ impl CargoController { changeset.commit_changes()?; for crate_name in &changed_crates { - run_cargo_publish(crate_name, self.dry_run)?; + run_cargo_publish(crate_name, self.dry_run); } changeset.revert_changes()?; @@ -109,11 +109,11 @@ fn strip_publish_markers(cargo_toml_path: &Path) -> Result { fn update_cargo_lock(changeset: &mut TemporaryChangeset) -> Result<()> { let cargo_lock_path = Path::repo_path("Cargo.lock"); - let old_contents = std::fs::read_to_string(&cargo_lock_path)?; + let old_contents = cargo_lock_path.read_to_string()?; - Command::new("cargo").arg("check").run()?; + Command::new("cargo").arg("check").run(); - let new_contents = std::fs::read_to_string(&cargo_lock_path)?; + let new_contents = cargo_lock_path.read_to_string()?; if new_contents != old_contents { changeset.expect_change(&cargo_lock_path); @@ -122,7 +122,7 @@ fn update_cargo_lock(changeset: &mut TemporaryChangeset) -> Result<()> { Ok(()) } -fn run_cargo_publish(crate_name: &str, dry_run: DryRun) -> Result<()> { +fn run_cargo_publish(crate_name: &str, dry_run: DryRun) { let mut command = Command::new("cargo") .arg("publish") .property("--package", crate_name) @@ -132,5 +132,5 @@ fn run_cargo_publish(crate_name: &str, dry_run: DryRun) -> Result<()> { command = command.flag("--dry-run"); } - command.run() + command.run(); } diff --git a/crates/infra/cli/src/commands/publish/changesets/mod.rs b/crates/infra/cli/src/commands/publish/changesets/mod.rs index 8208e5d25e..032edd58f9 100644 --- a/crates/infra/cli/src/commands/publish/changesets/mod.rs +++ b/crates/infra/cli/src/commands/publish/changesets/mod.rs @@ -41,7 +41,7 @@ impl ChangesetsController { // 2) Update the CHANGELOG.md file for the NPM package. // 3) Bump the version in its package.json accordingly. - Command::new("changeset").arg("version").run()?; + Command::new("changeset").arg("version").run(); let updated_version = NapiConfig::local_version(&package_dir)?; println!("Updated version: {updated_version}"); @@ -56,14 +56,14 @@ impl ChangesetsController { let package_dir = resolver.main_package_dir(); Command::new("prettier") .property("--write", package_dir.unwrap_str()) - .run()?; + .run(); // Update NPM lock file: Command::new("npm") .arg("install") .flag("--package-lock-only") - .run()?; + .run(); // Update Cargo workspace: @@ -75,7 +75,7 @@ impl ChangesetsController { Command::new("cargo") .arg("update") .flag("--workspace") - .run()?; + .run(); // Update other CHANGELOG files: @@ -92,7 +92,7 @@ impl ChangesetsController { .args(["stash", "push"]) .flag("--include-untracked") .property("--message", "applied changesets") - .run()?; + .run(); println!(); println!("Source files are now updated with the new version, and stored in a 'git stash'."); diff --git a/crates/infra/cli/src/commands/publish/mkdocs/mod.rs b/crates/infra/cli/src/commands/publish/mkdocs/mod.rs index fcd505917e..350a185caa 100644 --- a/crates/infra/cli/src/commands/publish/mkdocs/mod.rs +++ b/crates/infra/cli/src/commands/publish/mkdocs/mod.rs @@ -24,7 +24,9 @@ impl MkdocsController { pub fn execute(&self) -> Result<()> { match self.target { PublishTarget::MainBranch => Mkdocs::publish_main_branch(self.dry_run), - PublishTarget::LatestRelease => Mkdocs::publish_latest_release(self.dry_run), - } + PublishTarget::LatestRelease => Mkdocs::publish_latest_release(self.dry_run)?, + }; + + Ok(()) } } diff --git a/crates/infra/cli/src/commands/publish/npm/mod.rs b/crates/infra/cli/src/commands/publish/npm/mod.rs index 8ee151063b..395ea730fa 100644 --- a/crates/infra/cli/src/commands/publish/npm/mod.rs +++ b/crates/infra/cli/src/commands/publish/npm/mod.rs @@ -70,5 +70,7 @@ fn publish_package( command = command.flag("--dry-run"); } - command.run() + command.run(); + + Ok(()) } diff --git a/crates/infra/cli/src/commands/run/mod.rs b/crates/infra/cli/src/commands/run/mod.rs index 47eb9bbaa0..715c2aec04 100644 --- a/crates/infra/cli/src/commands/run/mod.rs +++ b/crates/infra/cli/src/commands/run/mod.rs @@ -1,4 +1,3 @@ -use anyhow::Result; use clap::{Parser, ValueEnum}; use infra_utils::commands::Command; use infra_utils::terminal::Terminal; @@ -33,7 +32,7 @@ enum BinaryName { } impl RunController { - pub fn execute(&self) -> Result<()> { + pub fn execute(&self) { let bin = self.bin.clap_name(); Terminal::step(format!("run {bin}")); @@ -48,6 +47,6 @@ impl RunController { .property("--bin", bin) .arg("--") .args(&self.args) - .run() + .run(); } } diff --git a/crates/infra/cli/src/commands/setup/cargo/mod.rs b/crates/infra/cli/src/commands/setup/cargo/mod.rs index d1cb2f15e9..e8d92abbb3 100644 --- a/crates/infra/cli/src/commands/setup/cargo/mod.rs +++ b/crates/infra/cli/src/commands/setup/cargo/mod.rs @@ -1,8 +1,7 @@ -use anyhow::Result; use infra_utils::commands::Command; use infra_utils::github::GitHub; -pub fn setup_cargo() -> Result<()> { +pub fn setup_cargo() { // The bootstrap bash script defined in '$REPO_ROOT/scripts/_common.sh' // installs the 'minimal' profile of the '$RUST_STABLE_VERSION' toolchain. // This includes the following components: @@ -13,46 +12,41 @@ pub fn setup_cargo() -> Result<()> { // // Which are enough to run infra scripts. // But we need these additional optional components for local development: - rustup_add_components(env!("RUST_STABLE_VERSION"), ["clippy"])?; + rustup_add_components(env!("RUST_STABLE_VERSION"), ["clippy"]); if !GitHub::is_running_in_ci() { rustup_add_components( env!("RUST_STABLE_VERSION"), ["rust-analyzer", "rust-docs", "rust-src"], - )?; + ); } // Additionally, we also need 'rustfmt nightly', as we use experimental options. // So let's install the '$RUST_NIGHTLY_VERSION' toolchain along with the 'rustfmt' component. - rustup_install_toolchain(env!("RUST_NIGHTLY_VERSION"))?; - rustup_add_components(env!("RUST_NIGHTLY_VERSION"), ["rustfmt"])?; + rustup_install_toolchain(env!("RUST_NIGHTLY_VERSION")); + rustup_add_components(env!("RUST_NIGHTLY_VERSION"), ["rustfmt"]); // Make sure we have the latest dependencies: - run_cargo_fetch()?; - - Ok(()) + run_cargo_fetch(); } -fn rustup_install_toolchain(toolchain: &str) -> Result<()> { +fn rustup_install_toolchain(toolchain: &str) { Command::new("rustup") .arg("install") .flag("--no-self-update") .property("--profile", "minimal") .arg(toolchain) - .run() + .run(); } -fn rustup_add_components( - toolchain: &str, - components: impl IntoIterator>, -) -> Result<()> { +fn rustup_add_components(toolchain: &str, components: impl IntoIterator>) { Command::new("rustup") .args(["component", "add"]) .property("--toolchain", toolchain) .args(components) - .run() + .run(); } -fn run_cargo_fetch() -> Result<()> { +fn run_cargo_fetch() { let mut command = Command::new("cargo").arg("fetch"); if GitHub::is_running_in_ci() { @@ -61,5 +55,5 @@ fn run_cargo_fetch() -> Result<()> { command = command.flag("--locked"); } - command.run() + command.run(); } diff --git a/crates/infra/cli/src/commands/setup/git/mod.rs b/crates/infra/cli/src/commands/setup/git/mod.rs index dfc8c11507..39a1cf88a8 100644 --- a/crates/infra/cli/src/commands/setup/git/mod.rs +++ b/crates/infra/cli/src/commands/setup/git/mod.rs @@ -1,22 +1,19 @@ -use anyhow::Result; use infra_utils::commands::Command; use infra_utils::github::GitHub; -pub fn setup_git() -> Result<()> { +pub fn setup_git() { if !GitHub::is_running_in_ci() { println!("No need to modify local dev environments."); - return Ok(()); + return; } Command::new("git") .arg("config") .property("user.name", "github-actions") - .run()?; + .run(); Command::new("git") .arg("config") .property("user.email", "github-actions@users.noreply.github.com") - .run()?; - - Ok(()) + .run(); } diff --git a/crates/infra/cli/src/commands/setup/mod.rs b/crates/infra/cli/src/commands/setup/mod.rs index 1663ef984c..4e139326e2 100644 --- a/crates/infra/cli/src/commands/setup/mod.rs +++ b/crates/infra/cli/src/commands/setup/mod.rs @@ -49,8 +49,10 @@ impl OrderedCommand for SetupCommand { SetupCommand::Git => setup_git(), SetupCommand::Cargo => setup_cargo(), SetupCommand::Npm => setup_npm(), - SetupCommand::Pipenv => setup_pipenv(), - SetupCommand::ShellCompletions => setup_shell_completions(), - } + SetupCommand::Pipenv => setup_pipenv()?, + SetupCommand::ShellCompletions => setup_shell_completions()?, + }; + + Ok(()) } } diff --git a/crates/infra/cli/src/commands/setup/npm/mod.rs b/crates/infra/cli/src/commands/setup/npm/mod.rs index 76f4e35cb5..b999deecfd 100644 --- a/crates/infra/cli/src/commands/setup/npm/mod.rs +++ b/crates/infra/cli/src/commands/setup/npm/mod.rs @@ -1,11 +1,10 @@ -use anyhow::Result; use infra_utils::commands::Command; use infra_utils::github::GitHub; -pub fn setup_npm() -> Result<()> { +pub fn setup_npm() { if GitHub::is_running_in_ci() { - Command::new("npm").arg("ci").run() + Command::new("npm").arg("ci").run(); } else { - Command::new("npm").arg("install").run() + Command::new("npm").arg("install").run(); } } diff --git a/crates/infra/cli/src/commands/test/mod.rs b/crates/infra/cli/src/commands/test/mod.rs index fff501e32e..37fbb59b1c 100644 --- a/crates/infra/cli/src/commands/test/mod.rs +++ b/crates/infra/cli/src/commands/test/mod.rs @@ -31,9 +31,11 @@ impl OrderedCommand for TestCommand { Terminal::step(format!("test {name}", name = self.clap_name())); match self { - TestCommand::Cargo => test_cargo(), + TestCommand::Cargo => test_cargo()?, TestCommand::Npm => test_npm(), - } + }; + + Ok(()) } } @@ -49,9 +51,11 @@ fn test_cargo() -> Result<()> { .flag("--examples") .flag("--no-fail-fast") .add_build_rustflags() - .run() + .run(); + + Ok(()) } -fn test_npm() -> Result<()> { - Command::new("jest").run() +fn test_npm() { + Command::new("jest").run(); } diff --git a/crates/infra/cli/src/commands/watch/mod.rs b/crates/infra/cli/src/commands/watch/mod.rs index 0787d41ae1..a842ac1753 100644 --- a/crates/infra/cli/src/commands/watch/mod.rs +++ b/crates/infra/cli/src/commands/watch/mod.rs @@ -27,11 +27,9 @@ impl OrderedCommand for WatchCommand { Terminal::step(format!("watch {name}", name = self.clap_name())); match self { - WatchCommand::Mkdocs => watch_mkdocs(), - } - } -} + WatchCommand::Mkdocs => Mkdocs::watch(), + }; -fn watch_mkdocs() -> Result<()> { - Mkdocs::watch() + Ok(()) + } } diff --git a/crates/infra/cli/src/toolchains/mkdocs/mod.rs b/crates/infra/cli/src/toolchains/mkdocs/mod.rs index 6d1487e43d..4baae044fd 100644 --- a/crates/infra/cli/src/toolchains/mkdocs/mod.rs +++ b/crates/infra/cli/src/toolchains/mkdocs/mod.rs @@ -11,11 +11,11 @@ use crate::utils::DryRun; pub struct Mkdocs; impl Mkdocs { - pub fn check() -> Result<()> { - mkdocs().arg("build").flag("--clean").flag("--strict").run() + pub fn check() { + mkdocs().arg("build").flag("--clean").flag("--strict").run(); } - pub fn watch() -> Result<()> { + pub fn watch() { // _MKDOCS_WATCH_PORT_ | keep in sync with the port number defined in "$REPO_ROOT/.devcontainer/devcontainer.json" const PORT: usize = 5353; @@ -24,11 +24,11 @@ impl Mkdocs { .flag("--clean") .flag("--watch-theme") .property("--dev-addr", format!("localhost:{PORT}")) - .run() + .run(); } - pub fn publish_main_branch(dry_run: DryRun) -> Result<()> { - fetch_latest_remote()?; + pub fn publish_main_branch(dry_run: DryRun) { + fetch_latest_remote(); let mut command = mike().args(["deploy", "main"]); @@ -36,15 +36,15 @@ impl Mkdocs { command = command.flag("--push"); } - command.run() + command.run(); } pub fn publish_latest_release(dry_run: DryRun) -> Result<()> { - fetch_latest_remote()?; + fetch_latest_remote(); let version = CargoWorkspace::local_version()?.to_string(); - if mike().args(["list", &version]).run().is_ok() { + if mike().args(["list", &version]).evaluate().is_ok() { println!("Version '{version}' is already published."); return Ok(()); } @@ -57,15 +57,17 @@ impl Mkdocs { command = command.flag("--push"); } - command.run() + command.run(); + + Ok(()) } } -fn fetch_latest_remote() -> Result<()> { +fn fetch_latest_remote() { Command::new("git") .args(["fetch", "origin", "gh-pages"]) .property("--depth", "1") - .run() + .run(); } fn mkdocs() -> Command { diff --git a/crates/infra/cli/src/toolchains/napi/cli.rs b/crates/infra/cli/src/toolchains/napi/cli.rs index f291f23507..b6c8d9fb11 100644 --- a/crates/infra/cli/src/toolchains/napi/cli.rs +++ b/crates/infra/cli/src/toolchains/napi/cli.rs @@ -60,7 +60,7 @@ impl NapiCli { } }; - command.run()?; + command.run(); glibc::ensure_correct_glibc_for_vscode(resolver, output_dir, target)?; diff --git a/crates/infra/cli/src/toolchains/napi/compiler.rs b/crates/infra/cli/src/toolchains/napi/compiler.rs index aba0167d37..43ae878f6c 100644 --- a/crates/infra/cli/src/toolchains/napi/compiler.rs +++ b/crates/infra/cli/src/toolchains/napi/compiler.rs @@ -62,7 +62,7 @@ fn compile_all_targets(resolver: NapiResolver) -> Result> { Command::new("rustup") .args(["target", "add"]) .args(&targets) - .run()?; + .run(); // Needed for cross-compiling windows targets: CargoWorkspace::install_binary("cargo-xwin")?; @@ -127,7 +127,7 @@ fn compile_root_package(resolver: NapiResolver, node_binary: Option<&Path>) -> R .property("--outDir", output_dir.unwrap_str()) .property("--declaration", "true") .property("--noEmit", "false") - .run()?; + .run(); for file_name in &["package.json", "CHANGELOG.md", "LICENSE", "README.md"] { let source = package_dir.join(file_name); diff --git a/crates/infra/cli/src/toolchains/napi/glibc.rs b/crates/infra/cli/src/toolchains/napi/glibc.rs index aff31260df..e0da454a4f 100644 --- a/crates/infra/cli/src/toolchains/napi/glibc.rs +++ b/crates/infra/cli/src/toolchains/napi/glibc.rs @@ -109,7 +109,7 @@ pub fn ensure_correct_glibc_for_vscode( .flag("--release") .property("--target", format!("{target_triple}.{target_glibc}")) .property("--target-dir", zigbuild_output.path().to_string_lossy()) - .run()?; + .run(); // Overwrite the existing artifact with the cross-compiled one. let zigbuild_output = zigbuild_output.into_path(); diff --git a/crates/infra/cli/src/toolchains/pipenv/mod.rs b/crates/infra/cli/src/toolchains/pipenv/mod.rs index 10c460b239..56f60795da 100644 --- a/crates/infra/cli/src/toolchains/pipenv/mod.rs +++ b/crates/infra/cli/src/toolchains/pipenv/mod.rs @@ -24,7 +24,7 @@ impl PipEnv { Command::new("pip3") .arg("install") .arg(format!("pipenv{version}")) - .run()?; + .run(); let mut command = Command::new("python3") .property("-m", "pipenv") @@ -34,7 +34,7 @@ impl PipEnv { command = command.flag("--deploy"); } - command.run()?; + command.run(); Ok(()) } diff --git a/crates/infra/utils/src/cargo/workspace.rs b/crates/infra/utils/src/cargo/workspace.rs index ba7e7e0f07..8f0846c527 100644 --- a/crates/infra/utils/src/cargo/workspace.rs +++ b/crates/infra/utils/src/cargo/workspace.rs @@ -44,7 +44,9 @@ impl CargoWorkspace { .property("--rev", rev), }; - command.run() + command.run(); + + Ok(()) } pub fn is_running_inside_build_scripts() -> bool { @@ -107,7 +109,9 @@ impl CargoWorkspace { .arg("set-version") .flag("--workspace") .arg(new_version.to_string()) - .run() + .run(); + + Ok(()) } } diff --git a/crates/infra/utils/src/commands/mod.rs b/crates/infra/utils/src/commands/mod.rs index dea3d14c46..aaa7882fb5 100644 --- a/crates/infra/utils/src/commands/mod.rs +++ b/crates/infra/utils/src/commands/mod.rs @@ -105,13 +105,13 @@ impl Command { extract_output(self, output) } - pub fn run(&self) -> Result<()> { - GitHub::collapse_group(format!("$ {self}"), || run_with_defaults(self)) + pub fn run(&self) { + GitHub::collapse_group(format!("$ {self}"), || run_with_defaults(self)); } /// A quick replacement for `xargs`. /// Splits files into smaller chunks, so that we don't exceed the maximum command line length. - pub fn run_xargs(&self, files: impl IntoIterator) -> Result<()> { + pub fn run_xargs(&self, files: impl IntoIterator) { const CHUNK_SIZE: usize = 50; GitHub::collapse_group(format!("$ {self}"), || { @@ -123,23 +123,25 @@ impl Command { .map(|chunk| chunk.collect_vec()) .collect_vec() .into_par_iter() - .map(|batch| run_with_defaults(&self.clone().args(batch))) - .collect() - }) + .for_each(|batch| run_with_defaults(&self.clone().args(batch))); + }); } } -fn run_with_defaults(command: &Command) -> Result<()> { - let status = spawn_with_defaults(command, Stdio::inherit)? +fn run_with_defaults(command: &Command) { + let status = spawn_with_defaults(command, Stdio::inherit) + .unwrap() .wait() - .with_context(|| format!("Failed to wait for status: {command}"))?; + .with_context(|| format!("Failed to wait for status: {command}")) + .unwrap(); - check_status(command, status).map_err(|error| { + check_status(command, status).unwrap_or_else(|error| { // Print error and exit process, to skip printing irrelevant backtraces from the parent process: eprintln!("{error}"); + #[allow(clippy::exit)] std::process::exit(1); - }) + }); } fn spawn_with_defaults(command: &Command, stdio: impl Fn() -> Stdio) -> Result { diff --git a/crates/infra/utils/src/git/mod.rs b/crates/infra/utils/src/git/mod.rs index d0850dac66..55137e20f1 100644 --- a/crates/infra/utils/src/git/mod.rs +++ b/crates/infra/utils/src/git/mod.rs @@ -52,19 +52,19 @@ impl TemporaryChangeset { Command::new("git") .arg("checkout") .property("-b", &self.head_branch) - .run()?; + .run(); Command::new("git") .arg("add") .args(local_changes.iter().map(|path| path.unwrap_str())) - .run()?; + .run(); - Command::new("git").arg("diff").flag("--cached").run()?; + Command::new("git").arg("diff").flag("--cached").run(); Command::new("git") .arg("commit") .property("--message", &self.message) - .run()?; + .run(); Ok(()) } @@ -80,12 +80,12 @@ impl TemporaryChangeset { Command::new("git") .arg("checkout") .arg(&self.base_branch) - .run()?; + .run(); Command::new("git") .arg("branch") .property("-D", &self.head_branch) - .run()?; + .run(); Ok(()) } diff --git a/crates/infra/utils/src/github/mod.rs b/crates/infra/utils/src/github/mod.rs index a3a8804827..9fade7b725 100644 --- a/crates/infra/utils/src/github/mod.rs +++ b/crates/infra/utils/src/github/mod.rs @@ -1,7 +1,7 @@ use std::env::var; use std::path::Path; -use anyhow::{Context, Result}; +use anyhow::{Context, Ok, Result}; use semver::Version; use serde::Deserialize; @@ -67,10 +67,12 @@ impl GitHub { std::fs::create_dir_all(notes_file.unwrap_parent())?; notes_file.write_string(notes)?; - return Command::new("gh") + Command::new("gh") .args(["release", "create", tag_name.as_ref()]) .property("--title", tag_name.as_ref()) .property("--notes-file", notes_file.unwrap_str()) .run(); + + Ok(()) } } diff --git a/crates/solidity/testing/sanctuary/src/datasets.rs b/crates/solidity/testing/sanctuary/src/datasets.rs index 4ece0d0e87..ad3240e3e7 100644 --- a/crates/solidity/testing/sanctuary/src/datasets.rs +++ b/crates/solidity/testing/sanctuary/src/datasets.rs @@ -61,13 +61,13 @@ impl DataSet { &self.directories } - pub fn checkout_directory(&self, directory: &str) -> Result<&Vec> { + pub fn checkout_directory(&self, directory: &str) -> &Vec { // Make sure to reset any local changes, in case some were made during local development/debugging: Command::new("git") .arg("reset") .flag("--hard") .current_dir(&self.repo_dir) - .run()?; + .run(); let relative_path = format!("contracts/{network}/{directory}", network = self.network); @@ -75,9 +75,9 @@ impl DataSet { .arg("sparse-checkout") .property("set", relative_path) .current_dir(&self.repo_dir) - .run()?; + .run(); - Ok(&self.directories[directory]) + &self.directories[directory] } } @@ -94,25 +94,22 @@ fn clone_repository(chain: &Chain) -> Result { .property("--depth", "1") .property("--filter", "blob:none") .flag("--no-checkout") - .run()?; + .run(); } Command::new("git") .arg("sparse-checkout") .property("set", "--cone") .current_dir(&repo_dir) - .run()?; + .run(); Command::new("git") .arg("checkout") .arg("origin/HEAD") .current_dir(&repo_dir) - .run()?; + .run(); - Command::new("git") - .arg("pull") - .current_dir(&repo_dir) - .run()?; + Command::new("git").arg("pull").current_dir(&repo_dir).run(); Ok(repo_dir) } diff --git a/crates/solidity/testing/sanctuary/src/main.rs b/crates/solidity/testing/sanctuary/src/main.rs index 26b79da0b4..8ad033c622 100644 --- a/crates/solidity/testing/sanctuary/src/main.rs +++ b/crates/solidity/testing/sanctuary/src/main.rs @@ -75,7 +75,7 @@ fn main() -> Result<()> { for directory in directories { Terminal::step(format!("testing directory '{directory}'")); - let files = dataset.checkout_directory(directory)?; + let files = dataset.checkout_directory(directory); events.start_directory(files.len());