Home Download Buy Blog Forum Support

[SOLVED] Append to Existing Syntax Definition

[SOLVED] Append to Existing Syntax Definition

Postby lilxvietxboi on Sat Sep 29, 2012 12:11 am

Hello,

I'm looking to modify the existing C syntax definition to include an annoying way my code includes #pragma's.

My code defines a macro for #pragma which is used all over the place before functions which causes the function list (CTRL+R) to display PRAGMA instead of the actual function.

e.g.,
Code: Select all
#define PRAGMA(x)   #pragma (x)
...
PRAGMA(X)
void Function()
{
  ...
}


So what I want to do is update the syntax definition with the following:
Code: Select all
      <dict>
         <key>comment</key>
         <string>Stupid PRAGMA()'s</string>
         <key>match</key>
         <string>^(PRAGMA).*$</string>
         <key>name</key>
         <string>keyword.control.import.c</string>
      </dict>


or the JSON pattern:
Code: Select all
   { "match": "^(PRAGMA).*$",
     "name": "keyword.control.import.c",
     "comment": "Stupid PRAGMA()'s"
   }


Is there anyway I can do that? I see how I can create an entirely new syntax, but all I want to do is append.
Last edited by lilxvietxboi on Sat Sep 29, 2012 12:22 am, edited 1 time in total.
lilxvietxboi
 
Posts: 2
Joined: Sat Sep 29, 2012 12:06 am

Re: Append to Existing Syntax Definition

Postby lilxvietxboi on Sat Sep 29, 2012 12:22 am

Resolved:

I found the language inside my packages and updated it myself...
In Packages\C++\C.tmLanguage:
Code: Select all
<string>^\s*((#\s*(pragma\s+mark)\s+(.*))|(PRAGMA)(.*))</string>
lilxvietxboi
 
Posts: 2
Joined: Sat Sep 29, 2012 12:06 am


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot] and 27 guests