Home Download Buy Blog Forum Support

How do you debug a language definition file

How do you debug a language definition file

Postby adrians on Thu May 27, 2010 6:23 pm

Hello,

I'm trying to use a REBOL language definition file (attached) from a TextMate REBOL bundle and Sublime just seems to hang when I select REBOL to try to set the language for a file. I've created a Rebol package dir under <userdir>AppData\Roaming\Sublime Text\Packages and added the file Rebol.tmLanguage there. Is this enough for Sublime to get going or does a full package need to be created even though the only content (at present) is the language definition? I see that Sublime includes a Python script that looks like it might do this, but there is no documentation for it. I don't see any logs that can help with debugging this, either. For the record, the language definition is known to work, so it's not a question of being malformed or incorrect. Sublime also created a Rebol.tmLanguage.cache file - I'm guessing this means that it was able to parse the file.

Cheers,
Adrian
Attachments
Rebol.zip
language definition
(3.53 KiB) Downloaded 187 times
adrians
 
Posts: 8
Joined: Thu May 27, 2010 5:25 pm

Re: How do you debug a language definition file

Postby tgkeul on Thu May 27, 2010 7:16 pm

This should be enough. I did it myself for two languages.

To my knowledge there is just one debuging aid. Typing ctrl+alt+p shows in the statusbar the patterns from tmLanguage which are in effect at the caret position.

Additionally, I created a file with correct and wrong statements in the language of choice. I can see if the syntax highlighting is as expected.
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm

Re: How do you debug a language definition file

Postby adrians on Thu May 27, 2010 9:18 pm

The problem is that I don't get to the point where the I can try ctrl-alt-P - the editor hangs as soon as I select Rebol as the file type from the status bar or through the menu.
adrians
 
Posts: 8
Joined: Thu May 27, 2010 5:25 pm

Re: How do you debug a language definition file

Postby tgkeul on Thu May 27, 2010 9:55 pm

I remember this situation. I resolved it with commenting and uncommenting parts until the evil pattern was identified. It was time consumimg. And yes, Sublime is not Textmate and not fully compatible.

Even if the XML is well formed, Sublime rarely hung on some misspelled regular expressions. But in most circumstances you get an error message.

First of all, in pattern singlequotedString I would replace <string>'</string> with <string>&quot</string>.
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm

Re: How do you debug a language definition file

Postby adrians on Fri May 28, 2010 2:26 pm

After doing as suggested and manually re-introducing removed elements into the language definition, it seems the offending bit is this:

<dict>
<key>name</key>
<string>serie.rebol</string>
<key>match</key>
<string></string>
</dict>

I guess the empty regex causes problems. Sublime could probably be a bit more robust to this kind of problem and just ignore the whole entry if the regex is empty instead of hanging.
adrians
 
Posts: 8
Joined: Thu May 27, 2010 5:25 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Vanishing and 23 guests