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

Add parsing support for freestanding macros #438

Open
ketchupfriend opened this issue Sep 14, 2024 · 1 comment
Open

Add parsing support for freestanding macros #438

ketchupfriend opened this issue Sep 14, 2024 · 1 comment

Comments

@ketchupfriend
Copy link

Macros were added in Swift 5.9 https://www.swift.org/blog/swift-5.9-released/#language-and-standard-library, and include:

  • Freestanding macros
  • Attached macros

Attached macros look the same as attributes, so they already get some highlighting. Freestanding macros don't seem to be supported yet, though. For example, on this sample file:

import Testing

#expect(true)

Has the following tree with InspectTree:

(source_file ; [0, 0] - [3, 0]
  (import_declaration ; [0, 0] - [0, 14]
    (identifier ; [0, 7] - [0, 14]
      (simple_identifier))) ; [0, 7] - [0, 14]
  (ERROR ; [2, 0] - [2, 7]
    (ERROR)) ; [2, 0] - [2, 7]
  (tuple_expression ; [2, 7] - [2, 13]
    value: (boolean_literal))) ; [2, 8] - [2, 12]

Expected result is that expect should be identified as a macro. This example comes from swift-testing

@alex-pinkus
Copy link
Owner

Thanks for the heads up!

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

No branches or pull requests

2 participants