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

Add shebang support #149

Merged
merged 3 commits into from
Dec 9, 2021
Merged

Add shebang support #149

merged 3 commits into from
Dec 9, 2021

Conversation

Rerumu
Copy link
Contributor

@Rerumu Rerumu commented Nov 6, 2021

Closes #106
If a script starts with the characters #! then the first line is skipped.

@LoganDark
Copy link
Contributor

LoganDark commented Nov 8, 2021

I actually think this should be in the CLI. Shebang is not a part of the Luau syntax. Files starting with one should be interpreted as if the source code starts after the shebang.

Roblox scripts don't have shebangs, loadstrings don't have shebangs, etc. shebangs are really only for loading from files.

@Rerumu
Copy link
Contributor Author

Rerumu commented Nov 8, 2021

Roblox scripts don't have shebangs, loadstrings don't have shebangs, etc. shebangs are really only for loading from files.

Makes sense. I've gone ahead and moved the check to readFile which is used by the CLI to read source files. I've also made it skip if the first character is # without checking the second character, since it seems that's what vanilla does too.

@zeux
Copy link
Collaborator

zeux commented Dec 9, 2021

Thanks! And sorry it took so long :) I'll change the PR a bit to detect #! pattern instead of # to make sure we're detecting the shebang instead of a comment that accidentally uses the wrong syntax and merge this.

@zeux zeux merged commit 12ef94d into luau-lang:master Dec 9, 2021
@Rerumu Rerumu deleted the shebang-support branch December 9, 2021 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add shebang support
3 participants