Home Download Buy Blog Forum Support

tmLanguage - highlighting nth word differently

tmLanguage - highlighting nth word differently

Postby TheSHEEEP on Tue Oct 15, 2013 12:23 am

Hey, I have the following line in a script file of the Ogre material script language:

texture_ref mrt_gbuffer Deferred/GBuffer mrt_gbuffer_out

Now, what I want to do is highlighting the first word "texture_ref" in one color, the second and final words in a second color and the third word ("Deferred/GBuffer") in yet another color.
Here is my rule so far:

Code: Select all
<dict>
            <key>comment</key>
            <string>Texture Reference</string>
            <key>begin</key>
            <string>\b(texture_ref)\b</string>
            <key>beginCaptures</key>
            <dict>
                <key>1</key>
                <dict>
                    <key>name</key>
                    <string>storage.type</string>
                </dict>
            </dict>
            <key>end</key>
            <string>$</string>
        </dict>

It does nothing but highlight the first word correctly, as I have no idea how I can highlight single words at the nth position.

Also, I'm using ST3, if that makes a difference.

Yes, I know I can use JSON, but all that saving JSON to PLIST, then saving under a different ending, then repeating all the time when doing minor changes just got on my nerves so I'm now sticking to XML.
TheSHEEEP
 
Posts: 1
Joined: Tue Oct 15, 2013 12:13 am

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 6 guests