> Le 25 nov. 2022 à 18:03, Luca Fascione <l.fasci...@gmail.com> 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

(?<=\w+)\d+

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