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

feat: exit as builtin function #402

Merged
merged 4 commits into from
Sep 23, 2024

Conversation

MuhamedMagdi
Copy link
Contributor

@MuhamedMagdi MuhamedMagdi commented Aug 11, 2024

This pr + #401 should close #215

@b1ek
Copy link
Member

b1ek commented Aug 15, 2024

is it really necessary to remove it from std/env tho?

@MuhamedMagdi
Copy link
Contributor Author

MuhamedMagdi commented Aug 15, 2024

It's not necessary if we don't want to add it in the known keywords, but i don't really know how amber decide to use which one of them?

@Mte90
Copy link
Member

Mte90 commented Aug 15, 2024

Well at that point it will be a conflict? We should keep a duplicate?


fn parse(&mut self, meta: &mut ParserMetadata) -> SyntaxResult {
token(meta, "exit")?;
syntax(meta, &mut self.code)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking if we should allow omitting this parameter - this way we could just exit with zero exit code.

exit
// Same as `exit 0`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kinda too late tbh but updated the PR to handle parsing of the code argument for the Exit statement as optional. If the code is omitted during parsing, it will now default to 0.

@Mte90 Mte90 linked an issue Sep 3, 2024 that may be closed by this pull request
Copy link
Member

@Ph0enixKM Ph0enixKM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mte90 Mte90 merged commit eb16c99 into amber-lang:master Sep 23, 2024
1 check 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.

[Feature] Make exit function a builtin [Feature] More built-in commands
4 participants