From 2f7430af70b2f531eeadaf71707200350ea928a7 Mon Sep 17 00:00:00 2001 From: Muhammad Talal Anwar Date: Fri, 4 Oct 2024 17:28:12 +0200 Subject: [PATCH] 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"] } ] ``` --- crates/languages/src/c/runnables.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 crates/languages/src/c/runnables.scm diff --git a/crates/languages/src/c/runnables.scm b/crates/languages/src/c/runnables.scm new file mode 100644 index 0000000000000000000000000000000000000000..4eaf5f730e10594e97ad7819efb5d3ff1013bc7e --- /dev/null +++ b/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) +)