Alternative to look-behind (was: [SVN] Revision 1203 (markdown))
Allan Odgaard
allan at macromates.com
Fri Jun 24 04:17:35 UTC 2005
On 24/06/2005, at 5.21, Charilaos Skiadas wrote:
> [...] the first star or underscore is also not preceded by an odd
> number of backslashes and the second symbol is not preceded by an
> even number of backslashes [...]
Sorry to use this as my example, but often look-behind can be avoided
by instead making a rule that “eats” the escape sequence(s) one tries
to avoid.
So for example if we add this rule to markdown:
{ name = "constant.character.escape.markdown";
match = "\\\\[-`*_#+.!(){}\\[\\]\\\\]";
},
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).
I'm leaving it to Hadley though to decide if he wants to include it!
Probably you'd also want to switch to a one combined grammar now that
1.1b13 can do local includes and recursion.
More information about the textmate-dev
mailing list