summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2022-11-27 17:21:33 +0100
committerGitHub <noreply@github.com>2022-11-27 17:21:33 +0100
commit0411c43c9cb8b9c8e7e8a25109d45994e300986e (patch)
treea27a3a0ff7c67a7df0263034a519bb19e4b5c324 /tests
parent96268fa16e05a684aa6dfa7d4b1995834290e25e (diff)
downloadpygments-git-0411c43c9cb8b9c8e7e8a25109d45994e300986e.tar.gz
LilyPond: slightly improve lexing (#2283)
* Handle `--` and `__` as `Token.Punctuation` only if preceded by whitespace: ``` <whitespace> -- ==> hyphen (in lyrics mode) <whitespace> __ ==> extender line (in lyrics mode) -- ==> tenuto, neutral attachment (in music mode) __ ==> portato, down attachment (in music mode) ``` * Handle `-` followed by a number as `Token.Number` only if preceded by whitespace. This is purely heuristic, derived from the coding style shown in the LilyPond manuals. ``` <whitespace> -3 ==> integer (e.g., as a function argument) -3 ==> fingering instruction ``` * Add forgotten `\maxima` note duration. * Some legibility improvements by using verbose mode for regular expressions. * Some comment additions and fixes. * Update tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/examplefiles/lilypond/example.ly5
-rw-r--r--tests/examplefiles/lilypond/example.ly.output18
2 files changed, 18 insertions, 5 deletions
diff --git a/tests/examplefiles/lilypond/example.ly b/tests/examplefiles/lilypond/example.ly
index b2cbb81c..8a2eb1d6 100644
--- a/tests/examplefiles/lilypond/example.ly
+++ b/tests/examplefiles/lilypond/example.ly
@@ -76,7 +76,8 @@ piuPiano = \markup \italic "più piano"
\key d \major
\cadenzaOn
deses'!4.~(\tweak thickness 4\( deses^\p-\signumcongruentiae_1\4
- deses\longa) \myFunc { r } 4 des8 8[ <des ges>8]\)
+ deses\longa) \myFunc { r } 4
+ des8-- 8[__ \ottava -1 <des, ges>8]\) \ottava 0
\bar "||"
\cadenzaOff
\pageBreak
@@ -100,7 +101,7 @@ piuPiano = \markup \italic "più piano"
}
\addlyrics {
\set Score.melismaBusyProperties = #'()
- My Lily -- Song
+ My Lily -- Song __
}
\chordmode {
c cis:dim3+\dim des:maj7/+e\!
diff --git a/tests/examplefiles/lilypond/example.ly.output b/tests/examplefiles/lilypond/example.ly.output
index f5fbe531..b54953d4 100644
--- a/tests/examplefiles/lilypond/example.ly.output
+++ b/tests/examplefiles/lilypond/example.ly.output
@@ -399,21 +399,31 @@
'}' Punctuation
' ' Text.Whitespace
'4' Literal.Number
-' ' Text.Whitespace
+'\n ' Text.Whitespace
'des' Pitch
'8' Literal.Number
+'--' Name.Builtin.Articulation
' ' Text.Whitespace
'8' Literal.Number
'[' Name.Builtin.Articulation
+'__' Name.Builtin.Articulation
+' ' Text.Whitespace
+'\\ottava' Name.Builtin.MusicFunction
+' ' Text.Whitespace
+'-1' Literal.Number
' ' Text.Whitespace
'<' Punctuation
-'des' Pitch
+'des,' Pitch
' ' Text.Whitespace
'ges' Pitch
'>' Punctuation
'8' Literal.Number
']' Name.Builtin.Articulation
'\\)' Name.Builtin.Articulation
+' ' Text.Whitespace
+'\\ottava' Name.Builtin.MusicFunction
+' ' Text.Whitespace
+'0' Literal.Number
'\n ' Text.Whitespace
'\\bar' Name.Builtin.MusicFunction
' ' Text.Whitespace
@@ -477,7 +487,7 @@
'left' Name.Builtin.GrobProperty
'.' Punctuation
'padding' Name.Builtin.GrobProperty
-'-5' Literal.Number
+'-5' Name.Builtin.Articulation
'\\-' Name.Builtin.Articulation
'^"' Literal.String
'Some music' Literal.String
@@ -573,6 +583,8 @@
'--' Punctuation
' ' Text.Whitespace
'Song' Text
+' ' Text.Whitespace
+'__' Punctuation
'\n ' Text.Whitespace
'}' Punctuation
'\n ' Text.Whitespace