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

Implement backtick syntax for defining commands #8

Merged
merged 7 commits into from
Nov 28, 2024

Conversation

moxvallix
Copy link
Contributor

Related: #7

Implements backtick syntax, replacing the forward slash syntax.
With this syntax multi-line commands are possible, and the lexer removes excess whitespace
when not within a string inside the command.

This is the first step towards having a command literal, but right now it still requires a newline first.

Copy link
Member

@GearsDatapacks GearsDatapacks left a comment

Choose a reason for hiding this comment

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

Looks pretty good! I've left couple of notes and questions inline

TODO.md Outdated Show resolved Hide resolved
src/lexer/mod.rs Outdated Show resolved Hide resolved
src/lexer/mod.rs Show resolved Hide resolved
src/lexer/mod.rs Outdated Show resolved Hide resolved
@@ -43,7 +43,7 @@ pub enum TokenKind {
ReturnKeyword,

// Non-zoglin
CommandBegin,
CommandBegin(bool),
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to store this bool in the token? It doesn't seem like it's used anywhere

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 used in tokenise to determine whether the command literal uses a backtick or is just a keyword command.

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 probably can and should be refactored, but that was the easiest implementation without changing how commands were set to be lexed.

Copy link
Member

@GearsDatapacks GearsDatapacks left a comment

Choose a reason for hiding this comment

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

LGTM!

@GearsDatapacks GearsDatapacks merged commit 758094a into main Nov 28, 2024
@GearsDatapacks GearsDatapacks deleted the command-literals branch December 1, 2024 21:29
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