syntax - Writing Textmate rules to match GABCNABC sections in a .gabc file - Stack Overflow

admin2025-04-17  4

I'm writing a VSCode extension to add syntax highlighting to .gabc files. I would like to match GABC and NABC sections within the code (so I can apply different patterns for each section), as follows:

  • simple case: (GABC section|NABC section)
  • arbitrary case: (GABC section|NABC section|GABC section|NABC section|...)

Concrete example:

(c3) Ad(f|ta) te,(h|vi) Dó(hi|pe)mi(i|vi)ne,(i|vi) *(,)
le(i|vi)vá(i|vi)vi(h|ta) á(ij|pe)ni(h|ta)mam(ij>|pe>) me(i|ta)am:(i|ta) (;)
ve(f|talsi7)ni,(i|vi) et(h|vi) é(g|vi)ri(f|vi)pe(e|ta) me,(fe__|cl-) (,)
Dó(d|ta)mi(e|vi)ne,(f|vi) ad(gxg|////vi) te(h|vi)
<nlba>con(gxg|////vi)fú(f|ta)gi.</nlba>(f|ta) (::i+)

How could I write TexMate rules to match those GABC sections and NABC sections within the parentheses?

I'm writing a VSCode extension to add syntax highlighting to .gabc files. I would like to match GABC and NABC sections within the code (so I can apply different patterns for each section), as follows:

  • simple case: (GABC section|NABC section)
  • arbitrary case: (GABC section|NABC section|GABC section|NABC section|...)

Concrete example:

(c3) Ad(f|ta) te,(h|vi) Dó(hi|pe)mi(i|vi)ne,(i|vi) *(,)
le(i|vi)vá(i|vi)vi(h|ta) á(ij|pe)ni(h|ta)mam(ij>|pe>) me(i|ta)am:(i|ta) (;)
ve(f|talsi7)ni,(i|vi) et(h|vi) é(g|vi)ri(f|vi)pe(e|ta) me,(fe__|cl-) (,)
Dó(d|ta)mi(e|vi)ne,(f|vi) ad(gxg|////vi) te(h|vi)
<nlba>con(gxg|////vi)fú(f|ta)gi.</nlba>(f|ta) (::i+)

How could I write TexMate rules to match those GABC sections and NABC sections within the parentheses?

Share Improve this question asked Feb 1 at 17:35 Laércio de SousaLaércio de Sousa 314 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I'm not sure the exact intention
Are you wanting to scope/colour the capture groups separatory?

You can use "captures" to target a capture group

do you have an example of a file you've trying to tokenize?

转载请注明原文地址:http://anycun.com/QandA/1744822022a88092.html