Skip to content

v0.2.0

Latest

Choose a tag to compare

@kenshaw kenshaw released this 02 Oct 02:38

transit is a pure Go port of tree-sitter. A program that imports it needs the Go toolchain and nothing else.

Every module of the repository has the tag v0.2.0: the root module, styles, and each module under grammars/.

New grammar modules

SQL grammars, for usql (D106, D107). A module of the language of one dialect has the name of the dialect.

Module Grammar Upstream
grammars/sql sql DerekStride/tree-sitter-sql
grammars/postgres postgres, plpgsql gmr/tree-sitter-postgres
grammars/sqlserver TSQL Crary-Systems/tree-sitter-tsql
grammars/oracle plsql andreasmaierde/tree-sitter-plsql
grammars/cql cql shotover/tree-sitter-cql

Grammars of the languages of dbmeta that are not SQL (D21):

Module Grammar Upstream
grammars/neo4j cypher taekwombo/tree-sitter-cypher
grammars/surrealdb surrealql surrealdb/surrealql-tree-sitter
grammars/sparql sparql GordianDziwis/tree-sitter-sparql
grammars/graphql graphql bkegley/tree-sitter-graphql
grammars/ydb yql udovin/tree-sitter-yql

The test module compares each package with its C grammar: the tables, the lexers, the trees, the edits and the scanners.

The usql grammar is one language

grammars/usql is now one package, usql, in place of the six packages of v0.1.0 (D108). The caller gives it the options of the dialect, with the field names of dbmeta's Syntax:

lang := usql.LanguageFor(usql.Options{
	BlockComments: true,
	HashComments:  true,
	Backticks:     true,
})

usql.Language() has the options of PostgreSQL: dollar quotes and block comments. The packages usqlpostgres, usqlmysql, usqlsqlite, usqlstandard, usqlcql and usqlplain are gone.

Other changes

  • Example functions, which pkg.go.dev shows, in grammars/json (the runtime), grammars/html (the package inject), styles and the root package (D53).
  • The generator names a grammar package after its folder (D107). Every existing package keeps its name.
  • grammars/html requires grammars/javascript, for one of its examples.

Changes that break code

  • A program that imports grammars/usql/usqlpostgres or another package of a family must import grammars/usql and call usql.Language() or usql.LanguageFor.