[Top][All Lists]

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

Re: pygment regex question

From: Jean Abou Samra
Subject: Re: pygment regex question
Date: Fri, 25 Nov 2022 18:11:28 +0100

> Le 25 nov. 2022 à 18:03, Luca Fascione <> a écrit :
> 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

What makes you think Pygments can’t do this? You can do


and things like that. You could also arrange so that the regex parsing a pitch 
leaves you in a state of the lexer where something special will happen for \d+. 
However, durations don’t always follow a pitch, as in

\tuplet 3/2 8. { … }

which is the reason why we don’t want to do that.

reply via email to

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