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

Adds attribute_group node to complete attributes support #130

Merged
merged 1 commit into from
May 27, 2022

Conversation

cfroystad
Copy link
Collaborator

@cfroystad cfroystad commented May 27, 2022

Also fixes a bug with missing support for trailing comma in attribute listings

This changes the node structure for currently unreleased code.

Example

Code:

#[
    A1,
    A2(),
    A3(0),
    A4(x: 1),
]
function a() {
}

Before:

(function_definition
    attributes: (attribute_list
        (attribute (name))
        (attribute
          (name)
          parameters: (arguments)
        )
        (attribute
          (name)
          parameters: (arguments (argument (integer)))
        )
        (attribute
          (name)
          parameters: (arguments (argument name: (name) (integer)))
        )
    )
    name: (name)
    parameters: (formal_parameters)
    body: (compound_statement)
  )

After:

(function_definition
    attributes: (attribute_list
      (attribute_group
        (attribute (name))
        (attribute
          (name)
          parameters: (arguments)
        )
        (attribute
          (name)
          parameters: (arguments (argument (integer)))
        )
        (attribute
          (name)
          parameters: (arguments (argument name: (name) (integer)))
        )
      )
    )
    name: (name)
    parameters: (formal_parameters)
    body: (compound_statement)
  )

Checklist:

  • All tests pass in CI
  • There are sufficient tests for the new fix/feature
  • Grammar rules have not been renamed unless absolutely necessary (0 rules renamed)
  • The conflicts section hasn't grown too much (0 new conflicts)
  • The parser size hasn't grown too much (master: 2330, PR: 2338)

@cfroystad cfroystad mentioned this pull request May 27, 2022
32 tasks
@aryx aryx merged commit c8955e9 into tree-sitter:master May 27, 2022
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