crates/languages/src/c/runnables.scm 🔗
@@ -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)
+)
Muhammad Talal Anwar created
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"]
}
]
```
crates/languages/src/c/runnables.scm | 10 ++++++++++
1 file changed, 10 insertions(+)
@@ -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)
+)