Help with RegEx in SublimeText 3 | sublime-syntax


1) To highlight a string, I use:

    - match: (")
        - meta_scope: string.quoted.double.ahk
        - match: (")(?!")|^
          pop: true
        - match: \.
          scope: constant.character.escape.ahk

With this I highlight what is in quotes "" on the same line. Me    I would like to be able to highlight also in this situation:

   var = "    // comentario
   ( si hay texto aquí (esta línea) quiero que se marque con otro color  // comentario
   Cadena | Línea #1
   Texto  | Línea #2   // esto no es un comentario y forma parte de la cadena
   "" Comillas tratadas como parte de la cadena | Línea #3
   )" aquí puede haber más texto que no forma parte de la cadena y deben seguir funcionando las otras regex normalmente  // comentario

2) I would like to be able to establish a certain highlight but that works within a block, for example switch-case. For example, if I write this:

   default:  // comentario

I do not want anything to happen, but now if "default:" is in a switch (the highlight should only work if the opening and closing keys were specified), I want to highlight "default".

   switch (blablabla) {   // "{" puede estar en una nueva línea
       default: blablabla

3) Finally, I would like to detect errors when a string ("), parenthesis, bracket or key is not found, but I just want to highlight the character that opens, not everything, for example:

   var = "cadena
   var = (2+3
   var = [1,2,3
   if (blablabla) {

I should highlight only ", (, [and {.I would also like it to work in reverse, if the opening is missing.

Thank you!

asked by Flipeador 22.04.2018 в 20:03

0 answers