euclidianAce / tree-sitter-teal

A tree sitter grammar for Teal, a typed dialect of Lua
38 stars 4 forks source link

Use a field instead of an alias for simple_type name #9

Closed Xandaros closed 3 years ago

Xandaros commented 3 years ago

The alias doesn't actually do anything - all you get is a (simple_type), which might have a (typeargs (simple_type)) child, but there is no direct reference to the identifier. If there are typeargs present, you would have to separate it out yourself.

In my test example, before:

(simple_type
    (typeargs (simple_type)))

After:

(simple_type
    name: (identifier)
    (typeargs
        (simple_type name: (identifier))))

The typeargs don't have their own field. This is consistent with the rest of the parser, though it would certainly help if there more fields around.