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

chore: add toml language #519

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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 @@ -127,3 +127,6 @@
[submodule "tree-sitter-c-sharp-pro"]
path = lang/semgrep-grammars/src/tree-sitter-c-sharp-pro
url = https://github.com/tree-sitter/tree-sitter-c-sharp.git
[submodule "lang/semgrep-grammars/src/tree-sitter-toml"]
path = lang/semgrep-grammars/src/tree-sitter-toml
url = git@github.com:tree-sitter-grammars/tree-sitter-toml.git
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the same format than the other; otherwise it might cause issues in some GHA workflows.
https://

1 change: 1 addition & 0 deletions lang/semgrep-grammars/lang/toml
1 change: 1 addition & 0 deletions lang/semgrep-grammars/src/semgrep-toml/Makefile
29 changes: 29 additions & 0 deletions lang/semgrep-grammars/src/semgrep-toml/grammar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
semgrep-toml

Extends the standard toml grammar with semgrep pattern constructs.
*/

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

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

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-toml/prep
Empty file.
1 change: 1 addition & 0 deletions lang/semgrep-grammars/src/tree-sitter-toml
Submodule tree-sitter-toml added at 64b568
1 change: 1 addition & 0 deletions lang/toml/Makefile
6 changes: 6 additions & 0 deletions lang/toml/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/toml/fyi.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
semgrep-grammars/src/tree-sitter-toml/LICENSE
semgrep-grammars/src/tree-sitter-toml/grammar.js
semgrep-grammars/src/semgrep-toml/grammar.js
3 changes: 3 additions & 0 deletions lang/toml/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.
#
Loading