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

Fix wildcard Scala 3 imports #44

Merged
merged 1 commit into from
May 9, 2022

Conversation

keynmol
Copy link
Collaborator

@keynmol keynmol commented Feb 2, 2022

Honestly just opening this to learn how to contribute, I know naught about writing good tree-sitter grammars.

As a source, I used https://docs.scala-lang.org/scala3/reference/syntax.html#lexical-syntax

Code:

import tools.nsc.classpath.{given Test, given Test2, Test3}
import bla.{*, given}

Before:

import_declaration [0, 0] - [0, 59]
  path: stable_identifier [0, 7] - [0, 26]
    stable_identifier [0, 7] - [0, 16]
      identifier [0, 7] - [0, 12]
      identifier [0, 13] - [0, 16]
    identifier [0, 17] - [0, 26]
  import_selectors [0, 27] - [0, 59]
    identifier [0, 28] - [0, 33]
    ERROR [0, 34] - [0, 38]
      identifier [0, 34] - [0, 38]
    identifier [0, 40] - [0, 45]
    ERROR [0, 46] - [0, 51]
      identifier [0, 46] - [0, 51]
    identifier [0, 53] - [0, 58]
import_declaration [1, 0] - [1, 21]
  path: identifier [1, 7] - [1, 10]
  import_selectors [1, 11] - [1, 21]
    ERROR [1, 12] - [1, 14]
    identifier [1, 15] - [1, 20]

After:

(compilation_unit [0, 0] - [3, 0]
  (import_declaration [0, 0] - [0, 59]
    path: (stable_identifier [0, 7] - [0, 26]
      (stable_identifier [0, 7] - [0, 16]
        (identifier [0, 7] - [0, 12])
        (identifier [0, 13] - [0, 16]))
      (identifier [0, 17] - [0, 26]))
    (import_selectors [0, 27] - [0, 59]
      (type_identifier [0, 34] - [0, 38])
      (type_identifier [0, 46] - [0, 51])
      (identifier [0, 53] - [0, 58])))
  (import_declaration [1, 0] - [1, 21]
    path: (identifier [1, 7] - [1, 10])
    (import_selectors [1, 11] - [1, 21]
      (import_wildcard [1, 12] - [1, 13])
      (import_wildcard [1, 15] - [1, 20]))))
  • Should I try to match some EBNF? I'd imagine Scala 2 and Scala 3 have different grammars name-wise

@ckipp01
Copy link
Collaborator

ckipp01 commented Feb 23, 2022

Gentle ping @maxbrunsfeld as I believe you're the only one that can merge any of these prs.

@ckipp01
Copy link
Collaborator

ckipp01 commented May 9, 2022

Couple months later, one more attempt. Anything holding this back from getting merged in? There are a few open prs that would be great to get added and to get support for some Scala 3 features.

@maxbrunsfeld maxbrunsfeld merged commit 8599058 into tree-sitter:master May 9, 2022
@maxbrunsfeld
Copy link
Contributor

Sorry for the delay; thanks @keynmol .

@eed3si9n eed3si9n added the area/scala3 Scala 3 syntax label Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/scala3 Scala 3 syntax
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants