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

how to parse parameter list in Swift? #335

Open
syrose01 opened this issue Nov 23, 2023 · 0 comments
Open

how to parse parameter list in Swift? #335

syrose01 opened this issue Nov 23, 2023 · 0 comments

Comments

@syrose01
Copy link

Hi,
We are writing a query that can parse all symbols in our Swift code.
But we discovered something strange while working.

If Swift code like the following,

func greet(firstName: String, lastName: String, age: Int) {
    print("Hello, \(firstName) \(lastName)! You are \(age) years old.")
}

and the query statement is as follows,

(function_declaration
  (simple_identifier) @func_name
  (parameter) @param_list)

the result of the query is:
image

We want to parse parameter list, but only parameters appear.
In other words, what we want is as follows.

Bag.swift
  pattern: 0
    capture: 0 - func_name, start: (0, 5), end: (0, 10), text: `greet`
    capture: 1 - param_list, start: (0, 11), end: (0, 28), text: `firstName: String, lastName: String, age: Int`

So we checked other Swift codes and found that they all had no parameter list.
Can you tell me if this part is not implemented or if we are doing something wrong?
I wonder if you can tell me the correct query statement if I'm doing something wrong.

I'll wait for your reply.
Sincerely,

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

1 participant