Skip to content

Commit

Permalink
feat(zeek): Add zeek highlighting
Browse files Browse the repository at this point in the history
Originally proposed in scopatz#395
  • Loading branch information
anthonykasza authored and galenguyer committed Nov 2, 2022
1 parent b3b029a commit 0e3b20a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions zeek.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Here is an example nanorc for syntax highlighting in Zeek scripts. Edited the standard sh.nanorc to create this, and added in the regex described by Scott Runnels.
## For Scott's bro-mode.el, go to https://github.com/srunnels/bro-mode/blob/master/bro-mode.el

syntax "zeek" "\.zeek$"
magic "(POSIX|Bourne.*) shell script text"
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
icolor brightgreen "^[0-9A-Z_]+\(\)"

color cyan "(usec|msec|sec|min|hr|day)s?\b"
color cyan "[0-9]+\/(tcp|udp|icmp|unknown)"

# Functions and event names
color magenta "\w+\("

# Declarations and statements
color brightcyan "\<(add|alarm|fallthrough|break|case|const|copy|continue|do|delete|else|for|global|switch|default|if|endif|local|next|of|print|redef|return|schedule|type|when|while|option)\>"
color brightcyan "module|export|timeout"

# Types
color cyan "\<(addr|opaque|any|bool|hook|connection|function|count|time|double|file|int|enum|event|interval|net|port|pattern|record|set|string|subnet|table|vector)\>"

# Namespaces
color yellow "(\w+?)::\b"

# Operators
color green "(:|\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|& |&&|\||\?|%|\+|\*|-\W| as |\^|~| not | in | is | !in | : |,)"

# attributes
color brightgreen "\&(expire_func|redef|priority|log|optional|default|add_func|delete_func|read_expire|write_expire|create_expire|on_change|raw_output|error_handler|type_column|deprecated)"

# Directives and record references
icolor brightred "(@\w+)"
icolor red "(\w+?)\$\{?[0-9A-Z_!@#$*?-]+\}?"

# string literals
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"

# Comments
color blue "(^|[[:space:]])#.*$"

0 comments on commit 0e3b20a

Please sign in to comment.