Skip to content

Commit

Permalink
feat: setup the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmfernandes committed Apr 7, 2024
0 parents commit 446eeab
Show file tree
Hide file tree
Showing 37 changed files with 3,173 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,toml,yml,gyp}]
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.rs]
indent_style = space
indent_size = 4

[*.{c,cc,h}]
indent_style = space
indent_size = 4

[*.{py,pyi}]
indent_style = space
indent_size = 4

[*.swift]
indent_style = space
indent_size = 4

[*.go]
indent_style = tab
indent_size = 8

[Makefile]
indent_style = tab
indent_size = 8
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text eol=lf

src/*.json linguist-generated
src/parser.c linguist-generated
src/tree_sitter/* linguist-generated

bindings/** linguist-generated
binding.gyp linguist-generated
setup.py linguist-generated
Makefile linguist-generated
Package.swift linguist-generated
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Rust artifacts
Cargo.lock
target/

# Node artifacts
build/
prebuilds/
node_modules/
*.tgz

# Swift artifacts
.build/

# Go artifacts
go.sum
_obj/

# Python artifacts
.venv/
dist/
*.egg-info
*.whl

# C artifacts
*.a
*.so
*.so.*
*.dylib
*.dll
*.pc

# Example dirs
/examples/*/

# Grammar volatiles
*.wasm
*.obj
*.o
23 changes: 23 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "tree-sitter-selinux"
description = "Selinux grammar for tree-sitter"
version = "0.0.1"
license = "MIT"
readme = "README.md"
keywords = ["incremental", "parsing", "tree-sitter", "selinux"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-selinux"
edition = "2021"
autoexamples = false

build = "bindings/rust/build.rs"
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]

[lib]
path = "bindings/rust/lib.rs"

[dependencies]
tree-sitter = ">=0.22.2"

[build-dependencies]
cc = "1.0.87"
110 changes: 110 additions & 0 deletions Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions Package.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Tree-sitter grammar for SELinux

## Set in Neovim

### Install

Add the following content to the tree-sitter Neovim config:

```lua
init = function()
-- Tree-sitter selinux parser
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.selinux = {
install_info = {
url = "~/src/tree-sitter-selinux",
files = { "src/parser.c" },
-- optional entries:
branch = "main",
generate_requires_npm = false,
requires_generate_from_grammar = false,
},
}
end,
```

See [nvim-treesitter -> adding
parsers](https://github.com/nvim-treesitter/nvim-treesitter?tab=readme-ov-file#adding-parsers) for details.

### Highlights

The queries must be added to the Neovim runtime directory:

```bash
cd ~/.local/share/nvim/lazy/nvim-treesitter/queries
ln -s ~/src/tree-sitter-selinux/queries ./selinux
```
21 changes: 21 additions & 0 deletions binding.gyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions bindings/c/tree-sitter-selinux.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions bindings/c/tree-sitter-selinux.pc.in

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions bindings/go/binding.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions bindings/go/binding_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions bindings/go/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 446eeab

Please sign in to comment.