Skip to content

Commit

Permalink
Add tree-sitter-make
Browse files Browse the repository at this point in the history
This is actually a fork of tree-sitter-make because the original
author does not seem responsive. See
alemuller/tree-sitter-make#19

test plan:
./test-lang make
  • Loading branch information
pad committed Jul 18, 2023
1 parent 4374124 commit 96fc57e
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@
[submodule "lang/semgrep-grammars/src/tree-sitter-promql"]
path = lang/semgrep-grammars/src/tree-sitter-promql
url = https://github.com/MichaHoffmann/tree-sitter-promql.git
[submodule "lang/semgrep-grammars/src/tree-sitter-make"]
path = lang/semgrep-grammars/src/tree-sitter-make
url = https://github.com/returntocorp/tree-sitter-make
2 changes: 2 additions & 0 deletions lang/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ SUPPORTED_TS_LANGUAGES = \
jsonnet \
kotlin \
lua \
make \
ocaml \
php \
promql \
Expand Down Expand Up @@ -78,6 +79,7 @@ SUPPORTED_DIALECTS = \
julia \
kotlin \
lua \
make \
ocaml \
php \
promql \
Expand Down
1 change: 1 addition & 0 deletions lang/make/Makefile
6 changes: 6 additions & 0 deletions lang/make/extensions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# File extensions for the target language, one per line. This is used for
# collecting parsing stats from the repos specified in 'projects.txt'. e.g.:
#
# .h
# .c
#
3 changes: 3 additions & 0 deletions lang/make/fyi.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
semgrep-grammars/src/tree-sitter-make/LICENSE
semgrep-grammars/src/tree-sitter-make/grammar.js
semgrep-grammars/src/semgrep-make/grammar.js
3 changes: 3 additions & 0 deletions lang/make/projects.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Git URLs of publicly-accessible projects to be used for parsing stats,
# one per line.
#
1 change: 1 addition & 0 deletions lang/semgrep-grammars/lang/make
1 change: 1 addition & 0 deletions lang/semgrep-grammars/src/semgrep-make/Makefile
29 changes: 29 additions & 0 deletions lang/semgrep-grammars/src/semgrep-make/grammar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
semgrep-make
Extends the standard make grammar with semgrep pattern constructs.
*/

const base_grammar = require('tree-sitter-make/grammar');

module.exports = grammar(base_grammar, {
name: 'make',

conflicts: ($, previous) => previous.concat([
]),

/*
Support for semgrep ellipsis ('...') and metavariables ('$FOO'),
if they're not already part of the base grammar.
*/
rules: {
/*
semgrep_ellipsis: $ => '...',
_expression: ($, previous) => choice(
$.semgrep_ellipsis,
...previous.members
),
*/
}
});
1 change: 1 addition & 0 deletions lang/semgrep-grammars/src/semgrep-make/prep
Empty file.
1 change: 1 addition & 0 deletions lang/semgrep-grammars/src/tree-sitter-make
Submodule tree-sitter-make added at 03b0c4

0 comments on commit 96fc57e

Please sign in to comment.