Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to parsing of use, else & commands #90

Merged
merged 16 commits into from
May 24, 2024

Conversation

CabalCrow
Copy link
Contributor

Description

Fix parsing of use, else & commands, by taking into account additional valid syntax.

Issues:

fixes #83
fixes #88
fixes #89

Details:

command

Split the command rule to accomodate 2 more syntaxes: ^'ls' and ^().

else

Allow non-block syntax for else (in comparison with if, which can't take anything, but a block).

use

Allow use to take pipe input.

Allow the module value of the use declaration to use parenthesis
expressions.
Allow else to take expression & command arguments.
Allow for the alternative syntax to write commands: ^'command_name'.
I made it use cmd_identifier before, but it is better to use any type of
command syntax.
Allow it to also parse this command syntax: ^()
@fdncred
Copy link
Collaborator

fdncred commented May 23, 2024

looks like we require prettier to be run - we might should say that somewhere.

@CabalCrow
Copy link
Contributor Author

Formatted with prettier.

Use can also accept interpolated string as a module argument.
Add a test for interpolated string with use.
@CabalCrow
Copy link
Contributor Author

CabalCrow commented May 24, 2024

Update the use rules to account for interpolated string as suggested by kubouch.

@CabalCrow
Copy link
Contributor Author

Note that I didn't regenerate for the last change, in order to keep the diff minimal.
After mergin the project should be regenerated with tree-sitter generate and the 3 generated src files should be commited for the project to work properly with python.

@CabalCrow
Copy link
Contributor Author

Note that I didn't regenerate for the last change, in order to keep the diff minimal. After mergin the project should be regenerated with tree-sitter generate and the 3 generated src files should be commited for the project to work properly with python.

Actually not a good idea - the github tests require the grammar to already be generated. I regenerated it so it could pass the new tests.

@fdncred
Copy link
Collaborator

fdncred commented May 24, 2024

I updated the packages with npm update, npm outdated, and npm install and I got the windows stuff to work, at least on my windows system. let's see if ci passes.

@fdncred
Copy link
Collaborator

fdncred commented May 24, 2024

yay, it worked. let's move forward! Thanks @BigCrow!

@fdncred fdncred merged commit 31b4e09 into nushell:main May 24, 2024
3 checks passed
@CabalCrow CabalCrow deleted the cabalcrow_pr branch May 24, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants