tree-sitter-julia icon indicating copy to clipboard operation
tree-sitter-julia copied to clipboard

Unify `scoped_identifier` and `field_expression`

Open ChrHorn opened this issue 3 years ago • 1 comments

These are used in different places but represent nearly the same syntax. I don't think we need both.

scoped_identifier is also currently defined recursively. Recursive structures of arbitrary depth are very hard to query. A flat structure would be better.

ChrHorn avatar Nov 06 '22 14:11 ChrHorn

Scoped identifiers were originally only used for import statements. I added them to other places where I don't think it makes sense to have a field expression (like function signatures) for the same reason we distinguish between parameters and arguments. Parameters are restricted to symbol-like things, but arguments allow any primary expression.

There are a couple of things that do need to get fixed tho:

  1. There's two ways to call scoped macros, but only one is parsed correctly:

    @M.foo x y z    # ok
    M.@foo x y z    # not parsed correctly
    
  2. quoted operators like Base.:+ are not parsed correctly either.

scoped_identifier is also currently defined recursively

Yes, that needs to get fixed too.

savq avatar Nov 28 '22 00:11 savq