Expand description
This crate provides PostgreSQL and PL/pgSQL language support for the tree-sitter parsing library.
Typically, you will use the LANGUAGE constant to add the PostgreSQL SQL grammar to a tree-sitter Parser, and LANGUAGE_PLPGSQL for PL/pgSQL:
let code = r#"
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_postgres::LANGUAGE;
parser
.set_language(&language.into())
.expect("Error loading Postgres parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());Constantsยง
- LANGUAGE
- The tree-sitter
LanguageFnfor the PostgreSQL SQL grammar. - LANGUAGE_
PLPGSQL - The tree-sitter
LanguageFnfor the PL/pgSQL grammar. - NODE_
TYPES - The content of the [
node-types.json][] file for the PostgreSQL grammar. - NODE_
TYPES_ PLPGSQL - The content of the [
node-types.json][] file for the PL/pgSQL grammar.