npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tree-sitter-ktav

v0.6.1

Published

Tree-sitter grammar for Ktav (כְּתָב) — the Written Configuration Format

Readme

tree-sitter-ktav

面向 Ktav (כְּתָב)(书面配置 格式)的 tree-sitter 语法。

语言: English · Русский · 简体中文

演练场: 在浏览器中互转 JSON / YAML / TOML / INI ⇄ Ktav — ktav-lang.github.io

Crates.io CI License: MIT OR Apache-2.0 Playground npm


什么是 Ktav?

Ktav(希伯来语 כְּתָב,"书写")是一种纯文本配置格式。形态与 JSON 相同(标量、数组、对象、null、布尔值),但字符串无引号、无逗 号,并使用点式键(server.port: 8080)表示嵌套。完整规范——所有官 方 Ktav 实现共同遵循的——在 ktav-lang/spec 仓库中。

什么是 tree-sitter?

Tree-sitter 是一种增 量解析器生成器。编辑器(Neovim、Helix、Emacs、VS Code、Zed 等)使用 它实现语法高亮、代码折叠、结构化选择以及其他需要真正解析树而非正则 词法器的功能。每种语言都有自己的语法包;本包就是 Ktav 的语法。

安装

Rust

[dependencies]
tree-sitter      = "0.25"
tree-sitter-ktav = "0.6.0"
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut parser = tree_sitter::Parser::new();
    parser.set_language(&tree_sitter_ktav::LANGUAGE.into())?;

    let source = "name: Russia\nport: 8080\n";
    let tree = parser.parse(source, None).unwrap();
    println!("{}", tree.root_node().to_sexp());
    Ok(())
}

Node.js

npm install tree-sitter tree-sitter-ktav
const Parser = require("tree-sitter");
const Ktav   = require("tree-sitter-ktav");

const parser = new Parser();
parser.setLanguage(Ktav);

const tree = parser.parse("name: Russia\nport: 8080\n");
console.log(tree.rootNode.toString());

编辑器集成

Neovim(搭配 nvim-treesitter

在语法尚未上游之前,请在配置中手动注册:

require("nvim-treesitter.parsers").get_parser_configs().ktav = {
  install_info = {
    url = "https://github.com/ktav-lang/tree-sitter-ktav",
    files = { "src/parser.c" },
    branch = "main",
  },
  filetype = "ktav",
}

vim.filetype.add({ extension = { ktav = "ktav" } })

随后执行 :TSInstall ktav。把 queries/highlights.scmqueries/locals.scmqueries/injections.scm 放入 ~/.config/nvim/queries/ktav/(或让 nvim-treesitter 自动从仓库 拉取)。

Helix

~/.config/helix/languages.toml 中:

[[language]]
name      = "ktav"
scope     = "source.ktav"
file-types = ["ktav"]
roots     = []
comment-token = "#"
indent    = { tab-width = 4, unit = "    " }

[[grammar]]
name   = "ktav"
source = { git = "https://github.com/ktav-lang/tree-sitter-ktav", rev = "main" }

随后执行 hx --grammar fetch && hx --grammar build

其他编辑器

语法导出标准的 tree-sitter 节点类型元数据 (src/node-types.json)和查询文件(queries/*.scm),任何支持 tree-sitter 的编辑器都可以在解析器构建后直接使用。

节点类型

语法生成以下命名节点:

| 节点 | 捕获内容 | |---------------------------|-----------------------------------------------| | source_file | 整个文档 | | comment | # 行注释 | | blank_line | 空行 | | object_pair | key SEP value 行 | | key / dotted_key | 键部分(可包含 . 分隔符) | | sep_string / sep_raw / sep_int / sep_float | 四种分隔符 | | keyword / kw_null / kw_true / kw_false | 关键字 | | scalar | 通用单行值正文 | | compound_object | {} 块 | | compound_array | [] 块 | | array_item | 数组中的单个元素 | | multiline_stripped | () 块 | | multiline_verbatim | (()) 块 | | multiline_content_line | 多行字符串内的单行 | | empty_object / empty_array / empty_paren / empty_double_paren | 内联空形式 | | empty_value | 分隔符紧跟行尾 |

object_pair 暴露字段 keyseparatorvaluearray_item 暴露 marker(可选)和 value

从源码构建

git clone https://github.com/ktav-lang/tree-sitter-ktav.git
cd tree-sitter-ktav
npm install
npx tree-sitter generate     # 生成 src/parser.c
npx tree-sitter test         # 运行语料库

src/parser.csrc/grammar.jsonsrc/node-types.jsonsrc/tree_sitter/* 按 tree-sitter 惯例已纳入 git,下游消费者无需 CLI 即可构建。

状态

0.6.0 — 实现 Ktav 0.6.0。 语法接受所有合法的 Ktav 0.6.0 文档(对 spec 仓库下 tests/valid/*.ktav 全部用例验证通过)。它是一个语法接受器,而非 严格的规范校验器——少数语法接受但规范拒绝的边界情况(主要是 § 6.10 "标记后必须有空格")见 CHANGELOG.md

许可证

MIT OR Apache-2.0。详见 LICENSE-MITLICENSE-APACHE

其他 Ktav 仓库

  • spec — 规范与一致性测试套件
  • rust — Rust(cargo add ktav
  • csharp — C# / .NET(dotnet add package Ktav
  • golang — Go
  • java — Java / JVM(Maven Central)
  • js — JS / TS(npm install @ktav-lang/ktav
  • php — PHP(composer require ktav-lang/ktav
  • python — Python(pip install ktav