diff options
author | Jean-Abou-Samra <37271310+Jean-Abou-Samra@users.noreply.github.com> | 2021-11-21 19:37:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-21 19:37:58 +0100 |
commit | d016802617093378ca9b0a75433051e69a244509 (patch) | |
tree | c359a5967b99e2642fe82e874929641c7fff6c5e /pygments/styles | |
parent | f22728e722228f534378a82283d47b42c9c74f5f (diff) | |
download | pygments-git-d016802617093378ca9b0a75433051e69a244509.tar.gz |
Add lexer and style for LilyPond (#1845)
* Add lexer and style for LilyPond
GNU LilyPond is a text-based music typesetter. Because its concepts
are completely different from programming languages, this adds
a special-purpose to highlight the special tokens.
The SchemeLexer is expanded to gain the ability of detecting when
one expression stops. LilyPondLexer subclasses SchemeLexer.
Builtins (the most important part) are generated with a script
put in external/ (as was already done for Lasso).
As part of this change, the CPSALexer is made no longer to
inherit from SchemeLexer. The inheritance was unused anyway.
* Fixup: translators names have underscores
* Fixup: avoid duplicate builtins
* Fixup: update goldens
* Fixup: typo
* Fixup: add missing tokens to style
* Fixup: update lexer comments
* Fixup: Tentative style adjustments
* Fixup: move test file to examplefiles/
* Fixup: miscellaneous fixes (to be finished)
* Fixup: escape all braces
* Fixup: use Text, not Whitespace
* Fixup: fixes for lexing and style
* Fixup: update goldens!
* Fixup: also test alist assignments
* Fixup: recognize escape sequences in strings
* Fixup: use Comment.Single
* Fixup: Whitespace, not Text!
* Fixup: fix pitch parsing
* Fixup: update comment
* Fixup: remove redundant re.UNICODE
Diffstat (limited to 'pygments/styles')
-rw-r--r-- | pygments/styles/lilypond.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/pygments/styles/lilypond.py b/pygments/styles/lilypond.py new file mode 100644 index 00000000..a49733ed --- /dev/null +++ b/pygments/styles/lilypond.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" + pygments.styles.lilypond + ~~~~~~~~~~~~~~~~~~~~~~~~ + + LilyPond-specific style. + + :copyright: Copyright 2021-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.style import Style +from pygments.token import Token + +class LilypondStyle(Style): + + default_style = "#0000ff" + + styles = { + Token.Whitespace: "", + Token.Text: "", + Token.Keyword: "bold", + Token.Comment: "italic #A3AAB2", + Token.String: "#AB0909", + Token.String.Escape: "#C46C6C", + Token.String.Symbol: "noinherit", + Token.Pitch: "", #"#911520", + Token.Number: "#976806", # includes durations + # A bare 11 is not distinguishable from a number, so we highlight + # the same. + Token.ChordModifier: "#976806", + Token.Name.Lvalue: "#08547A", + Token.Name.BackslashReference: "#08547A", + Token.Name.Builtin.MusicCommand: "bold #08547A", + Token.Name.Builtin.PaperVariable: "bold #6C5A05", + Token.Name.Builtin.HeaderVariable: "bold #6C5A05", + Token.Name.Builtin.MusicFunction: "bold #08547A", + Token.Name.Builtin.Clef: "bold #08547A", + Token.Name.Builtin.Scale: "bold #08547A", + Token.Name.Builtin.RepeatType: "#08547A", + Token.Name.Builtin.Dynamic: "#68175A", + Token.Name.Builtin.Articulation: "#68175A", + Token.Name.Builtin.SchemeFunction: "bold #A83401", + Token.Name.Builtin.SchemeBuiltin: "bold", + Token.Name.Builtin.MarkupCommand: "bold #831E71", + Token.Name.Builtin.Context: "bold #038B8B", + Token.Name.Builtin.ContextProperty: "#038B8B", + Token.Name.Builtin.Grob: "bold #0C7441", + Token.Name.Builtin.GrobProperty: "#0C7441", + Token.Name.Builtin.Translator: "bold #6200A4", + } |