delphin.highlight
This module provides the following Pygments lexers:
-
delphin.highlight.TDLLexer
-- For Type Description Language (TDL) -
delphin.highlight.SimpleMRSLexer
-- For SimpleMRS, a popular serialization format for Minimal Recursion Semantics
In addition, the following Pygments style is included:
-
delphin.highlight.MRSStyle
-- Draws attention to interesting information in SimpleMRS
Examples
The SimpleMRS style is meant for console output, and works with both dark and light backgrounds:
The TDL lexer is used for PyDelphin's Sphinx-based documentation:
Installation and Requirements
This module is a namespace package of PyDelphin, but it does not depend on any PyDelphin packages, rather it only depends on Pygments version 2.3.1 or higher. This means it can be used independently of PyDelphin.
This module can be installed via pip
:
$ pip install delphin.highlight
Note, however, that it will likely not work correctly if installed to
the same environment as a PyDelphin version less than 1.0.0 because of
how namespace packages work. But in this case it is already included
in those versions as delphin.extra.highlight
.
Usage
While you can drop in the lexers into Pygments-capable applications
like wikis or documentation sites, the console highlighting of
SimpleMRS is provided by the PyDelphin package via the delphin convert
command. For instance, the example in the screenshot above
could be created with a command like the following:
$ echo "The chef whose soup spilled quit." \
> | ace -g ~/grammars/erg-2018-x86-64-0.9.30.dat -1 \
> | delphin convert --from ace --color=always --indent