Skip to content

Commit

Permalink
🎉 first push
Browse files Browse the repository at this point in the history
  • Loading branch information
emillon committed Jul 25, 2024
0 parents commit c74f08d
Show file tree
Hide file tree
Showing 9 changed files with 437 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI
on:
push:
branches:
- main
pull_request:

jobs:
nix-fmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- run: nix fmt
- run: nix flake check
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- run: nix build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.direnv/
src/
package.json
60 changes: 60 additions & 0 deletions flake.lock

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

26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
in
{
formatter = pkgs.nixpkgs-fmt;
devShells.default = pkgs.mkShell {
nativeBuildInputs = [ pkgs.tree-sitter ];
};
packages.default = pkgs.tree-sitter.buildGrammar {
generate = true;
version = "n/a";
src = ./.;
language = "dune";
};
});
}
13 changes: 13 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/// <reference types="tree-sitter-cli/dsl" />
// @ts-check

module.exports = grammar({
name: "dune",

rules: {
source_file: $ => repeat($.sexp),
sexp: $ => choice($.atom, $.list),
atom: $ => /[a-zA-Z_%.:/{}\"|=\\,\-!#]+/,
list: $ => seq('(', repeat($.sexp), ')'),
}
});
1 change: 1 addition & 0 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(atom) @variable
41 changes: 41 additions & 0 deletions test/corpus/actions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
=====
copy#
=====

(rule
(targets setup.ml)
(mode fallback)
(action
(copy# setup.defaults.ml setup.ml)))

---

(source_file
(sexp
(list
(sexp
(atom))
(sexp
(list
(sexp
(atom))
(sexp
(atom))))
(sexp
(list
(sexp
(atom))
(sexp
(atom))))
(sexp
(list
(sexp
(atom))
(sexp
(list
(sexp
(atom))
(sexp
(atom))
(sexp
(atom)))))))))
Loading

0 comments on commit c74f08d

Please sign in to comment.