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

Fixed the SHEBANG detection #4290

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

Webstonesl
Copy link
Contributor

In Rust a shebang is only if the '#!' is not followed by a '['. I added an action to fix it. If it is possible to do it with normal ANTLR, I don't know how.

@Webstonesl
Copy link
Contributor Author

There was a small issue regarding the Cpp and CSharp language specific changes. Should be fixed now.

@@ -133,7 +133,9 @@ OUTER_BLOCK_DOC:

BLOCK_COMMENT_OR_DOC: ( BLOCK_COMMENT | INNER_BLOCK_DOC | OUTER_BLOCK_DOC) -> channel (HIDDEN);

SHEBANG: {this.SOF()}? '\ufeff'? '#!' ~[\r\n]* -> channel(HIDDEN);
SHEBANG: {this.SOF()}? '\ufeff'? '#!' {this._input.LA(1) != 97}? ~[\r\n]* -> channel(HIDDEN);
Copy link
Contributor

Choose a reason for hiding this comment

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

Strictly speaking, this is not "target agnostic" (#4286 (comment)) because != is a target-specific operator. The entire expression should go in a base class, which is already done for both lexer and parser. Please add a "is...()" method, reference that here, and implement the methods for each of the targets.

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