From 48d63a8f3a7812f363f5631209f8b244691b5b0d Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 3 Oct 2023 16:57:27 -0700 Subject: [PATCH 01/28] Add `--input` and `--input-file` to `dsc` --- dsc/Cargo.toml | 2 +- dsc/src/args.rs | 4 +++ dsc/src/main.rs | 19 +++++++++++--- dsc/tests/dsc_args.tests.ps1 | 51 ++++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/dsc/Cargo.toml b/dsc/Cargo.toml index 5e9498c2d..610ff4bea 100644 --- a/dsc/Cargo.toml +++ b/dsc/Cargo.toml @@ -12,7 +12,7 @@ lto = true [dependencies] atty = { version = "0.2" } -clap = { version = "4.1", features = ["derive"] } +clap = { version = "4.4", features = ["derive"] } clap_complete = { version = "4.4" } crossterm = { version = "0.27" } ctrlc = { version = "3.4.0" } diff --git a/dsc/src/args.rs b/dsc/src/args.rs index 4aa9d5ae2..87e500da5 100644 --- a/dsc/src/args.rs +++ b/dsc/src/args.rs @@ -20,6 +20,10 @@ pub struct Args { /// The output format to use #[clap(short = 'f', long)] pub format: Option, + #[clap(short = 'i', long, help = "The input to pass to the configuration or resource", conflicts_with = "input_file")] + pub input: Option, + #[clap(short = 'p', long, help = "The path to a file used as input to the configuration or resource")] + pub input_file: Option, } #[derive(Debug, PartialEq, Eq, Subcommand)] diff --git a/dsc/src/main.rs b/dsc/src/main.rs index a3301beba..14570e8cd 100644 --- a/dsc/src/main.rs +++ b/dsc/src/main.rs @@ -37,9 +37,22 @@ fn main() { let args = Args::parse(); - let stdin: Option = if atty::is(Stream::Stdin) { + let input = if args.input.is_some() { + args.input + } else if args.input_file.is_some() { + info!("Reading input from file {}", args.input_file.as_ref().unwrap()); + let input_file = args.input_file.unwrap(); + match std::fs::read_to_string(input_file) { + Ok(input) => Some(input), + Err(err) => { + error!("Error: Failed to read input file: {err}"); + exit(util::EXIT_INVALID_INPUT); + } + } + } else if atty::is(Stream::Stdin) { None } else { + info!("Reading input from STDIN"); let mut buffer: Vec = Vec::new(); io::stdin().read_to_end(&mut buffer).unwrap(); let input = match String::from_utf8(buffer) { @@ -59,10 +72,10 @@ fn main() { generate(shell, &mut cmd, "dsc", &mut io::stdout()); }, SubCommand::Config { subcommand } => { - subcommand::config(&subcommand, &args.format, &stdin); + subcommand::config(&subcommand, &args.format, &input); }, SubCommand::Resource { subcommand } => { - subcommand::resource(&subcommand, &args.format, &stdin); + subcommand::resource(&subcommand, &args.format, &input); }, SubCommand::Schema { dsc_type } => { let schema = util::get_schema(dsc_type); diff --git a/dsc/tests/dsc_args.tests.ps1 b/dsc/tests/dsc_args.tests.ps1 index 2faffd1d0..f81cdaad6 100644 --- a/dsc/tests/dsc_args.tests.ps1 +++ b/dsc/tests/dsc_args.tests.ps1 @@ -90,6 +90,7 @@ actualState: $out.Trim() | Should -BeExactly $expected } +<<<<<<< HEAD It 'can generate PowerShell completer' { $out = dsc completer powershell | Out-String Invoke-Expression $out @@ -98,4 +99,54 @@ actualState: $completions.CompletionMatches[0].CompletionText | Should -Be 'completer' $completions.CompletionMatches[1].CompletionText | Should -Be 'config' } +======= + It 'input can be passed using ' -TestCases @( + @{ parameter = '-i' } + @{ parameter = '--input' } + ) { + param($parameter) + + $yaml = @' +$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json +resources: +- name: os + type: Microsoft/OSInfo + properties: + family: Windows +'@ + + $out = dsc $parameter "$yaml" config get | ConvertFrom-Json + $LASTEXITCODE | Should -Be 0 + $out.results[0].type | Should -BeExactly 'Microsoft/OSInfo' + } + + It 'input can be passed using ' -TestCases @( + @{ parameter = '-p' } + @{ parameter = '--input-file' } + ) { + param($parameter) + + $yaml = @' +$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json +resources: +- name: os + type: Microsoft/OSInfo + properties: + family: Windows +'@ + + Set-Content -Path $TestDrive/foo.yaml -Value $yaml + $out = dsc $parameter "$TestDrive/foo.yaml" config get | ConvertFrom-Json + $LASTEXITCODE | Should -Be 0 + $out.results[0].type | Should -BeExactly 'Microsoft/OSInfo' + } + + It '--input and --input-file cannot be used together' { + dsc --input 1 --input-file foo.json config get 2> $TestDrive/error.txt + $err = Get-Content $testdrive/error.txt -Raw + $err.Length | Should -Not -Be 0 + $LASTEXITCODE | Should -Be 2 + } + +>>>>>>> 2332df9 (Add `--input` and `--input-file` to `dsc`) } From 179135862b8647bade77d0ee941d0c0f0fb5b464 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 4 Oct 2023 15:40:29 -0700 Subject: [PATCH 02/28] fix leftover merge conflict --- dsc/tests/dsc_args.tests.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dsc/tests/dsc_args.tests.ps1 b/dsc/tests/dsc_args.tests.ps1 index f81cdaad6..586f7da36 100644 --- a/dsc/tests/dsc_args.tests.ps1 +++ b/dsc/tests/dsc_args.tests.ps1 @@ -90,7 +90,6 @@ actualState: $out.Trim() | Should -BeExactly $expected } -<<<<<<< HEAD It 'can generate PowerShell completer' { $out = dsc completer powershell | Out-String Invoke-Expression $out @@ -99,7 +98,7 @@ actualState: $completions.CompletionMatches[0].CompletionText | Should -Be 'completer' $completions.CompletionMatches[1].CompletionText | Should -Be 'config' } -======= + It 'input can be passed using ' -TestCases @( @{ parameter = '-i' } @{ parameter = '--input' } @@ -148,5 +147,4 @@ resources: $LASTEXITCODE | Should -Be 2 } ->>>>>>> 2332df9 (Add `--input` and `--input-file` to `dsc`) } From ed044c69eff459d272ee2225915d4cbec835ef5e Mon Sep 17 00:00:00 2001 From: Michael Lombardi Date: Thu, 5 Oct 2023 18:00:48 -0500 Subject: [PATCH 03/28] (DOCS) Update changelog, documentation, & schemas This change updates the project changelog, reference documentation, and schemas for the recent PRs merged for the project: - #206 - #208 - #211 - #213 - #215 - #216 - #217 The updates include: - Documenting the new `_exist` property, replacing `_ensure` for resources. This documentation update includes the schema definition, but doesn't regenerate the schema, which will be handled separately. - Documenting the new `completer` command. - Documenting the new `--input` and `--input-file` global options. - Adding a deprecation notice to the `_ensure` documentation. - Adding entries for all user-impacting changes to the changelog. --- CHANGELOG.md | 124 +++++++++++++++++- docs/reference/cli/completer/command.md | 108 +++++++++++++++ docs/reference/cli/config/get.md | 26 +++- docs/reference/cli/config/set.md | 26 +++- docs/reference/cli/config/test.md | 26 +++- docs/reference/cli/dsc.md | 50 ++++++- .../schemas/resource/properties/ensure.md | 9 +- .../schemas/resource/properties/exist.md | 49 +++++++ .../schemas/resource/properties/overview.md | 17 ++- schemas/src/resource/manifest.schema.yaml | 31 +++-- .../properties/{ensure.yaml => exist.yaml} | 21 ++- 11 files changed, 437 insertions(+), 50 deletions(-) create mode 100644 docs/reference/cli/completer/command.md create mode 100644 docs/reference/schemas/resource/properties/exist.md rename schemas/src/resource/properties/{ensure.yaml => exist.yaml} (54%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94b24f1d9..27c9fd0bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,13 @@ title: "Desired State Configuration changelog" description: >- A log of the changes for releases of DSCv3. -ms.date: 09/27/2023 +ms.date: 10/05/2023 --- # Changelog + + All notable changes to DSCv3 are documented in this file. The format is based on [Keep a Changelog][m1], and DSCv3 adheres to [Semantic Versioning][m2]. @@ -24,6 +26,106 @@ changes since the last release, see the [diff on GitHub][unreleased]. +### Changed + +- Replaced the `_ensure` well-known property with the boolean [_exist][21] property. This improves + the semantics for users and simplifies implementation for resources, replacing the string enum + values `Present` and `Absent` with `true` and `false` respectively. + +
Related work items + + - Issues: [#202][#202] + - PRs: [#206][#206] + +
+ +- Updated the `Microsoft.Windows/Registry` resource to use the `_exist` property instead of + `_ensure` and updated the output to be idiomatic for a DSC Resource. + +
Related work items + + - Issues: [#162][#162] + - PRs: [#206][#206] + +
+ +- When a user presses the Ctrl+C key combination, DSC now recursively + terminates all child processes before exiting. This helps prevent dangling processes that were + previously unhandled by the interrupt event. + +
Related work items + + - PRs: [#213][#213] + +
+ +### Added + +- Added the [--input][22] and [--input-file][23] global options to the root `dsc` command. Now, you + can pass input to DSC from a variable or file instead of piping from stdin. + +
Related work items + + - Issues: [#130][#130] + - PRs: [#217][#217] + +
+ +- Added the `arg` value as an option for defining how a command-based DSC Resource expects to + receive input. This enables resource authors to define resources that handle DSC passing the + instance JSON as an argument. + +
Related work items + + - PRs: [#213][#213] + +
+ +- Added the new [completer][24] command enables users to add shell completions for DSC to their + shell. The command supports completions for Bash, Elvish, fish, PowerShell, and ZSH. + +
Related work items + + - Issues: [#186][#186] + - PRs: [#216][#216] + +
+ +- DSC now emits tace logging to the stderr stream. This can make it easier to understand what DSC + is doing. This doesn't affect the data output. In this release, there's no way to opt out of the + logging. + +
Related work items + + - Issues: + - [#107][#107] + - [#158][#158] + - PRs: [#211][#211] + +
+ +### Fixed + +- The `--format` option now works as users expect when the output is redirected or saved to a + variable. Before this fix, DSC always returned JSON output, even when the user wanted to save + the output as YAML. With this fix, the specified format is respected. + +
Related work items + + - PRs: [#215][#215] + +
+ +- The `DSC/PowerShellGroup` resource now correctly returns the _labels_ for enumerations instead of + their integer value, making it easier to understand and compare results. + +
Related work items + + - Issues: [#159][#159] + - PRs: [#208][#208] + +
+ ## [v3.0.0-alpha.3][release-v3.0.0-alpha.3] - 2023-09-26 This section includes a summary of changes for the `alpha.3` release. For the full list of changes @@ -291,11 +393,22 @@ For the full list of changes in this release, see the [diff on GitHub][compare-v [19]: docs/reference/schemas/resource/manifest/set.md#input [20]: docs/reference/schemas/resource/manifest/test.md#input + +[21]: docs/reference/schemas/resource/properties/exist.md +[22]: docs/reference/cli/dsc.md#-i---input +[23]: docs/reference/cli/dsc.md#-p---input-file +[24]: docs/reference/cli/completer/command.md + +[#107]: https://github.com/PowerShell/DSC/issues/107 [#127]: https://github.com/PowerShell/DSC/issues/127 +[#130]: https://github.com/PowerShell/DSC/issues/130 [#133]: https://github.com/PowerShell/DSC/issues/133 [#150]: https://github.com/PowerShell/DSC/issues/150 [#156]: https://github.com/PowerShell/DSC/issues/156 +[#158]: https://github.com/PowerShell/DSC/issues/158 +[#159]: https://github.com/PowerShell/DSC/issues/159 +[#162]: https://github.com/PowerShell/DSC/issues/162 [#163]: https://github.com/PowerShell/DSC/issues/163 [#168]: https://github.com/PowerShell/DSC/issues/168 [#171]: https://github.com/PowerShell/DSC/issues/171 @@ -306,9 +419,18 @@ For the full list of changes in this release, see the [diff on GitHub][compare-v [#177]: https://github.com/PowerShell/DSC/issues/177 [#181]: https://github.com/PowerShell/DSC/issues/181 [#182]: https://github.com/PowerShell/DSC/issues/182 +[#186]: https://github.com/PowerShell/DSC/issues/186 [#197]: https://github.com/PowerShell/DSC/issues/197 [#198]: https://github.com/PowerShell/DSC/issues/198 [#199]: https://github.com/PowerShell/DSC/issues/199 +[#202]: https://github.com/PowerShell/DSC/issues/202 +[#206]: https://github.com/PowerShell/DSC/issues/206 +[#208]: https://github.com/PowerShell/DSC/issues/208 +[#211]: https://github.com/PowerShell/DSC/issues/211 +[#213]: https://github.com/PowerShell/DSC/issues/213 +[#215]: https://github.com/PowerShell/DSC/issues/215 +[#216]: https://github.com/PowerShell/DSC/issues/216 +[#217]: https://github.com/PowerShell/DSC/issues/217 [#45]: https://github.com/PowerShell/DSC/issues/45 [#73]: https://github.com/PowerShell/DSC/issues/73 [#98]: https://github.com/PowerShell/DSC/issues/98 diff --git a/docs/reference/cli/completer/command.md b/docs/reference/cli/completer/command.md new file mode 100644 index 000000000..95a3a66d9 --- /dev/null +++ b/docs/reference/cli/completer/command.md @@ -0,0 +1,108 @@ +--- +description: Command line reference for the 'dsc completer' command +ms.date: 10/05/2023 +ms.topic: reference +title: dsc schema +--- + +# dsc schema + +## Synopsis + +Generates a shell completion script. + +## Syntax + +```sh +dsc completer [Options] +``` + +## Description + +The `completer` command returns a shell script that, when executed, registers completions for the +given shell. DSC can generate completion scripts for the following shells: + +- [Bourne Again SHell (BASH)][01] +- [Elvish][02] +- [Friendly Interactive SHell (fish)][03] +- [PowerShell][04] +- [Z SHell (ZSH)][05] + +The output for this command is the script itself. To register completions for DSC, execute the +script. + +> [!WARNING] +> Always review scripts before executing them, especially in an elevated execution context. + +## Examples + +### Example 1 - Register completions for Bash + +```sh +completer=~/dsc_completion.bash +# Export the completion script +dsc completer bash > $completer +# Review the completion script +cat $completer +# Add the completion script to your profile +echo "source $completer" >> ~/.bashrc +# Execute the completion script to register completions for this session +source $completer +``` + +### Example 2 - Register completions for PowerShell + +```powershell +$Completer = '~/dsc_completion.ps1' +# Export the completion script +dsc completer powershell | Out-File $Completer +# Review the completion script +Get-Content $completer +# Add the completion script to your profile +Add-Content -Path $PROFILE ". $Completer" +# Execute the completion script to register completions for this session +. $Completer +``` + +## Arguments + +### SHELL + +This argument is mandatory for the `completer` command. The value for this option determines which +shell the application returns a completion script for: + +- `bash` - [Bourne Again SHell (BASH)][01] +- `elvish` - [Elvish][02] +- `fish` - [Friendly Interactive SHell (fish)][03] +- `powershell` - [PowerShell][04] +- `zsh` - [Z SHell (ZSH)][05] + +```yaml +Type: String +Mandatory: true +ValidValues: [ + bash, + elvish, + fish, + powershell, + zsh, + ] +``` + +## Options + +### -h, --help + +Displays the help for the current command or subcommand. When you specify this option, the +application ignores all options and arguments after this one. + +```yaml +Type: Boolean +Mandatory: false +``` + +[01]: https://www.gnu.org/software/bash/ +[02]: https://elv.sh/ +[03]: https://fishshell.com/ +[04]: https://learn.microsoft.com/powershell/scripting/overview +[05]: https://zsh.sourceforge.io/ diff --git a/docs/reference/cli/config/get.md b/docs/reference/cli/config/get.md index fe6130be8..f687563de 100644 --- a/docs/reference/cli/config/get.md +++ b/docs/reference/cli/config/get.md @@ -1,6 +1,6 @@ --- description: Command line reference for the 'dsc config get' command -ms.date: 08/04/2023 +ms.date: 10/05/2023 ms.topic: reference title: dsc config get --- @@ -58,6 +58,24 @@ resources: cat ./example.dsc.config.yaml | dsc config get ``` +### Example 2 - Passing a file to read as the configuration document + +The command uses the [--input-file][01] global option to retrieve the resource instances defined in +the `example.dsc.config.yaml` file. + +```sh +dsc --input-file ./example.dsc.config.yaml config get +``` + +### Example 3 - Passing a configuration document as a variable + +The command uses the [--input][02] global option to retrieve the resource instances defined in a +configuration document stored in the `$desired` variable. + +```sh +dsc --input $desired config get +``` + ## Options ### -h, --help @@ -74,6 +92,8 @@ Mandatory: false This command returns JSON output that includes whether the operation or any resources raised any errors, the collection of messages emitted during the operation, and the get operation results for -every instance. For more information, see [dsc config get result schema][01]. +every instance. For more information, see [dsc config get result schema][03]. -[01]: ../../schemas/outputs/config/get.md +[01]: ../dsc.md#-p---input-file +[02]: ../dsc.md#-i---input +[03]: ../../schemas/outputs/config/get.md diff --git a/docs/reference/cli/config/set.md b/docs/reference/cli/config/set.md index 223d1be6f..5185b84bf 100644 --- a/docs/reference/cli/config/set.md +++ b/docs/reference/cli/config/set.md @@ -1,6 +1,6 @@ --- description: Command line reference for the 'dsc config set' command -ms.date: 08/04/2023 +ms.date: 10/05/2023 ms.topic: reference title: dsc config set --- @@ -59,6 +59,24 @@ resources: cat ./example.dsc.config.yaml | dsc config set ``` +### Example 2 - Passing a file to read as the configuration document + +The command uses the [--input-file][01] global option to enforce the configuration defined in +the `example.dsc.config.yaml` file. + +```sh +dsc --input-file ./example.dsc.config.yaml config set +``` + +### Example 3 - Passing a configuration document as a variable + +The command uses the [--input][02] global option to enforce the configuration stored in the +`$desired` variable. + +```sh +dsc --input $desired config set +``` + ## Options ### -h, --help @@ -75,6 +93,8 @@ Mandatory: false This command returns JSON output that includes whether the operation or any resources raised any errors, the collection of messages emitted during the operation, and the set operation results for -every instance. For more information, see [dsc config get result schema][01]. +every instance. For more information, see [dsc config get result schema][03]. -[01]: ../../schemas/outputs/config/set.md +[01]: ../dsc.md#-p---input-file +[02]: ../dsc.md#-i---input +[03]: ../../schemas/outputs/config/set.md diff --git a/docs/reference/cli/config/test.md b/docs/reference/cli/config/test.md index 6cd072c27..271a117e0 100644 --- a/docs/reference/cli/config/test.md +++ b/docs/reference/cli/config/test.md @@ -1,6 +1,6 @@ --- description: Command line reference for the 'dsc config test' command -ms.date: 08/04/2023 +ms.date: 10/05/2023 ms.topic: reference title: dsc config test --- @@ -58,6 +58,24 @@ resources: cat ./example.dsc.config.yaml | dsc config test ``` +### Example 2 - Passing a file to read as the configuration document + +The command uses the [--input-file][01] global option to validate the configuration defined in +the `example.dsc.config.yaml` file. + +```sh +dsc --input-file ./example.dsc.config.yaml config test +``` + +### Example 3 - Passing a configuration document as a variable + +The command uses the [--input][02] global option to validate the configuration stored in the +`$desired` variable. + +```sh +dsc --input $desired config test +``` + ## Options ### -h, --help @@ -74,6 +92,8 @@ Mandatory: false This command returns JSON output that includes whether the operation or any resources raised any errors, the collection of messages emitted during the operation, and the test operation results for -every instance. For more information, see [dsc config test result schema][01]. +every instance. For more information, see [dsc config test result schema][03]. -[01]: ../../schemas/outputs/config/test.md +[01]: ../dsc.md#-p---input-file +[02]: ../dsc.md#-i---input +[03]: ../../schemas/outputs/config/test.md diff --git a/docs/reference/cli/dsc.md b/docs/reference/cli/dsc.md index 274306b9f..7847dda94 100644 --- a/docs/reference/cli/dsc.md +++ b/docs/reference/cli/dsc.md @@ -1,6 +1,6 @@ --- description: Command line reference for the 'dsc' command -ms.date: 08/04/2023 +ms.date: 10/05/2023 ms.topic: reference title: dsc --- @@ -19,6 +19,11 @@ dsc [Options] ## Commands +### completer + +The `completer` command returns a shell script that, when executed, registers completions for the +given shell. For more information, see [completer][01]. + ### config The `config` command manages a DSC Configuration document. You can use it to: @@ -27,7 +32,7 @@ The `config` command manages a DSC Configuration document. You can use it to: - Test whether a configuration is in the desired state. - Set a configuration to the desired state. -For more information, see [config][01]. +For more information, see [config][02]. ### resource @@ -39,12 +44,12 @@ The `resource` command manages a DSC Resource. You can use it to: - Test whether a resource instance is in the desired state. - Set a resource instance to the desired state. -For more information, see [resource][02] +For more information, see [resource][03] ### schema The `schema` command returns the JSON schema for a specific DSC type. For more information, see -[schema][03]. +[schema][04]. ### help @@ -89,6 +94,36 @@ Type: Boolean Mandatory: false ``` +### -i, --input + +Defines input for the command as a string instead of piping input from stdin. This option is +mutually exclusive with the `--input-file` option. When you use this option, DSC ignores any input +from stdin. + +To pass input for a command or subcommand, specify this option before the command, like +`dsc --input $desired resource test`. + +```yaml +Type: String +Mandatory: false +``` + +### -p, --input-file + +Defines the path to a text file to read as input for the command instead of piping input from +stdin. This option is mutually exclusive with the `--input` option. When you use this option, DSC +ignores any input from stdin. + +To pass a file to read as input for a command or subcommand, specify this option before the +command, like `dsc --input-file web.dsc.config.yaml config set`. + +If the specified file doesn't exist, DSC raises an error. + +```yaml +Type: String +Mandatory: false +``` + ### -V, --version Displays the version of the application. When you specify this option, the application ignores all @@ -124,6 +159,7 @@ execution of the command. | `5` | The command failed because a resource definition or instance value was invalid against its JSON schema. | | `6` | The command was cancelled by a Ctrl+C interruption. | -[01]: config/command.md -[02]: resource/command.md -[03]: schema/command.md +[01]: completer/command.md +[02]: config/command.md +[03]: resource/command.md +[04]: schema/command.md diff --git a/docs/reference/schemas/resource/properties/ensure.md b/docs/reference/schemas/resource/properties/ensure.md index 0bb6045f4..d98b67ffb 100644 --- a/docs/reference/schemas/resource/properties/ensure.md +++ b/docs/reference/schemas/resource/properties/ensure.md @@ -1,6 +1,6 @@ --- description: JSON schema reference for the '_ensure' well-known DSC Resource property. -ms.date: 08/04/2023 +ms.date: 10/05/2023 ms.topic: reference title: DSC Resource _ensure property schema --- @@ -22,6 +22,11 @@ ValidValues: [Absent, Present] ## Description +> [!IMPORTANT] +> Starting with DSC v3.0.0-alpha.4 and schema version `2023/10` this well-known property is removed +> from the schema. It's replaced by the [_exist][01] property. Microsoft recommends migrating +> resources to use the `_exist` keyword instead. + The `_ensure` property indicates that the resource can enforce whether instances exist using the shared present and absent semantics. @@ -54,3 +59,5 @@ specifically a file, or exists as a symlink. In that case, the resource would de "default": "present" } ``` + +[01]: exist.md diff --git a/docs/reference/schemas/resource/properties/exist.md b/docs/reference/schemas/resource/properties/exist.md new file mode 100644 index 000000000..4e75c8bf0 --- /dev/null +++ b/docs/reference/schemas/resource/properties/exist.md @@ -0,0 +1,49 @@ +--- +description: JSON schema reference for the '_exist' well-known DSC Resource property. +ms.date: 10/05/2023 +ms.topic: reference +title: DSC Resource _exist property schema +--- + +# DSC Resource _exist property schema + +## Synopsis + +Indicates whether an instance should exist. + +## Metadata + +```yaml +SchemaDialect: https://json-schema.org/draft/2020-12/schema +SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/resource/properties/exist.json +Type: boolean +DefaultValue: true +``` + +## Description + +The `_exist` property indicates that the resource can enforce whether instances exist, handling +whether an instance should be added, updated, or removed during a set operation. This property +provides shared semantics for DSC Resources and integrating tools, but doesn't enable any +additional built-in processing with DSC. + +Resources should only define this property when their implementation adheres to the following +behavior contract: + +1. When the desired state for `_exist` is `true`, the resource expects the instance to exist. If it + doesn't exist, the resource creates or adds the instance during the set operation. +1. When the desired state for `_exist` is `false`, the resource expects the instance to not exist. + If it does exist, the resource deletes or removes the instance during the set operation. +1. When the get operation queries for an instance that doesn't exist, the returned JSON always + defines the `_exist` property as `false`. + + The resource _may_ omit the `_exist` property from the result JSON when the instance exists. + +To add this property to a resource's instance schema, define the property with the following +snippet: + +```json +"_exist": { + "$ref": "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/resource/properties/exist.json" +} +``` diff --git a/docs/reference/schemas/resource/properties/overview.md b/docs/reference/schemas/resource/properties/overview.md index 2ceb75022..353476c37 100644 --- a/docs/reference/schemas/resource/properties/overview.md +++ b/docs/reference/schemas/resource/properties/overview.md @@ -2,7 +2,7 @@ description: >- Information about the list of well-known DSC Resource properties, including their purpose and how to add them to a resource's manifest. -ms.date: 08/04/2023 +ms.date: 10/05/2023 ms.topic: reference title: DSC well-known properties --- @@ -13,15 +13,14 @@ DSC has support for several well-known properties. Some well-known properties en to use built-in processing. The well-known properties always start with an underscore (`_`) and DSC Resources that use these properties may not override or extend them. -## _ensure +## _exist -The `_ensure` property indicates that the resource can enforce whether instances exist using the -shared present and absent semantics. If a resource must distinguish between states beyond whether -an instance is present or absent, the resource should define its own `ensure` property without the -leading underscore. This property provides shared semantics for DSC Resources and integrating -tools, but doesn't enable any additional built-in processing with DSC. +The `_exist` property indicates that the resource can enforce whether instances exist, handling +whether an instance should be added, updated, or removed during a set operation. This property +provides shared semantics for DSC Resources and integrating tools, but doesn't enable any +additional built-in processing with DSC. -For more information, see [DSC Resource _ensure property schema][01]. +For more information, see [DSC Resource _exist property schema][01]. ## _inDesiredState @@ -48,7 +47,7 @@ this property in their manifest. For more information, see [DSC Resource _rebootRequested property schema][06]. -[01]: ensure.md +[01]: exist.md [02]: ../manifest/test.md [03]: ../manifest/root.md [04]: inDesiredState.md diff --git a/schemas/src/resource/manifest.schema.yaml b/schemas/src/resource/manifest.schema.yaml index 040754603..3e52770db 100644 --- a/schemas/src/resource/manifest.schema.yaml +++ b/schemas/src/resource/manifest.schema.yaml @@ -329,27 +329,34 @@ properties: const: ^${3:"constant value"} properties: - _ensure: - title: 'Standard Property: _ensure' + _exist: + title: 'Standard Property: _exist' description: >- - Indicates that the DSC Resource uses the standard `_ensure` property to specify - whether an instance should exist with the `Present` and `Absent` enums. + Indicates that the DSC Resource uses the standard `_exist` property to specify + whether an instance should exist as a boolean value that defaults to `true`. const: - $ref: ///resource/properties/ensure.yaml + $ref: ///resource/properties/exist.yaml # VS Code only markdownDescription: | *** [_Online Documentation_][01] *** - Indicates that the resource can enforce whether instances exist using the shared - `present` and `absent` semantics. If a resource must distinguish between states - beyond whether an instance is `present` or `absent`, the resource should define its - own `ensure` property without the leading underscore. This property provides shared - semantics for DSC Resources and integrating tools, but doesn't enable any additional - built-in processing with DSC. + Indicates that the resource can enforce whether instances exist, handling whether an + instance should be added, updated, or removed during a set operation. The default + value is `true`. - [01]: /reference/schemas/resource/properties/ensure? + Resources that define this property declare that the implementation adheres to the + following behavior contract: + + 1. When the desired state for `_exist` is `true`, the resource expects the instance + to exist. If it doesn't exist, the resource creates or adds the instance during + the set operation. + 1. When the desired state for `_exist` is `false`, the resource expects the instance + to not exist. If it does exist, the resource deletes or removes the instance + during the set operation. + + [01]: /reference/schemas/resource/properties/exist? _inDesiredState: title: 'Standard Property: _inDesiredState' description: >- diff --git a/schemas/src/resource/properties/ensure.yaml b/schemas/src/resource/properties/exist.yaml similarity index 54% rename from schemas/src/resource/properties/ensure.yaml rename to schemas/src/resource/properties/exist.yaml index 06024b27e..d254909ac 100644 --- a/schemas/src/resource/properties/ensure.yaml +++ b/schemas/src/resource/properties/exist.yaml @@ -1,15 +1,14 @@ # yaml-language-server: $schema=https://json-schema.org/draft/2020-12/schema $schema: https://json-schema.org/draft/2020-12/schema -$id: ///resource/properties/ensure.yaml +$id: ///resource/properties/exist.yaml -title: Ensure Existence +title: Instance should exist description: >- Indicates whether the DSC Resource instance should exist. -type: string -enum: - - Absent - - Present +type: boolean +default: true +enum: [false, true] # VS Code Only markdownDescription: | @@ -19,15 +18,15 @@ markdownDescription: | Indicates whether the DSC Resource instance should exist. - [01]: /reference/schemas/resource/properties/ensure? + [01]: /reference/schemas/resource/properties/exist? markdownEnumDescriptions: - - | # Absent + - | # false _Instance shouldn't exist._ - > If the desired state for `_ensure` is `absent` and the instance exists, the resource removes + > If the desired state for `_exist` is `false` and the instance exists, the resource removes > the instance during the `set` operation. - - | # Present + - | # true _Instance should exist._ - > If the desired state for `_ensure` is `present` and the instance doesn't exist, the resource + > If the desired state for `_exist` is `true` and the instance doesn't exist, the resource > adds or creates the instance during the `set` operation. From 9e93b14399829b70499f4061442ee573d29d90e7 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Thu, 5 Oct 2023 20:55:57 -0700 Subject: [PATCH 04/28] initial grammar --- .gitignore | 4 + tree-sitter-dscexpression/Cargo.toml | 26 + tree-sitter-dscexpression/binding.gyp | 19 + .../bindings/node/binding.cc | 28 + .../bindings/node/index.js | 19 + .../bindings/rust/build.rs | 40 + .../bindings/rust/lib.rs | 52 ++ tree-sitter-dscexpression/build.ps1 | 14 + .../corpus/invalid_expressions.txt | 75 ++ .../corpus/valid_expressions.txt | 96 ++ tree-sitter-dscexpression/grammar.js | 25 + tree-sitter-dscexpression/package.json | 19 + tree-sitter-dscexpression/src/grammar.json | 227 +++++ tree-sitter-dscexpression/src/node-types.json | 141 +++ tree-sitter-dscexpression/src/parser.c | 831 ++++++++++++++++++ .../src/tree_sitter/parser.h | 224 +++++ 16 files changed, 1840 insertions(+) create mode 100644 tree-sitter-dscexpression/Cargo.toml create mode 100644 tree-sitter-dscexpression/binding.gyp create mode 100644 tree-sitter-dscexpression/bindings/node/binding.cc create mode 100644 tree-sitter-dscexpression/bindings/node/index.js create mode 100644 tree-sitter-dscexpression/bindings/rust/build.rs create mode 100644 tree-sitter-dscexpression/bindings/rust/lib.rs create mode 100644 tree-sitter-dscexpression/build.ps1 create mode 100644 tree-sitter-dscexpression/corpus/invalid_expressions.txt create mode 100644 tree-sitter-dscexpression/corpus/valid_expressions.txt create mode 100644 tree-sitter-dscexpression/grammar.js create mode 100644 tree-sitter-dscexpression/package.json create mode 100644 tree-sitter-dscexpression/src/grammar.json create mode 100644 tree-sitter-dscexpression/src/node-types.json create mode 100644 tree-sitter-dscexpression/src/parser.c create mode 100644 tree-sitter-dscexpression/src/tree_sitter/parser.h diff --git a/.gitignore b/.gitignore index 897d9aabe..dc2ae44f6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ Cargo.lock target bin/ .DS_Store + +# Node.js generated files for tree-sitter +build/ +node_modules/ diff --git a/tree-sitter-dscexpression/Cargo.toml b/tree-sitter-dscexpression/Cargo.toml new file mode 100644 index 000000000..317c64b15 --- /dev/null +++ b/tree-sitter-dscexpression/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "tree-sitter-dscexpression" +description = "DSCExpression grammar for the tree-sitter parsing library" +version = "0.0.1" +keywords = ["incremental", "parsing", "DSCExpression"] +categories = ["parsing", "text-editors"] +repository = "https://github.com/powershell/dsc" +edition = "2018" +license = "MIT" + +build = "bindings/rust/build.rs" +include = [ + "bindings/rust/*", + "grammar.js", + "queries/*", + "src/*", +] + +[lib] +path = "bindings/rust/lib.rs" + +[dependencies] +tree-sitter = "~0.20.10" + +[build-dependencies] +cc = "1.0" diff --git a/tree-sitter-dscexpression/binding.gyp b/tree-sitter-dscexpression/binding.gyp new file mode 100644 index 000000000..b505a643a --- /dev/null +++ b/tree-sitter-dscexpression/binding.gyp @@ -0,0 +1,19 @@ +{ + "targets": [ + { + "target_name": "tree_sitter_DSCExpression_binding", + "include_dirs": [ + " +#include "nan.h" + +using namespace v8; + +extern "C" TSLanguage * tree_sitter_DSCExpression(); + +namespace { + +NAN_METHOD(New) {} + +void Init(Local exports, Local module) { + Local tpl = Nan::New(New); + tpl->SetClassName(Nan::New("Language").ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); + Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); + Nan::SetInternalFieldPointer(instance, 0, tree_sitter_DSCExpression()); + + Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("DSCExpression").ToLocalChecked()); + Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); +} + +NODE_MODULE(tree_sitter_DSCExpression_binding, Init) + +} // namespace diff --git a/tree-sitter-dscexpression/bindings/node/index.js b/tree-sitter-dscexpression/bindings/node/index.js new file mode 100644 index 000000000..73d046fa3 --- /dev/null +++ b/tree-sitter-dscexpression/bindings/node/index.js @@ -0,0 +1,19 @@ +try { + module.exports = require("../../build/Release/tree_sitter_DSCExpression_binding"); +} catch (error1) { + if (error1.code !== 'MODULE_NOT_FOUND') { + throw error1; + } + try { + module.exports = require("../../build/Debug/tree_sitter_DSCExpression_binding"); + } catch (error2) { + if (error2.code !== 'MODULE_NOT_FOUND') { + throw error2; + } + throw error1 + } +} + +try { + module.exports.nodeTypeInfo = require("../../src/node-types.json"); +} catch (_) {} diff --git a/tree-sitter-dscexpression/bindings/rust/build.rs b/tree-sitter-dscexpression/bindings/rust/build.rs new file mode 100644 index 000000000..c6061f099 --- /dev/null +++ b/tree-sitter-dscexpression/bindings/rust/build.rs @@ -0,0 +1,40 @@ +fn main() { + let src_dir = std::path::Path::new("src"); + + let mut c_config = cc::Build::new(); + c_config.include(&src_dir); + c_config + .flag_if_supported("-Wno-unused-parameter") + .flag_if_supported("-Wno-unused-but-set-variable") + .flag_if_supported("-Wno-trigraphs"); + let parser_path = src_dir.join("parser.c"); + c_config.file(&parser_path); + + // If your language uses an external scanner written in C, + // then include this block of code: + + /* + let scanner_path = src_dir.join("scanner.c"); + c_config.file(&scanner_path); + println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); + */ + + c_config.compile("parser"); + println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); + + // If your language uses an external scanner written in C++, + // then include this block of code: + + /* + let mut cpp_config = cc::Build::new(); + cpp_config.cpp(true); + cpp_config.include(&src_dir); + cpp_config + .flag_if_supported("-Wno-unused-parameter") + .flag_if_supported("-Wno-unused-but-set-variable"); + let scanner_path = src_dir.join("scanner.cc"); + cpp_config.file(&scanner_path); + cpp_config.compile("scanner"); + println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); + */ +} diff --git a/tree-sitter-dscexpression/bindings/rust/lib.rs b/tree-sitter-dscexpression/bindings/rust/lib.rs new file mode 100644 index 000000000..c2d7a6d69 --- /dev/null +++ b/tree-sitter-dscexpression/bindings/rust/lib.rs @@ -0,0 +1,52 @@ +//! This crate provides DSCExpression language support for the [tree-sitter][] parsing library. +//! +//! Typically, you will use the [language][language func] function to add this language to a +//! tree-sitter [Parser][], and then use the parser to parse some code: +//! +//! ``` +//! let code = ""; +//! let mut parser = tree_sitter::Parser::new(); +//! parser.set_language(tree_sitter_DSCExpression::language()).expect("Error loading DSCExpression grammar"); +//! let tree = parser.parse(code, None).unwrap(); +//! ``` +//! +//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html +//! [language func]: fn.language.html +//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html +//! [tree-sitter]: https://tree-sitter.github.io/ + +use tree_sitter::Language; + +extern "C" { + fn tree_sitter_DSCExpression() -> Language; +} + +/// Get the tree-sitter [Language][] for this grammar. +/// +/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html +pub fn language() -> Language { + unsafe { tree_sitter_DSCExpression() } +} + +/// The content of the [`node-types.json`][] file for this grammar. +/// +/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types +pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json"); + +// Uncomment these to include any queries that this grammar contains + +// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm"); +// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm"); +// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm"); +// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm"); + +#[cfg(test)] +mod tests { + #[test] + fn test_can_load_grammar() { + let mut parser = tree_sitter::Parser::new(); + parser + .set_language(super::language()) + .expect("Error loading DSCExpression language"); + } +} diff --git a/tree-sitter-dscexpression/build.ps1 b/tree-sitter-dscexpression/build.ps1 new file mode 100644 index 000000000..6c73ed2ff --- /dev/null +++ b/tree-sitter-dscexpression/build.ps1 @@ -0,0 +1,14 @@ +#requires -version 7.4 + +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +# check if tools are installed + +$PSNativeCommandUseErrorActionPreference = $true +$ErrorActionPreference = 'Stop' + +npx tree-sitter generate +node-gyp configure +node-gyp build +npx tree-sitter test diff --git a/tree-sitter-dscexpression/corpus/invalid_expressions.txt b/tree-sitter-dscexpression/corpus/invalid_expressions.txt new file mode 100644 index 000000000..d3fe02684 --- /dev/null +++ b/tree-sitter-dscexpression/corpus/invalid_expressions.txt @@ -0,0 +1,75 @@ +===== +String literal looking like function +===== + +functionOne(1,2) + +--- + + (statement + (stringLiteral)) + +===== +String parameter not in quotes +===== + +[functionOne(alpha, beta)] + +--- + + (statement + (expression + (function + (functionName) + (ERROR + (functionName) + (functionName))))) + +===== +Missing parenthesis +===== + +[functionOne] + +--- + + (ERROR + (functionName)) + +===== +Missing parameter +===== + +[functionOne(1, ,2)] + +--- + + (statement + (expression + (function + (functionName) + (number) + (ERROR) + (number)))) + +===== +Escaped bracket +===== + +[[notFunction()] + +--- + + (statement + (escapedStringLiteral)) + +===== +String literal +===== + +This is a string + +--- + + (statement + (stringLiteral)) diff --git a/tree-sitter-dscexpression/corpus/valid_expressions.txt b/tree-sitter-dscexpression/corpus/valid_expressions.txt new file mode 100644 index 000000000..ba653864a --- /dev/null +++ b/tree-sitter-dscexpression/corpus/valid_expressions.txt @@ -0,0 +1,96 @@ +===== +Function no args +===== + +[functionOne()] + +--- + + (statement + (expression + (function + (functionName)))) + +===== +Simple expression +===== + +[myFunction('argString')] + +--- + + (statement + (expression + (function + (functionName) + (string)))) + +===== +Whitespace +===== + + [ functionOne ( 'arg' , 2 ) ] + +--- + + (statement + (expression + (function + (functionName) + (string) + (number)))) + +===== +Multiple arguments +===== + +[myFunction('argString', 1, true)] + +--- + + (statement + (expression + (function + (functionName) + (string) + (number) + (boolean)))) + +===== +Nested functions +===== + +[functionOne('argString', functionTwo(1, functionThree('threeString', 3), 2), 'oneString')] + +--- + + (statement + (expression + (function + (functionName) + (string) + (function + (functionName) + (number) + (function + (functionName) + (string) + (number)) + (number)) + (string)))) + +===== +Function with dot-notation +===== + +[functionOne('argString').prop1.prop2] + +--- + + (statement + (expression + (function + (functionName) + (string)) + (memberName) + (memberName))) diff --git a/tree-sitter-dscexpression/grammar.js b/tree-sitter-dscexpression/grammar.js new file mode 100644 index 000000000..2d8f8ea2e --- /dev/null +++ b/tree-sitter-dscexpression/grammar.js @@ -0,0 +1,25 @@ +module.exports = grammar({ + name: 'dscexpression', + + rules: { + statement: $ => choice( + $.escapedStringLiteral, + $.expression, + $.stringLiteral, + ), + escapedStringLiteral: $ => token(seq('[[', /.*/)), + expression: $ => seq('[', $.function, optional($._members), ']'), + stringLiteral: $ => token(prec(-11, /.*/)), + function: $ => seq($.functionName, '(', optional($._arguments), ')'), + functionName: $ => /[a-zA-Z]+/, + _arguments: $ => seq($._argument, repeat(seq(',', $._argument))), + _argument: $ => choice($.function, $.string, $.number, $.boolean), + string: $ => seq("'", /[^']*/, "'"), + number: $ => /\d+/, + boolean: $ => choice('true', 'false'), + _members: $ => repeat1($._member), + _member: $ => seq('.', $.memberName), + memberName: $ => /[a-zA-Z0-9_-]+/, + } + +}); diff --git a/tree-sitter-dscexpression/package.json b/tree-sitter-dscexpression/package.json new file mode 100644 index 000000000..9dfef26f2 --- /dev/null +++ b/tree-sitter-dscexpression/package.json @@ -0,0 +1,19 @@ +{ + "name": "tree-sitter-dscexpression", + "version": "0.0.1", + "description": "DSCExpression grammar for tree-sitter", + "main": "bindings/node", + "keywords": [ + "parsing", + "incremental" + ], + "dependencies": { + "nan": "^2.12.1" + }, + "devDependencies": { + "tree-sitter-cli": "^0.20.8" + }, + "scripts": { + "test": "tree-sitter test" + } +} diff --git a/tree-sitter-dscexpression/src/grammar.json b/tree-sitter-dscexpression/src/grammar.json new file mode 100644 index 000000000..268796be5 --- /dev/null +++ b/tree-sitter-dscexpression/src/grammar.json @@ -0,0 +1,227 @@ +{ + "name": "dscexpression", + "rules": { + "statement": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "escapedStringLiteral" + }, + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "SYMBOL", + "name": "stringLiteral" + } + ] + }, + "escapedStringLiteral": { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "[[" + }, + { + "type": "PATTERN", + "value": ".*" + } + ] + } + }, + "expression": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "[" + }, + { + "type": "SYMBOL", + "name": "function" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "_members" + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "STRING", + "value": "]" + } + ] + }, + "stringLiteral": { + "type": "TOKEN", + "content": { + "type": "PREC", + "value": -11, + "content": { + "type": "PATTERN", + "value": ".*" + } + } + }, + "function": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "functionName" + }, + { + "type": "STRING", + "value": "(" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "_arguments" + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "STRING", + "value": ")" + } + ] + }, + "functionName": { + "type": "PATTERN", + "value": "[a-zA-Z]+" + }, + "_arguments": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "_argument" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "_argument" + } + ] + } + } + ] + }, + "_argument": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "function" + }, + { + "type": "SYMBOL", + "name": "string" + }, + { + "type": "SYMBOL", + "name": "number" + }, + { + "type": "SYMBOL", + "name": "boolean" + } + ] + }, + "string": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "'" + }, + { + "type": "PATTERN", + "value": "[^']*" + }, + { + "type": "STRING", + "value": "'" + } + ] + }, + "number": { + "type": "PATTERN", + "value": "\\d+" + }, + "boolean": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "true" + }, + { + "type": "STRING", + "value": "false" + } + ] + }, + "_members": { + "type": "REPEAT1", + "content": { + "type": "SYMBOL", + "name": "_member" + } + }, + "_member": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "." + }, + { + "type": "SYMBOL", + "name": "memberName" + } + ] + }, + "memberName": { + "type": "PATTERN", + "value": "[a-zA-Z0-9_-]+" + } + }, + "extras": [ + { + "type": "PATTERN", + "value": "\\s" + } + ], + "conflicts": [], + "precedences": [], + "externals": [], + "inline": [], + "supertypes": [] +} + diff --git a/tree-sitter-dscexpression/src/node-types.json b/tree-sitter-dscexpression/src/node-types.json new file mode 100644 index 000000000..146b98e9b --- /dev/null +++ b/tree-sitter-dscexpression/src/node-types.json @@ -0,0 +1,141 @@ +[ + { + "type": "boolean", + "named": true, + "fields": {} + }, + { + "type": "expression", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "function", + "named": true + }, + { + "type": "memberName", + "named": true + } + ] + } + }, + { + "type": "function", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "boolean", + "named": true + }, + { + "type": "function", + "named": true + }, + { + "type": "functionName", + "named": true + }, + { + "type": "number", + "named": true + }, + { + "type": "string", + "named": true + } + ] + } + }, + { + "type": "statement", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "escapedStringLiteral", + "named": true + }, + { + "type": "expression", + "named": true + }, + { + "type": "stringLiteral", + "named": true + } + ] + } + }, + { + "type": "string", + "named": true, + "fields": {} + }, + { + "type": "'", + "named": false + }, + { + "type": "(", + "named": false + }, + { + "type": ")", + "named": false + }, + { + "type": ",", + "named": false + }, + { + "type": ".", + "named": false + }, + { + "type": "[", + "named": false + }, + { + "type": "]", + "named": false + }, + { + "type": "escapedStringLiteral", + "named": true + }, + { + "type": "false", + "named": false + }, + { + "type": "functionName", + "named": true + }, + { + "type": "memberName", + "named": true + }, + { + "type": "number", + "named": true + }, + { + "type": "stringLiteral", + "named": true + }, + { + "type": "true", + "named": false + } +] \ No newline at end of file diff --git a/tree-sitter-dscexpression/src/parser.c b/tree-sitter-dscexpression/src/parser.c new file mode 100644 index 000000000..d84dea6e7 --- /dev/null +++ b/tree-sitter-dscexpression/src/parser.c @@ -0,0 +1,831 @@ +#include + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#define LANGUAGE_VERSION 14 +#define STATE_COUNT 26 +#define LARGE_STATE_COUNT 2 +#define SYMBOL_COUNT 26 +#define ALIAS_COUNT 0 +#define TOKEN_COUNT 16 +#define EXTERNAL_TOKEN_COUNT 0 +#define FIELD_COUNT 0 +#define MAX_ALIAS_SEQUENCE_LENGTH 4 +#define PRODUCTION_ID_COUNT 1 + +enum { + sym_escapedStringLiteral = 1, + anon_sym_LBRACK = 2, + anon_sym_RBRACK = 3, + sym_stringLiteral = 4, + anon_sym_LPAREN = 5, + anon_sym_RPAREN = 6, + sym_functionName = 7, + anon_sym_COMMA = 8, + anon_sym_SQUOTE = 9, + aux_sym_string_token1 = 10, + sym_number = 11, + anon_sym_true = 12, + anon_sym_false = 13, + anon_sym_DOT = 14, + sym_memberName = 15, + sym_statement = 16, + sym_expression = 17, + sym_function = 18, + sym__arguments = 19, + sym__argument = 20, + sym_string = 21, + sym_boolean = 22, + aux_sym__members = 23, + sym__member = 24, + aux_sym__arguments_repeat1 = 25, +}; + +static const char * const ts_symbol_names[] = { + [ts_builtin_sym_end] = "end", + [sym_escapedStringLiteral] = "escapedStringLiteral", + [anon_sym_LBRACK] = "[", + [anon_sym_RBRACK] = "]", + [sym_stringLiteral] = "stringLiteral", + [anon_sym_LPAREN] = "(", + [anon_sym_RPAREN] = ")", + [sym_functionName] = "functionName", + [anon_sym_COMMA] = ",", + [anon_sym_SQUOTE] = "'", + [aux_sym_string_token1] = "string_token1", + [sym_number] = "number", + [anon_sym_true] = "true", + [anon_sym_false] = "false", + [anon_sym_DOT] = ".", + [sym_memberName] = "memberName", + [sym_statement] = "statement", + [sym_expression] = "expression", + [sym_function] = "function", + [sym__arguments] = "_arguments", + [sym__argument] = "_argument", + [sym_string] = "string", + [sym_boolean] = "boolean", + [aux_sym__members] = "_members", + [sym__member] = "_member", + [aux_sym__arguments_repeat1] = "_arguments_repeat1", +}; + +static const TSSymbol ts_symbol_map[] = { + [ts_builtin_sym_end] = ts_builtin_sym_end, + [sym_escapedStringLiteral] = sym_escapedStringLiteral, + [anon_sym_LBRACK] = anon_sym_LBRACK, + [anon_sym_RBRACK] = anon_sym_RBRACK, + [sym_stringLiteral] = sym_stringLiteral, + [anon_sym_LPAREN] = anon_sym_LPAREN, + [anon_sym_RPAREN] = anon_sym_RPAREN, + [sym_functionName] = sym_functionName, + [anon_sym_COMMA] = anon_sym_COMMA, + [anon_sym_SQUOTE] = anon_sym_SQUOTE, + [aux_sym_string_token1] = aux_sym_string_token1, + [sym_number] = sym_number, + [anon_sym_true] = anon_sym_true, + [anon_sym_false] = anon_sym_false, + [anon_sym_DOT] = anon_sym_DOT, + [sym_memberName] = sym_memberName, + [sym_statement] = sym_statement, + [sym_expression] = sym_expression, + [sym_function] = sym_function, + [sym__arguments] = sym__arguments, + [sym__argument] = sym__argument, + [sym_string] = sym_string, + [sym_boolean] = sym_boolean, + [aux_sym__members] = aux_sym__members, + [sym__member] = sym__member, + [aux_sym__arguments_repeat1] = aux_sym__arguments_repeat1, +}; + +static const TSSymbolMetadata ts_symbol_metadata[] = { + [ts_builtin_sym_end] = { + .visible = false, + .named = true, + }, + [sym_escapedStringLiteral] = { + .visible = true, + .named = true, + }, + [anon_sym_LBRACK] = { + .visible = true, + .named = false, + }, + [anon_sym_RBRACK] = { + .visible = true, + .named = false, + }, + [sym_stringLiteral] = { + .visible = true, + .named = true, + }, + [anon_sym_LPAREN] = { + .visible = true, + .named = false, + }, + [anon_sym_RPAREN] = { + .visible = true, + .named = false, + }, + [sym_functionName] = { + .visible = true, + .named = true, + }, + [anon_sym_COMMA] = { + .visible = true, + .named = false, + }, + [anon_sym_SQUOTE] = { + .visible = true, + .named = false, + }, + [aux_sym_string_token1] = { + .visible = false, + .named = false, + }, + [sym_number] = { + .visible = true, + .named = true, + }, + [anon_sym_true] = { + .visible = true, + .named = false, + }, + [anon_sym_false] = { + .visible = true, + .named = false, + }, + [anon_sym_DOT] = { + .visible = true, + .named = false, + }, + [sym_memberName] = { + .visible = true, + .named = true, + }, + [sym_statement] = { + .visible = true, + .named = true, + }, + [sym_expression] = { + .visible = true, + .named = true, + }, + [sym_function] = { + .visible = true, + .named = true, + }, + [sym__arguments] = { + .visible = false, + .named = true, + }, + [sym__argument] = { + .visible = false, + .named = true, + }, + [sym_string] = { + .visible = true, + .named = true, + }, + [sym_boolean] = { + .visible = true, + .named = true, + }, + [aux_sym__members] = { + .visible = false, + .named = false, + }, + [sym__member] = { + .visible = false, + .named = true, + }, + [aux_sym__arguments_repeat1] = { + .visible = false, + .named = false, + }, +}; + +static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { + [0] = {0}, +}; + +static const uint16_t ts_non_terminal_alias_map[] = { + 0, +}; + +static const TSStateId ts_primary_state_ids[STATE_COUNT] = { + [0] = 0, + [1] = 1, + [2] = 2, + [3] = 3, + [4] = 4, + [5] = 5, + [6] = 6, + [7] = 7, + [8] = 8, + [9] = 9, + [10] = 10, + [11] = 11, + [12] = 12, + [13] = 13, + [14] = 14, + [15] = 15, + [16] = 16, + [17] = 17, + [18] = 18, + [19] = 19, + [20] = 20, + [21] = 21, + [22] = 22, + [23] = 23, + [24] = 24, + [25] = 25, +}; + +static bool ts_lex(TSLexer *lexer, TSStateId state) { + START_LEXER(); + eof = lexer->eof(lexer); + switch (state) { + case 0: + if (eof) ADVANCE(4); + if (lookahead == '\'') ADVANCE(29); + if (lookahead == '(') ADVANCE(10); + if (lookahead == ')') ADVANCE(11); + if (lookahead == ',') ADVANCE(28); + if (lookahead == '.') ADVANCE(38); + if (lookahead == '[') ADVANCE(6); + if (lookahead == ']') ADVANCE(7); + if (lookahead == 'f') ADVANCE(12); + if (lookahead == 't') ADVANCE(20); + if (lookahead == '-' || + lookahead == '_') ADVANCE(39); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(0) + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(32); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 1: + if (lookahead == '\'') ADVANCE(29); + if (lookahead == ')') ADVANCE(11); + if (lookahead == 'f') ADVANCE(13); + if (lookahead == 't') ADVANCE(21); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(1) + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(33); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 2: + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(2) + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 3: + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(3) + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(39); + END_STATE(); + case 4: + ACCEPT_TOKEN(ts_builtin_sym_end); + END_STATE(); + case 5: + ACCEPT_TOKEN(sym_escapedStringLiteral); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(5); + END_STATE(); + case 6: + ACCEPT_TOKEN(anon_sym_LBRACK); + if (lookahead == '[') ADVANCE(5); + END_STATE(); + case 7: + ACCEPT_TOKEN(anon_sym_RBRACK); + END_STATE(); + case 8: + ACCEPT_TOKEN(sym_stringLiteral); + if (lookahead == '\n') SKIP(8) + if (lookahead == '[') ADVANCE(6); + if (lookahead == '\t' || + lookahead == '\r' || + lookahead == ' ') ADVANCE(8); + if (lookahead != 0) ADVANCE(9); + END_STATE(); + case 9: + ACCEPT_TOKEN(sym_stringLiteral); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(9); + END_STATE(); + case 10: + ACCEPT_TOKEN(anon_sym_LPAREN); + END_STATE(); + case 11: + ACCEPT_TOKEN(anon_sym_RPAREN); + END_STATE(); + case 12: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'a') ADVANCE(18); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 13: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'a') ADVANCE(19); + if (('A' <= lookahead && lookahead <= 'Z') || + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 14: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'e') ADVANCE(34); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 15: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'e') ADVANCE(36); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 16: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'e') ADVANCE(35); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 17: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'e') ADVANCE(37); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 18: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'l') ADVANCE(22); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 19: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'l') ADVANCE(23); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 20: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'r') ADVANCE(24); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 21: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'r') ADVANCE(25); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 22: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 's') ADVANCE(15); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 23: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 's') ADVANCE(17); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 24: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'u') ADVANCE(14); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 25: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == 'u') ADVANCE(16); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 26: + ACCEPT_TOKEN(sym_functionName); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 27: + ACCEPT_TOKEN(sym_functionName); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 28: + ACCEPT_TOKEN(anon_sym_COMMA); + END_STATE(); + case 29: + ACCEPT_TOKEN(anon_sym_SQUOTE); + END_STATE(); + case 30: + ACCEPT_TOKEN(aux_sym_string_token1); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') ADVANCE(30); + if (lookahead != 0 && + lookahead != '\'') ADVANCE(31); + END_STATE(); + case 31: + ACCEPT_TOKEN(aux_sym_string_token1); + if (lookahead != 0 && + lookahead != '\'') ADVANCE(31); + END_STATE(); + case 32: + ACCEPT_TOKEN(sym_number); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(32); + if (lookahead == '-' || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(39); + END_STATE(); + case 33: + ACCEPT_TOKEN(sym_number); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(33); + END_STATE(); + case 34: + ACCEPT_TOKEN(anon_sym_true); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 35: + ACCEPT_TOKEN(anon_sym_true); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 36: + ACCEPT_TOKEN(anon_sym_false); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + lookahead == '_') ADVANCE(39); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 37: + ACCEPT_TOKEN(anon_sym_false); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + END_STATE(); + case 38: + ACCEPT_TOKEN(anon_sym_DOT); + END_STATE(); + case 39: + ACCEPT_TOKEN(sym_memberName); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(39); + END_STATE(); + default: + return false; + } +} + +static const TSLexMode ts_lex_modes[STATE_COUNT] = { + [0] = {.lex_state = 0}, + [1] = {.lex_state = 8}, + [2] = {.lex_state = 1}, + [3] = {.lex_state = 1}, + [4] = {.lex_state = 0}, + [5] = {.lex_state = 0}, + [6] = {.lex_state = 0}, + [7] = {.lex_state = 0}, + [8] = {.lex_state = 0}, + [9] = {.lex_state = 0}, + [10] = {.lex_state = 0}, + [11] = {.lex_state = 0}, + [12] = {.lex_state = 0}, + [13] = {.lex_state = 0}, + [14] = {.lex_state = 2}, + [15] = {.lex_state = 0}, + [16] = {.lex_state = 0}, + [17] = {.lex_state = 3}, + [18] = {.lex_state = 0}, + [19] = {.lex_state = 0}, + [20] = {.lex_state = 30}, + [21] = {.lex_state = 0}, + [22] = {.lex_state = 0}, + [23] = {.lex_state = 0}, + [24] = {.lex_state = 0}, + [25] = {.lex_state = 0}, +}; + +static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { + [0] = { + [ts_builtin_sym_end] = ACTIONS(1), + [sym_escapedStringLiteral] = ACTIONS(1), + [anon_sym_LBRACK] = ACTIONS(1), + [anon_sym_RBRACK] = ACTIONS(1), + [anon_sym_LPAREN] = ACTIONS(1), + [anon_sym_RPAREN] = ACTIONS(1), + [sym_functionName] = ACTIONS(1), + [anon_sym_COMMA] = ACTIONS(1), + [anon_sym_SQUOTE] = ACTIONS(1), + [sym_number] = ACTIONS(1), + [anon_sym_true] = ACTIONS(1), + [anon_sym_false] = ACTIONS(1), + [anon_sym_DOT] = ACTIONS(1), + [sym_memberName] = ACTIONS(1), + }, + [1] = { + [sym_statement] = STATE(25), + [sym_expression] = STATE(23), + [sym_escapedStringLiteral] = ACTIONS(3), + [anon_sym_LBRACK] = ACTIONS(5), + [sym_stringLiteral] = ACTIONS(3), + }, +}; + +static const uint16_t ts_small_parse_table[] = { + [0] = 7, + ACTIONS(7), 1, + anon_sym_RPAREN, + ACTIONS(9), 1, + sym_functionName, + ACTIONS(11), 1, + anon_sym_SQUOTE, + ACTIONS(13), 1, + sym_number, + STATE(21), 1, + sym__arguments, + ACTIONS(15), 2, + anon_sym_true, + anon_sym_false, + STATE(9), 4, + sym_function, + sym__argument, + sym_string, + sym_boolean, + [26] = 5, + ACTIONS(9), 1, + sym_functionName, + ACTIONS(11), 1, + anon_sym_SQUOTE, + ACTIONS(17), 1, + sym_number, + ACTIONS(15), 2, + anon_sym_true, + anon_sym_false, + STATE(16), 4, + sym_function, + sym__argument, + sym_string, + sym_boolean, + [46] = 3, + ACTIONS(19), 1, + anon_sym_RBRACK, + ACTIONS(21), 1, + anon_sym_DOT, + STATE(4), 2, + aux_sym__members, + sym__member, + [57] = 1, + ACTIONS(24), 4, + anon_sym_RBRACK, + anon_sym_RPAREN, + anon_sym_COMMA, + anon_sym_DOT, + [64] = 1, + ACTIONS(26), 4, + anon_sym_RBRACK, + anon_sym_RPAREN, + anon_sym_COMMA, + anon_sym_DOT, + [71] = 3, + ACTIONS(28), 1, + anon_sym_RBRACK, + ACTIONS(30), 1, + anon_sym_DOT, + STATE(8), 2, + aux_sym__members, + sym__member, + [82] = 3, + ACTIONS(30), 1, + anon_sym_DOT, + ACTIONS(32), 1, + anon_sym_RBRACK, + STATE(4), 2, + aux_sym__members, + sym__member, + [93] = 3, + ACTIONS(34), 1, + anon_sym_RPAREN, + ACTIONS(36), 1, + anon_sym_COMMA, + STATE(10), 1, + aux_sym__arguments_repeat1, + [103] = 3, + ACTIONS(36), 1, + anon_sym_COMMA, + ACTIONS(38), 1, + anon_sym_RPAREN, + STATE(11), 1, + aux_sym__arguments_repeat1, + [113] = 3, + ACTIONS(40), 1, + anon_sym_RPAREN, + ACTIONS(42), 1, + anon_sym_COMMA, + STATE(11), 1, + aux_sym__arguments_repeat1, + [123] = 1, + ACTIONS(45), 2, + anon_sym_RPAREN, + anon_sym_COMMA, + [128] = 1, + ACTIONS(47), 2, + anon_sym_RBRACK, + anon_sym_DOT, + [133] = 2, + ACTIONS(49), 1, + sym_functionName, + STATE(7), 1, + sym_function, + [140] = 1, + ACTIONS(51), 2, + anon_sym_RPAREN, + anon_sym_COMMA, + [145] = 1, + ACTIONS(40), 2, + anon_sym_RPAREN, + anon_sym_COMMA, + [150] = 1, + ACTIONS(53), 1, + sym_memberName, + [154] = 1, + ACTIONS(55), 1, + ts_builtin_sym_end, + [158] = 1, + ACTIONS(57), 1, + anon_sym_LPAREN, + [162] = 1, + ACTIONS(59), 1, + aux_sym_string_token1, + [166] = 1, + ACTIONS(61), 1, + anon_sym_RPAREN, + [170] = 1, + ACTIONS(63), 1, + ts_builtin_sym_end, + [174] = 1, + ACTIONS(65), 1, + ts_builtin_sym_end, + [178] = 1, + ACTIONS(67), 1, + anon_sym_SQUOTE, + [182] = 1, + ACTIONS(69), 1, + ts_builtin_sym_end, +}; + +static const uint32_t ts_small_parse_table_map[] = { + [SMALL_STATE(2)] = 0, + [SMALL_STATE(3)] = 26, + [SMALL_STATE(4)] = 46, + [SMALL_STATE(5)] = 57, + [SMALL_STATE(6)] = 64, + [SMALL_STATE(7)] = 71, + [SMALL_STATE(8)] = 82, + [SMALL_STATE(9)] = 93, + [SMALL_STATE(10)] = 103, + [SMALL_STATE(11)] = 113, + [SMALL_STATE(12)] = 123, + [SMALL_STATE(13)] = 128, + [SMALL_STATE(14)] = 133, + [SMALL_STATE(15)] = 140, + [SMALL_STATE(16)] = 145, + [SMALL_STATE(17)] = 150, + [SMALL_STATE(18)] = 154, + [SMALL_STATE(19)] = 158, + [SMALL_STATE(20)] = 162, + [SMALL_STATE(21)] = 166, + [SMALL_STATE(22)] = 170, + [SMALL_STATE(23)] = 174, + [SMALL_STATE(24)] = 178, + [SMALL_STATE(25)] = 182, +}; + +static const TSParseActionEntry ts_parse_actions[] = { + [0] = {.entry = {.count = 0, .reusable = false}}, + [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), + [3] = {.entry = {.count = 1, .reusable = false}}, SHIFT(23), + [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), + [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), + [9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), + [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), + [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), + [15] = {.entry = {.count = 1, .reusable = false}}, SHIFT(12), + [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), + [19] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__members, 2), + [21] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__members, 2), SHIFT_REPEAT(17), + [24] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function, 4), + [26] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function, 3), + [28] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), + [30] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [32] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), + [34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__arguments, 1), + [36] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [38] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__arguments, 2), + [40] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__arguments_repeat1, 2), + [42] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__arguments_repeat1, 2), SHIFT_REPEAT(3), + [45] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1), + [47] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__member, 2), + [49] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), + [51] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 3), + [53] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), + [55] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 3), + [57] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), + [59] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), + [61] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), + [63] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 4), + [65] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 1), + [67] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), + [69] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), +}; + +#ifdef __cplusplus +extern "C" { +#endif +#ifdef _WIN32 +#define extern __declspec(dllexport) +#endif + +extern const TSLanguage *tree_sitter_dscexpression(void) { + static const TSLanguage language = { + .version = LANGUAGE_VERSION, + .symbol_count = SYMBOL_COUNT, + .alias_count = ALIAS_COUNT, + .token_count = TOKEN_COUNT, + .external_token_count = EXTERNAL_TOKEN_COUNT, + .state_count = STATE_COUNT, + .large_state_count = LARGE_STATE_COUNT, + .production_id_count = PRODUCTION_ID_COUNT, + .field_count = FIELD_COUNT, + .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, + .parse_table = &ts_parse_table[0][0], + .small_parse_table = ts_small_parse_table, + .small_parse_table_map = ts_small_parse_table_map, + .parse_actions = ts_parse_actions, + .symbol_names = ts_symbol_names, + .symbol_metadata = ts_symbol_metadata, + .public_symbol_map = ts_symbol_map, + .alias_map = ts_non_terminal_alias_map, + .alias_sequences = &ts_alias_sequences[0][0], + .lex_modes = ts_lex_modes, + .lex_fn = ts_lex, + .primary_state_ids = ts_primary_state_ids, + }; + return &language; +} +#ifdef __cplusplus +} +#endif diff --git a/tree-sitter-dscexpression/src/tree_sitter/parser.h b/tree-sitter-dscexpression/src/tree_sitter/parser.h new file mode 100644 index 000000000..2b14ac104 --- /dev/null +++ b/tree-sitter-dscexpression/src/tree_sitter/parser.h @@ -0,0 +1,224 @@ +#ifndef TREE_SITTER_PARSER_H_ +#define TREE_SITTER_PARSER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define ts_builtin_sym_error ((TSSymbol)-1) +#define ts_builtin_sym_end 0 +#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 + +typedef uint16_t TSStateId; + +#ifndef TREE_SITTER_API_H_ +typedef uint16_t TSSymbol; +typedef uint16_t TSFieldId; +typedef struct TSLanguage TSLanguage; +#endif + +typedef struct { + TSFieldId field_id; + uint8_t child_index; + bool inherited; +} TSFieldMapEntry; + +typedef struct { + uint16_t index; + uint16_t length; +} TSFieldMapSlice; + +typedef struct { + bool visible; + bool named; + bool supertype; +} TSSymbolMetadata; + +typedef struct TSLexer TSLexer; + +struct TSLexer { + int32_t lookahead; + TSSymbol result_symbol; + void (*advance)(TSLexer *, bool); + void (*mark_end)(TSLexer *); + uint32_t (*get_column)(TSLexer *); + bool (*is_at_included_range_start)(const TSLexer *); + bool (*eof)(const TSLexer *); +}; + +typedef enum { + TSParseActionTypeShift, + TSParseActionTypeReduce, + TSParseActionTypeAccept, + TSParseActionTypeRecover, +} TSParseActionType; + +typedef union { + struct { + uint8_t type; + TSStateId state; + bool extra; + bool repetition; + } shift; + struct { + uint8_t type; + uint8_t child_count; + TSSymbol symbol; + int16_t dynamic_precedence; + uint16_t production_id; + } reduce; + uint8_t type; +} TSParseAction; + +typedef struct { + uint16_t lex_state; + uint16_t external_lex_state; +} TSLexMode; + +typedef union { + TSParseAction action; + struct { + uint8_t count; + bool reusable; + } entry; +} TSParseActionEntry; + +struct TSLanguage { + uint32_t version; + uint32_t symbol_count; + uint32_t alias_count; + uint32_t token_count; + uint32_t external_token_count; + uint32_t state_count; + uint32_t large_state_count; + uint32_t production_id_count; + uint32_t field_count; + uint16_t max_alias_sequence_length; + const uint16_t *parse_table; + const uint16_t *small_parse_table; + const uint32_t *small_parse_table_map; + const TSParseActionEntry *parse_actions; + const char * const *symbol_names; + const char * const *field_names; + const TSFieldMapSlice *field_map_slices; + const TSFieldMapEntry *field_map_entries; + const TSSymbolMetadata *symbol_metadata; + const TSSymbol *public_symbol_map; + const uint16_t *alias_map; + const TSSymbol *alias_sequences; + const TSLexMode *lex_modes; + bool (*lex_fn)(TSLexer *, TSStateId); + bool (*keyword_lex_fn)(TSLexer *, TSStateId); + TSSymbol keyword_capture_token; + struct { + const bool *states; + const TSSymbol *symbol_map; + void *(*create)(void); + void (*destroy)(void *); + bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); + unsigned (*serialize)(void *, char *); + void (*deserialize)(void *, const char *, unsigned); + } external_scanner; + const TSStateId *primary_state_ids; +}; + +/* + * Lexer Macros + */ + +#define START_LEXER() \ + bool result = false; \ + bool skip = false; \ + bool eof = false; \ + int32_t lookahead; \ + goto start; \ + next_state: \ + lexer->advance(lexer, skip); \ + start: \ + skip = false; \ + lookahead = lexer->lookahead; + +#define ADVANCE(state_value) \ + { \ + state = state_value; \ + goto next_state; \ + } + +#define SKIP(state_value) \ + { \ + skip = true; \ + state = state_value; \ + goto next_state; \ + } + +#define ACCEPT_TOKEN(symbol_value) \ + result = true; \ + lexer->result_symbol = symbol_value; \ + lexer->mark_end(lexer); + +#define END_STATE() return result; + +/* + * Parse Table Macros + */ + +#define SMALL_STATE(id) id - LARGE_STATE_COUNT + +#define STATE(id) id + +#define ACTIONS(id) id + +#define SHIFT(state_value) \ + {{ \ + .shift = { \ + .type = TSParseActionTypeShift, \ + .state = state_value \ + } \ + }} + +#define SHIFT_REPEAT(state_value) \ + {{ \ + .shift = { \ + .type = TSParseActionTypeShift, \ + .state = state_value, \ + .repetition = true \ + } \ + }} + +#define SHIFT_EXTRA() \ + {{ \ + .shift = { \ + .type = TSParseActionTypeShift, \ + .extra = true \ + } \ + }} + +#define REDUCE(symbol_val, child_count_val, ...) \ + {{ \ + .reduce = { \ + .type = TSParseActionTypeReduce, \ + .symbol = symbol_val, \ + .child_count = child_count_val, \ + __VA_ARGS__ \ + }, \ + }} + +#define RECOVER() \ + {{ \ + .type = TSParseActionTypeRecover \ + }} + +#define ACCEPT_INPUT() \ + {{ \ + .type = TSParseActionTypeAccept \ + }} + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_PARSER_H_ From b343ebe22abdbc395432afb2387132cfc32e2c35 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Thu, 5 Oct 2023 21:01:26 -0700 Subject: [PATCH 05/28] add tree-sitter to build --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index a01f8558c..fb568b689 100644 --- a/build.ps1 +++ b/build.ps1 @@ -93,7 +93,7 @@ New-Item -ItemType Directory $target > $null # make sure dependencies are built first so clippy runs correctly $windows_projects = @("pal", "ntreg", "ntstatuserror", "ntuserinfo", "registry") $projects = @("dsc_lib", "dsc", "osinfo", "process", "tools/test_group_resource", "y2j", "powershellgroup", "tools/dsctest") -$pedantic_unclean_projects = @("ntreg") +$pedantic_unclean_projects = @("tree-sitter-dscexpression", "ntreg") if ($IsWindows) { $projects += $windows_projects From 2b4e919836be54b87a422980a8b5d5683a63c01e Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 9 Oct 2023 16:45:27 -0700 Subject: [PATCH 06/28] grammar for DSC expressions --- .vscode/settings.json | 2 +- build.ps1 | 9 +- .../bindings/node/binding.cc | 8 +- .../bindings/node/index.js | 4 +- .../bindings/rust/lib.rs | 10 +- .../corpus/invalid_expressions.txt | 56 +- .../corpus/valid_expressions.txt | 57 +- tree-sitter-dscexpression/grammar.js | 23 +- tree-sitter-dscexpression/src/grammar.json | 77 ++- tree-sitter-dscexpression/src/node-types.json | 10 +- tree-sitter-dscexpression/src/parser.c | 625 ++++++++++-------- 11 files changed, 528 insertions(+), 353 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 195513fff..237a714b4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,10 +6,10 @@ "./ntstatuserror/Cargo.toml", "./ntuserinfo/Cargo.toml", "./osinfo/Cargo.toml", - "./pal/Cargo.toml", "./registry/Cargo.toml", "./tools/test_group_resource/Cargo.toml", "./tools/dsctest/Cargo.toml", + "./tree-sitter-dscexpression/Cargo.toml", "./y2j/Cargo.toml" ], "rust-analyzer.showUnlinkedFileNotification": true, diff --git a/build.ps1 b/build.ps1 index fb568b689..9df8258d8 100644 --- a/build.ps1 +++ b/build.ps1 @@ -208,13 +208,10 @@ if ($Test) { Push-Location "$PSScriptRoot/$project" if (Test-Path "./Cargo.toml") { - if (Test-Path "./Cargo.toml") - { - cargo test + cargo test - if ($LASTEXITCODE -ne 0) { - $failed = $true - } + if ($LASTEXITCODE -ne 0) { + $failed = $true } } } finally { diff --git a/tree-sitter-dscexpression/bindings/node/binding.cc b/tree-sitter-dscexpression/bindings/node/binding.cc index 38b407b53..49790f244 100644 --- a/tree-sitter-dscexpression/bindings/node/binding.cc +++ b/tree-sitter-dscexpression/bindings/node/binding.cc @@ -4,7 +4,7 @@ using namespace v8; -extern "C" TSLanguage * tree_sitter_DSCExpression(); +extern "C" TSLanguage * tree_sitter_dscexpression(); namespace { @@ -17,12 +17,12 @@ void Init(Local exports, Local module) { Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); - Nan::SetInternalFieldPointer(instance, 0, tree_sitter_DSCExpression()); + Nan::SetInternalFieldPointer(instance, 0, tree_sitter_dscexpression()); - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("DSCExpression").ToLocalChecked()); + Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("dscexpression").ToLocalChecked()); Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); } -NODE_MODULE(tree_sitter_DSCExpression_binding, Init) +NODE_MODULE(tree_sitter_dscexpression_binding, Init) } // namespace diff --git a/tree-sitter-dscexpression/bindings/node/index.js b/tree-sitter-dscexpression/bindings/node/index.js index 73d046fa3..550da52d1 100644 --- a/tree-sitter-dscexpression/bindings/node/index.js +++ b/tree-sitter-dscexpression/bindings/node/index.js @@ -1,11 +1,11 @@ try { - module.exports = require("../../build/Release/tree_sitter_DSCExpression_binding"); + module.exports = require("../../build/Release/tree_sitter_dscexpression_binding"); } catch (error1) { if (error1.code !== 'MODULE_NOT_FOUND') { throw error1; } try { - module.exports = require("../../build/Debug/tree_sitter_DSCExpression_binding"); + module.exports = require("../../build/Debug/tree_sitter_dscexpression_binding"); } catch (error2) { if (error2.code !== 'MODULE_NOT_FOUND') { throw error2; diff --git a/tree-sitter-dscexpression/bindings/rust/lib.rs b/tree-sitter-dscexpression/bindings/rust/lib.rs index c2d7a6d69..fb06ae2df 100644 --- a/tree-sitter-dscexpression/bindings/rust/lib.rs +++ b/tree-sitter-dscexpression/bindings/rust/lib.rs @@ -1,4 +1,4 @@ -//! This crate provides DSCExpression language support for the [tree-sitter][] parsing library. +//! This crate provides dscexpression language support for the [tree-sitter][] parsing library. //! //! Typically, you will use the [language][language func] function to add this language to a //! tree-sitter [Parser][], and then use the parser to parse some code: @@ -6,7 +6,7 @@ //! ``` //! let code = ""; //! let mut parser = tree_sitter::Parser::new(); -//! parser.set_language(tree_sitter_DSCExpression::language()).expect("Error loading DSCExpression grammar"); +//! parser.set_language(tree_sitter_dscexpression::language()).expect("Error loading dscexpression grammar"); //! let tree = parser.parse(code, None).unwrap(); //! ``` //! @@ -18,14 +18,14 @@ use tree_sitter::Language; extern "C" { - fn tree_sitter_DSCExpression() -> Language; + fn tree_sitter_dscexpression() -> Language; } /// Get the tree-sitter [Language][] for this grammar. /// /// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html pub fn language() -> Language { - unsafe { tree_sitter_DSCExpression() } + unsafe { tree_sitter_dscexpression() } } /// The content of the [`node-types.json`][] file for this grammar. @@ -47,6 +47,6 @@ mod tests { let mut parser = tree_sitter::Parser::new(); parser .set_language(super::language()) - .expect("Error loading DSCExpression language"); + .expect("Error loading dscexpression language"); } } diff --git a/tree-sitter-dscexpression/corpus/invalid_expressions.txt b/tree-sitter-dscexpression/corpus/invalid_expressions.txt index d3fe02684..599659569 100644 --- a/tree-sitter-dscexpression/corpus/invalid_expressions.txt +++ b/tree-sitter-dscexpression/corpus/invalid_expressions.txt @@ -1,9 +1,7 @@ ===== String literal looking like function ===== - functionOne(1,2) - --- (statement @@ -12,9 +10,7 @@ functionOne(1,2) ===== String parameter not in quotes ===== - [functionOne(alpha, beta)] - --- (statement @@ -28,9 +24,7 @@ String parameter not in quotes ===== Missing parenthesis ===== - [functionOne] - --- (ERROR @@ -39,9 +33,7 @@ Missing parenthesis ===== Missing parameter ===== - [functionOne(1, ,2)] - --- (statement @@ -55,9 +47,16 @@ Missing parameter ===== Escaped bracket ===== - [[notFunction()] +--- + (statement + (escapedStringLiteral)) + +===== +String literal starting with two brackets +===== +[[This is a string --- (statement @@ -66,10 +65,47 @@ Escaped bracket ===== String literal ===== - This is a string +--- + + (statement + (stringLiteral)) + +===== +String starting with bracket +===== +[Test] string +--- + (statement + (bracketInStringLiteral)) + +===== +Multiple expressions +===== +[functionOne()][functionTwo()] +--- + + (statement + (bracketInStringLiteral)) + +===== +Whitespace +===== + [ functionOne ( 'arg' , 2 ) ] --- (statement (stringLiteral)) + +===== +Incomplete expression +===== +[functionOne() +--- + + (statement + (expression + (function + (functionName))) + (MISSING "]")) diff --git a/tree-sitter-dscexpression/corpus/valid_expressions.txt b/tree-sitter-dscexpression/corpus/valid_expressions.txt index ba653864a..ae35a870e 100644 --- a/tree-sitter-dscexpression/corpus/valid_expressions.txt +++ b/tree-sitter-dscexpression/corpus/valid_expressions.txt @@ -1,9 +1,7 @@ ===== Function no args ===== - [functionOne()] - --- (statement @@ -14,9 +12,7 @@ Function no args ===== Simple expression ===== - [myFunction('argString')] - --- (statement @@ -25,27 +21,10 @@ Simple expression (functionName) (string)))) -===== -Whitespace -===== - - [ functionOne ( 'arg' , 2 ) ] - ---- - - (statement - (expression - (function - (functionName) - (string) - (number)))) - ===== Multiple arguments ===== - [myFunction('argString', 1, true)] - --- (statement @@ -59,9 +38,7 @@ Multiple arguments ===== Nested functions ===== - [functionOne('argString', functionTwo(1, functionThree('threeString', 3), 2), 'oneString')] - --- (statement @@ -69,22 +46,22 @@ Nested functions (function (functionName) (string) - (function - (functionName) - (number) + (expression (function (functionName) - (string) - (number)) - (number)) + (number) + (expression + (function + (functionName) + (string) + (number))) + (number))) (string)))) ===== Function with dot-notation ===== - [functionOne('argString').prop1.prop2] - --- (statement @@ -94,3 +71,21 @@ Function with dot-notation (string)) (memberName) (memberName))) + +===== +Nested dot-notation +===== +[functionOne(functionTwo(2).prop1.prop2).prop3] +--- + + (statement + (expression + (function + (functionName) + (expression + (function + (functionName) + (number)) + (memberName) + (memberName))) + (memberName))) diff --git a/tree-sitter-dscexpression/grammar.js b/tree-sitter-dscexpression/grammar.js index 2d8f8ea2e..178d89d3c 100644 --- a/tree-sitter-dscexpression/grammar.js +++ b/tree-sitter-dscexpression/grammar.js @@ -1,22 +1,35 @@ +const PREC = { + ESCAPEDSTRING: 3, + BRACKETINSTRING: 2, + EXPRESSIONSTRING: 1, + STRINGLITERAL: -11, +} + module.exports = grammar({ name: 'dscexpression', rules: { statement: $ => choice( $.escapedStringLiteral, - $.expression, + $.bracketInStringLiteral, + $._expressionString, $.stringLiteral, ), - escapedStringLiteral: $ => token(seq('[[', /.*/)), - expression: $ => seq('[', $.function, optional($._members), ']'), - stringLiteral: $ => token(prec(-11, /.*/)), + escapedStringLiteral: $ => token(prec(PREC.ESCAPEDSTRING, seq('[[', /.*?/))), + bracketInStringLiteral: $ => token(prec(PREC.BRACKETINSTRING, seq('[', /.*?/, ']', /.+?/))), + _expressionString: $ => prec(PREC.EXPRESSIONSTRING, seq('[', $.expression, ']')), + expression: $ => seq($.function, optional($._members)), + stringLiteral: $ => token(prec(PREC.STRINGLITERAL, /[^\[].*?/)), + function: $ => seq($.functionName, '(', optional($._arguments), ')'), functionName: $ => /[a-zA-Z]+/, _arguments: $ => seq($._argument, repeat(seq(',', $._argument))), - _argument: $ => choice($.function, $.string, $.number, $.boolean), + _argument: $ => choice($.expression, $.string, $.number, $.boolean), + string: $ => seq("'", /[^']*/, "'"), number: $ => /\d+/, boolean: $ => choice('true', 'false'), + _members: $ => repeat1($._member), _member: $ => seq('.', $.memberName), memberName: $ => /[a-zA-Z0-9_-]+/, diff --git a/tree-sitter-dscexpression/src/grammar.json b/tree-sitter-dscexpression/src/grammar.json index 268796be5..a128b0ae6 100644 --- a/tree-sitter-dscexpression/src/grammar.json +++ b/tree-sitter-dscexpression/src/grammar.json @@ -10,7 +10,11 @@ }, { "type": "SYMBOL", - "name": "expression" + "name": "bracketInStringLiteral" + }, + { + "type": "SYMBOL", + "name": "_expressionString" }, { "type": "SYMBOL", @@ -20,16 +24,69 @@ }, "escapedStringLiteral": { "type": "TOKEN", + "content": { + "type": "PREC", + "value": 3, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "[[" + }, + { + "type": "PATTERN", + "value": ".*?" + } + ] + } + } + }, + "bracketInStringLiteral": { + "type": "TOKEN", + "content": { + "type": "PREC", + "value": 2, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "[" + }, + { + "type": "PATTERN", + "value": ".*?" + }, + { + "type": "STRING", + "value": "]" + }, + { + "type": "PATTERN", + "value": ".+?" + } + ] + } + } + }, + "_expressionString": { + "type": "PREC", + "value": 1, "content": { "type": "SEQ", "members": [ { "type": "STRING", - "value": "[[" + "value": "[" }, { - "type": "PATTERN", - "value": ".*" + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "STRING", + "value": "]" } ] } @@ -37,10 +94,6 @@ "expression": { "type": "SEQ", "members": [ - { - "type": "STRING", - "value": "[" - }, { "type": "SYMBOL", "name": "function" @@ -56,10 +109,6 @@ "type": "BLANK" } ] - }, - { - "type": "STRING", - "value": "]" } ] }, @@ -70,7 +119,7 @@ "value": -11, "content": { "type": "PATTERN", - "value": ".*" + "value": "[^\\[].*?" } } }, @@ -137,7 +186,7 @@ "members": [ { "type": "SYMBOL", - "name": "function" + "name": "expression" }, { "type": "SYMBOL", diff --git a/tree-sitter-dscexpression/src/node-types.json b/tree-sitter-dscexpression/src/node-types.json index 146b98e9b..767e8b3f1 100644 --- a/tree-sitter-dscexpression/src/node-types.json +++ b/tree-sitter-dscexpression/src/node-types.json @@ -36,7 +36,7 @@ "named": true }, { - "type": "function", + "type": "expression", "named": true }, { @@ -62,6 +62,10 @@ "multiple": false, "required": true, "types": [ + { + "type": "bracketInStringLiteral", + "named": true + }, { "type": "escapedStringLiteral", "named": true @@ -110,6 +114,10 @@ "type": "]", "named": false }, + { + "type": "bracketInStringLiteral", + "named": true + }, { "type": "escapedStringLiteral", "named": true diff --git a/tree-sitter-dscexpression/src/parser.c b/tree-sitter-dscexpression/src/parser.c index d84dea6e7..d2f3ca7ec 100644 --- a/tree-sitter-dscexpression/src/parser.c +++ b/tree-sitter-dscexpression/src/parser.c @@ -8,9 +8,9 @@ #define LANGUAGE_VERSION 14 #define STATE_COUNT 26 #define LARGE_STATE_COUNT 2 -#define SYMBOL_COUNT 26 +#define SYMBOL_COUNT 28 #define ALIAS_COUNT 0 -#define TOKEN_COUNT 16 +#define TOKEN_COUNT 17 #define EXTERNAL_TOKEN_COUNT 0 #define FIELD_COUNT 0 #define MAX_ALIAS_SEQUENCE_LENGTH 4 @@ -18,35 +18,38 @@ enum { sym_escapedStringLiteral = 1, - anon_sym_LBRACK = 2, - anon_sym_RBRACK = 3, - sym_stringLiteral = 4, - anon_sym_LPAREN = 5, - anon_sym_RPAREN = 6, - sym_functionName = 7, - anon_sym_COMMA = 8, - anon_sym_SQUOTE = 9, - aux_sym_string_token1 = 10, - sym_number = 11, - anon_sym_true = 12, - anon_sym_false = 13, - anon_sym_DOT = 14, - sym_memberName = 15, - sym_statement = 16, - sym_expression = 17, - sym_function = 18, - sym__arguments = 19, - sym__argument = 20, - sym_string = 21, - sym_boolean = 22, - aux_sym__members = 23, - sym__member = 24, - aux_sym__arguments_repeat1 = 25, + sym_bracketInStringLiteral = 2, + anon_sym_LBRACK = 3, + anon_sym_RBRACK = 4, + sym_stringLiteral = 5, + anon_sym_LPAREN = 6, + anon_sym_RPAREN = 7, + sym_functionName = 8, + anon_sym_COMMA = 9, + anon_sym_SQUOTE = 10, + aux_sym_string_token1 = 11, + sym_number = 12, + anon_sym_true = 13, + anon_sym_false = 14, + anon_sym_DOT = 15, + sym_memberName = 16, + sym_statement = 17, + sym__expressionString = 18, + sym_expression = 19, + sym_function = 20, + sym__arguments = 21, + sym__argument = 22, + sym_string = 23, + sym_boolean = 24, + aux_sym__members = 25, + sym__member = 26, + aux_sym__arguments_repeat1 = 27, }; static const char * const ts_symbol_names[] = { [ts_builtin_sym_end] = "end", [sym_escapedStringLiteral] = "escapedStringLiteral", + [sym_bracketInStringLiteral] = "bracketInStringLiteral", [anon_sym_LBRACK] = "[", [anon_sym_RBRACK] = "]", [sym_stringLiteral] = "stringLiteral", @@ -62,6 +65,7 @@ static const char * const ts_symbol_names[] = { [anon_sym_DOT] = ".", [sym_memberName] = "memberName", [sym_statement] = "statement", + [sym__expressionString] = "_expressionString", [sym_expression] = "expression", [sym_function] = "function", [sym__arguments] = "_arguments", @@ -76,6 +80,7 @@ static const char * const ts_symbol_names[] = { static const TSSymbol ts_symbol_map[] = { [ts_builtin_sym_end] = ts_builtin_sym_end, [sym_escapedStringLiteral] = sym_escapedStringLiteral, + [sym_bracketInStringLiteral] = sym_bracketInStringLiteral, [anon_sym_LBRACK] = anon_sym_LBRACK, [anon_sym_RBRACK] = anon_sym_RBRACK, [sym_stringLiteral] = sym_stringLiteral, @@ -91,6 +96,7 @@ static const TSSymbol ts_symbol_map[] = { [anon_sym_DOT] = anon_sym_DOT, [sym_memberName] = sym_memberName, [sym_statement] = sym_statement, + [sym__expressionString] = sym__expressionString, [sym_expression] = sym_expression, [sym_function] = sym_function, [sym__arguments] = sym__arguments, @@ -111,6 +117,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_bracketInStringLiteral] = { + .visible = true, + .named = true, + }, [anon_sym_LBRACK] = { .visible = true, .named = false, @@ -171,6 +181,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym__expressionString] = { + .visible = false, + .named = true, + }, [sym_expression] = { .visible = true, .named = true, @@ -251,279 +265,326 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { eof = lexer->eof(lexer); switch (state) { case 0: - if (eof) ADVANCE(4); - if (lookahead == '\'') ADVANCE(29); - if (lookahead == '(') ADVANCE(10); - if (lookahead == ')') ADVANCE(11); - if (lookahead == ',') ADVANCE(28); - if (lookahead == '.') ADVANCE(38); - if (lookahead == '[') ADVANCE(6); - if (lookahead == ']') ADVANCE(7); - if (lookahead == 'f') ADVANCE(12); - if (lookahead == 't') ADVANCE(20); + if (eof) ADVANCE(7); + if (lookahead == '\'') ADVANCE(36); + if (lookahead == '(') ADVANCE(17); + if (lookahead == ')') ADVANCE(18); + if (lookahead == ',') ADVANCE(35); + if (lookahead == '.') ADVANCE(45); + if (lookahead == '[') ADVANCE(10); + if (lookahead == ']') ADVANCE(12); + if (lookahead == 'f') ADVANCE(19); + if (lookahead == 't') ADVANCE(27); if (lookahead == '-' || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') SKIP(0) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(32); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(39); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); case 1: - if (lookahead == '\'') ADVANCE(29); - if (lookahead == ')') ADVANCE(11); - if (lookahead == 'f') ADVANCE(13); - if (lookahead == 't') ADVANCE(21); + if (lookahead == '\'') ADVANCE(36); + if (lookahead == ')') ADVANCE(18); + if (lookahead == 'f') ADVANCE(20); + if (lookahead == 't') ADVANCE(28); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') SKIP(1) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(33); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(40); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); case 2: + if (lookahead == '[') ADVANCE(10); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || - lookahead == ' ') SKIP(2) - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + lookahead == ' ') ADVANCE(13); + if (lookahead != 0) ADVANCE(16); END_STATE(); case 3: + if (lookahead == ']') ADVANCE(4); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(3); + END_STATE(); + case 4: + if (lookahead == ']') ADVANCE(9); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(9); + END_STATE(); + case 5: + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(5) + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); + END_STATE(); + case 6: if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || - lookahead == ' ') SKIP(3) + lookahead == ' ') SKIP(6) if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(39); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(46); END_STATE(); - case 4: + case 7: ACCEPT_TOKEN(ts_builtin_sym_end); END_STATE(); - case 5: + case 8: ACCEPT_TOKEN(sym_escapedStringLiteral); + if (lookahead == ']') ADVANCE(8); if (lookahead != 0 && - lookahead != '\n') ADVANCE(5); + lookahead != '\n') ADVANCE(8); END_STATE(); - case 6: + case 9: + ACCEPT_TOKEN(sym_bracketInStringLiteral); + if (lookahead == ']') ADVANCE(9); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(9); + END_STATE(); + case 10: + ACCEPT_TOKEN(anon_sym_LBRACK); + if (lookahead == '[') ADVANCE(8); + if (lookahead == ']') ADVANCE(4); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(3); + END_STATE(); + case 11: ACCEPT_TOKEN(anon_sym_LBRACK); - if (lookahead == '[') ADVANCE(5); + if (lookahead == '[') ADVANCE(8); + if (lookahead == ']') ADVANCE(14); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(15); END_STATE(); - case 7: + case 12: ACCEPT_TOKEN(anon_sym_RBRACK); END_STATE(); - case 8: + case 13: ACCEPT_TOKEN(sym_stringLiteral); - if (lookahead == '\n') SKIP(8) - if (lookahead == '[') ADVANCE(6); + if (lookahead == '\n') ADVANCE(13); + if (lookahead == '[') ADVANCE(11); if (lookahead == '\t' || lookahead == '\r' || - lookahead == ' ') ADVANCE(8); - if (lookahead != 0) ADVANCE(9); + lookahead == ' ') ADVANCE(13); + if (lookahead != 0) ADVANCE(16); END_STATE(); - case 9: + case 14: ACCEPT_TOKEN(sym_stringLiteral); + if (lookahead == ']') ADVANCE(9); if (lookahead != 0 && lookahead != '\n') ADVANCE(9); END_STATE(); - case 10: + case 15: + ACCEPT_TOKEN(sym_stringLiteral); + if (lookahead == ']') ADVANCE(14); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(15); + END_STATE(); + case 16: + ACCEPT_TOKEN(sym_stringLiteral); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(16); + END_STATE(); + case 17: ACCEPT_TOKEN(anon_sym_LPAREN); END_STATE(); - case 11: + case 18: ACCEPT_TOKEN(anon_sym_RPAREN); END_STATE(); - case 12: + case 19: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'a') ADVANCE(18); + if (lookahead == 'a') ADVANCE(25); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('b' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 13: + case 20: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'a') ADVANCE(19); + if (lookahead == 'a') ADVANCE(26); if (('A' <= lookahead && lookahead <= 'Z') || - ('b' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 14: + case 21: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'e') ADVANCE(34); + if (lookahead == 'e') ADVANCE(41); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 15: + case 22: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'e') ADVANCE(36); + if (lookahead == 'e') ADVANCE(43); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 16: + case 23: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'e') ADVANCE(35); + if (lookahead == 'e') ADVANCE(42); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 17: + case 24: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'e') ADVANCE(37); + if (lookahead == 'e') ADVANCE(44); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 18: + case 25: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'l') ADVANCE(22); + if (lookahead == 'l') ADVANCE(29); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 19: + case 26: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'l') ADVANCE(23); + if (lookahead == 'l') ADVANCE(30); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 20: + case 27: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'r') ADVANCE(24); + if (lookahead == 'r') ADVANCE(31); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 21: + case 28: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'r') ADVANCE(25); + if (lookahead == 'r') ADVANCE(32); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 22: + case 29: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 's') ADVANCE(15); + if (lookahead == 's') ADVANCE(22); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 23: + case 30: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 's') ADVANCE(17); + if (lookahead == 's') ADVANCE(24); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 24: + case 31: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'u') ADVANCE(14); + if (lookahead == 'u') ADVANCE(21); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 25: + case 32: ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'u') ADVANCE(16); + if (lookahead == 'u') ADVANCE(23); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 26: + case 33: ACCEPT_TOKEN(sym_functionName); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 27: + case 34: ACCEPT_TOKEN(sym_functionName); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 28: + case 35: ACCEPT_TOKEN(anon_sym_COMMA); END_STATE(); - case 29: + case 36: ACCEPT_TOKEN(anon_sym_SQUOTE); END_STATE(); - case 30: + case 37: ACCEPT_TOKEN(aux_sym_string_token1); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || - lookahead == ' ') ADVANCE(30); + lookahead == ' ') ADVANCE(37); if (lookahead != 0 && - lookahead != '\'') ADVANCE(31); + lookahead != '\'') ADVANCE(38); END_STATE(); - case 31: + case 38: ACCEPT_TOKEN(aux_sym_string_token1); if (lookahead != 0 && - lookahead != '\'') ADVANCE(31); + lookahead != '\'') ADVANCE(38); END_STATE(); - case 32: + case 39: ACCEPT_TOKEN(sym_number); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(32); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(39); if (lookahead == '-' || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(39); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(46); END_STATE(); - case 33: + case 40: ACCEPT_TOKEN(sym_number); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(33); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(40); END_STATE(); - case 34: + case 41: ACCEPT_TOKEN(anon_sym_true); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 35: + case 42: ACCEPT_TOKEN(anon_sym_true); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 36: + case 43: ACCEPT_TOKEN(anon_sym_false); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(39); + lookahead == '_') ADVANCE(46); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); END_STATE(); - case 37: + case 44: ACCEPT_TOKEN(anon_sym_false); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); END_STATE(); - case 38: + case 45: ACCEPT_TOKEN(anon_sym_DOT); END_STATE(); - case 39: + case 46: ACCEPT_TOKEN(sym_memberName); if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(39); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(46); END_STATE(); default: return false; @@ -532,7 +593,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { static const TSLexMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0}, - [1] = {.lex_state = 8}, + [1] = {.lex_state = 2}, [2] = {.lex_state = 1}, [3] = {.lex_state = 1}, [4] = {.lex_state = 0}, @@ -542,18 +603,18 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [8] = {.lex_state = 0}, [9] = {.lex_state = 0}, [10] = {.lex_state = 0}, - [11] = {.lex_state = 0}, + [11] = {.lex_state = 5}, [12] = {.lex_state = 0}, [13] = {.lex_state = 0}, - [14] = {.lex_state = 2}, + [14] = {.lex_state = 0}, [15] = {.lex_state = 0}, [16] = {.lex_state = 0}, - [17] = {.lex_state = 3}, + [17] = {.lex_state = 0}, [18] = {.lex_state = 0}, [19] = {.lex_state = 0}, - [20] = {.lex_state = 30}, + [20] = {.lex_state = 6}, [21] = {.lex_state = 0}, - [22] = {.lex_state = 0}, + [22] = {.lex_state = 37}, [23] = {.lex_state = 0}, [24] = {.lex_state = 0}, [25] = {.lex_state = 0}, @@ -563,6 +624,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [0] = { [ts_builtin_sym_end] = ACTIONS(1), [sym_escapedStringLiteral] = ACTIONS(1), + [sym_bracketInStringLiteral] = ACTIONS(1), [anon_sym_LBRACK] = ACTIONS(1), [anon_sym_RBRACK] = ACTIONS(1), [anon_sym_LPAREN] = ACTIONS(1), @@ -577,16 +639,17 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_memberName] = ACTIONS(1), }, [1] = { - [sym_statement] = STATE(25), - [sym_expression] = STATE(23), + [sym_statement] = STATE(24), + [sym__expressionString] = STATE(21), [sym_escapedStringLiteral] = ACTIONS(3), + [sym_bracketInStringLiteral] = ACTIONS(3), [anon_sym_LBRACK] = ACTIONS(5), [sym_stringLiteral] = ACTIONS(3), }, }; static const uint16_t ts_small_parse_table[] = { - [0] = 7, + [0] = 8, ACTIONS(7), 1, anon_sym_RPAREN, ACTIONS(9), 1, @@ -595,201 +658,215 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_SQUOTE, ACTIONS(13), 1, sym_number, - STATE(21), 1, + STATE(4), 1, + sym_function, + STATE(23), 1, sym__arguments, ACTIONS(15), 2, anon_sym_true, anon_sym_false, - STATE(9), 4, - sym_function, + STATE(10), 4, + sym_expression, sym__argument, sym_string, sym_boolean, - [26] = 5, + [29] = 6, ACTIONS(9), 1, sym_functionName, ACTIONS(11), 1, anon_sym_SQUOTE, ACTIONS(17), 1, sym_number, + STATE(4), 1, + sym_function, ACTIONS(15), 2, anon_sym_true, anon_sym_false, STATE(16), 4, - sym_function, + sym_expression, sym__argument, sym_string, sym_boolean, - [46] = 3, - ACTIONS(19), 1, - anon_sym_RBRACK, + [52] = 3, ACTIONS(21), 1, anon_sym_DOT, - STATE(4), 2, + STATE(6), 2, aux_sym__members, sym__member, - [57] = 1, - ACTIONS(24), 4, + ACTIONS(19), 3, anon_sym_RBRACK, anon_sym_RPAREN, anon_sym_COMMA, + [65] = 3, + ACTIONS(25), 1, anon_sym_DOT, - [64] = 1, - ACTIONS(26), 4, + STATE(5), 2, + aux_sym__members, + sym__member, + ACTIONS(23), 3, anon_sym_RBRACK, anon_sym_RPAREN, anon_sym_COMMA, + [78] = 3, + ACTIONS(21), 1, anon_sym_DOT, - [71] = 3, - ACTIONS(28), 1, - anon_sym_RBRACK, - ACTIONS(30), 1, - anon_sym_DOT, - STATE(8), 2, + STATE(5), 2, aux_sym__members, sym__member, - [82] = 3, - ACTIONS(30), 1, + ACTIONS(28), 3, + anon_sym_RBRACK, + anon_sym_RPAREN, + anon_sym_COMMA, + [91] = 1, + ACTIONS(30), 4, + anon_sym_RBRACK, + anon_sym_RPAREN, + anon_sym_COMMA, anon_sym_DOT, - ACTIONS(32), 1, + [98] = 1, + ACTIONS(32), 4, anon_sym_RBRACK, - STATE(4), 2, - aux_sym__members, - sym__member, - [93] = 3, - ACTIONS(34), 1, anon_sym_RPAREN, - ACTIONS(36), 1, anon_sym_COMMA, - STATE(10), 1, - aux_sym__arguments_repeat1, - [103] = 3, + anon_sym_DOT, + [105] = 1, + ACTIONS(34), 4, + anon_sym_RBRACK, + anon_sym_RPAREN, + anon_sym_COMMA, + anon_sym_DOT, + [112] = 3, ACTIONS(36), 1, + anon_sym_RPAREN, + ACTIONS(38), 1, anon_sym_COMMA, + STATE(12), 1, + aux_sym__arguments_repeat1, + [122] = 3, + ACTIONS(40), 1, + sym_functionName, + STATE(4), 1, + sym_function, + STATE(18), 1, + sym_expression, + [132] = 3, ACTIONS(38), 1, + anon_sym_COMMA, + ACTIONS(42), 1, anon_sym_RPAREN, - STATE(11), 1, + STATE(13), 1, aux_sym__arguments_repeat1, - [113] = 3, - ACTIONS(40), 1, + [142] = 3, + ACTIONS(44), 1, anon_sym_RPAREN, - ACTIONS(42), 1, + ACTIONS(46), 1, anon_sym_COMMA, - STATE(11), 1, + STATE(13), 1, aux_sym__arguments_repeat1, - [123] = 1, - ACTIONS(45), 2, + [152] = 1, + ACTIONS(49), 2, anon_sym_RPAREN, anon_sym_COMMA, - [128] = 1, - ACTIONS(47), 2, - anon_sym_RBRACK, - anon_sym_DOT, - [133] = 2, - ACTIONS(49), 1, - sym_functionName, - STATE(7), 1, - sym_function, - [140] = 1, + [157] = 1, ACTIONS(51), 2, anon_sym_RPAREN, anon_sym_COMMA, - [145] = 1, - ACTIONS(40), 2, + [162] = 1, + ACTIONS(44), 2, anon_sym_RPAREN, anon_sym_COMMA, - [150] = 1, + [167] = 1, ACTIONS(53), 1, - sym_memberName, - [154] = 1, + anon_sym_LPAREN, + [171] = 1, ACTIONS(55), 1, - ts_builtin_sym_end, - [158] = 1, + anon_sym_RBRACK, + [175] = 1, ACTIONS(57), 1, - anon_sym_LPAREN, - [162] = 1, + ts_builtin_sym_end, + [179] = 1, ACTIONS(59), 1, - aux_sym_string_token1, - [166] = 1, + sym_memberName, + [183] = 1, ACTIONS(61), 1, - anon_sym_RPAREN, - [170] = 1, - ACTIONS(63), 1, ts_builtin_sym_end, - [174] = 1, + [187] = 1, + ACTIONS(63), 1, + aux_sym_string_token1, + [191] = 1, ACTIONS(65), 1, - ts_builtin_sym_end, - [178] = 1, + anon_sym_RPAREN, + [195] = 1, ACTIONS(67), 1, - anon_sym_SQUOTE, - [182] = 1, - ACTIONS(69), 1, ts_builtin_sym_end, + [199] = 1, + ACTIONS(69), 1, + anon_sym_SQUOTE, }; static const uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(2)] = 0, - [SMALL_STATE(3)] = 26, - [SMALL_STATE(4)] = 46, - [SMALL_STATE(5)] = 57, - [SMALL_STATE(6)] = 64, - [SMALL_STATE(7)] = 71, - [SMALL_STATE(8)] = 82, - [SMALL_STATE(9)] = 93, - [SMALL_STATE(10)] = 103, - [SMALL_STATE(11)] = 113, - [SMALL_STATE(12)] = 123, - [SMALL_STATE(13)] = 128, - [SMALL_STATE(14)] = 133, - [SMALL_STATE(15)] = 140, - [SMALL_STATE(16)] = 145, - [SMALL_STATE(17)] = 150, - [SMALL_STATE(18)] = 154, - [SMALL_STATE(19)] = 158, - [SMALL_STATE(20)] = 162, - [SMALL_STATE(21)] = 166, - [SMALL_STATE(22)] = 170, - [SMALL_STATE(23)] = 174, - [SMALL_STATE(24)] = 178, - [SMALL_STATE(25)] = 182, + [SMALL_STATE(3)] = 29, + [SMALL_STATE(4)] = 52, + [SMALL_STATE(5)] = 65, + [SMALL_STATE(6)] = 78, + [SMALL_STATE(7)] = 91, + [SMALL_STATE(8)] = 98, + [SMALL_STATE(9)] = 105, + [SMALL_STATE(10)] = 112, + [SMALL_STATE(11)] = 122, + [SMALL_STATE(12)] = 132, + [SMALL_STATE(13)] = 142, + [SMALL_STATE(14)] = 152, + [SMALL_STATE(15)] = 157, + [SMALL_STATE(16)] = 162, + [SMALL_STATE(17)] = 167, + [SMALL_STATE(18)] = 171, + [SMALL_STATE(19)] = 175, + [SMALL_STATE(20)] = 179, + [SMALL_STATE(21)] = 183, + [SMALL_STATE(22)] = 187, + [SMALL_STATE(23)] = 191, + [SMALL_STATE(24)] = 195, + [SMALL_STATE(25)] = 199, }; static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), - [3] = {.entry = {.count = 1, .reusable = false}}, SHIFT(23), - [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), - [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), - [9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), - [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), - [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), - [15] = {.entry = {.count = 1, .reusable = false}}, SHIFT(12), + [3] = {.entry = {.count = 1, .reusable = false}}, SHIFT(21), + [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(11), + [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17), + [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), + [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), + [15] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), - [19] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__members, 2), - [21] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__members, 2), SHIFT_REPEAT(17), - [24] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function, 4), - [26] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function, 3), - [28] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), - [30] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), - [32] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), - [34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__arguments, 1), - [36] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [38] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__arguments, 2), - [40] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__arguments_repeat1, 2), - [42] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__arguments_repeat1, 2), SHIFT_REPEAT(3), - [45] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1), - [47] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__member, 2), - [49] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), + [19] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1), + [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), + [23] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__members, 2), + [25] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__members, 2), SHIFT_REPEAT(20), + [28] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 2), + [30] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function, 3), + [32] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__member, 2), + [34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function, 4), + [36] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__arguments, 1), + [38] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [40] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [42] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__arguments, 2), + [44] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__arguments_repeat1, 2), + [46] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__arguments_repeat1, 2), SHIFT_REPEAT(3), + [49] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1), [51] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 3), - [53] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), - [55] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 3), - [57] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [59] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), - [61] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), - [63] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 4), - [65] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 1), - [67] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), - [69] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [53] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), + [55] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), + [57] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__expressionString, 3), + [59] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), + [61] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 1), + [63] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), + [65] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), + [67] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [69] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), }; #ifdef __cplusplus From 148b770fd85c97ad9da613173535886072847060 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 9 Oct 2023 17:55:07 -0700 Subject: [PATCH 07/28] add tree-sitter to build and run test --- build.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 9df8258d8..6a6ed098b 100644 --- a/build.ps1 +++ b/build.ps1 @@ -92,7 +92,7 @@ New-Item -ItemType Directory $target > $null # make sure dependencies are built first so clippy runs correctly $windows_projects = @("pal", "ntreg", "ntstatuserror", "ntuserinfo", "registry") -$projects = @("dsc_lib", "dsc", "osinfo", "process", "tools/test_group_resource", "y2j", "powershellgroup", "tools/dsctest") +$projects = @("tree-sitter-dscexpression", "dsc_lib", "dsc", "osinfo", "process", "tools/test_group_resource", "y2j", "powershellgroup", "tools/dsctest") $pedantic_unclean_projects = @("tree-sitter-dscexpression", "ntreg") if ($IsWindows) { @@ -106,6 +106,10 @@ foreach ($project in $projects) { try { Push-Location "$PSScriptRoot/$project" -ErrorAction Stop + if ($project -eq 'tree-sitter-dscexpression') { + ./build.ps1 + } + if (Test-Path "./Cargo.toml") { if ($Clippy) { From 00985a6d2e849a924eef4400d9b8db38c78f40ca Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 9 Oct 2023 17:58:28 -0700 Subject: [PATCH 08/28] update script to work on 7.2 --- tree-sitter-dscexpression/build.ps1 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tree-sitter-dscexpression/build.ps1 b/tree-sitter-dscexpression/build.ps1 index 6c73ed2ff..ad7642b2e 100644 --- a/tree-sitter-dscexpression/build.ps1 +++ b/tree-sitter-dscexpression/build.ps1 @@ -1,14 +1,16 @@ -#requires -version 7.4 - # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # check if tools are installed -$PSNativeCommandUseErrorActionPreference = $true -$ErrorActionPreference = 'Stop' +function Invoke-NativeCommand($cmd) { + Invoke-Expression $cmd + if ($LASTEXITCODE -ne 0) { + throw "Command $cmd failed with exit code $LASTEXITCODE" + } +} -npx tree-sitter generate -node-gyp configure -node-gyp build -npx tree-sitter test +Invoke-NativeCommand 'npx tree-sitter generate' +Invoke-NativeCommand 'node-gyp configure' +Invoke-NativeCommand 'node-gyp build' +Invoke-NativeCommand 'npx tree-sitter test' From 85cc089aaa664198e00854247a6c7f257210fbe6 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 9 Oct 2023 18:12:15 -0700 Subject: [PATCH 09/28] update build script to install dependencies --- tree-sitter-dscexpression/build.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tree-sitter-dscexpression/build.ps1 b/tree-sitter-dscexpression/build.ps1 index ad7642b2e..82266dccf 100644 --- a/tree-sitter-dscexpression/build.ps1 +++ b/tree-sitter-dscexpression/build.ps1 @@ -10,6 +10,20 @@ function Invoke-NativeCommand($cmd) { } } +if ($null -eq (Get-Command npm -ErrorAction Ignore)) { + throw "npm is not installed" +} + +npm list tree-sitter-cli +if ($LASTEXITCODE -ne 0) { + npm install tree-sitter-cli +} + +npm list node-gyp +if ($LASTEXITCODE -ne 0) { + npm install node-gyp +} + Invoke-NativeCommand 'npx tree-sitter generate' Invoke-NativeCommand 'node-gyp configure' Invoke-NativeCommand 'node-gyp build' From ffac544de0c76dc80fa1b698bb5e9533f4a64710 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 9 Oct 2023 18:15:25 -0700 Subject: [PATCH 10/28] use npx to execute node-gyp --- tree-sitter-dscexpression/build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tree-sitter-dscexpression/build.ps1 b/tree-sitter-dscexpression/build.ps1 index 82266dccf..bfdc7fec6 100644 --- a/tree-sitter-dscexpression/build.ps1 +++ b/tree-sitter-dscexpression/build.ps1 @@ -25,6 +25,6 @@ if ($LASTEXITCODE -ne 0) { } Invoke-NativeCommand 'npx tree-sitter generate' -Invoke-NativeCommand 'node-gyp configure' -Invoke-NativeCommand 'node-gyp build' +Invoke-NativeCommand 'npx node-gyp configure' +Invoke-NativeCommand 'npx node-gyp build' Invoke-NativeCommand 'npx tree-sitter test' From 4a9c3b371310b60a175460701e7aff2eab8e6ff3 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 9 Oct 2023 18:26:12 -0700 Subject: [PATCH 11/28] need to exclude tree-sitter from even just clippy --- build.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 6a6ed098b..9bdb2f989 100644 --- a/build.ps1 +++ b/build.ps1 @@ -93,7 +93,8 @@ New-Item -ItemType Directory $target > $null # make sure dependencies are built first so clippy runs correctly $windows_projects = @("pal", "ntreg", "ntstatuserror", "ntuserinfo", "registry") $projects = @("tree-sitter-dscexpression", "dsc_lib", "dsc", "osinfo", "process", "tools/test_group_resource", "y2j", "powershellgroup", "tools/dsctest") -$pedantic_unclean_projects = @("tree-sitter-dscexpression", "ntreg") +$pedantic_unclean_projects = @("ntreg") +$clippy_unclean_projects = @("tree-sitter-dscexpression") if ($IsWindows) { $projects += $windows_projects @@ -113,7 +114,10 @@ foreach ($project in $projects) { if (Test-Path "./Cargo.toml") { if ($Clippy) { - if ($pedantic_unclean_projects -contains $project) { + if ($clippy_unclean_projects -contains $project) { + Write-Verbose -Verbose "Skipping clippy for $project" + } + elseif ($pedantic_unclean_projects -contains $project) { Write-Verbose -Verbose "Running clippy for $project" cargo clippy @flags -- -Dwarnings } From 47b7690b1895232bbd1f860aed19e2fc5fd13e5f Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 9 Oct 2023 19:13:48 -0700 Subject: [PATCH 12/28] remove generated files as it gets built --- .../bindings/node/binding.cc | 28 - .../bindings/node/index.js | 19 - .../bindings/rust/build.rs | 40 - .../bindings/rust/lib.rs | 52 - tree-sitter-dscexpression/src/grammar.json | 276 ------ tree-sitter-dscexpression/src/node-types.json | 149 --- tree-sitter-dscexpression/src/parser.c | 908 ------------------ .../src/tree_sitter/parser.h | 224 ----- 8 files changed, 1696 deletions(-) delete mode 100644 tree-sitter-dscexpression/bindings/node/binding.cc delete mode 100644 tree-sitter-dscexpression/bindings/node/index.js delete mode 100644 tree-sitter-dscexpression/bindings/rust/build.rs delete mode 100644 tree-sitter-dscexpression/bindings/rust/lib.rs delete mode 100644 tree-sitter-dscexpression/src/grammar.json delete mode 100644 tree-sitter-dscexpression/src/node-types.json delete mode 100644 tree-sitter-dscexpression/src/parser.c delete mode 100644 tree-sitter-dscexpression/src/tree_sitter/parser.h diff --git a/tree-sitter-dscexpression/bindings/node/binding.cc b/tree-sitter-dscexpression/bindings/node/binding.cc deleted file mode 100644 index 49790f244..000000000 --- a/tree-sitter-dscexpression/bindings/node/binding.cc +++ /dev/null @@ -1,28 +0,0 @@ -#include "tree_sitter/parser.h" -#include -#include "nan.h" - -using namespace v8; - -extern "C" TSLanguage * tree_sitter_dscexpression(); - -namespace { - -NAN_METHOD(New) {} - -void Init(Local exports, Local module) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("Language").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); - Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); - Nan::SetInternalFieldPointer(instance, 0, tree_sitter_dscexpression()); - - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("dscexpression").ToLocalChecked()); - Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); -} - -NODE_MODULE(tree_sitter_dscexpression_binding, Init) - -} // namespace diff --git a/tree-sitter-dscexpression/bindings/node/index.js b/tree-sitter-dscexpression/bindings/node/index.js deleted file mode 100644 index 550da52d1..000000000 --- a/tree-sitter-dscexpression/bindings/node/index.js +++ /dev/null @@ -1,19 +0,0 @@ -try { - module.exports = require("../../build/Release/tree_sitter_dscexpression_binding"); -} catch (error1) { - if (error1.code !== 'MODULE_NOT_FOUND') { - throw error1; - } - try { - module.exports = require("../../build/Debug/tree_sitter_dscexpression_binding"); - } catch (error2) { - if (error2.code !== 'MODULE_NOT_FOUND') { - throw error2; - } - throw error1 - } -} - -try { - module.exports.nodeTypeInfo = require("../../src/node-types.json"); -} catch (_) {} diff --git a/tree-sitter-dscexpression/bindings/rust/build.rs b/tree-sitter-dscexpression/bindings/rust/build.rs deleted file mode 100644 index c6061f099..000000000 --- a/tree-sitter-dscexpression/bindings/rust/build.rs +++ /dev/null @@ -1,40 +0,0 @@ -fn main() { - let src_dir = std::path::Path::new("src"); - - let mut c_config = cc::Build::new(); - c_config.include(&src_dir); - c_config - .flag_if_supported("-Wno-unused-parameter") - .flag_if_supported("-Wno-unused-but-set-variable") - .flag_if_supported("-Wno-trigraphs"); - let parser_path = src_dir.join("parser.c"); - c_config.file(&parser_path); - - // If your language uses an external scanner written in C, - // then include this block of code: - - /* - let scanner_path = src_dir.join("scanner.c"); - c_config.file(&scanner_path); - println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); - */ - - c_config.compile("parser"); - println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); - - // If your language uses an external scanner written in C++, - // then include this block of code: - - /* - let mut cpp_config = cc::Build::new(); - cpp_config.cpp(true); - cpp_config.include(&src_dir); - cpp_config - .flag_if_supported("-Wno-unused-parameter") - .flag_if_supported("-Wno-unused-but-set-variable"); - let scanner_path = src_dir.join("scanner.cc"); - cpp_config.file(&scanner_path); - cpp_config.compile("scanner"); - println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); - */ -} diff --git a/tree-sitter-dscexpression/bindings/rust/lib.rs b/tree-sitter-dscexpression/bindings/rust/lib.rs deleted file mode 100644 index fb06ae2df..000000000 --- a/tree-sitter-dscexpression/bindings/rust/lib.rs +++ /dev/null @@ -1,52 +0,0 @@ -//! This crate provides dscexpression language support for the [tree-sitter][] parsing library. -//! -//! Typically, you will use the [language][language func] function to add this language to a -//! tree-sitter [Parser][], and then use the parser to parse some code: -//! -//! ``` -//! let code = ""; -//! let mut parser = tree_sitter::Parser::new(); -//! parser.set_language(tree_sitter_dscexpression::language()).expect("Error loading dscexpression grammar"); -//! let tree = parser.parse(code, None).unwrap(); -//! ``` -//! -//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html -//! [language func]: fn.language.html -//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html -//! [tree-sitter]: https://tree-sitter.github.io/ - -use tree_sitter::Language; - -extern "C" { - fn tree_sitter_dscexpression() -> Language; -} - -/// Get the tree-sitter [Language][] for this grammar. -/// -/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html -pub fn language() -> Language { - unsafe { tree_sitter_dscexpression() } -} - -/// The content of the [`node-types.json`][] file for this grammar. -/// -/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types -pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json"); - -// Uncomment these to include any queries that this grammar contains - -// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm"); -// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm"); -// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm"); -// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm"); - -#[cfg(test)] -mod tests { - #[test] - fn test_can_load_grammar() { - let mut parser = tree_sitter::Parser::new(); - parser - .set_language(super::language()) - .expect("Error loading dscexpression language"); - } -} diff --git a/tree-sitter-dscexpression/src/grammar.json b/tree-sitter-dscexpression/src/grammar.json deleted file mode 100644 index a128b0ae6..000000000 --- a/tree-sitter-dscexpression/src/grammar.json +++ /dev/null @@ -1,276 +0,0 @@ -{ - "name": "dscexpression", - "rules": { - "statement": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "escapedStringLiteral" - }, - { - "type": "SYMBOL", - "name": "bracketInStringLiteral" - }, - { - "type": "SYMBOL", - "name": "_expressionString" - }, - { - "type": "SYMBOL", - "name": "stringLiteral" - } - ] - }, - "escapedStringLiteral": { - "type": "TOKEN", - "content": { - "type": "PREC", - "value": 3, - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "[[" - }, - { - "type": "PATTERN", - "value": ".*?" - } - ] - } - } - }, - "bracketInStringLiteral": { - "type": "TOKEN", - "content": { - "type": "PREC", - "value": 2, - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "[" - }, - { - "type": "PATTERN", - "value": ".*?" - }, - { - "type": "STRING", - "value": "]" - }, - { - "type": "PATTERN", - "value": ".+?" - } - ] - } - } - }, - "_expressionString": { - "type": "PREC", - "value": 1, - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "[" - }, - { - "type": "SYMBOL", - "name": "expression" - }, - { - "type": "STRING", - "value": "]" - } - ] - } - }, - "expression": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "function" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "_members" - }, - { - "type": "BLANK" - } - ] - } - ] - }, - "stringLiteral": { - "type": "TOKEN", - "content": { - "type": "PREC", - "value": -11, - "content": { - "type": "PATTERN", - "value": "[^\\[].*?" - } - } - }, - "function": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "functionName" - }, - { - "type": "STRING", - "value": "(" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "_arguments" - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "STRING", - "value": ")" - } - ] - }, - "functionName": { - "type": "PATTERN", - "value": "[a-zA-Z]+" - }, - "_arguments": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "_argument" - }, - { - "type": "REPEAT", - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "_argument" - } - ] - } - } - ] - }, - "_argument": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "expression" - }, - { - "type": "SYMBOL", - "name": "string" - }, - { - "type": "SYMBOL", - "name": "number" - }, - { - "type": "SYMBOL", - "name": "boolean" - } - ] - }, - "string": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "'" - }, - { - "type": "PATTERN", - "value": "[^']*" - }, - { - "type": "STRING", - "value": "'" - } - ] - }, - "number": { - "type": "PATTERN", - "value": "\\d+" - }, - "boolean": { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "true" - }, - { - "type": "STRING", - "value": "false" - } - ] - }, - "_members": { - "type": "REPEAT1", - "content": { - "type": "SYMBOL", - "name": "_member" - } - }, - "_member": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "." - }, - { - "type": "SYMBOL", - "name": "memberName" - } - ] - }, - "memberName": { - "type": "PATTERN", - "value": "[a-zA-Z0-9_-]+" - } - }, - "extras": [ - { - "type": "PATTERN", - "value": "\\s" - } - ], - "conflicts": [], - "precedences": [], - "externals": [], - "inline": [], - "supertypes": [] -} - diff --git a/tree-sitter-dscexpression/src/node-types.json b/tree-sitter-dscexpression/src/node-types.json deleted file mode 100644 index 767e8b3f1..000000000 --- a/tree-sitter-dscexpression/src/node-types.json +++ /dev/null @@ -1,149 +0,0 @@ -[ - { - "type": "boolean", - "named": true, - "fields": {} - }, - { - "type": "expression", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "function", - "named": true - }, - { - "type": "memberName", - "named": true - } - ] - } - }, - { - "type": "function", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "boolean", - "named": true - }, - { - "type": "expression", - "named": true - }, - { - "type": "functionName", - "named": true - }, - { - "type": "number", - "named": true - }, - { - "type": "string", - "named": true - } - ] - } - }, - { - "type": "statement", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "bracketInStringLiteral", - "named": true - }, - { - "type": "escapedStringLiteral", - "named": true - }, - { - "type": "expression", - "named": true - }, - { - "type": "stringLiteral", - "named": true - } - ] - } - }, - { - "type": "string", - "named": true, - "fields": {} - }, - { - "type": "'", - "named": false - }, - { - "type": "(", - "named": false - }, - { - "type": ")", - "named": false - }, - { - "type": ",", - "named": false - }, - { - "type": ".", - "named": false - }, - { - "type": "[", - "named": false - }, - { - "type": "]", - "named": false - }, - { - "type": "bracketInStringLiteral", - "named": true - }, - { - "type": "escapedStringLiteral", - "named": true - }, - { - "type": "false", - "named": false - }, - { - "type": "functionName", - "named": true - }, - { - "type": "memberName", - "named": true - }, - { - "type": "number", - "named": true - }, - { - "type": "stringLiteral", - "named": true - }, - { - "type": "true", - "named": false - } -] \ No newline at end of file diff --git a/tree-sitter-dscexpression/src/parser.c b/tree-sitter-dscexpression/src/parser.c deleted file mode 100644 index d2f3ca7ec..000000000 --- a/tree-sitter-dscexpression/src/parser.c +++ /dev/null @@ -1,908 +0,0 @@ -#include - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif - -#define LANGUAGE_VERSION 14 -#define STATE_COUNT 26 -#define LARGE_STATE_COUNT 2 -#define SYMBOL_COUNT 28 -#define ALIAS_COUNT 0 -#define TOKEN_COUNT 17 -#define EXTERNAL_TOKEN_COUNT 0 -#define FIELD_COUNT 0 -#define MAX_ALIAS_SEQUENCE_LENGTH 4 -#define PRODUCTION_ID_COUNT 1 - -enum { - sym_escapedStringLiteral = 1, - sym_bracketInStringLiteral = 2, - anon_sym_LBRACK = 3, - anon_sym_RBRACK = 4, - sym_stringLiteral = 5, - anon_sym_LPAREN = 6, - anon_sym_RPAREN = 7, - sym_functionName = 8, - anon_sym_COMMA = 9, - anon_sym_SQUOTE = 10, - aux_sym_string_token1 = 11, - sym_number = 12, - anon_sym_true = 13, - anon_sym_false = 14, - anon_sym_DOT = 15, - sym_memberName = 16, - sym_statement = 17, - sym__expressionString = 18, - sym_expression = 19, - sym_function = 20, - sym__arguments = 21, - sym__argument = 22, - sym_string = 23, - sym_boolean = 24, - aux_sym__members = 25, - sym__member = 26, - aux_sym__arguments_repeat1 = 27, -}; - -static const char * const ts_symbol_names[] = { - [ts_builtin_sym_end] = "end", - [sym_escapedStringLiteral] = "escapedStringLiteral", - [sym_bracketInStringLiteral] = "bracketInStringLiteral", - [anon_sym_LBRACK] = "[", - [anon_sym_RBRACK] = "]", - [sym_stringLiteral] = "stringLiteral", - [anon_sym_LPAREN] = "(", - [anon_sym_RPAREN] = ")", - [sym_functionName] = "functionName", - [anon_sym_COMMA] = ",", - [anon_sym_SQUOTE] = "'", - [aux_sym_string_token1] = "string_token1", - [sym_number] = "number", - [anon_sym_true] = "true", - [anon_sym_false] = "false", - [anon_sym_DOT] = ".", - [sym_memberName] = "memberName", - [sym_statement] = "statement", - [sym__expressionString] = "_expressionString", - [sym_expression] = "expression", - [sym_function] = "function", - [sym__arguments] = "_arguments", - [sym__argument] = "_argument", - [sym_string] = "string", - [sym_boolean] = "boolean", - [aux_sym__members] = "_members", - [sym__member] = "_member", - [aux_sym__arguments_repeat1] = "_arguments_repeat1", -}; - -static const TSSymbol ts_symbol_map[] = { - [ts_builtin_sym_end] = ts_builtin_sym_end, - [sym_escapedStringLiteral] = sym_escapedStringLiteral, - [sym_bracketInStringLiteral] = sym_bracketInStringLiteral, - [anon_sym_LBRACK] = anon_sym_LBRACK, - [anon_sym_RBRACK] = anon_sym_RBRACK, - [sym_stringLiteral] = sym_stringLiteral, - [anon_sym_LPAREN] = anon_sym_LPAREN, - [anon_sym_RPAREN] = anon_sym_RPAREN, - [sym_functionName] = sym_functionName, - [anon_sym_COMMA] = anon_sym_COMMA, - [anon_sym_SQUOTE] = anon_sym_SQUOTE, - [aux_sym_string_token1] = aux_sym_string_token1, - [sym_number] = sym_number, - [anon_sym_true] = anon_sym_true, - [anon_sym_false] = anon_sym_false, - [anon_sym_DOT] = anon_sym_DOT, - [sym_memberName] = sym_memberName, - [sym_statement] = sym_statement, - [sym__expressionString] = sym__expressionString, - [sym_expression] = sym_expression, - [sym_function] = sym_function, - [sym__arguments] = sym__arguments, - [sym__argument] = sym__argument, - [sym_string] = sym_string, - [sym_boolean] = sym_boolean, - [aux_sym__members] = aux_sym__members, - [sym__member] = sym__member, - [aux_sym__arguments_repeat1] = aux_sym__arguments_repeat1, -}; - -static const TSSymbolMetadata ts_symbol_metadata[] = { - [ts_builtin_sym_end] = { - .visible = false, - .named = true, - }, - [sym_escapedStringLiteral] = { - .visible = true, - .named = true, - }, - [sym_bracketInStringLiteral] = { - .visible = true, - .named = true, - }, - [anon_sym_LBRACK] = { - .visible = true, - .named = false, - }, - [anon_sym_RBRACK] = { - .visible = true, - .named = false, - }, - [sym_stringLiteral] = { - .visible = true, - .named = true, - }, - [anon_sym_LPAREN] = { - .visible = true, - .named = false, - }, - [anon_sym_RPAREN] = { - .visible = true, - .named = false, - }, - [sym_functionName] = { - .visible = true, - .named = true, - }, - [anon_sym_COMMA] = { - .visible = true, - .named = false, - }, - [anon_sym_SQUOTE] = { - .visible = true, - .named = false, - }, - [aux_sym_string_token1] = { - .visible = false, - .named = false, - }, - [sym_number] = { - .visible = true, - .named = true, - }, - [anon_sym_true] = { - .visible = true, - .named = false, - }, - [anon_sym_false] = { - .visible = true, - .named = false, - }, - [anon_sym_DOT] = { - .visible = true, - .named = false, - }, - [sym_memberName] = { - .visible = true, - .named = true, - }, - [sym_statement] = { - .visible = true, - .named = true, - }, - [sym__expressionString] = { - .visible = false, - .named = true, - }, - [sym_expression] = { - .visible = true, - .named = true, - }, - [sym_function] = { - .visible = true, - .named = true, - }, - [sym__arguments] = { - .visible = false, - .named = true, - }, - [sym__argument] = { - .visible = false, - .named = true, - }, - [sym_string] = { - .visible = true, - .named = true, - }, - [sym_boolean] = { - .visible = true, - .named = true, - }, - [aux_sym__members] = { - .visible = false, - .named = false, - }, - [sym__member] = { - .visible = false, - .named = true, - }, - [aux_sym__arguments_repeat1] = { - .visible = false, - .named = false, - }, -}; - -static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { - [0] = {0}, -}; - -static const uint16_t ts_non_terminal_alias_map[] = { - 0, -}; - -static const TSStateId ts_primary_state_ids[STATE_COUNT] = { - [0] = 0, - [1] = 1, - [2] = 2, - [3] = 3, - [4] = 4, - [5] = 5, - [6] = 6, - [7] = 7, - [8] = 8, - [9] = 9, - [10] = 10, - [11] = 11, - [12] = 12, - [13] = 13, - [14] = 14, - [15] = 15, - [16] = 16, - [17] = 17, - [18] = 18, - [19] = 19, - [20] = 20, - [21] = 21, - [22] = 22, - [23] = 23, - [24] = 24, - [25] = 25, -}; - -static bool ts_lex(TSLexer *lexer, TSStateId state) { - START_LEXER(); - eof = lexer->eof(lexer); - switch (state) { - case 0: - if (eof) ADVANCE(7); - if (lookahead == '\'') ADVANCE(36); - if (lookahead == '(') ADVANCE(17); - if (lookahead == ')') ADVANCE(18); - if (lookahead == ',') ADVANCE(35); - if (lookahead == '.') ADVANCE(45); - if (lookahead == '[') ADVANCE(10); - if (lookahead == ']') ADVANCE(12); - if (lookahead == 'f') ADVANCE(19); - if (lookahead == 't') ADVANCE(27); - if (lookahead == '-' || - lookahead == '_') ADVANCE(46); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(0) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(39); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 1: - if (lookahead == '\'') ADVANCE(36); - if (lookahead == ')') ADVANCE(18); - if (lookahead == 'f') ADVANCE(20); - if (lookahead == 't') ADVANCE(28); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(1) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(40); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 2: - if (lookahead == '[') ADVANCE(10); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(13); - if (lookahead != 0) ADVANCE(16); - END_STATE(); - case 3: - if (lookahead == ']') ADVANCE(4); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(3); - END_STATE(); - case 4: - if (lookahead == ']') ADVANCE(9); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(9); - END_STATE(); - case 5: - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(5) - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 6: - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(6) - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(46); - END_STATE(); - case 7: - ACCEPT_TOKEN(ts_builtin_sym_end); - END_STATE(); - case 8: - ACCEPT_TOKEN(sym_escapedStringLiteral); - if (lookahead == ']') ADVANCE(8); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(8); - END_STATE(); - case 9: - ACCEPT_TOKEN(sym_bracketInStringLiteral); - if (lookahead == ']') ADVANCE(9); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(9); - END_STATE(); - case 10: - ACCEPT_TOKEN(anon_sym_LBRACK); - if (lookahead == '[') ADVANCE(8); - if (lookahead == ']') ADVANCE(4); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(3); - END_STATE(); - case 11: - ACCEPT_TOKEN(anon_sym_LBRACK); - if (lookahead == '[') ADVANCE(8); - if (lookahead == ']') ADVANCE(14); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(15); - END_STATE(); - case 12: - ACCEPT_TOKEN(anon_sym_RBRACK); - END_STATE(); - case 13: - ACCEPT_TOKEN(sym_stringLiteral); - if (lookahead == '\n') ADVANCE(13); - if (lookahead == '[') ADVANCE(11); - if (lookahead == '\t' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(13); - if (lookahead != 0) ADVANCE(16); - END_STATE(); - case 14: - ACCEPT_TOKEN(sym_stringLiteral); - if (lookahead == ']') ADVANCE(9); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(9); - END_STATE(); - case 15: - ACCEPT_TOKEN(sym_stringLiteral); - if (lookahead == ']') ADVANCE(14); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(15); - END_STATE(); - case 16: - ACCEPT_TOKEN(sym_stringLiteral); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(16); - END_STATE(); - case 17: - ACCEPT_TOKEN(anon_sym_LPAREN); - END_STATE(); - case 18: - ACCEPT_TOKEN(anon_sym_RPAREN); - END_STATE(); - case 19: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'a') ADVANCE(25); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('b' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 20: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'a') ADVANCE(26); - if (('A' <= lookahead && lookahead <= 'Z') || - ('b' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 21: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'e') ADVANCE(41); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 22: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'e') ADVANCE(43); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 23: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'e') ADVANCE(42); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 24: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'e') ADVANCE(44); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 25: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'l') ADVANCE(29); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 26: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'l') ADVANCE(30); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 27: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'r') ADVANCE(31); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 28: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'r') ADVANCE(32); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 29: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 's') ADVANCE(22); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 30: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 's') ADVANCE(24); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 31: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'u') ADVANCE(21); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 32: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == 'u') ADVANCE(23); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 33: - ACCEPT_TOKEN(sym_functionName); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 34: - ACCEPT_TOKEN(sym_functionName); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 35: - ACCEPT_TOKEN(anon_sym_COMMA); - END_STATE(); - case 36: - ACCEPT_TOKEN(anon_sym_SQUOTE); - END_STATE(); - case 37: - ACCEPT_TOKEN(aux_sym_string_token1); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(37); - if (lookahead != 0 && - lookahead != '\'') ADVANCE(38); - END_STATE(); - case 38: - ACCEPT_TOKEN(aux_sym_string_token1); - if (lookahead != 0 && - lookahead != '\'') ADVANCE(38); - END_STATE(); - case 39: - ACCEPT_TOKEN(sym_number); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(39); - if (lookahead == '-' || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(46); - END_STATE(); - case 40: - ACCEPT_TOKEN(sym_number); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(40); - END_STATE(); - case 41: - ACCEPT_TOKEN(anon_sym_true); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 42: - ACCEPT_TOKEN(anon_sym_true); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 43: - ACCEPT_TOKEN(anon_sym_false); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - lookahead == '_') ADVANCE(46); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); - END_STATE(); - case 44: - ACCEPT_TOKEN(anon_sym_false); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); - END_STATE(); - case 45: - ACCEPT_TOKEN(anon_sym_DOT); - END_STATE(); - case 46: - ACCEPT_TOKEN(sym_memberName); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(46); - END_STATE(); - default: - return false; - } -} - -static const TSLexMode ts_lex_modes[STATE_COUNT] = { - [0] = {.lex_state = 0}, - [1] = {.lex_state = 2}, - [2] = {.lex_state = 1}, - [3] = {.lex_state = 1}, - [4] = {.lex_state = 0}, - [5] = {.lex_state = 0}, - [6] = {.lex_state = 0}, - [7] = {.lex_state = 0}, - [8] = {.lex_state = 0}, - [9] = {.lex_state = 0}, - [10] = {.lex_state = 0}, - [11] = {.lex_state = 5}, - [12] = {.lex_state = 0}, - [13] = {.lex_state = 0}, - [14] = {.lex_state = 0}, - [15] = {.lex_state = 0}, - [16] = {.lex_state = 0}, - [17] = {.lex_state = 0}, - [18] = {.lex_state = 0}, - [19] = {.lex_state = 0}, - [20] = {.lex_state = 6}, - [21] = {.lex_state = 0}, - [22] = {.lex_state = 37}, - [23] = {.lex_state = 0}, - [24] = {.lex_state = 0}, - [25] = {.lex_state = 0}, -}; - -static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { - [0] = { - [ts_builtin_sym_end] = ACTIONS(1), - [sym_escapedStringLiteral] = ACTIONS(1), - [sym_bracketInStringLiteral] = ACTIONS(1), - [anon_sym_LBRACK] = ACTIONS(1), - [anon_sym_RBRACK] = ACTIONS(1), - [anon_sym_LPAREN] = ACTIONS(1), - [anon_sym_RPAREN] = ACTIONS(1), - [sym_functionName] = ACTIONS(1), - [anon_sym_COMMA] = ACTIONS(1), - [anon_sym_SQUOTE] = ACTIONS(1), - [sym_number] = ACTIONS(1), - [anon_sym_true] = ACTIONS(1), - [anon_sym_false] = ACTIONS(1), - [anon_sym_DOT] = ACTIONS(1), - [sym_memberName] = ACTIONS(1), - }, - [1] = { - [sym_statement] = STATE(24), - [sym__expressionString] = STATE(21), - [sym_escapedStringLiteral] = ACTIONS(3), - [sym_bracketInStringLiteral] = ACTIONS(3), - [anon_sym_LBRACK] = ACTIONS(5), - [sym_stringLiteral] = ACTIONS(3), - }, -}; - -static const uint16_t ts_small_parse_table[] = { - [0] = 8, - ACTIONS(7), 1, - anon_sym_RPAREN, - ACTIONS(9), 1, - sym_functionName, - ACTIONS(11), 1, - anon_sym_SQUOTE, - ACTIONS(13), 1, - sym_number, - STATE(4), 1, - sym_function, - STATE(23), 1, - sym__arguments, - ACTIONS(15), 2, - anon_sym_true, - anon_sym_false, - STATE(10), 4, - sym_expression, - sym__argument, - sym_string, - sym_boolean, - [29] = 6, - ACTIONS(9), 1, - sym_functionName, - ACTIONS(11), 1, - anon_sym_SQUOTE, - ACTIONS(17), 1, - sym_number, - STATE(4), 1, - sym_function, - ACTIONS(15), 2, - anon_sym_true, - anon_sym_false, - STATE(16), 4, - sym_expression, - sym__argument, - sym_string, - sym_boolean, - [52] = 3, - ACTIONS(21), 1, - anon_sym_DOT, - STATE(6), 2, - aux_sym__members, - sym__member, - ACTIONS(19), 3, - anon_sym_RBRACK, - anon_sym_RPAREN, - anon_sym_COMMA, - [65] = 3, - ACTIONS(25), 1, - anon_sym_DOT, - STATE(5), 2, - aux_sym__members, - sym__member, - ACTIONS(23), 3, - anon_sym_RBRACK, - anon_sym_RPAREN, - anon_sym_COMMA, - [78] = 3, - ACTIONS(21), 1, - anon_sym_DOT, - STATE(5), 2, - aux_sym__members, - sym__member, - ACTIONS(28), 3, - anon_sym_RBRACK, - anon_sym_RPAREN, - anon_sym_COMMA, - [91] = 1, - ACTIONS(30), 4, - anon_sym_RBRACK, - anon_sym_RPAREN, - anon_sym_COMMA, - anon_sym_DOT, - [98] = 1, - ACTIONS(32), 4, - anon_sym_RBRACK, - anon_sym_RPAREN, - anon_sym_COMMA, - anon_sym_DOT, - [105] = 1, - ACTIONS(34), 4, - anon_sym_RBRACK, - anon_sym_RPAREN, - anon_sym_COMMA, - anon_sym_DOT, - [112] = 3, - ACTIONS(36), 1, - anon_sym_RPAREN, - ACTIONS(38), 1, - anon_sym_COMMA, - STATE(12), 1, - aux_sym__arguments_repeat1, - [122] = 3, - ACTIONS(40), 1, - sym_functionName, - STATE(4), 1, - sym_function, - STATE(18), 1, - sym_expression, - [132] = 3, - ACTIONS(38), 1, - anon_sym_COMMA, - ACTIONS(42), 1, - anon_sym_RPAREN, - STATE(13), 1, - aux_sym__arguments_repeat1, - [142] = 3, - ACTIONS(44), 1, - anon_sym_RPAREN, - ACTIONS(46), 1, - anon_sym_COMMA, - STATE(13), 1, - aux_sym__arguments_repeat1, - [152] = 1, - ACTIONS(49), 2, - anon_sym_RPAREN, - anon_sym_COMMA, - [157] = 1, - ACTIONS(51), 2, - anon_sym_RPAREN, - anon_sym_COMMA, - [162] = 1, - ACTIONS(44), 2, - anon_sym_RPAREN, - anon_sym_COMMA, - [167] = 1, - ACTIONS(53), 1, - anon_sym_LPAREN, - [171] = 1, - ACTIONS(55), 1, - anon_sym_RBRACK, - [175] = 1, - ACTIONS(57), 1, - ts_builtin_sym_end, - [179] = 1, - ACTIONS(59), 1, - sym_memberName, - [183] = 1, - ACTIONS(61), 1, - ts_builtin_sym_end, - [187] = 1, - ACTIONS(63), 1, - aux_sym_string_token1, - [191] = 1, - ACTIONS(65), 1, - anon_sym_RPAREN, - [195] = 1, - ACTIONS(67), 1, - ts_builtin_sym_end, - [199] = 1, - ACTIONS(69), 1, - anon_sym_SQUOTE, -}; - -static const uint32_t ts_small_parse_table_map[] = { - [SMALL_STATE(2)] = 0, - [SMALL_STATE(3)] = 29, - [SMALL_STATE(4)] = 52, - [SMALL_STATE(5)] = 65, - [SMALL_STATE(6)] = 78, - [SMALL_STATE(7)] = 91, - [SMALL_STATE(8)] = 98, - [SMALL_STATE(9)] = 105, - [SMALL_STATE(10)] = 112, - [SMALL_STATE(11)] = 122, - [SMALL_STATE(12)] = 132, - [SMALL_STATE(13)] = 142, - [SMALL_STATE(14)] = 152, - [SMALL_STATE(15)] = 157, - [SMALL_STATE(16)] = 162, - [SMALL_STATE(17)] = 167, - [SMALL_STATE(18)] = 171, - [SMALL_STATE(19)] = 175, - [SMALL_STATE(20)] = 179, - [SMALL_STATE(21)] = 183, - [SMALL_STATE(22)] = 187, - [SMALL_STATE(23)] = 191, - [SMALL_STATE(24)] = 195, - [SMALL_STATE(25)] = 199, -}; - -static const TSParseActionEntry ts_parse_actions[] = { - [0] = {.entry = {.count = 0, .reusable = false}}, - [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), - [3] = {.entry = {.count = 1, .reusable = false}}, SHIFT(21), - [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(11), - [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), - [9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17), - [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), - [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), - [15] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), - [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), - [19] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1), - [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), - [23] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__members, 2), - [25] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__members, 2), SHIFT_REPEAT(20), - [28] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 2), - [30] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function, 3), - [32] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__member, 2), - [34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function, 4), - [36] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__arguments, 1), - [38] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [40] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), - [42] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__arguments, 2), - [44] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__arguments_repeat1, 2), - [46] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__arguments_repeat1, 2), SHIFT_REPEAT(3), - [49] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1), - [51] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 3), - [53] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [55] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), - [57] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__expressionString, 3), - [59] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [61] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 1), - [63] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), - [65] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), - [67] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [69] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), -}; - -#ifdef __cplusplus -extern "C" { -#endif -#ifdef _WIN32 -#define extern __declspec(dllexport) -#endif - -extern const TSLanguage *tree_sitter_dscexpression(void) { - static const TSLanguage language = { - .version = LANGUAGE_VERSION, - .symbol_count = SYMBOL_COUNT, - .alias_count = ALIAS_COUNT, - .token_count = TOKEN_COUNT, - .external_token_count = EXTERNAL_TOKEN_COUNT, - .state_count = STATE_COUNT, - .large_state_count = LARGE_STATE_COUNT, - .production_id_count = PRODUCTION_ID_COUNT, - .field_count = FIELD_COUNT, - .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, - .parse_table = &ts_parse_table[0][0], - .small_parse_table = ts_small_parse_table, - .small_parse_table_map = ts_small_parse_table_map, - .parse_actions = ts_parse_actions, - .symbol_names = ts_symbol_names, - .symbol_metadata = ts_symbol_metadata, - .public_symbol_map = ts_symbol_map, - .alias_map = ts_non_terminal_alias_map, - .alias_sequences = &ts_alias_sequences[0][0], - .lex_modes = ts_lex_modes, - .lex_fn = ts_lex, - .primary_state_ids = ts_primary_state_ids, - }; - return &language; -} -#ifdef __cplusplus -} -#endif diff --git a/tree-sitter-dscexpression/src/tree_sitter/parser.h b/tree-sitter-dscexpression/src/tree_sitter/parser.h deleted file mode 100644 index 2b14ac104..000000000 --- a/tree-sitter-dscexpression/src/tree_sitter/parser.h +++ /dev/null @@ -1,224 +0,0 @@ -#ifndef TREE_SITTER_PARSER_H_ -#define TREE_SITTER_PARSER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#define ts_builtin_sym_error ((TSSymbol)-1) -#define ts_builtin_sym_end 0 -#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 - -typedef uint16_t TSStateId; - -#ifndef TREE_SITTER_API_H_ -typedef uint16_t TSSymbol; -typedef uint16_t TSFieldId; -typedef struct TSLanguage TSLanguage; -#endif - -typedef struct { - TSFieldId field_id; - uint8_t child_index; - bool inherited; -} TSFieldMapEntry; - -typedef struct { - uint16_t index; - uint16_t length; -} TSFieldMapSlice; - -typedef struct { - bool visible; - bool named; - bool supertype; -} TSSymbolMetadata; - -typedef struct TSLexer TSLexer; - -struct TSLexer { - int32_t lookahead; - TSSymbol result_symbol; - void (*advance)(TSLexer *, bool); - void (*mark_end)(TSLexer *); - uint32_t (*get_column)(TSLexer *); - bool (*is_at_included_range_start)(const TSLexer *); - bool (*eof)(const TSLexer *); -}; - -typedef enum { - TSParseActionTypeShift, - TSParseActionTypeReduce, - TSParseActionTypeAccept, - TSParseActionTypeRecover, -} TSParseActionType; - -typedef union { - struct { - uint8_t type; - TSStateId state; - bool extra; - bool repetition; - } shift; - struct { - uint8_t type; - uint8_t child_count; - TSSymbol symbol; - int16_t dynamic_precedence; - uint16_t production_id; - } reduce; - uint8_t type; -} TSParseAction; - -typedef struct { - uint16_t lex_state; - uint16_t external_lex_state; -} TSLexMode; - -typedef union { - TSParseAction action; - struct { - uint8_t count; - bool reusable; - } entry; -} TSParseActionEntry; - -struct TSLanguage { - uint32_t version; - uint32_t symbol_count; - uint32_t alias_count; - uint32_t token_count; - uint32_t external_token_count; - uint32_t state_count; - uint32_t large_state_count; - uint32_t production_id_count; - uint32_t field_count; - uint16_t max_alias_sequence_length; - const uint16_t *parse_table; - const uint16_t *small_parse_table; - const uint32_t *small_parse_table_map; - const TSParseActionEntry *parse_actions; - const char * const *symbol_names; - const char * const *field_names; - const TSFieldMapSlice *field_map_slices; - const TSFieldMapEntry *field_map_entries; - const TSSymbolMetadata *symbol_metadata; - const TSSymbol *public_symbol_map; - const uint16_t *alias_map; - const TSSymbol *alias_sequences; - const TSLexMode *lex_modes; - bool (*lex_fn)(TSLexer *, TSStateId); - bool (*keyword_lex_fn)(TSLexer *, TSStateId); - TSSymbol keyword_capture_token; - struct { - const bool *states; - const TSSymbol *symbol_map; - void *(*create)(void); - void (*destroy)(void *); - bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); - unsigned (*serialize)(void *, char *); - void (*deserialize)(void *, const char *, unsigned); - } external_scanner; - const TSStateId *primary_state_ids; -}; - -/* - * Lexer Macros - */ - -#define START_LEXER() \ - bool result = false; \ - bool skip = false; \ - bool eof = false; \ - int32_t lookahead; \ - goto start; \ - next_state: \ - lexer->advance(lexer, skip); \ - start: \ - skip = false; \ - lookahead = lexer->lookahead; - -#define ADVANCE(state_value) \ - { \ - state = state_value; \ - goto next_state; \ - } - -#define SKIP(state_value) \ - { \ - skip = true; \ - state = state_value; \ - goto next_state; \ - } - -#define ACCEPT_TOKEN(symbol_value) \ - result = true; \ - lexer->result_symbol = symbol_value; \ - lexer->mark_end(lexer); - -#define END_STATE() return result; - -/* - * Parse Table Macros - */ - -#define SMALL_STATE(id) id - LARGE_STATE_COUNT - -#define STATE(id) id - -#define ACTIONS(id) id - -#define SHIFT(state_value) \ - {{ \ - .shift = { \ - .type = TSParseActionTypeShift, \ - .state = state_value \ - } \ - }} - -#define SHIFT_REPEAT(state_value) \ - {{ \ - .shift = { \ - .type = TSParseActionTypeShift, \ - .state = state_value, \ - .repetition = true \ - } \ - }} - -#define SHIFT_EXTRA() \ - {{ \ - .shift = { \ - .type = TSParseActionTypeShift, \ - .extra = true \ - } \ - }} - -#define REDUCE(symbol_val, child_count_val, ...) \ - {{ \ - .reduce = { \ - .type = TSParseActionTypeReduce, \ - .symbol = symbol_val, \ - .child_count = child_count_val, \ - __VA_ARGS__ \ - }, \ - }} - -#define RECOVER() \ - {{ \ - .type = TSParseActionTypeRecover \ - }} - -#define ACCEPT_INPUT() \ - {{ \ - .type = TSParseActionTypeAccept \ - }} - -#ifdef __cplusplus -} -#endif - -#endif // TREE_SITTER_PARSER_H_ From a14eb07d203df30f185154c813699d50b1e9d038 Mon Sep 17 00:00:00 2001 From: miroman9364 <107484955+miroman9364@users.noreply.github.com> Date: Mon, 9 Oct 2023 20:36:15 -0700 Subject: [PATCH 13/28] Add initial library for `file` resource ## PR Summary - Add code to compute checksums for SHA-1, SHA-256 and SHA-512 hash algorithms. - Add code to generalize checking the environment and prompting the user to attach a debugger. ## PR Context The `file_lib` contains the implementation for the `file` resource. --- file_lib/Cargo.toml | 13 ++++++ file_lib/cspell.yaml | 3 ++ file_lib/src/checksum.rs | 98 ++++++++++++++++++++++++++++++++++++++++ file_lib/src/debug.rs | 43 ++++++++++++++++++ file_lib/src/lib.rs | 9 ++++ 5 files changed, 166 insertions(+) create mode 100644 file_lib/Cargo.toml create mode 100644 file_lib/cspell.yaml create mode 100644 file_lib/src/checksum.rs create mode 100644 file_lib/src/debug.rs create mode 100644 file_lib/src/lib.rs diff --git a/file_lib/Cargo.toml b/file_lib/Cargo.toml new file mode 100644 index 000000000..ecfcac215 --- /dev/null +++ b/file_lib/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "file_lib" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +crossterm = "0.27.0" +digest = "0.10.7" +hex-string = "0.1.0" +sha1 = "0.10.6" +sha2 = "0.10.8" diff --git a/file_lib/cspell.yaml b/file_lib/cspell.yaml new file mode 100644 index 000000000..ca7c4012f --- /dev/null +++ b/file_lib/cspell.yaml @@ -0,0 +1,3 @@ +words: + - crossterm + - hasher diff --git a/file_lib/src/checksum.rs b/file_lib/src/checksum.rs new file mode 100644 index 000000000..0c2fdbb68 --- /dev/null +++ b/file_lib/src/checksum.rs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +use digest::Digest; +use sha1::Sha1; +use sha2::{Sha256, Sha512}; +use hex_string::HexString; + +/// The supported checksum hash algorithms. +pub enum Algorithm { + /// The SHA-1 algorithm. (Considered insecure.) + Sha1, + /// The SHA-256 algorithm. + Sha256, + /// The SHA-512 algorithm. + Sha512, +} + +/// Compute the checksum for a vector of bytes using a given algorithm. +/// +/// # Arguments +/// +/// * `bytes` - The vector of bytes to compute the checksum for. +/// * `algorithm` - The algorithm to use to compute the checksum. +/// +/// # Return value +/// +/// The checksum as a lowercase string. +/// +/// # Examples +/// +/// ## Can compute SHA-1 checksum +/// +/// ``` +/// # use file_lib::checksum::{compute_checksum, Algorithm}; +/// let checksum = compute_checksum(b"hello world", Algorithm::Sha1); +/// assert_eq!(checksum, "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"); +/// ``` +/// +/// ## Can compute SHA-256 checksum +/// +/// ``` +/// # use file_lib::checksum::{compute_checksum, Algorithm}; +/// let checksum = compute_checksum(b"hello world", Algorithm::Sha256); +/// assert_eq!(checksum, "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"); +/// ``` +/// +/// ## Can compute SHA-512 checksum +/// +/// ``` +/// # use file_lib::checksum::{compute_checksum, Algorithm}; +/// let checksum = compute_checksum(b"hello world", Algorithm::Sha512); +/// assert_eq!(checksum, "309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f"); +/// ``` +/// +/// ## Checksum is lowercase string +/// +/// ``` +/// # use file_lib::checksum::{compute_checksum, Algorithm}; +/// let checksum = compute_checksum(b"hello world", Algorithm::Sha512); +/// assert_eq!(checksum, checksum.to_lowercase()); +/// ``` +pub fn compute_checksum(bytes: &[u8], algorithm: Algorithm) -> String { + match algorithm { + Algorithm::Sha1 => { + let mut hasher = Sha1::new(); + hasher.update(bytes); + let result = hasher.finalize(); + + HexString::from_bytes(&result.to_vec()).as_string().to_lowercase() + }, + Algorithm::Sha256 => { + let mut hasher = Sha256::new(); + hasher.update(bytes); + let result = hasher.finalize(); + + HexString::from_bytes(&result.to_vec()).as_string().to_lowercase() + }, + Algorithm::Sha512 => { + let mut hasher = Sha512::new(); + hasher.update(bytes); + let result = hasher.finalize(); + + HexString::from_bytes(&result.to_vec()).as_string().to_lowercase() + } + } +} + +#[cfg(test)] +mod tests { + use crate::checksum; + + #[test] + fn can_compute_sha1_checksum() { + let checksum = checksum::compute_checksum(b"hello world", checksum::Algorithm::Sha1); + assert_eq!(checksum, "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"); + } +} diff --git a/file_lib/src/debug.rs b/file_lib/src/debug.rs new file mode 100644 index 000000000..5769f098f --- /dev/null +++ b/file_lib/src/debug.rs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +use crossterm::event; +use std::env; + + + +pub const DEBUG_ENV_VAR: &str = "DEBUG_DSC"; + +/// If the `DEBUG_DSC` environment variable is set, and it contains the given command, +/// then prompt the user to attach a debugger. +/// +/// The environment variable is a comma-separated list of case-insensitive commands to enable for +/// prompting to attach the debugger. +/// +/// # Arguments +/// +/// * `command` - The command to check for in the `DEBUG_DSC` environment variable. +/// +pub fn check_debug(command: &String) { + if env::var("DEBUG_DSC").is_ok() { + let debug_args: Vec = env::var(DEBUG_ENV_VAR) + .unwrap() + .split(',') + .map(|s| s.to_lowercase()) + .collect(); + + if debug_args.contains(command) { + eprintln!( + "attach debugger to pid {} and press any key to continue", + std::process::id() + ); + loop { + let event = event::read().unwrap(); + if let event::Event::Key(_key) = event { + break; + } + eprintln!("Unexpected event: {event:?}"); + } + } + } +} diff --git a/file_lib/src/lib.rs b/file_lib/src/lib.rs new file mode 100644 index 000000000..5960c2fbd --- /dev/null +++ b/file_lib/src/lib.rs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +pub use self::checksum::Algorithm; +pub use self::checksum::compute_checksum; +pub use self::debug::check_debug; + +pub mod checksum; +pub mod debug; From db26ca731a6dd66f89e5561877026234f41025fe Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 9 Oct 2023 22:36:21 -0700 Subject: [PATCH 14/28] remove debug string from build --- build.ps1 | 3 --- tree-sitter-dscexpression/package.json | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/build.ps1 b/build.ps1 index 9bdb2f989..b4a0ab5b5 100644 --- a/build.ps1 +++ b/build.ps1 @@ -206,9 +206,6 @@ if ($Test) { Install-Module Pester -WarningAction Ignore } - "For debug - env:PATH is:" - $env:PATH - foreach ($project in $projects) { ## Build format_json Write-Host -ForegroundColor Cyan "Testing $project ..." diff --git a/tree-sitter-dscexpression/package.json b/tree-sitter-dscexpression/package.json index 9dfef26f2..838094966 100644 --- a/tree-sitter-dscexpression/package.json +++ b/tree-sitter-dscexpression/package.json @@ -8,7 +8,8 @@ "incremental" ], "dependencies": { - "nan": "^2.12.1" + "nan": "^2.12.1", + "node-gyp": "^9.4.0" }, "devDependencies": { "tree-sitter-cli": "^0.20.8" From 103e5c6566f04ccbb3bae490a1fccc79f4bf0a7b Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 10 Oct 2023 10:11:44 -0700 Subject: [PATCH 15/28] add package-lock.json --- tree-sitter-dscexpression/package-lock.json | 1374 +++++++++++++++++++ 1 file changed, 1374 insertions(+) create mode 100644 tree-sitter-dscexpression/package-lock.json diff --git a/tree-sitter-dscexpression/package-lock.json b/tree-sitter-dscexpression/package-lock.json new file mode 100644 index 000000000..4a1804303 --- /dev/null +++ b/tree-sitter-dscexpression/package-lock.json @@ -0,0 +1,1374 @@ +{ + "name": "tree-sitter-dscexpression", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "tree-sitter-dscexpression", + "version": "0.0.1", + "dependencies": { + "nan": "^2.12.1", + "node-gyp": "^9.4.0" + }, + "devDependencies": { + "tree-sitter-cli": "^0.20.8" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@npmcli/fs": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.0.tgz", + "integrity": "sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "engines": { + "node": ">= 10" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/aproba": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==" + }, + "node_modules/are-we-there-yet": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", + "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/cacache": { + "version": "17.1.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz", + "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==", + "dependencies": { + "@npmcli/fs": "^3.1.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^7.7.1", + "minipass": "^7.0.3", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^4.0.0", + "ssri": "^10.0.0", + "tar": "^6.1.11", + "unique-filename": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/cacache/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==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/cacache/node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "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/cacache/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/cacache/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "engines": { + "node": ">=6" + } + }, + "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==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "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==" + }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "bin": { + "color-support": "bin.js" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==" + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "engines": { + "node": ">=6" + } + }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==" + }, + "node_modules/exponential-backoff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz", + "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==" + }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fs-minipass": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", + "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/gauge": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", + "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^3.0.7", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" + }, + "node_modules/http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" + }, + "node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-lambda": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", + "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/jackspeak": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/make-fetch-happen": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz", + "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==", + "dependencies": { + "agentkeepalive": "^4.2.1", + "cacache": "^17.0.0", + "http-cache-semantics": "^4.1.1", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^7.7.1", + "minipass": "^5.0.0", + "minipass-fetch": "^3.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^7.0.0", + "ssri": "^10.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-collect/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-fetch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.4.tgz", + "integrity": "sha512-jHAqnA728uUpIaFm7NWsCnqKT6UqZz7GcI/bDpPATuwYyKwJwW0remxSCxUlKiEty+eopHGa3oc8WxgQ1FFJqg==", + "dependencies": { + "minipass": "^7.0.3", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/minipass-fetch/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", + "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/nan": { + "version": "2.18.0", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-gyp": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.0.tgz", + "integrity": "sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "glob": "^7.1.4", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^11.0.3", + "nopt": "^6.0.0", + "npmlog": "^6.0.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.2", + "which": "^2.0.2" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^12.13 || ^14.13 || >=16" + } + }, + "node_modules/nopt": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", + "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", + "dependencies": { + "abbrev": "^1.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npmlog": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", + "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", + "dependencies": { + "are-we-there-yet": "^3.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^4.0.3", + "set-blocking": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", + "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "optional": true + }, + "node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", + "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "dependencies": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.13.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", + "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", + "dependencies": { + "agent-base": "^6.0.2", + "debug": "^4.3.3", + "socks": "^2.6.2" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/ssri": { + "version": "10.0.5", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.5.tgz", + "integrity": "sha512-bSf16tAFkGeRlUNDjXu8FzaMQt6g2HZJrun7mtMbIPOddxt3GLMSz5VWUWcqTJUPfLEaDIepGxv+bYQW49596A==", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/ssri/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tar": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", + "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tar/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tree-sitter-cli": { + "version": "0.20.8", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "tree-sitter": "cli.js" + } + }, + "node_modules/unique-filename": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz", + "integrity": "sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==", + "dependencies": { + "unique-slug": "^4.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/unique-slug": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-4.0.0.tgz", + "integrity": "sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/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==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } +} From 62c4dac58aa98dfdb1d4d077ec8021904002b915 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 10 Oct 2023 16:24:54 -0700 Subject: [PATCH 16/28] add toolchain to path and install node if necessary --- build.ps1 | 9 ++++++++- tree-sitter-dscexpression/build.ps1 | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index b4a0ab5b5..9b57a8d18 100644 --- a/build.ps1 +++ b/build.ps1 @@ -190,6 +190,14 @@ if (!$found) { $env:PATH += [System.IO.Path]::PathSeparator + $target } +# add rustup toolchain to PATH +$toolchainPath = rustc --print sysroot +$toolchainBinPath = Join-Path $toolchainPath 'bin' +if ($env:PATH -notlike "*$toolchainBinPath*") { + Write-Host -ForegroundColor Yellow "Adding $toolchainBinPath to `$env:PATH" + $env:PATH += [System.IO.Path]::PathSeparator + $toolchainBinPath +} + if ($Test) { $failed = $false @@ -207,7 +215,6 @@ if ($Test) { } foreach ($project in $projects) { - ## Build format_json Write-Host -ForegroundColor Cyan "Testing $project ..." try { Push-Location "$PSScriptRoot/$project" diff --git a/tree-sitter-dscexpression/build.ps1 b/tree-sitter-dscexpression/build.ps1 index bfdc7fec6..7a8f02468 100644 --- a/tree-sitter-dscexpression/build.ps1 +++ b/tree-sitter-dscexpression/build.ps1 @@ -11,7 +11,18 @@ function Invoke-NativeCommand($cmd) { } if ($null -eq (Get-Command npm -ErrorAction Ignore)) { - throw "npm is not installed" + Write-Host 'Installing Node' + + if ($IsWindows) { + winget install OpenJS.NodeJS.LTS + } + elseif ($IsMacOS) { + brew install node + } + else { + sudo apt-get install nodejs + sudo apt-get install npm + } } npm list tree-sitter-cli From 3a481e4bafb4f7154c2bc22aae39a64db5808ad4 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 10 Oct 2023 17:06:15 -0700 Subject: [PATCH 17/28] add verbose output --- build.ps1 | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/build.ps1 b/build.ps1 index 9b57a8d18..38f52442d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -190,14 +190,6 @@ if (!$found) { $env:PATH += [System.IO.Path]::PathSeparator + $target } -# add rustup toolchain to PATH -$toolchainPath = rustc --print sysroot -$toolchainBinPath = Join-Path $toolchainPath 'bin' -if ($env:PATH -notlike "*$toolchainBinPath*") { - Write-Host -ForegroundColor Yellow "Adding $toolchainBinPath to `$env:PATH" - $env:PATH += [System.IO.Path]::PathSeparator + $toolchainBinPath -} - if ($Test) { $failed = $false @@ -220,7 +212,7 @@ if ($Test) { Push-Location "$PSScriptRoot/$project" if (Test-Path "./Cargo.toml") { - cargo test + cargo test -vv if ($LASTEXITCODE -ne 0) { $failed = $true From 1635960e7d01f6416c6621079588678759a0f195 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 10 Oct 2023 17:49:41 -0700 Subject: [PATCH 18/28] skip unit test for tree-sitter --- build.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 38f52442d..8c01c8187 100644 --- a/build.ps1 +++ b/build.ps1 @@ -95,6 +95,7 @@ $windows_projects = @("pal", "ntreg", "ntstatuserror", "ntuserinfo", "registry") $projects = @("tree-sitter-dscexpression", "dsc_lib", "dsc", "osinfo", "process", "tools/test_group_resource", "y2j", "powershellgroup", "tools/dsctest") $pedantic_unclean_projects = @("ntreg") $clippy_unclean_projects = @("tree-sitter-dscexpression") +$skip_test_projects = @("tree-sitter-dscexpression") if ($IsWindows) { $projects += $windows_projects @@ -207,12 +208,17 @@ if ($Test) { } foreach ($project in $projects) { + if ($skip_test_projects -contains $project) { + Write-Verbose -Verbose "Skipping test for $project" + continue + } + Write-Host -ForegroundColor Cyan "Testing $project ..." try { Push-Location "$PSScriptRoot/$project" if (Test-Path "./Cargo.toml") { - cargo test -vv + cargo test if ($LASTEXITCODE -ne 0) { $failed = $true From ff00c58caa13d88373d11545c6f458c97e2f513b Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 10 Oct 2023 17:56:17 -0700 Subject: [PATCH 19/28] change to just skipping on windows --- build.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.ps1 b/build.ps1 index 8c01c8187..68f67975d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -95,7 +95,7 @@ $windows_projects = @("pal", "ntreg", "ntstatuserror", "ntuserinfo", "registry") $projects = @("tree-sitter-dscexpression", "dsc_lib", "dsc", "osinfo", "process", "tools/test_group_resource", "y2j", "powershellgroup", "tools/dsctest") $pedantic_unclean_projects = @("ntreg") $clippy_unclean_projects = @("tree-sitter-dscexpression") -$skip_test_projects = @("tree-sitter-dscexpression") +$skip_test_projects_on_windows = @("tree-sitter-dscexpression") if ($IsWindows) { $projects += $windows_projects @@ -208,8 +208,8 @@ if ($Test) { } foreach ($project in $projects) { - if ($skip_test_projects -contains $project) { - Write-Verbose -Verbose "Skipping test for $project" + if ($IsWindows -and $skip_test_projects_on_windows -contains $project) { + Write-Verbose -Verbose "Skipping test for $project on Windows" continue } From 4824b10d1f12627f5ae6692e070bf886d7943647 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 10 Oct 2023 19:29:49 -0700 Subject: [PATCH 20/28] update tree-sitter files --- .gitignore | 2 ++ package-lock.json | 21 +++++++++++++++++++++ package.json | 5 +++++ 3 files changed, 28 insertions(+) create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore index dc2ae44f6..30d722f65 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ bin/ # Node.js generated files for tree-sitter build/ node_modules/ +tree-sitter-dscexpression/bindings/ +tree-sitter-dscexpression/src/ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..c318cefa3 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,21 @@ +{ + "name": "DSC", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "tree-sitter-cli": "^0.20.8" + } + }, + "node_modules/tree-sitter-cli": { + "version": "0.20.8", + "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.8.tgz", + "integrity": "sha512-XjTcS3wdTy/2cc/ptMLc/WRyOLECRYcMTrSWyhZnj1oGSOWbHLTklgsgRICU3cPfb0vy+oZCC33M43u6R1HSCA==", + "hasInstallScript": true, + "bin": { + "tree-sitter": "cli.js" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..849cb8f35 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "tree-sitter-cli": "^0.20.8" + } +} From 8f3f21fcf89fa85f6b0323086a11efaf7fe7216e Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 11 Oct 2023 15:10:02 -0700 Subject: [PATCH 21/28] Simplify the build for tree-sitter parser --- .gitignore | 2 + tree-sitter-dscexpression/binding.gyp | 19 - tree-sitter-dscexpression/build.ps1 | 7 - tree-sitter-dscexpression/package-lock.json | 1348 +------------------ tree-sitter-dscexpression/package.json | 3 +- 5 files changed, 6 insertions(+), 1373 deletions(-) delete mode 100644 tree-sitter-dscexpression/binding.gyp diff --git a/.gitignore b/.gitignore index 30d722f65..e25f63e66 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ build/ node_modules/ tree-sitter-dscexpression/bindings/ tree-sitter-dscexpression/src/ +tree-sitter-dscexpression/parser.* +tree-sitter-dscexpression/binding.gyp diff --git a/tree-sitter-dscexpression/binding.gyp b/tree-sitter-dscexpression/binding.gyp deleted file mode 100644 index b505a643a..000000000 --- a/tree-sitter-dscexpression/binding.gyp +++ /dev/null @@ -1,19 +0,0 @@ -{ - "targets": [ - { - "target_name": "tree_sitter_DSCExpression_binding", - "include_dirs": [ - "=12" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" - }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@npmcli/fs": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.0.tgz", - "integrity": "sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==", - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "optional": true, - "engines": { - "node": ">=14" - } - }, - "node_modules/@tootallnate/once": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "engines": { - "node": ">= 10" - } - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/agentkeepalive": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", - "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", - "dependencies": { - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==" - }, - "node_modules/are-we-there-yet": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", - "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/cacache": { - "version": "17.1.4", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz", - "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==", - "dependencies": { - "@npmcli/fs": "^3.1.0", - "fs-minipass": "^3.0.0", - "glob": "^10.2.2", - "lru-cache": "^7.7.1", - "minipass": "^7.0.3", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "p-map": "^4.0.0", - "ssri": "^10.0.0", - "tar": "^6.1.11", - "unique-filename": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/cacache/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==", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/cacache/node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", - "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/cacache/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/cacache/node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "engines": { - "node": ">=10" - } - }, - "node_modules/clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "engines": { - "node": ">=6" - } - }, - "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==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "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==" - }, - "node_modules/color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "bin": { - "color-support": "bin.js" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==" - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" - }, - "node_modules/encoding": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", - "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", - "optional": true, - "dependencies": { - "iconv-lite": "^0.6.2" - } - }, - "node_modules/env-paths": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", - "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", - "engines": { - "node": ">=6" - } - }, - "node_modules/err-code": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", - "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==" - }, - "node_modules/exponential-backoff": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz", - "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==" - }, - "node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/foreground-child/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/fs-minipass": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", - "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", - "dependencies": { - "minipass": "^7.0.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/fs-minipass/node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" - }, - "node_modules/gauge": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", - "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.3", - "console-control-strings": "^1.1.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.7", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" - }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" - }, - "node_modules/http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" - }, - "node_modules/http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "dependencies": { - "ms": "^2.0.0" - } - }, - "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "optional": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-lambda": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", - "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" - }, - "node_modules/jackspeak": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", - "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "engines": { - "node": ">=12" - } - }, - "node_modules/make-fetch-happen": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz", - "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==", - "dependencies": { - "agentkeepalive": "^4.2.1", - "cacache": "^17.0.0", - "http-cache-semantics": "^4.1.1", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^7.7.1", - "minipass": "^5.0.0", - "minipass-fetch": "^3.0.0", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.3", - "promise-retry": "^2.0.1", - "socks-proxy-agent": "^7.0.0", - "ssri": "^10.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-collect": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", - "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minipass-collect/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-fetch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.4.tgz", - "integrity": "sha512-jHAqnA728uUpIaFm7NWsCnqKT6UqZz7GcI/bDpPATuwYyKwJwW0remxSCxUlKiEty+eopHGa3oc8WxgQ1FFJqg==", - "dependencies": { - "minipass": "^7.0.3", - "minipass-sized": "^1.0.3", - "minizlib": "^2.1.2" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - }, - "optionalDependencies": { - "encoding": "^0.1.13" - } - }, - "node_modules/minipass-fetch/node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/minipass-flush": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", - "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minipass-flush/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-pipeline": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", - "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-pipeline/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-sized": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", - "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-sized/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minizlib": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, "node_modules/nan": { "version": "2.18.0", "license": "MIT" }, - "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/node-gyp": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.0.tgz", - "integrity": "sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==", - "dependencies": { - "env-paths": "^2.2.0", - "exponential-backoff": "^3.1.1", - "glob": "^7.1.4", - "graceful-fs": "^4.2.6", - "make-fetch-happen": "^11.0.3", - "nopt": "^6.0.0", - "npmlog": "^6.0.0", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^2.0.2" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": "^12.13 || ^14.13 || >=16" - } - }, - "node_modules/nopt": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", - "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", - "dependencies": { - "abbrev": "^1.0.0" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npmlog": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", - "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", - "dependencies": { - "are-we-there-yet": "^3.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^4.0.3", - "set-blocking": "^2.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dependencies": { - "aggregate-error": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", - "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", - "engines": { - "node": "14 || >=16.14" - } - }, - "node_modules/promise-retry": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", - "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", - "dependencies": { - "err-code": "^2.0.2", - "retry": "^0.12.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", - "engines": { - "node": ">= 4" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "optional": true - }, - "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" - }, - "node_modules/smart-buffer": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socks": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", - "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", - "dependencies": { - "ip": "^2.0.0", - "smart-buffer": "^4.2.0" - }, - "engines": { - "node": ">= 10.13.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socks-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", - "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", - "dependencies": { - "agent-base": "^6.0.2", - "debug": "^4.3.3", - "socks": "^2.6.2" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/ssri": { - "version": "10.0.5", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.5.tgz", - "integrity": "sha512-bSf16tAFkGeRlUNDjXu8FzaMQt6g2HZJrun7mtMbIPOddxt3GLMSz5VWUWcqTJUPfLEaDIepGxv+bYQW49596A==", - "dependencies": { - "minipass": "^7.0.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/ssri/node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tar": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", - "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/tar/node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/tree-sitter-cli": { "version": "0.20.8", + "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.8.tgz", + "integrity": "sha512-XjTcS3wdTy/2cc/ptMLc/WRyOLECRYcMTrSWyhZnj1oGSOWbHLTklgsgRICU3cPfb0vy+oZCC33M43u6R1HSCA==", "dev": true, "hasInstallScript": true, - "license": "MIT", "bin": { "tree-sitter": "cli.js" } - }, - "node_modules/unique-filename": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz", - "integrity": "sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==", - "dependencies": { - "unique-slug": "^4.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/unique-slug": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-4.0.0.tgz", - "integrity": "sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==", - "dependencies": { - "imurmurhash": "^0.1.4" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/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==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" - }, - "node_modules/wrap-ansi/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } } diff --git a/tree-sitter-dscexpression/package.json b/tree-sitter-dscexpression/package.json index 838094966..f066ad537 100644 --- a/tree-sitter-dscexpression/package.json +++ b/tree-sitter-dscexpression/package.json @@ -8,8 +8,7 @@ "incremental" ], "dependencies": { - "nan": "^2.12.1", - "node-gyp": "^9.4.0" + "nan": "^2.18.0" }, "devDependencies": { "tree-sitter-cli": "^0.20.8" From 680c47cc1796d7ed0651a65e25cf720d52a1cc53 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 11 Oct 2023 16:02:07 -0700 Subject: [PATCH 22/28] Update file_lib/src/checksum.rs Refactor duplicate code to take advantage of common `Digest` Co-authored-by: Steve Lee --- file_lib/src/checksum.rs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/file_lib/src/checksum.rs b/file_lib/src/checksum.rs index 0c2fdbb68..288ab4676 100644 --- a/file_lib/src/checksum.rs +++ b/file_lib/src/checksum.rs @@ -63,29 +63,24 @@ pub enum Algorithm { pub fn compute_checksum(bytes: &[u8], algorithm: Algorithm) -> String { match algorithm { Algorithm::Sha1 => { - let mut hasher = Sha1::new(); - hasher.update(bytes); - let result = hasher.finalize(); - - HexString::from_bytes(&result.to_vec()).as_string().to_lowercase() + get_checksum(bytes, Sha1::default()) }, Algorithm::Sha256 => { - let mut hasher = Sha256::new(); - hasher.update(bytes); - let result = hasher.finalize(); - - HexString::from_bytes(&result.to_vec()).as_string().to_lowercase() + get_checksum(bytes, Sha256::default()) }, Algorithm::Sha512 => { - let mut hasher = Sha512::new(); - hasher.update(bytes); - let result = hasher.finalize(); - - HexString::from_bytes(&result.to_vec()).as_string().to_lowercase() + get_checksum(bytes, Sha512::default()) } } } +fn get_checksum(bytes: &[u8], mut hasher: D) -> String +where D: digest::Digest { + hasher.update(bytes); + let result = hasher.finalize(); + HexString::from_bytes(&result.to_vec()).as_string().to_lowercase() +} + #[cfg(test)] mod tests { use crate::checksum; From 1ab812eb8373974ea1c96de369b446e78fa5fcae Mon Sep 17 00:00:00 2001 From: miroman9364 <107484955+miroman9364@users.noreply.github.com> Date: Wed, 11 Oct 2023 16:54:00 -0700 Subject: [PATCH 23/28] Add `file_lib` to build - added the `file_lib` project - list of projects was getting long, so refactored onto multiple lines (sorted project names) --- build.ps1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 68f67975d..758a30a3a 100644 --- a/build.ps1 +++ b/build.ps1 @@ -92,7 +92,18 @@ New-Item -ItemType Directory $target > $null # make sure dependencies are built first so clippy runs correctly $windows_projects = @("pal", "ntreg", "ntstatuserror", "ntuserinfo", "registry") -$projects = @("tree-sitter-dscexpression", "dsc_lib", "dsc", "osinfo", "process", "tools/test_group_resource", "y2j", "powershellgroup", "tools/dsctest") +$projects = @( + "dsc", + "dsc_lib", + "file_lib", + "osinfo", + "powershellgroup", + "process", + "tools/dsctest", + "tools/test_group_resource", + "tree-sitter-dscexpression", + "y2j" +) $pedantic_unclean_projects = @("ntreg") $clippy_unclean_projects = @("tree-sitter-dscexpression") $skip_test_projects_on_windows = @("tree-sitter-dscexpression") From 90c873235f25cb87a99774781a3a5fded219a620 Mon Sep 17 00:00:00 2001 From: miroman9364 <107484955+miroman9364@users.noreply.github.com> Date: Wed, 11 Oct 2023 16:55:17 -0700 Subject: [PATCH 24/28] Refactor to cleanup **clippy** warnings --- file_lib/src/checksum.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/file_lib/src/checksum.rs b/file_lib/src/checksum.rs index 288ab4676..5d1f411fd 100644 --- a/file_lib/src/checksum.rs +++ b/file_lib/src/checksum.rs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -use digest::Digest; use sha1::Sha1; use sha2::{Sha256, Sha512}; use hex_string::HexString; From b122d9151f681e31d85e34bda7a75046bf2bd5cd Mon Sep 17 00:00:00 2001 From: miroman9364 <107484955+miroman9364@users.noreply.github.com> Date: Wed, 11 Oct 2023 16:56:35 -0700 Subject: [PATCH 25/28] Change to address PR comments --- file_lib/src/debug.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/file_lib/src/debug.rs b/file_lib/src/debug.rs index 5769f098f..b9e21be59 100644 --- a/file_lib/src/debug.rs +++ b/file_lib/src/debug.rs @@ -4,8 +4,6 @@ use crossterm::event; use std::env; - - pub const DEBUG_ENV_VAR: &str = "DEBUG_DSC"; /// If the `DEBUG_DSC` environment variable is set, and it contains the given command, From 8fd917338b383a8faf4d7576dcb562d14f7e49df Mon Sep 17 00:00:00 2001 From: miroman9364 <107484955+miroman9364@users.noreply.github.com> Date: Wed, 11 Oct 2023 20:31:43 -0700 Subject: [PATCH 26/28] Fix clippy and the wait for key press - Clippy was unhappy with names, potential panics, and moves. - There is a key release for the enter key already buffered when the application starts; ignore this. --- file_lib/src/checksum.rs | 22 +++++++------- file_lib/src/debug.rs | 64 ++++++++++++++++++++++++++-------------- file_lib/src/lib.rs | 4 +-- 3 files changed, 56 insertions(+), 34 deletions(-) diff --git a/file_lib/src/checksum.rs b/file_lib/src/checksum.rs index 5d1f411fd..1113ea028 100644 --- a/file_lib/src/checksum.rs +++ b/file_lib/src/checksum.rs @@ -6,6 +6,7 @@ use sha2::{Sha256, Sha512}; use hex_string::HexString; /// The supported checksum hash algorithms. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Algorithm { /// The SHA-1 algorithm. (Considered insecure.) Sha1, @@ -31,35 +32,36 @@ pub enum Algorithm { /// ## Can compute SHA-1 checksum /// /// ``` -/// # use file_lib::checksum::{compute_checksum, Algorithm}; -/// let checksum = compute_checksum(b"hello world", Algorithm::Sha1); +/// # use file_lib::checksum::{compute, Algorithm}; +/// let checksum = compute(b"hello world", Algorithm::Sha1); /// assert_eq!(checksum, "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"); /// ``` /// /// ## Can compute SHA-256 checksum /// /// ``` -/// # use file_lib::checksum::{compute_checksum, Algorithm}; -/// let checksum = compute_checksum(b"hello world", Algorithm::Sha256); +/// # use file_lib::checksum::{compute, Algorithm}; +/// let checksum = compute(b"hello world", Algorithm::Sha256); /// assert_eq!(checksum, "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"); /// ``` /// /// ## Can compute SHA-512 checksum /// /// ``` -/// # use file_lib::checksum::{compute_checksum, Algorithm}; -/// let checksum = compute_checksum(b"hello world", Algorithm::Sha512); +/// # use file_lib::checksum::{compute, Algorithm}; +/// let checksum = compute(b"hello world", Algorithm::Sha512); /// assert_eq!(checksum, "309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f"); /// ``` /// /// ## Checksum is lowercase string /// /// ``` -/// # use file_lib::checksum::{compute_checksum, Algorithm}; -/// let checksum = compute_checksum(b"hello world", Algorithm::Sha512); +/// # use file_lib::checksum::{compute, Algorithm}; +/// let checksum = compute(b"hello world", Algorithm::Sha512); /// assert_eq!(checksum, checksum.to_lowercase()); /// ``` -pub fn compute_checksum(bytes: &[u8], algorithm: Algorithm) -> String { +#[must_use] +pub fn compute(bytes: &[u8], algorithm: &Algorithm) -> String { match algorithm { Algorithm::Sha1 => { get_checksum(bytes, Sha1::default()) @@ -86,7 +88,7 @@ mod tests { #[test] fn can_compute_sha1_checksum() { - let checksum = checksum::compute_checksum(b"hello world", checksum::Algorithm::Sha1); + let checksum = checksum::compute(b"hello world", checksum::Algorithm::Sha1); assert_eq!(checksum, "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"); } } diff --git a/file_lib/src/debug.rs b/file_lib/src/debug.rs index b9e21be59..ce6813206 100644 --- a/file_lib/src/debug.rs +++ b/file_lib/src/debug.rs @@ -2,40 +2,60 @@ // Licensed under the MIT License. use crossterm::event; -use std::env; +use std::{env, io}; -pub const DEBUG_ENV_VAR: &str = "DEBUG_DSC"; +pub const DEBUG_ENV_VAR: &str = "DSC_DEBUG"; -/// If the `DEBUG_DSC` environment variable is set, and it contains the given command, +/// If the `DSC_DEBUG` environment variable is set, and it contains the given command, /// then prompt the user to attach a debugger. -/// +/// /// The environment variable is a comma-separated list of case-insensitive commands to enable for /// prompting to attach the debugger. -/// +/// /// # Arguments -/// +/// /// * `command` - The command to check for in the `DEBUG_DSC` environment variable. -/// -pub fn check_debug(command: &String) { - if env::var("DEBUG_DSC").is_ok() { - let debug_args: Vec = env::var(DEBUG_ENV_VAR) - .unwrap() - .split(',') - .map(|s| s.to_lowercase()) - .collect(); - - if debug_args.contains(command) { +/// +/// # Errors +/// +/// Will return `Err` if there is an error reading the keyboard. +pub fn check_debugger_prompt(command: &str) -> io::Result<()> { + let dsc_debug = env::var(DEBUG_ENV_VAR).unwrap_or_default().to_lowercase(); + let debug_args: Vec<&str> = dsc_debug.split(',').collect(); + + for arg in &debug_args { + if arg.trim() == command.to_lowercase() { eprintln!( "attach debugger to pid {} and press any key to continue", std::process::id() ); - loop { - let event = event::read().unwrap(); - if let event::Event::Key(_key) = event { - break; - } - eprintln!("Unexpected event: {event:?}"); + + wait_for_keypress()?; + } + } + + Ok(()) +} + +fn wait_for_keypress() -> io::Result<()> { + // there will be a latent `Release` on the `Enter` key sitting in the buffer; ignore it + let mut ignore_first_release = true; + loop { + let event = event::read()?; + if let event::Event::Key(key) = event { + if key.code == event::KeyCode::Enter + && key.kind == event::KeyEventKind::Release + && ignore_first_release + { + ignore_first_release = false; + continue; } + + break; } + + eprintln!("Unexpected event: {event:?}"); } + + Ok(()) } diff --git a/file_lib/src/lib.rs b/file_lib/src/lib.rs index 5960c2fbd..421cb0715 100644 --- a/file_lib/src/lib.rs +++ b/file_lib/src/lib.rs @@ -2,8 +2,8 @@ // Licensed under the MIT License. pub use self::checksum::Algorithm; -pub use self::checksum::compute_checksum; -pub use self::debug::check_debug; +pub use self::checksum::compute; +pub use self::debug::check_debugger_prompt; pub mod checksum; pub mod debug; From 3568f2ece49f4d29410c4f90b26c35f685f423e1 Mon Sep 17 00:00:00 2001 From: miroman9364 <107484955+miroman9364@users.noreply.github.com> Date: Wed, 11 Oct 2023 20:43:54 -0700 Subject: [PATCH 27/28] Fix doc examples --- file_lib/src/checksum.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/file_lib/src/checksum.rs b/file_lib/src/checksum.rs index 1113ea028..bc348245b 100644 --- a/file_lib/src/checksum.rs +++ b/file_lib/src/checksum.rs @@ -33,7 +33,7 @@ pub enum Algorithm { /// /// ``` /// # use file_lib::checksum::{compute, Algorithm}; -/// let checksum = compute(b"hello world", Algorithm::Sha1); +/// let checksum = compute(b"hello world", &Algorithm::Sha1); /// assert_eq!(checksum, "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"); /// ``` /// @@ -41,7 +41,7 @@ pub enum Algorithm { /// /// ``` /// # use file_lib::checksum::{compute, Algorithm}; -/// let checksum = compute(b"hello world", Algorithm::Sha256); +/// let checksum = compute(b"hello world", &Algorithm::Sha256); /// assert_eq!(checksum, "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"); /// ``` /// @@ -49,7 +49,7 @@ pub enum Algorithm { /// /// ``` /// # use file_lib::checksum::{compute, Algorithm}; -/// let checksum = compute(b"hello world", Algorithm::Sha512); +/// let checksum = compute(b"hello world", &Algorithm::Sha512); /// assert_eq!(checksum, "309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f"); /// ``` /// @@ -57,7 +57,7 @@ pub enum Algorithm { /// /// ``` /// # use file_lib::checksum::{compute, Algorithm}; -/// let checksum = compute(b"hello world", Algorithm::Sha512); +/// let checksum = compute(b"hello world", &Algorithm::Sha512); /// assert_eq!(checksum, checksum.to_lowercase()); /// ``` #[must_use] From d02d30fb0660cb4fa4939429f8ba490d2f6e99c6 Mon Sep 17 00:00:00 2001 From: miroman9364 <107484955+miroman9364@users.noreply.github.com> Date: Wed, 11 Oct 2023 20:47:01 -0700 Subject: [PATCH 28/28] Remove old test from before docs --- file_lib/src/checksum.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/file_lib/src/checksum.rs b/file_lib/src/checksum.rs index bc348245b..a8bc7e3e1 100644 --- a/file_lib/src/checksum.rs +++ b/file_lib/src/checksum.rs @@ -81,14 +81,3 @@ where D: digest::Digest { let result = hasher.finalize(); HexString::from_bytes(&result.to_vec()).as_string().to_lowercase() } - -#[cfg(test)] -mod tests { - use crate::checksum; - - #[test] - fn can_compute_sha1_checksum() { - let checksum = checksum::compute(b"hello world", checksum::Algorithm::Sha1); - assert_eq!(checksum, "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"); - } -}