#parser #incremental #prisma

tree-sitter-prisma

Primsa grammar for the tree-sitter parsing library

2 releases

0.1.1 Dec 10, 2021
0.1.0 Dec 10, 2021

#352 in Text editors

MIT license

92KB
3K SLoC

C 3K SLoC JavaScript 62 SLoC // 0.1% comments Scheme 35 SLoC Rust 33 SLoC // 0.4% comments

tree-sitter-prisma


lib.rs:

This crate provides a Prisma grammar for the tree-sitter parsing library.

Typically, you will use the language function to add this grammar to a tree-sitter Parser, and then use the parser to parse some code:

use tree_sitter::Parser;

let code = r#"
    datasource db {
      provider = "postgresql"
      url      = env("DATABASE_URL")
    }
"#;
let mut parser = Parser::new();
parser.set_language(tree_sitter_prisma::language()).expect("Error loading Prisma grammar");
let parsed = parser.parse(code, None);

Dependencies

~2.7–4MB
~71K SLoC