c: Add runnable for main function (#18720)

Release Notes:

- Added Runnable for C main function

This tags can then be used in tasks, for example:

```json
[
  {
    "label": "Run ${ZED_STEM}",
    "command": "gcc",
    "args": [
      "$ZED_FILE",
      "-o",
      "${ZED_DIRNAME}/${ZED_STEM}.out",
      "&&",
      "${ZED_DIRNAME}/${ZED_STEM}.out"
    ],
    "tags": ["c-main"]
  }
]

```
This commit is contained in:
Muhammad Talal Anwar 2024-10-04 17:28:12 +02:00 committed by GitHub
parent d012e35b04
commit 2f7430af70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,10 @@
; Tag the main function
(
(function_definition
declarator: (function_declarator
declarator: (identifier) @run
)
) @c-main
(#eq? @run "main")
(#set! tag c-main)
)