Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Initial commit JSON source and compiled Plist, to use it put it in
user's "Sublime Text3/Packages/User" dir, then select
"View/Syntax/OpenBDF PF conf".
  • Loading branch information
paukstis committed Feb 27, 2014
1 parent 8c36e16 commit 465d3fb
Show file tree
Hide file tree
Showing 2 changed files with 235 additions and 0 deletions.
80 changes: 80 additions & 0 deletions pfconf.JSON-tmLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// ===========================================================
// OpenBSD PacketFilter syntax highlight for SublimeText,
// v.0.0.1
// https://github.com/paukstis/sublimetext-packetfilter-syntax
// http://manual.macromates.com/en/language_grammars
// ===========================================================
{ "name": "OpenBSD PF conf",
"scopeName": "source.pfconf",
"fileTypes": ["pfconf"],
"uuid": "132f6dba-2e9a-4b80-bdac-0274645b81a2",
"patterns": [
{ "match": "\\$[A-Za-z0-9_\\-]+",
"name": "variable.pfconf",
"comment": "variables"
},
{ "match": "^\\#.*$",
"name": "comment.line.pfconf",
"comment": "comments"
},
{ "match": "<[a-zA-Z0-9_\\-\\.]+>",
"name": "markup.bold.pfconf",
"comment": "tables"
},
{ "match": "[\\!:<>,]",
"name": "constant.pfconf",
"comment": "operators"
},
{ "match": "[{}\\(\\)]",
"name": "storage.modifier.pfconf",
"comment": "lists"
},

{ "match": "\\/[0-9]+",
"name": "markup.italic.pfconf",
"comment": "numeric netmasks"
},
{ "match": "[\\\"](.+)[\\\"]",
"name": "string.pfconf",
"captures": {
"1": { "name": "string.pfconf" }
},
"comment": "strings"
},
{ "match": "^(\\S+)\\s*=",
"name": "",
"captures": {
"1": { "name": "entity.name.pfconf" }
},
"comment": "variables defs"
},
{ "match": "(quick|persist)",
"name": "markup.heading.pfconf",
"comment": "keywords qualifier"
},
{ "match": "(tagged|tag)",
"name": "markup.quote.pfconf",
"comment": "keywords tag"
},
{ "match": "(all|any|yes|no|drop|return)",
"name": "invalid.illegal.pfconf",
"comment": "keywords atom"
},
{ "match": "(proto|inet6|inet|tcp|udp|icmp6|icmp|port|other|carp|pfsync|first|opening|closing|single|finwait|established|closed|multiple|error|states|frags|interval|frag)",
"name": "markup.list.pfconf",
"comment": "keywords builtin"
},
{ "match": "(label|user|file|timeout|limit|optimization|block-policy|loginterface|require-order|skip|synproxy|state|parent|bandwidth|static-port)",
"name": "entity.name.pfconf",
"comment": "keywords def"
},
{ "match": "(altq|anchor|antispoof|binat|pass|block|queue|match|scrub|table|set|in|out|rdr-to|divert-to|route-to|reply-to|nat-to|nat|rdr)",
"name": "keyword.control.pfconf",
"comment": "keywords main"
},
{ "match": "(log)",
"name": "storage.pfconf",
"comment": "keywords attribute"
}
]
}
155 changes: 155 additions & 0 deletions pfconf.tmLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>pfconf</string>
</array>
<key>name</key>
<string>OpenBSD PF conf</string>
<key>patterns</key>
<array>
<dict>
<key>comment</key>
<string>variables</string>
<key>match</key>
<string>\$[A-Za-z0-9_\-]+</string>
<key>name</key>
<string>variable.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>comments</string>
<key>match</key>
<string>^\#.*$</string>
<key>name</key>
<string>comment.line.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>tables</string>
<key>match</key>
<string>&lt;[a-zA-Z0-9_\-\.]+&gt;</string>
<key>name</key>
<string>markup.bold.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>operators</string>
<key>match</key>
<string>[\!:&lt;&gt;,]</string>
<key>name</key>
<string>constant.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>lists</string>
<key>match</key>
<string>[{}\(\)]</string>
<key>name</key>
<string>storage.modifier.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>numeric netmasks</string>
<key>match</key>
<string>\/[0-9]+</string>
<key>name</key>
<string>markup.italic.pfconf</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>string.pfconf</string>
</dict>
</dict>
<key>comment</key>
<string>strings</string>
<key>match</key>
<string>[\"](.+)[\"]</string>
<key>name</key>
<string>string.pfconf</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.pfconf</string>
</dict>
</dict>
<key>comment</key>
<string>variables defs</string>
<key>match</key>
<string>^(\S+)\s*=</string>
<key>name</key>
<string></string>
</dict>
<dict>
<key>comment</key>
<string>keywords qualifier</string>
<key>match</key>
<string>(quick|persist)</string>
<key>name</key>
<string>markup.heading.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>keywords tag</string>
<key>match</key>
<string>(tagged|tag)</string>
<key>name</key>
<string>markup.quote.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>keywords atom</string>
<key>match</key>
<string>(all|any|yes|no|drop|return)</string>
<key>name</key>
<string>invalid.illegal.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>keywords builtin</string>
<key>match</key>
<string>(proto|inet6|inet|tcp|udp|icmp6|icmp|port|other|carp|pfsync|first|opening|closing|single|finwait|established|closed|multiple|error|states|frags|interval|frag)</string>
<key>name</key>
<string>markup.list.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>keywords def</string>
<key>match</key>
<string>(label|user|file|timeout|limit|optimization|block-policy|loginterface|require-order|skip|synproxy|state|parent|bandwidth|static-port)</string>
<key>name</key>
<string>entity.name.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>keywords main</string>
<key>match</key>
<string>(altq|anchor|antispoof|binat|pass|block|queue|match|scrub|table|set|in|out|rdr-to|divert-to|route-to|reply-to|nat-to|nat|rdr)</string>
<key>name</key>
<string>keyword.control.pfconf</string>
</dict>
<dict>
<key>comment</key>
<string>keywords attribute</string>
<key>match</key>
<string>(log)</string>
<key>name</key>
<string>storage.pfconf</string>
</dict>
</array>
<key>scopeName</key>
<string>source.pfconf</string>
<key>uuid</key>
<string>132f6dba-2e9a-4b80-bdac-0274645b81a2</string>
</dict>
</plist>

0 comments on commit 465d3fb

Please sign in to comment.