lilypond-devel
[Top][All Lists]
Advanced

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

Re: pygment regex question


From: Luca Fascione
Subject: Re: pygment regex question
Date: Fri, 25 Nov 2022 17:15:30 +0100

well -3 seems to be matching it, (say in a-3, I'm aware this is a
fingering/articulation mark, not a duration).
It appears to be an attempt to match a signed integer followed by zero or
more dots.

It sucks that pygments regexes are context free, though.
This should be using regex capturing and be more like
`[a-g]((?:\d+|\\longa|\\breve)\.*)` or better yet
be more like `[a-g]((?:2|4|8|16|32|64|128|\\longa|\\breve)\.*)`, it's not
like a5 is a valid token...

L

On Fri, Nov 25, 2022 at 2:24 PM Werner LEMBERG <wl@gnu.org> wrote:

>
> Looking into `lilypond.py` (in `pygments.zip`), I wonder what exactly
> this regex does:
>
> ```
> # Integer, or duration with optional augmentation dots. We have no
> # way to distinguish these, so we highlight them all as numbers.
> (r"-?(\d+|\\longa|\\breve)\.*", Token.Number),
> ```
>
> What is `-?` good for?  Note that at the time this regex is active,
> numbers are taken care of.
>
>
>     Werner
>
>

-- 
Luca Fascione


reply via email to

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