add nix infrastructure to build the grammar
This commit is contained in:
11
README.md
11
README.md
@@ -1,4 +1,15 @@
|
|||||||
this will be a tree-sitter implementation for `nix-shell` files.
|
this will be a tree-sitter implementation for `nix-shell` files.
|
||||||
|
|
||||||
|
try one of the following:
|
||||||
|
- `nix build` => build the parser
|
||||||
|
- `nix develop` => manually/interactively generate the parser
|
||||||
|
- `tree-sitter generate`
|
||||||
|
|
||||||
|
non-flake equivalents:
|
||||||
|
- `nix-build`
|
||||||
|
- `nix-shell`
|
||||||
|
|
||||||
|
|
||||||
99% of this repository is code-gen'd garbage.
|
99% of this repository is code-gen'd garbage.
|
||||||
to recreate it or update it, follow this guide:
|
to recreate it or update it, follow this guide:
|
||||||
<https://tree-sitter.github.io/tree-sitter/creating-parsers>
|
<https://tree-sitter.github.io/tree-sitter/creating-parsers>
|
||||||
|
8
default.nix
Normal file
8
default.nix
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
|
|
||||||
|
pkgs.tree-sitter.buildGrammar {
|
||||||
|
src = ./.;
|
||||||
|
version = "0.1.0";
|
||||||
|
language = "nixshell";
|
||||||
|
generate = true;
|
||||||
|
}
|
60
flake.lock
generated
Normal file
60
flake.lock
generated
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1687709756,
|
||||||
|
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1688389917,
|
||||||
|
"narHash": "sha256-RKiK1QeommEsjQ8fLgxt4831x9O6n2gD7wAhVZTrr8M=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "aed4b19d312525ae7ca9bceb4e1efe3357d0e2eb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-23.05",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
20
flake.nix
Normal file
20
flake.nix
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
description = "tree-sitter implementation for nix-shell scripts";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "nixpkgs/nixos-23.05";
|
||||||
|
flake-utils.url = github:numtide/flake-utils;
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
with flake-utils.lib; eachSystem allSystems (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
in rec {
|
||||||
|
packages.tree-sitter-nixshell = pkgs.callPackage ./default.nix { };
|
||||||
|
defaultPackage = packages.tree-sitter-nixshell;
|
||||||
|
|
||||||
|
devShells.default = pkgs.callPackage ./shell.nix { };
|
||||||
|
});
|
||||||
|
}
|
8
grammar.js
Normal file
8
grammar.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
module.exports = grammar({
|
||||||
|
name: 'nixshell',
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
// TODO: add the actual grammar rules
|
||||||
|
source_file: $ => 'hello'
|
||||||
|
}
|
||||||
|
});
|
Reference in New Issue
Block a user