Skip to content

First iteration of the features feature for the declarative parser#1346

Merged
Araq merged 3 commits intonim-lang:masterfrom
jmgomez:parser_features
Feb 25, 2025
Merged

First iteration of the features feature for the declarative parser#1346
Araq merged 3 commits intonim-lang:masterfrom
jmgomez:parser_features

Conversation

@jmgomez
Copy link
Copy Markdown
Collaborator

@jmgomez jmgomez commented Feb 12, 2025

There are a few things left to implement. Like adding a special syntax to requires.

This PR handles the scenarios for root packages.
See the tdeclarativeparser tests over the features packages. Nimble file

# Dependencies

feature "feature1":
  requires "stew"
when defined(features.features.feature1):
  echo "feature1 is enabled"
  import stew/byteutils #we should be able to import stew here as is its part of the feature1

else:
  echo "feature1 is disabled"

There are a few things left to implement. Like adding a special syntax to requires.
This PR handles the scenarios for root packages.
See the `tdeclarativeparser` tests over the `features` packages.
Nimble file
```nim
# Dependencies

requires "nim >= 2.3.1"

feature "feature1":
  requires "stew"

```nim

when defined(features.features.feature1):
  echo "feature1 is enabled"
  import stew/byteutils #we should be able to import stew here as is its part of the feature1

else:
  echo "feature1 is disabled"
```
@jmgomez jmgomez self-assigned this Feb 12, 2025
@jmgomez jmgomez requested a review from Araq February 12, 2025 12:40
@Araq Araq merged commit fd05f30 into nim-lang:master Feb 25, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants