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 18:00:19 +0100

It's not a validation, it's an anchor, it avoids it matching other numbers.
That's why the capture.
If pygments was better designed it'll let you do semi-context-sensitive
stuff like this, so you could say "numbers, but only if the follow a note
name" -> durations

L

On Fri, 25 Nov 2022, 17:52 Werner LEMBERG, <wl@gnu.org> wrote:

>
> > 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.
>
> The thing is that the regular expressions match both LilyPond and
> Scheme syntax.
>
> > 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...
>
>  I don't think stuff like `ag` is a problem – it's not the job of
>  pygments to validate LilyPond input.
>
>
>     Werner
>


reply via email to

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