Home Download Buy Blog Forum Support

Custom Syntax highlighting - PF

Custom Syntax highlighting - PF

Postby ajl119 on Mon Feb 11, 2013 10:48 am

Hi everyone,

I am evaluating Sublime for use at work to edit OpenBSD/FreePBSD 'PF' and 'Snort' files ('pf' being the important one).

So far its great, but their is no syntax support in Sublime for 'PF' which is a deal breaker for us.
It should look like this; http://www.sentia.org/downloads/pf.conf.html

Their is syntax support for 'PF' in 'VIM'. Is it possible to somehow get the 'pf' syntax support (as per http://www.vim.org/scripts/script.php?script_id=341) loaded into Sublime?

If we could get this working we would be able to pay for sublime and roll it out to quite a few members of staff :)

Thanks for your time and help, Andy.
ajl119
 
Posts: 1
Joined: Mon Feb 11, 2013 10:37 am

Re: Custom Syntax highlighting - PF

Postby Shammah on Tue Feb 12, 2013 8:56 pm

Hey,

I've had this problem as well regarding Boo syntax highlighting and had to resort to writing my own syntax highlighting.
For a reference, you can find it at https://github.com/Shammah/boo-sublime.

Now your script syntax looks doable with a few regexes.

To start, I'd recommend reading the guides at
http://sublimetext.info/docs/en/extensibility/syntaxdefs.html
http://docs.sublimetext.info/en/latest/reference/syntaxdefs.html

Basically, you create your regexes in JSON format and convert it to the format supported by Sublime Text.
Sublime's system is based on TextMate's system, which you can find a reference at http://manual.macromates.com/en/language_grammars

It might be a bit tedious at first, but once you get it working it's all worth it in my opinion.
I wish you best of luck!

PS: If you ever get it working, you might contribute your syntax file / package to the Package Control library, so everybody else who might need such plugin can enjoy it as well :) .
Shammah
 
Posts: 3
Joined: Tue Feb 12, 2013 8:51 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], lukasbob and 28 guests