tree-sitter-macaulay2
Macaulay2 grammar for tree-sitter.
The parse tree follows the precedence and newline rules of Macaulay2's own parser; docs/macaulay2-parsing-precedence.md describes how they are modelled.
Queries
| File | Purpose |
|---|---|
highlights.scm |
Syntax highlighting, see docs/highlight-queries.md |
indents.scm |
Indentation |
folds.scm |
Code folding |
tags.scm |
Symbol tags for definitions and method installations |
injections.scm |
Language injections |
queries/macaulay2/ holds deprecated copies of the same files and will be
removed in 7.x.
Usage
Rust
let mut parser = new;
parser.set_language?;
let tree = parser.parse.unwrap;
Node.js
import Parser from "tree-sitter";
import Macaulay2 from "tree-sitter-macaulay2";
const parser = ;
parser.;
const tree = parser.;
Python
=
=
All bindings also export the queries as HIGHLIGHTS_QUERY, INJECTIONS_QUERY,
TAGS_QUERY, INDENTS_QUERY, and FOLDS_QUERY.
Neovim
The parser is not bundled with nvim-treesitter yet. With the master branch of
nvim-treesitter, register it and the .m2 file type, then run
:TSInstall macaulay2:
vim..
require.. =
Neovim reads queries from queries/macaulay2/ on the runtime path; add a clone
of this repository to runtimepath to use them.
Development
Part of the corpus is generated from Macaulay2's own parser; see CONTRIBUTING.md for that workflow and the full set of checks.