Warning, /frameworks/syntax-highlighting/autotests/input/highlight.ly is written in an unsupported language. File is not indexed.

0001 % This is a file to test the Lilypond highlighting features of Katepart.
0002 % This is NOT a valid lilypond file, because it also shows the
0003 % highlighting of some invalid lilypond constructs!
0004 % This is a line comment.
0005 
0006 %{
0007 this is a block comment, that can occur inside a line, or across
0008 multiple lines.
0009 %}
0010 
0011 \header {
0012   title = "Katepart Lilypond syntax highlighting test file"
0013   composer = %{"Wilbert Berendsen"%} "Anonymus"
0014   poet = "The KDE team"
0015   opus = "1"
0016   copyright = "Share and enjoy!"
0017 }
0018 
0019 \paper {
0020   #(set-paper-size "a4")  % a hash introduces scheme
0021   indent = 0              % recognize variable names inside \paper, \layout etc.
0022   between-system-space = 3\mm
0023 }
0024 
0025 \layout {
0026   \context {
0027     \Score
0028     \remove Bar_number_engraver   % recognize engraver names
0029     \remove "Bar_number_engraver" % also when quoted!
0030   }
0031 }
0032 
0033 % { and << block are folded
0034 \score {
0035   \new StaffGroup <<
0036     \new ChordNames \chordmode { c2sus4/f g2/d c1 }
0037     \new Staff \new Voice ="mel" {
0038       \key f \major
0039       \time 4/4
0040       \partial 4
0041       \set Staff.instrumentName = "Bla."
0042       \once \override Staff.NoteHead #'color = #red
0043       % dynamics, articulations and markup
0044       c8\p d\< e-. f-> g a\f c-5\markup {Hoi}
0045       \notemode { c d e f }
0046       \repeat volta 2 {
0047         % complex durations are highlighted:
0048         g4*2/3
0049       }
0050       \times 2/3 {e8 f g}
0051       % there is some error checking:
0052       % often made mistake to have octavemarks after the duration:
0053       c2'
0054       % invalid durations are caught:
0055       g3
0056     }
0057     \context Lyrics \lyricsto "mel" {
0058       \set fontSize = #1
0059       this is a line of ly -- rics.
0060       with4 dur -- a -- tions.2.
0061       % errors like forgetting spaces are found:
0062       space-- flight %{i.s.o.%} space -- flight
0063       space at end for -- got -- ten as well.}
0064     
0065     \new DrumStaff \drummode { hihat4 bassdrum8 }
0066     \new FiguredBass \figuremode {
0067       <5 4>8 <6->
0068     }
0069   >>
0070   \midi {
0071     \context {
0072       \Score
0073       tempoWholesPerMinute = #(ly:make-moment 60 2)
0074     }
0075   }
0076 }
0077 
0078 av = #(define-music-function (parser location voice)
0079 (string?)
0080 ; scheme comments are recognized in scheme
0081 ; Lilypond inside scheme works as well:
0082 #{
0083   \set associatedVoice = $voice
0084 #})
0085 
0086 
0087 
0088       
0089 % inside scheme some elements are highlighted:    
0090 #(define  (naturalise-pitch p)
0091   (let* ((o (ly:pitch-octave p))
0092          (a (* 4 (ly:pitch-alteration p))) 
0093          (n (ly:pitch-notename p)))
0094          (bla 'ArticulationEvent 'ChoirStaff)
0095     (cond
0096      ((> a 2) (set! a (- a 4)) (set! n (+ n 1)))
0097      ((< a -2) (set! a (+ a 4)) (set! n (- n 1))))
0098 
0099     (if (< n 0) (begin (set!  o (- o 1)) (set! n (+ n 7))))
0100     (if (> n 6) (begin (set!  o (+ o 1)) (set! n (- n 7))))
0101 
0102     (ly:make-pitch o n (/ a 4))))
0103 
0104 % markup is also highlighted
0105 \markup {
0106   \line {
0107     text test Voice Staff % note Lilypond keywords are not highlighted here
0108   }
0109   \score { \relative c' { <ceg>2( d) } }
0110   \italic bla
0111   \override #'(baseline-skip . 2) {
0112     \underline blu
0113   }
0114 }