Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoohey31 committed Nov 2, 2023
0 parents commit 0187cea
Show file tree
Hide file tree
Showing 19 changed files with 727 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
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/flake.lock -diff

/bindings/** linguist-generated=true
/src/** linguist-generated=true
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/result
/.direnv

/build/
/Cargo.lock
/node_modules/
/package-lock.json
7 changes: 7 additions & 0 deletions .helix/languages.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[language]]
name = "text"
scope = "source.text"
injection-regex = "text"
file-types = ["txt"]
roots = []
indent = { tab-width = 1, unit = " " }
26 changes: 26 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "tree-sitter-koka"
description = "Koka grammar for the tree-sitter parsing library"
version = "0.0.1"
keywords = ["incremental", "parsing", "koka"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/mtoohey31/tree-sitter-koka"
edition = "2018"
license = "MIT"

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

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

[dependencies]
tree-sitter = "~0.20.3"

[build-dependencies]
cc = "1.0"
19 changes: 19 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"targets": [
{
"target_name": "tree_sitter_koka_binding",
"include_dirs": [
"<!(node -e \"require('nan')\")",
"src"
],
"sources": [
"bindings/node/binding.cc",
"src/parser.c",
# If your language uses an external scanner, add it here.
],
"cflags_c": [
"-std=c99",
]
}
]
}
28 changes: 28 additions & 0 deletions bindings/node/binding.cc

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

19 changes: 19 additions & 0 deletions bindings/node/index.js

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

40 changes: 40 additions & 0 deletions bindings/rust/build.rs

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

52 changes: 52 additions & 0 deletions bindings/rust/lib.rs

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

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.

40 changes: 40 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
description = "tree-sitter-koka";

inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, utils }: {
overlays.default = _: prev: {
tree-sitter = prev.tree-sitter.override {
extraGrammars.tree-sitter-koka = {
language = "koka";
inherit (prev.tree-sitter) version;
src = _: builtins.path { path = ./.; name = "tree-sitter-koka-src"; };
};
};
};
} // utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
overlays = [ self.overlays.default ];
inherit system;
};
inherit (pkgs) mkShell nodejs nodePackages python3 tree-sitter typescript;
in
{
packages.default = tree-sitter.builtGrammars.tree-sitter-koka;

devShells.default = mkShell {
packages = [
nodejs
nodePackages.typescript-language-server
python3
tree-sitter
typescript
];
};
});
}
9 changes: 9 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="tree-sitter-cli/dsl" />
// @ts-check

module.exports = grammar({
name: 'koka',
rules: {
source_file: $ => seq(),
}
})
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "tree-sitter-koka",
"version": "0.1.0",
"description": "Koka grammar for tree-sitter",
"author": "Matthew Toohey <[email protected]>",
"dependencies": {
"nan": "^2.17.0"
},
"devDependencies": {
"tree-sitter-cli": "^0.20.7"
},
"main": "bindings/node",
"tree-sitter": [
{
"scope": "source.koka",
"injection-regex": "koka",
"file-types": ["kk"]
}
]
}
21 changes: 21 additions & 0 deletions src/grammar.json

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

7 changes: 7 additions & 0 deletions src/node-types.json

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

Loading

0 comments on commit 0187cea

Please sign in to comment.