blob: 8630160d0caacf5cc2c5dbe779dfb6d8d2908469 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
% This is a file to test the Lilypond highlighting features of Katepart.
% This is NOT a valid lilypond file, because it also shows the
% highlighting of some invalid lilypond constructs!
% This is a line comment.
%{
this is a block comment, that can occur inside a line, or across
multiple lines.
%}
\header {
title = "Katepart Lilypond syntax highlighting test file"
composer = %{"Wilbert Berendsen"%} "Anonymus"
poet = "The KDE team"
opus = "1"
copyright = "Share and enjoy!"
}
\paper {
#(set-paper-size "a4") % a hash introduces scheme
indent = 0 % recognize variable names inside \paper, \tqlayout etc.
between-system-space = 3\mm
}
\tqlayout {
\context {
\Score
\remove Bar_number_engraver % recognize engraver names
\remove "Bar_number_engraver" % also when quoted!
}
}
% { and << block are folded
\score {
\new StaffGroup <<
\new ChordNames \chordmode { c2sus4/f g2/d c1 }
\new Staff \new Voice ="mel" {
\key f \major
\time 4/4
\partial 4
\set Staff.instrumentName = "Bla."
\once \override Staff.NoteHead #'color = #red
% dynamics, articulations and markup
c8\p d\< e-. f-> g a\f c-5\markup {Hoi}
\notemode { c d e f }
\repeat volta 2 {
% complex durations are highlighted:
g4*2/3
}
\times 2/3 {e8 f g}
% there is some error checking:
% often made mistake to have octavemarks after the duration:
c2'
% invalid durations are caught:
g3
}
\context Lyrics \lyricsto "mel" {
\set fontSize = #1
this is a line of ly -- rics.
with4 dur -- a -- tions.2.
% errors like forgetting spaces are found:
space-- flight %{i.s.o.%} space -- flight
space at end for -- got -- ten as well.}
\new DrumStaff \drummode { hihat4 bassdrum8 }
\new FiguredBass \figuremode {
<5 4>8 <6->
}
>>
\midi {
\context {
\Score
tempoWholesPerMinute = #(ly:make-moment 60 2)
}
}
}
av = #(define-music-function (parser location voice)
(string?)
; scheme comments are recognized in scheme
; Lilypond inside scheme works as well:
#{
\set associatedVoice = $voice
#})
% inside scheme some elements are highlighted:
#(define (naturalise-pitch p)
(let* ((o (ly:pitch-octave p))
(a (* 4 (ly:pitch-alteration p)))
(n (ly:pitch-notename p)))
(bla 'ArticulationEvent 'ChoirStaff)
(cond
((> a 2) (set! a (- a 4)) (set! n (+ n 1)))
((< a -2) (set! a (+ a 4)) (set! n (- n 1))))
(if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7))))
(if (> n 6) (begin (set! o (+ o 1)) (set! n (- n 7))))
(ly:make-pitch o n (/ a 4))))
% markup is also highlighted
\markup {
\line {
text test Voice Staff % note Lilypond keywords are not highlighted here
}
\score { \relative c' { <ceg>2( d) } }
\italic bla
\override #'(baseline-skip . 2) {
\underline blu
}
}
|