Emacs major modes for NLP++ and the files an NLP++ analyzer is made of. They use tree-sitter and need Emacs 29.1 or later.
| Mode | Files |
|---|---|
nlpplus-ts-mode |
Pass files: *.nlp, *.pat |
nlpplus-ts-dict-mode |
Dictionaries: kb/user/*.dict |
nlpplus-ts-kbb-mode |
Knowledge bases: *.kbb |
nlpplus-ts-seq-mode |
Pass sequences: analyzer.seq |
nlpplus-ts-tree-mode |
Parse trees: *_log/*.tree |
All five modes highlight their files. nlpplus-ts-mode also provides indentation, imenu, and
navigation by function and rule (beginning-of-defun, end-of-defun). It also registers the
NLP++ language server with Eglot.
-
Install the package:
(use-package nlpplus-ts-mode :vc (:url "https://github.com/VisualText/nlpplus-ts-mode"))
-
Install the grammars from tree-sitter-nlpplus by running
M-x nlpplus-ts-mode-install-grammars. This needs a C compiler.If your Emacs's tree-sitter library is older than 0.25 (ABI 14), the command builds the grammars from their
abi-14branch. The official Windows build of Emacs 30 has that older library. -
For the language server, install it with
npm i -g nlpplus-language-server. Then runM-x eglotin a pass file.
nlpplus-ts-mode-indent-offset (default 4) sets the indentation step in pass files.
To change how much is colored, set treesit-font-lock-level. Level 4 also colors function calls,
operators and punctuation.
MIT