Skip to content

Commit

Permalink
Fixed whitespaces, reordered tokens, used Gulp to min JS
Browse files Browse the repository at this point in the history
  • Loading branch information
wayward710 committed Apr 8, 2016
1 parent 4d7fee8 commit f6938b9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
36 changes: 19 additions & 17 deletions components/prism-bro.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@ Prism.languages.bro = {

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

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

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

'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)\b/,

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

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

'variable': {
Expand All @@ -28,18 +26,22 @@ Prism.languages.bro = {
}
},

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

'italic': /\b(TODO|FIXME|XXX)\b/,
'punctuation': /[{}[\];(),.:]/,

'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))/,
'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': /[{}[\];(),.:]/
};
2 changes: 1 addition & 1 deletion components/prism-bro.min.js

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

1 change: 1 addition & 0 deletions examples/prism-bro.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ <h2>Numbers</h2>
<h2>Misc</h2>
<pre><code>
@ifndef ourexp
@load-sigs somesigs
</code></pre>

<h2>Full example</h2>
Expand Down

0 comments on commit f6938b9

Please sign in to comment.