lilypond-devel
[Top][All Lists]
Advanced

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

Re: Please review Pygments lexer and style


From: Jean Abou Samra
Subject: Re: Please review Pygments lexer and style
Date: Thu, 24 Jun 2021 20:17:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0



Le 24/06/2021 à 19:23, Jonas Hahnfeld via Discussions on LilyPond development a écrit :
Am Donnerstag, dem 24.06.2021 um 18:36 +0200 schrieb Jean Abou Samra:
Le 23/06/2021 à 19:03, Jean Abou Samra a écrit :
Le 23/06/2021 à 18:53, Dan Eble a écrit :
Not a bad idea, but -1 for the use of light colors on white: silver,
yellow, sky blue, etc.

What is the minimum set of distinctions that is likely to do more
good than harm?  The example is a little overwhelming.

(All MHO.)
I should probably find something else for pitches and
durations. The example does look overwhelming, but it
was intentionally constructed as a showcase for many
pieces of syntax and builtins. A typical score mostly
consists of long runs of pitches and durations interspersed
with articulations and commands, so I think making many
distinctions should be fine as long as the most common
parts of the syntax have colors that are easy enough
to read.
Here is a new "patch set".

- New colors for pitches, articulations and some others.
- Darker colors overall.
- No distinction between dynamics and other articulations, nor between
\header and \paper variables, nor music functions and music shortcuts.

How does this look? I've been staring at it for too long to even see if
it's acceptable.
I still only see text in the .html files, no formatting.

 From the .rtf (as far as LibreOffice Writer can read that format), it's
not clear to me (I didn't look at the first proposal):
  * why some functions / variables are printed in bold (\staff-space and
\major are not; assignment to myFunc, mySecondFunc, and myPitch are
not, but their uses are),

Ok, I already simplified it, but it's still too complicated.
All builtin functions are in bold, and anything unknown and
backslash-escaped is as well. I'll style \staff-space, \major
and \longa in bold too. Assignments are not specially recognized
at the moment as the lexer is very simple-minded; changing that
might be feasible.

  * which ones have different colors (\hide and \omit are blue, \tweak
and \override are black; markups seem to be purple, but \markup itself
is black), and

Built-in music functions and shortcuts are blue (except articulations,
in green). Everything unknown and backslash-escaped is blue, assuming
that it is most frequently a variable containing music or a music function.
Parser keywords are in black (note that \tweak is actually a music function,
but it pairs with \override and Frescobaldi sets a precedent by highlighting
it like keywords). Markup functions are in purple. The word \markup is
black since it's a keyword; maybe I should make it purple as a special
case?

  * why ##t is bold (the first pound seems not?), but #5 and #'() are
not despite also being constants.

The lexer I wrote delegates Scheme parsing to the already existing
Scheme lexer, which is responsible for this behavior. The first pound
is not bold because it's the switch to Scheme; #t is the Scheme constant.
'(), in spite of being a constant, is not recognized as such by the
Scheme lexer; that could be a nice improvement there.

Thanks for the feedback!
Jean




reply via email to

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