feat: Add support for GNU Make #510

Merged
wetneb merged 2 commits from twz123/mergiraf:add-make into main 2025-07-23 12:42:37 +02:00
Contributor

(Still figuring out the right tree-sitter queries and examples. If we had support for shell, we could even think about an injection for recipe_line / shell_command. Ugh, what a rabbit hole 😅)

Atomic nodes: recipe_line, shell_command, and raw_text typically hold shell commands or uninterpreted text. Better don't try to merge those.

Commutative parents: Prerequisite lists such as foo: bar baz are represented by list or pattern_list nodes. Make does not care about the order of prerequisites, so new prerequisites can be added in different positions without creating real conflicts.

Signatues: Variable assignments are uniquely identified by their variable name, and rules are keyed by their target. Prevent duplicating them.

Fixes #491.

(Still figuring out the right tree-sitter queries and examples. If we had support for shell, we could even think about an injection for recipe_line / shell_command. Ugh, what a rabbit hole 😅) Atomic nodes: recipe_line, shell_command, and raw_text typically hold shell commands or uninterpreted text. Better don't try to merge those. Commutative parents: Prerequisite lists such as `foo: bar baz` are represented by list or pattern_list nodes. Make does not care about the order of prerequisites, so new prerequisites can be added in different positions without creating real conflicts. Signatues: Variable assignments are uniquely identified by their variable name, and rules are keyed by their target. Prevent duplicating them. Fixes #491.
feat: Add support for GNU Make
All checks were successful
/ test (pull_request) Successful in 1m31s
5b26c5598e
Signed-off-by: Tom Wieczorek <tom@bibbu.net>
Owner

This looks absolutely fantastic as it stands! :)
Let us know if you need any support for the tree-sitter queries. Beyond the possible language injection, do you need them to add specific commutative parents?

This looks absolutely fantastic as it stands! :) Let us know if you need any support for the tree-sitter queries. Beyond the possible language injection, do you need them to add specific commutative parents?
twz123 changed title from WIP: feat: Add support for GNU Make to feat: Add support for GNU Make 2025-07-23 11:35:53 +02:00
Author
Contributor

Thanks! I'm removing the WIP because I'm not sure when I'll have time to look at this again. It definitely won't be in the next few weeks, so it's better not to let this linger for too long.

Thanks! I'm removing the WIP because I'm not sure when I'll have time to look at this again. It definitely won't be in the next few weeks, so it's better not to let this linger for too long.
wetneb approved these changes 2025-07-23 12:41:52 +02:00
@ -1014,0 +1019,4 @@
language: tree_sitter_make::LANGUAGE.into(),
atomic_nodes: vec!["recipe_line", "shell_command", "raw_text"],
commutative_parents: vec![
CommutativeParent::without_delimiters("list", " "),
Owner

I was a bit worried to see that all lists are made commutative, but looking at the grammar, this node type seems to be only used in places where it does make sense.

I was a bit worried to see that all lists are made commutative, but looking at the grammar, this node type seems to be only used in places where it does make sense.
wetneb merged commit a63afa8b43 into main 2025-07-23 12:42:37 +02:00
wetneb referenced this pull request from a commit 2025-07-23 12:42:38 +02:00
twz123 deleted branch add-make 2025-07-23 13:54:23 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: mergiraf/mergiraf#510
No description provided.