Alternative to look-behind (was: [SVN] Revision 1203 (markdown))

Allan Odgaard allan at macromates.com
Fri Jun 24 05:46:42 UTC 2005


On 24/06/2005, at 6.53, Charilaos Skiadas wrote:

>> So for example if we add this rule to markdown:
>>  [...]
>> Then we don't have to do anything special for the *emphasis* rule  
>> to handle: \*not-emphasis* or the dozen variants of this (and it  
>> should work for all constructs).
> So this will not work as is for the closing *? I wonder, could we  
> use a begin-end-swallow pattern instead of a match?

Problem is that if there's no legal end pattern, the begin pattern  
shouldn't have been taken.

I was thinking one could perhaps do something like:

{   name = "markup.bold.markdown";
     begin = "\\*(?=.*?<pattern-to-verify-legal-end-marker>)";
     end = "\\*";
     patterns = (
         { include = "#escape";
     );
},

Though I don't think that “pattern-to-verify-legal-end-marker” is any  
simpler than doing the actual match, since the match would just be to  
remove “(?=” and “)”.




More information about the textmate-dev mailing list