Skip to content

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

Merged
merged 1 commit into from
Jan 9, 2023

Conversation

keynmol
Copy link
Collaborator

@keynmol keynmol commented Jan 9, 2023

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.

- Bump dotty/scala library percentage
(operator_identifier)
(generic_type
(type_identifier
(MISSING _plainid))
Copy link
Collaborator Author

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: $ => /[!#%&*+-\/:<=>?@'^\|‘~]+/,
Copy link
Collaborator Author

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)

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

@eed3si9n eed3si9n left a 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚀

@eed3si9n eed3si9n merged commit 561da3b into tree-sitter:master Jan 9, 2023
@keynmol keynmol deleted the scala2-fixes branch January 9, 2023 21:24
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