Skip to content

Commit

Permalink
Merge pull request #925 from open-nsm/master
Browse files Browse the repository at this point in the history
Added Support for Bro language
  • Loading branch information
zeitgeist87 committed Apr 8, 2016
2 parents 97b0eb5 + f6938b9 commit 3b997fb
Show file tree
Hide file tree
Showing 4 changed files with 707 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ var components = {
"title": "Brainfuck",
"owner": "Golmote"
},
"bro": {
"title": "Bro",
"owner": "wayward710"
},
"c": {
"title": "C",
"require": "clike",
Expand Down
47 changes: 47 additions & 0 deletions components/prism-bro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Prism.languages.bro = {

'comment': {
pattern: /(^|[^\\$])#.*/,
lookbehind: true,
inside: {
'italic': /\b(TODO|FIXME|XXX)\b/
}
},

'string': /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,

'boolean': /\b(T|F)\b/,

'function': {
pattern: /(?:function|hook|event) [a-zA-Z0-9_]+(::[a-zA-Z0-9_]+)?/,
inside: {
keyword: /^(?:function|hook|event)/
}
},

'variable': {
pattern: /(?:global|local) [a-zA-Z0-9_]+/i,
inside: {
keyword: /(?:global|local)/
}
},

'builtin':
/(@(load(-(sigs|plugin))?|unload|prefixes|ifn?def|else|(end)?if|DIR|FILENAME))|(&?(redef|priority|log|optional|default|add_func|delete_func|expire_func|read_expire|write_expire|create_expire|synchronized|persistent|rotate_interval|rotate_size|encrypt|raw_output|mergeable|group|error_handler|type_column))/,

'constant': {
pattern: /const [a-zA-Z0-9_]+/i,
inside: {
keyword: /const/
}
},

'keyword':
/\b(break|next|continue|alarm|using|of|add|delete|export|print|return|schedule|when|timeout|addr|any|bool|count|double|enum|file|int|interval|pattern|opaque|port|record|set|string|subnet|table|time|vector|for|if|else|in|module|function)\b/,

'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/,

'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,

'punctuation': /[{}[\];(),.:]/
};
1 change: 1 addition & 0 deletions components/prism-bro.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3b997fb

Please sign in to comment.