[TxMt] Language Grammar - TM's internal markups

Hans-Joerg Bibiko bibiko at eva.mpg.de
Wed Jul 25 09:10:22 UTC 2007


On 24 Jul 2007, at 15:15, Michael Sheets wrote:
> On Jul 24, 2007, at 3:23 AM, Hans-Jörg Bibiko wrote:
>> 1) Is it possible to look for the internal markups which TM is  
>> using like
>> "<support.function.perl>(.*?)</support.function.perl>"
>> directly?
>> I only know the way to use the 'magic keyword' in a tmCommand  
>> "<key>inputFormat</key><string>xml</string>" and parse the output.
> Need to know why you need this to better answer it. For some cases  
> you might have to do that, if you want the content of a scope for a  
> command that is easy. Change the input to selected text, then  
> choose scope as the alternate. Now the text around the caret  
> matching the scope given will be available to the command.

Yes, I know.
I'm using TM not only for writing source code but also for text  
analysis (n-gram, morphemes, special consonant clusters, unwanted  
glyphs, etc.). I find it quite convient to see what's going on within  
the text while writing. That's why I wrote a special language grammar  
to highlight these patterns (unfortunately a dynamic grammar doesn't  
work). Then I want to find the next morpheme for instance. Within  
TM's Find Dialog I cannot look for for these tags, I "only" can look  
for the regexp, but sometimes the regexp is really long (like for the  
next example).

Or an other example. A friend of mine is teaching Perl. He would find  
it very helpful to parse the current Perl code for all  
<support.function.perl> and <variable.other.predefined.perl> in order  
to list the used Perl functions/variables for a kind of glossary.

Of course, everything is doable by using Regexps in a command with  
inputFormat=xml. So my question only was whether there is a more  
direct way to use the internal markups, because these tags are  
already there.


More information about the textmate mailing list