aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Pygments/py3/pygments/lexers/lilypond.py
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-06-09 14:39:19 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-06-09 14:39:19 +0300
commitc04b663c7bb4b750deeb8f48f620497ec13da8fa (patch)
tree151ebc8bfdd2ad918caf5e6e2d8013e14272ddf8 /contrib/python/Pygments/py3/pygments/lexers/lilypond.py
parent0d55ca22c507d18c2f35718687e0b06d9915397b (diff)
downloadydb-c04b663c7bb4b750deeb8f48f620497ec13da8fa.tar.gz
intermediate changes
ref:2d4f292087954c9344efdabb7b2a67f466263c65
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/lilypond.py')
-rw-r--r--contrib/python/Pygments/py3/pygments/lexers/lilypond.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/lilypond.py b/contrib/python/Pygments/py3/pygments/lexers/lilypond.py
index 9705cbadcb..0debac85dd 100644
--- a/contrib/python/Pygments/py3/pygments/lexers/lilypond.py
+++ b/contrib/python/Pygments/py3/pygments/lexers/lilypond.py
@@ -4,13 +4,13 @@
Lexer for LilyPond.
- :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
-from pygments.lexer import default, inherit, words
+from pygments.lexer import bygroups, default, inherit, words
from pygments.lexers.lisp import SchemeLexer
from pygments.lexers._lilypond_builtins import (
keywords, pitch_language_names, clefs, scales, repeat_types, units,
@@ -37,7 +37,7 @@ def builtin_words(names, backslash, suffix=NAME_END_RE):
class LilyPondLexer(SchemeLexer):
"""
- Lexer for input to `LilyPond <https://lilypond.org>`_, a text-based music typesetter.
+ Lexer for input to LilyPond, a text-based music typesetter.
.. important::
@@ -46,6 +46,7 @@ class LilyPondLexer(SchemeLexer):
.. versionadded:: 2.11
"""
name = 'LilyPond'
+ url = 'https://lilypond.org'
aliases = ['lilypond']
filenames = ['*.ly']
mimetypes = []
@@ -99,7 +100,7 @@ class LilyPondLexer(SchemeLexer):
# - chord: < >,
# - bar check: |,
# - dot in nested properties: \revert NoteHead.color,
- # - equals sign in assignemnts and lists for various commands:
+ # - equals sign in assignments and lists for various commands:
# \override Stem.color = red,
# - comma as alternative syntax for lists: \time 3,3,2 4/4,
# - colon in tremolos: c:32,
@@ -169,7 +170,9 @@ class LilyPondLexer(SchemeLexer):
(r"([^\W\d]|-)+(?=([^\W\d]|[\-.])*\s*=)", Token.Name.Lvalue),
# Virtually everything can appear in markup mode, so we highlight
- # as text.
+ # as text. Try to get a complete word, or we might wrongly lex
+ # a suffix that happens to be a builtin as a builtin (e.g., "myStaff").
+ (r"([^\W\d]|-)+?" + NAME_END_RE, Token.Text),
(r".", Token.Text),
],
"string": [
@@ -188,9 +191,9 @@ class LilyPondLexer(SchemeLexer):
# everything that looks like a-known-property.foo.bar-baz as
# one single property name.
"maybe-subproperties": [
- (r"\.", Token.Punctuation),
(r"\s+", Token.Whitespace),
- (r"([^\W\d])+" + NAME_END_RE, Token.Name.Builtin.GrobProperty),
+ (r"(\.)((?:[^\W\d]|-)+?)" + NAME_END_RE,
+ bygroups(Token.Punctuation, Token.Name.Builtin.GrobProperty)),
default("#pop"),
]
}