[TxMt] Re: Regexp generator for language grammars wanted

Timothy Bates timothy.c.bates at gmail.com
Mon Sep 22 13:47:42 UTC 2008


great stuff Hans!

could use teaching about some options like (?i) - which makes the  
search case-insensitive

\b(?i)(Boundary|CMatrix)\b

should probably go to either
options: (?i)
\bBoundary\b
\bCMatrix\b

or
\b(?i)Boundary\b
\b(?i)CMatrix\b

but instead the boundary condition is stuck to the first line and a  
raw 'i' is prefixed to each word, and the trailing \b is lost.

\b?iBoundary
iCMatrix


tim


On 22 Sep 2008, at 12:10 PM, Hans-Jörg Bibiko wrote:

> On 22.09.2008, at 12:11, Alex Ross wrote:
>>> I believe I found a way to do the reverse.
>>>
>>> Install the attached command, edit a tmLanguage in TM, select a
>>> given optimized regexp and invoke that command. It will open a new
>>> doc with a sorted list of - hopefully - all matched keywords. I
>>> tested it for some of these regexps BUT PLEASE check it whether it
>>> works for everything ;)
>>>
>>>
>> Oh, well, it was a
>> good exercise.
> Yeap ;)
>
> Here comes a slightly improved version. It compiles the regexp only  
> once (not for each while loop and sub) thus it's a bit faster; and I  
> fixed [a-zA-Z\|]+? to [^(]+? (I forgot it in the first version)
>
> Maybe one can put both scripts into the Bundle Development bundle?
>
> --Hans
>
>
> <DeOptimize Regexp Alternations.tmCommand.zip>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate




More information about the textmate mailing list