[SVN] Perl qq(..) with multiline nested (..) within

Peter Traskalik dreamy.de at mac.com
Sun Jun 5 12:41:24 UTC 2005


I would like to enhance the Perl Bundle,
because the qq() pattern seems to have problems with multiline nested  
"(..)" within.

this is my current status: it works quite well.
(i also added matches for html and sql,
because qq() is often used for multiline html/sql content)

--------------------------------------------------

         {    name = "string.double-quoted.q.perl";
             begin = "\\Wq[qwx]*\\(";
             end = "\\)";
             swallow = "\\(.*\\)[^;]|\\)\\s*[\\n\\)][^;]?";
             patterns = (
                 {    match = "<.?*>";
                     include = "text.html";
                 },
                 {    match = "SELECT|UPDATE|INSERT";
                     include = "source.sql";
                 },
             );
         }

--------------------------------------------------

AFAIK "swallow" does only "one-line-matching"

my version works with this code:

$sql_filter = qq(
         AND (    something  IN (10,11,100,115 )
         OR whatever  ) if $foo == 1;


(the current Perl Bundle Syntax ends the match in second line at the  
ending ")")

but my version fails here:

$sql_filter = qq(
         AND (    something  IN (10,11,100,115 )
         OR whatever AND ( foo = bar) ) if $foo == 1;

because of the ") )" sequence i think...



this is very hard to match,
without actually "counting" the "(..)" pairs

there could be a built in functionality for "counting" the matching  
"(" and ")"
so with a given end = "\\)"; TextMate would not match any of the   
"(...)" pairs
in between if the amount of openings and closings is equal.


what do you think ?
maybe i am on the wrong way at all? missing something ?


Peter



More information about the textmate-dev mailing list