Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tree-sitter-make #437

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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