Hi LilyPonders,

I'm following Graham's suggestion[0] and I'm asking here if you could please test the attached lilypond language file for source-highlight.

There's an issue on the tracker[1] about syntax highlighting in the doc.
The first step to make it happen is writing a language file for a third party package called source-highlight[2]. Before submitting it to source-highlight developers I'd appreciate some feedback from you. Not much about color scheme (I'm trying to follow Frescobaldi highlighting as much as possible).. what I really need is being sure that the regexp work fine in "real" files. The files I've tested so far seem to work fine now (with this last version I'm attaching), but I may have missed something.

On Linux you just need to install the source-highlight package.
On Windows you may want to try these binaries[3]. It's v1.2.1 while I'm using v3.1.5, so I don't guarantee it will work.

Once you have source-highlight installed, place the attached files in a directory, open the terminal and change to that directory. Then launch the following command:

source-highlight -s lilypond.lang --style-file=lilypond.style -i test.ly -o test.html

NOTE: input files can be anywhere, but lilypond.lang, lilypond.style and lang.map must be in the current working directory (i.e. where you launch the command).

You can test it using your files or Mutopia files (better if v2.14, see advanced search of Mutopia).

I'll send the files to source-highlight developers next Sunday.
If you have any comment/improvement let me know.

Thanks,
Federico

[0] http://lists.gnu.org/archive/html/lilypond-devel/2011-12/msg00722.html
[1] http://code.google.com/p/lilypond/issues/detail?id=1005
[2] http://www.gnu.org/software/src-highlite/
[3] http://gnuwin32.sourceforge.net/packages/source-highlight.htm
java = java.lang 
moc = cpp.lang
cpp = cpp.lang
c = c.lang
C = cpp.lang
cc = cpp.lang
cs = csharp.lang
csharp = csharp.lang
h = cpp.lang
hh = cpp.lang
H = cpp.lang
hpp = cpp.lang
javascript = javascript.lang
js = javascript.lang
prolog = prolog.lang
pl = prolog.lang
perl = perl.lang
pm = perl.lang
php3 = php.lang
php4 = php.lang
php5 = php.lang
php = php.lang
ctp = php.lang
protobuf = proto.lang
proto = proto.lang
python = python.lang
py = python.lang
ruby = ruby.lang
rb = ruby.lang
flex = flex.lang
lex = flex.lang
l = flex.lang
ll = flex.lang
bison = bison.lang
yacc = bison.lang
y = bison.lang
yy = bison.lang
changelog = changelog.lang
lua = lua.lang
ml = caml.lang
caml = caml.lang
mli = caml.lang
sml = sml.lang
sig = sml.lang
syslog = log.lang
log = log.lang
pas = pascal.lang
pascal = pascal.lang    
fortran = fortran.lang
free-fortran = fortran.lang
fixed-fortran = fixed-fortran.lang
html = html.lang
htm = html.lang
tex = latex.lang
latex = latex.lang
cls = latex.lang
sty = latex.lang
dtx = latex.lang
lgt = logtalk.lang
logtalk = logtalk.lang
diff = diff.lang
patch = diff.lang
lang = langdef.lang
langdef = langdef.lang
outlang = outlang.lang
style = style.lang
ps = postscript.lang
eps = postscript.lang
postscript = postscript.lang
kcfg = xml.lang
ui = xml.lang
kdevelop = xml.lang
rc = xml.lang
docbook = xml.lang
kidl = xml.lang
xml = xml.lang
xhtml = xml.lang
bash = sh.lang
sh = sh.lang
csh = sh.lang
ksh = sh.lang
tcsh = sh.lang
shell = sh.lang
tcl = tcl.lang
tk = tcl.lang
txt = nohilite.lang
sql = sql.lang
bib = bib.lang
makefile = makefile.lang
am = makefile.lang
in = makefile.lang
css = css.lang
m4 = m4.lang
ac = m4.lang
autoconf = m4.lang
sl = slang.lang
slsh = slang.lang
slang = slang.lang
properties = properties.lang
desktop = desktop.lang
ini = desktop.lang
conf = conf.lang
lsm = lsm.lang
spec = spec.lang
haxe = haxe.lang
hx = haxe.lang
ldap = ldap.lang
ldif = ldap.lang
glsl = glsl.lang
xorg = xorg.lang
scala = scala.lang
ada = ada.lang
adb = ada.lang
pc = pc.lang
pkgconfig = pc.lang
oz = oz.lang
texinfo = texinfo.lang
texi = texinfo.lang
hs = haskell.lang
hs = haskell.lang
lhs = haskell_literate.lang
haskell = haskell.lang
manifest = manifest.lang
mf = manifest.lang
asm = asm.lang
s = asm.lang
applescript = applescript.lang
scpt = applescript.lang
vbscript = vbscript.lang
vbs = vbscript.lang
awk = awk.lang
bat = bat.lang
batch = bat.lang
clipper = clipper.lang
prg = clipper.lang
cbl = cobol.lang
cobol = cobol.lang
dmd = d.lang
d = d.lang
errors = errors.lang
erl = erlang.lang
erlang = erlang.lang
vala = vala.lang
lisp = lisp.lang
el = lisp.lang
scm = scheme.lang
scheme = scheme.lang
po = po.lang
pot = po.lang
opa = opa.lang
javalog = javalog.lang
upc = upc.lang
tml = tml.lang
ly = lilypond.lang
# Symbols
cbracket = "{|}"
symbol = "(|)|~|^|_"
dynamic = '\\(<|>|!|f{1,5}|p{1,5}|m(f|p)|fp|(r|s)fz|s(f|p){1,2})(?!\w)'
string delim "\"" "\""

# Scheme
scheme_block delim "#'((" "))" multiline
scheme delim '#(\'|\()' '\)|$' # single line only

# Comments
comment delim "%{" "%}" multiline nested
comment start "%"

# Numbers
specialchar = '(?<!#)-[1-5]\b', '\\[0-9]\b' # strings and fingerings
note_duration = '(?<=[a-z\',!?>])(1|2|4|8|16|32|64|128)(\.+|\b)'
value = '\d+'

# Markup commands
markup_command = '\\(bold|box|center-column|hspace|italic|line|justified-line',
                 'markup(list)?|\musicglyph|normal-text|override-lines',
                 'small(er)?|table-of-contents|teeny|vspace|with-(url|color)',
                 'wordwrap(-lines)?)'

lyric_command = '\\(lyricmode|lyrics(to)?)'

# Commands
preproc = '\\(book(part)?|context|consists|header|include|language|layout',
          'midi|once|override(Property)?|paper|remove(WithTag)?',
          'revert|score|(un)?set|version|with)\b'

# Attributes of music functions
attribute = '(alto|baritone|bass|french|mezzosoprano|percussion',
            'soprano|subbass|tenor|treble|varbaritone',
            'percent|tremolo|unfold|volta',
            
'\\(aeolian|dorian|ionian|lydian|locrian|minor|major|mixolydian|phrygian))\b'

header_variables = 'arranger', 'breakbefore', 'composer', 'copyright', 'date',
    'dedication', 'enteredby', 'filename', 'footer', 'instrument\b', 
'lastupdated',
    'maintainer(Email|Web)?', 'meter', 'moreInfo',
    'mutopia(composer|instrument|opus|poet|title)?',
    'opus', 'poet', 'piece', 'source(url)?', 'style', '(sub){0,2}title',
    'tagline', 'texidoc'

# Contexts: regexp is too hungry, a list is better
# old regexp: '([A-Z][a-z]+){2,}'
context = '\\?(ChoirStaff|ChordNames|CueVoice|Devnull|Drum(Staff|Voice)',
          'Dynamics|FiguredBass|FretBoards|Global|GrandStaff',
          'GregorianTranscription(Staff|Voice)|Lyrics|Mensural(Staff|Voice)',
          'NoteNames|PianoStaff|RhythmicStaff|Score|Staff(Group)?',
          'Tab(Staff|Voice)|Vaticana(Staff|Voice)|Voice)\b'

# Layout objects
layout_object = 'Accidental(Cautionary|Placement|Suggestion)?',
                'Ambitus(Accidental|Line|NoteHead)?', 'Arpeggio', 
'BalloonTextItem',
                'Bar(Line|Number)?',
                
'BassFigure(Alignment(Positioning)?|Bracket|Continuation|Line)?',
                'Beam', 'BendAfter', 'Break(AlignGroup|Alignment)?', 
'BreathingSign',
                'ChordName', 'Clef', 'Cluster(Spanner(Beacon)?)', 
'CombineTextScript',
                'Cue(Clef|EndClef)?', 'Custos', 'Dot(Column|s)?',
                'Double(PercentRepeat(Counter)?|RepeatSlash)?',
                'Dynamic(LineSpanner|Text|TextSpanner)?\b', 'Episema', 
'Fingering',
                'Footnote(Item|Spanner)', 'FretBoard', 'Glissando', 
'GraceSpacing',
                'Grid(Line|Point)', 'Hairpin', 'HorizontalBracket',
                'Instrument(Name|Switch)', 'Key(Cancellation|Signature)',
                'Laissez(VibrerTie(Column)?)', 'LedgerLineSpanner',
                'LeftEdge', 'LigatureBracket',
                'Lyric(Extender|Hyphen|Space|Text)', 'MeasureGrouping',
                'MelodyItem', 'MensuralLigature', 'MetronomeMark',
                'MultiMeasureRest(Number|Text)?', 'NonMusicalPaperColumn',
                'Note(Collision|Column|Head|Name|Spacing)', 'OctavateEight',
                'OttavaBracket', 'PaperColumn', 'ParenthesesItem',
                'Percent(Repeat(Counter)?)', 'PhrasingSlur', 
'PianoPedalBracket',
                'RehearsalMark', 'Repeat(Slash|Tie(Column)?)', 
'Rest(Collision)?',
                'Script(Column|Row)?', 'Slur', 'Sostenuto(Pedal(LineSpanner)?)',
                'SpacingSpanner', 'SpanBar', 'Staff(Grouper|Spacing|Symbol)',
                'StanzaNumber', 'Stem(Tremolo)?', 'StringNumber', 
'StrokeFinger',
                'SustainPedal(LineSpanner)?',
                'System(StartBar|StartBrace|StartBracket|StartSquare)?',
                'TabNoteHead', 'Text(Script|Spanner)', 'Tie(Column)?', 
'TimeSignature',
                'TrillPitch(Accidental|Group|Head)', 'TrillSpanner',
                'Tuplet(Bracket|Number)', 'UnaCordaPedal(LineSpanner)?',
                'VaticanaLigature', 'Vertical(Alignment|AxisGroup)', 
'VoiceFollower',
                'VoltaBracket(Spanner)?'

# Context properties
# regexp a bit hungry with user-defined variables
context_property = '\b[a-z]+([A-Z]+[a-z]+)+',
                   'ottavation|output|stanza|timing|tonic'

# Layout properties
layout_property = '\b[a-z]+(-[a-z]+)+', 'indent'

# All the other commands (including variables defined by users)
function = '\\[[:alpha:]]+'

symbol pink b ;
cbracket, preproc black b ;
dynamic orange ;

string "#C20F0F" ;
scheme, scheme_block "#A04900" ;
comment gray i ;

note_duration teal ;
value "#808000" ;
specialchar orange ;

function "#0000C0" b ;
markup_command "#008000" ;
lyric_command "#006000" b ;

header_variables, attribute blue ;
context pink b ;
layout_object pink ;
context_property, layout_property blue ;

%%% COMMENTS => grey
% Single comment
not a comment % right comment

%{ Multiple
  lines
  
  %{ nested
  multiple %}
  
  comment
%}



%%% STRINGS => red
\version "2.14.2"
\markup_"Lily rocks!"



%%% SYMBOLS
| % bar checks
\\ % voices separator
( ) % slurs
~ % tie
^ _ % markup placement
*
c'' c,,,, % octave


%% DYNAMICS
The available dynamic marks are \ppppp, \pppp, \ppp, \pp, \p,
\mp, \mf, \f, \ff, \fff, \ffff, \fffff, \fp, \sf, \sff, \sp, 
\spp, \sfz, and \rfz.


%%% NUMBERS
% Note duration
\relative {
  a1 a11 a111 a18 a81 a181 
  b2 b22 b222 b25 b52 b252
  a1. a1.. a1... .a1 ..a1 .a1.
  a2. a2.. a2... .a2 ..a2 .a2.
  c4 c44 c444 c47 c74 c474
  d8 d88 d888 d82 d28 d828
  e16 e1616 e161616 e162 e16216
  f32 f3232 f323232 f324 f32432
  g64 g6464 g646464 g641 g64164
  e128 e1288 e2128
  eis!2 ees?16
}

% String and fingering numbers
e8\2 e8-4\0 f-5 g\3



%%% SCHEME
% one line
\once \override Tie #'staff-position = #3.5
tempoWholesPerMinute = #(ly:make-moment 120 4)
tagline = \markup { \override #'(box-padding . 1.0) \override #'(baseline-skip 
. 2.7) }

% multiline
\override VerticalAxisGroup #'default-staff-staff-spacing =
  #'((basic-distance . 8)
     (minimum-distance . 7)
     (padding . 1))



%%% COMMANDS

% Main commands
\book \bookpart \context \header \include \language \layout \midi
\once \override \overrideProperty \paper \remove \removeWithTag \revert
\score \set \unset \version \with 

% Lyric commands
\lyricmode \lyrics \lyricsto

% Markup commands
\markup \markuplist
\bold \box \center-column \hspace \italic \line
\musicglyph \normal-text \override-lines
\small \smaller \table-of-contents \teeny \vspace
\with-url \with-color \wordwrap \wordwrap-lines

% Other commands
\acciaccatura \appoggiatura \arpeggio \bar \bendAfter \break \breathe \clef
\glissando \grace \harmonic \hideNotes \laissezVibrer \melisma \mark
\new \noBeam \noBreak \noPageBreak \noPageTurn \normalsize
\oneVoice \ottava \pageBreak \pageTurn \parallelMusic
\parenthesize \partcombine \partial
\quilisma \quoteDuring \repeat \repeatTie \rest
\relative \repeat unfold 4 \repeat volta 4 
\slurDown \slurNeutral \slurUp \tag \tempo \time \times
\transpose \tupletDown \tupletNeutral \tupletUp
\unHideNotes \unfoldRepeats \voiceOne \voiceThree \voiceFour
\coda \fermata \varcoda \rfz \rheel \rtoe

%%% VARIABLES defined by users
\whatever \youLike






% Conventions: 
Documentation/learning/naming-conventions-of-objects-and-properties.html

% CONTEXTS
ChoirStaff
ChordNames
CueVoice
Devnull
DrumStaff
DrumVoice
FiguredBass
FretBoards
Global
GrandStaff
GregorianTranscriptionStaff
GregorianTranscriptionVoice
Lyrics
MensuralStaff
MensuralVoice
NoteNames
PianoStaff
RhythmicStaff
Score
Staff
StaffGroup
TabStaff
TabVoice
VaticanaStaff
VaticanaVoice
Voice

% LAYOUT OBJECTS
Accidental
AccidentalCautionary
AccidentalPlacement
AccidentalSuggestion
Ambitus
AmbitusAccidental
AmbitusLine
AmbitusNoteHead
Arpeggio
BalloonTextItem
Bar
BarLine
BarNumber
BassFigure
BassFigureAlignment
BassFigureAlignmentPositioning
BassFigureBracket
BassFigureContinuation
BassFigureLine
Beam
BendAfter
Break
BreakAlignGroup
BreakAlignment
BreathingSign
ChordName
Clef
ClusterSpanner
ClusterSpannerBeacon
CombineTextScript
Cue
CueClef
CueEndClef
Custos
Dot
DotColumn
Dots
Double
DoublePercentRepeat
DoublePercentRepeatCounter
DoubleRepeatSlash
Dynamic
DynamicLineSpanner
DynamicText
DynamicTextSpanner
Episema
Fingering
FootnoteItem
FootnoteSpanner
FretBoard
Glissando
GraceSpacing
GridLine
GridPoint
Hairpin
HorizontalBracket
InstrumentName
InstrumentSwitch
KeyCancellation
KeySignature
LaissezVibrerTie
LaissezVibrerTieColumn
LedgerLineSpanner
LeftEdge
LigatureBracket
LyricExtender
LyricHyphen
LyricSpace
LyricText
MeasureGrouping
MelodyItem
MensuralLigature
MetronomeMark
MultiMeasureRest
MultiMeasureRestNumber
MultiMeasureRestText
NonMusicalPaperColumn
NoteCollision
NoteColumn
NoteHead
NoteName
NoteSpacing
OctavateEight
OttavaBracket
PaperColumn
ParenthesesItem
PercentRepeat
PercentRepeatCounter
PhrasingSlur
PianoPedalBracket
RehearsalMark
RepeatSlash
RepeatTie
RepeatTieColumn
Rest
RestCollision
Script
ScriptColumn
ScriptRow
Slur
SostenutoPedal
SostenutoPedalLineSpanner
SpacingSpanner
SpanBar
StaffGrouper
StaffSpacing
StaffSymbol
StanzaNumber
Stem
StemTremolo
StringNumber
StrokeFinger
SustainPedal
SustainPedalLineSpanner
System
SystemStartBar
SystemStartBrace
SystemStartBracket
SystemStartSquare
TabNoteHead
TextScript
TextSpanner
Tie
TieColumn
TimeSignature
TrillPitchAccidental
TrillPitchGroup
TrillPitchHead
TrillSpanner
TupletBracket
TupletNumber
UnaCordaPedal
UnaCordaPedalLineSpanner
VaticanaLigature
VerticalAlignment
VerticalAxisGroup
VoiceFollower
VoltaBracket
VoltaBracketSpanner



%%% CONTEXT PROPERTIES
%%% aaa or aaaAaaaAaaa
aDueText
alignAboveContext
alignBassFigureAccidentals
alignBelowContext
associatedVoice
autoAccidentals
autoBeamCheck
autoBeaming
autoCautionaries
automaticBars
barAlways
barCheckSynchronize
barNumberVisibility
bassFigureFormatFunction
bassStaffProperties
beatGrouping
beatLength
chordChanges
chordNameExceptions
chordNameExceptionsFull
chordNameExceptionsPartial
chordNameFunction
chordNameSeparator
chordNoteNamer
chordPrefixSpacer
chordRootNamer
clefGlyph
clefOctavation
clefPosition
connectArpeggios
countPercentRepeats
createKeyOnClefChange
createSpacing
crescendoSpanner
crescendoText
currentBarNumber
decrescendoSpanner
decrescendoText
defaultBarType
doubleRepeatType
doubleSlurs
drumPitchTable
drumStyleTable
explicitClefVisibility
explicitKeySignatureVisibility
extendersOverRests
extraNatural
figuredBassAlterationDirection
figuredBassCenterContinuations
figuredBassFormatter
figuredBassPlusDirection
fingeringOrientations
firstClef
followVoice
fontSize
forbidBreak
forceClef
gridInterval
harmonicAccidentals
highStringOne
ignoreBarChecks
ignoreFiguredBassRest
ignoreMelismata
implicitBassFigures
implicitTimeSignatureVisibility
instrumentCueName
instrumentEqualizer
instrumentName
instrumentTransposition
internalBarNumber
keepAliveInterfaces
keyAlterationOrder
keySignature
lyricMelismaAlignment
majorSevenSymbol
markFormatter
maximumFretStretch
measureLength
measurePosition
melismaBusyProperties
metronomeMarkFormatter
middleCClefPosition
middleCOffset
middleCPosition
midiInstrument
midiMaximumVolume
midiMinimumVolume
minimumFret
minimumPageTurnLength
minimumRepeatLengthForPageTurn
noteToFretFunction
ottavation
output
pedalSostenutoStrings
pedalSostenutoStyle
pedalSustainStrings
pedalSustainStyle
pedalUnaCordaStrings
pedalUnaCordaStyle
printKeyCancellation
printOctaveNames
printPartCombineTexts
proportionalNotationDuration
recordEventSequence
rehearsalMark
repeatCommands
restNumberThreshold
shapeNoteStyles
shortInstrumentName
shortVocalName
skipBars
skipTypesetting
soloIIText
soloText
squashedPosition
staffLineLayoutFunction
stanza
stemLeftBeamCount
stemRightBeamCount
stringNumberOrientations
stringOneTopmost
stringTunings
strokeFingerOrientations
subdivideBeams
suggestAccidentals
systemStartDelimiter
systemStartDelimiterHierarchy
tablatureFormat
tempoUnitCount
tempoUnitDuration
tempoWholesPerMinute
tieWaitForNote
timeSignatureFraction
timing
tonic
trebleStaffProperties
tremoloFlags
tupletFullLength
tupletFullLengthNote
tupletSpannerDuration
useBassFigureExtenders
verticallySpacedContexts
vocalName
voltaSpannerDuration



%%% LAYOUT PROPERTIES
%%% aaa or aaa-aaa-aaa
after-title-spacing
annotate-spacing
auto-first-page-number
before-title-spacing
between-scores-system-spacing
between-system-padding 
between-system-spacing
between-title-spacing
bottom-margin
bottom-system-spacing
indent
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to