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

import, using, export rules (from tree-sitter) are clumsy #28

Closed
o314 opened this issue Sep 19, 2021 · 0 comments · Fixed by #64
Closed

import, using, export rules (from tree-sitter) are clumsy #28

o314 opened this issue Sep 19, 2021 · 0 comments · Fixed by #64

Comments

@o314
Copy link

o314 commented Sep 19, 2021

Nota: this is a repost of https://github.com/lezer-parser/julia/issues/4

the tree-sitter grammar offer a very partial implementation of the import/export rules. in particular

  • selected and scoped (tree-sitter lingo) are exclusive
  • aliasing is not supported
  • interpolation is not supported
  • etc.

Here is an update targeting Julia v1.6

# for julia v1.6
import_family ::=
    "import" _imex_bypath ("," _imex_bypath)*
  | "import" _imex_path ":" _imex_bypath ("," _imex_bypath)*
  | "using" _imex_path ("," _imex_path)*
  | "using" _imex_path ":" _imex_bypath ("," _imex_bypath)*
  .

export ::= _imex_path_elem ("," _imex_path_elem)* .

_imex_bypath ::= _imex_path ("as" _imex_path_elem)? .

_imex_path ::= _imex_path_dots _imex_path_elem ("." _imex_path_elem)* .

_imex_path_dots ::= "."* .

_imex_path_elem ::=
    id                                                      # std id
  | id string                                               # nonstd id
  | op                                                      # operator
  | "@" instance                                            # macro name
  | "$" expression                                          # interpolation
# | "(" expression ")"                                      # staging
    .

I write grammar in bnf format since i don't know the js lingo used there, sorry for the inconvenience
Is there any way to update the def file ?

REFS

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 a pull request may close this issue.

1 participant