Hi,

I've finished the draft of the lilypond language file for source-highlight (task 1 of issue 1005):

http://code.google.com/p/lilypond/issues/detail?id=1005

I need some feedback and tips from you, please test it.


How-to
======

You must install the source-highlight package.
You don't need to recompile it: just put the attached files (lilypond.lang, lilypond.style and lang.map) in the current working directory. Then launch this command:

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

HTML is the default output format.  A list of all the output format
available can be obtained with:

source-highlight --outlang-list



Feedback
========

Please let me know:

1) which colours you prefer for each element. source-highlight is very flexible: http://www.gnu.org/software/src-highlite/source-highlight.html#Colors

2) the numbers regexp may be improved, I guess. Any idea?

3) I tried to use mainly regexp instead of lists of words. Do you think it's ok? Grouping the music functions and styling them differently as Frescobaldi does would be nice but not easy to maintain. I chose the easiest way so far.

4) I tried to choose source-highlight elements (function, cbracket, code) which are as close as possible to the meaning of the lilypond element. But sometimes it was almost impossible or difficult for a non-developer like me. I don't know even if it's that important (after all I just have to tie a regexp to an element that I can style as I wish). Anyway any feedback on this regard is much appreciated. A list of all elements is available - I think - in /usr/share/source-highlight/default.style, where you can see that there are some elements specific of each language, so maybe we can even create them. I tried to ask on the source-highlight mailing list but I haven't received any reply so far.

Thanks,
Federico
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
ly = lilypond.lang
comment delim "%{" "%}" multiline nested
comment start "%"

string delim "\"" "\""

symbol = "\\\\|(|)|^|_|*|=|<|>|,|'|~|\|"
cbracket = "{|}"

# Fingering and string number
specialchar = '-[1-5]\b', '\\[0-9]\b'

# Note duration
number = '(1|2|4|8|16|32|64|128)(\.+|\b)'

# Main commands
preproc = '\\bookpart|\\book|\\context|\\header|\\include|\\layout|\\midi',
           '\\new|\\once|\\overrideProperty|\\override|\\paper|\\removeWithTag',
           '\\remove|\\revert|\\score|\\set|\\unset|\\version|\\with'

# Music functions, plus variables defined by users
function = '\\[[:alpha:]]+'

# Contexts and Layout objects
keyword = '\b[A-Z][a-z]+'

# Context properties
classname = '\b[a-z]+([A-Z]+[a-z]+)+',
            'ottavation|output|stanza|timing|tonic'

# Layout properties
type = '\b[a-z]+(-[a-z]+)+'

# Attributes of music functions
attribute = "unfold|volta"

# Scheme
code delim '#\'\(' '\){2}' multiline
code start '#\''

comment gray i ;
string red ;
cbracket, preproc, symbol black b ;
number teal ;
specialchar orange ;
function darkblue b ;
keyword pink b ;
classname blue ;
type cyan ;
code brown ;

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

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



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



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


%%% NUMBERS
% Note numbers => ?
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

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



%%% SCHEME
% one line
\once \override Tie #'staff-position = #3.5

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



%%% COMMANDS start with \
%%% We could make several groups with different styles, like Frescobaldi does.
%%% It is worth?

% Commands 1st group: bold black => #000000
\book \bookpart \context \header \include \layout \midi \new
\once \override \overrideProperty \paper \remove \removeWithTag \revert
\score \set \unset \version \with 


% Commands 2nd group: bold lilla => #452886
\acciaccatura \appoggiatura \arpeggio \bar \bendAfter \break \breathe \clef
\glissando \grace \harmonic \hideNotes \laissezVibrer \melisma \mark
\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


% Commands 3rd group: bold green => #007010
\lyricmode \lyrics \lyricsto

% Command 4th group: bold aqua => #0094E4
\chords \chordmode \figures \figuremode
\notes \notemode 

% Commands 5th group: green => #009817
\markup \markuplines

% Commands 6th group: orange => #EE5000
\coda \fermata \varcoda \rfz \rheel \rtoe



%%% VARIABLES defined by users
\whatever \youLike






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


%%% CONTEXTS and LAYOUT OBJECTS (should we separate them?)
%%% Aaaa or AaaaAaaaAaaa
%%% any word starting with a capital letter should work fine

% 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
NoteHead
Slur



%%% 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

_______________________________________________
lilypond-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to