lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: indent-ly


From: Wilbert Berendsen
Subject: Re: indent-ly
Date: Mon, 26 Oct 2009 13:44:36 +0100
User-agent: KMail/1.12.2 (Linux/2.6.31-14-generic; KDE/4.3.2; i686; ; )

Op donderdag 22 oktober 2009 schreef Bertalan:

> Now, the real problem I see with this approach is that no perfect 
> formatting (which is not the same as indentation) can be done without 
> actually parsing the input.

I think this is true; my indent script[1] includes a basic parser. It knows 
when to switch from LilyPond to Scheme mode and back again and also supports 
LilyPond code in Scheme.

It also has a nice feature that line-comments starting with three %%% or ;;; 
are not indented, because that comment style if often used to mark big 
sections of LilyPond or Scheme input.

The scheme indenting currently works like this: If an opening parenthesis is 
found, the following 10 characters are searched for another one (before 
closing one or newline). If there is another opening parenthesis on the same 
line, the next line is aligned the same way. If none is found, the normal 
indent is used. (default 2).

[1] 
http://code.google.com/p/lilykde/source/browse/trunk/frescobaldi/python/ly/indent.py

best regards,
Wilbert Berendsen

-- 
Frescobaldi, LilyPond editor for KDE: http://www.frescobaldi.org/
Nederlands LilyPond forum: http://www.lilypondforum.nl/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]