Skip to content

gram-data/tree-sitter-cypher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tree-sitter-cypher

Tree-sitter grammar for Cypher, the graph query language used by Neo4j and other graph databases.

Install

Node.js

npm install tree-sitter-cypher tree-sitter

Rust

cargo add tree-sitter-cypher

Usage

Node.js

import Parser from "tree-sitter";
import Cypher from "tree-sitter-cypher";

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

const tree = parser.parse("MATCH (n:Person {name: $name}) RETURN n");
console.log(tree.rootNode.toString());

Rust

let mut parser = tree_sitter::Parser::new();
parser
    .set_language(&tree_sitter_cypher::LANGUAGE.into())
    .expect("Error loading Cypher parser");

let tree = parser.parse("MATCH (n:Person {name: $name}) RETURN n", None).unwrap();
assert!(!tree.root_node().has_error());

Queries

The queries/ directory contains Tree-sitter query files for editor integration:

File Purpose
highlights.scm Syntax highlighting
injections.scm Injects tree-sitter-cypherdoc into /** */ doc comments
tags.scm Symbol tagging for code navigation
locals.scm Variable scope tracking

Related Packages

License

MIT

About

Cypher language port of openCypher to tree-sitter

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors