-
Notifications
You must be signed in to change notification settings - Fork 58
Vararg class params and operator identifiers #112
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
Conversation
- Bump dotty/scala library percentage
(operator_identifier) | ||
(generic_type | ||
(type_identifier | ||
(MISSING _plainid)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't know what this is.
Found tree-sitter/tree-sitter#1043 but not sure I understand both the issue and a way to fix it..
@@ -1045,7 +1048,7 @@ module.exports = grammar({ | |||
|
|||
wildcard: $ => '_', | |||
|
|||
operator_identifier: $ => /[^\s\w\(\)\[\]\{\}'"`\.;,]+/, | |||
operator_identifier: $ => /[!#%&*+-\/:<=>?@'^\|‘~]+/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a more precise match, from https://docs.scala-lang.org/scala3/reference/syntax.html#
What it doesn't match is unicode characters from Sm, So, that's why in Predef this is an error:
@deprecated("Use `->` instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.", "2.13.0")
def →[B](y: B): (A, B) = ->(y)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to include all the characters from those character sets (thousands), so I think we can live with the limitation that ligatures will cause errors in the grammar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People shouldn't be using ligatures anyways. ASCII or die.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @keynmol!
SCALA_SCALA_LIBRARY_EXPECTED=95 | ||
SCALA_SCALA_LIBRARY_EXPECTED=98 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
This does bring up the coverage, but unfortunately this handling of operator_identifier caused issues in prefix_expression tests.
I'm not sure how to fix the tests.
Another option would be to perhaps do
_identifier_like: $ => choice($.identifier, $.operator_identifier)
but this takes us further away from what Scala syntax is like.