Fixed whitespaces, reordered tokens, used Gulp to min JS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
diff --git a/components/prism-bro.js b/components/prism-bro.js
index d616083..4591d92 100644
--- a/components/prism-bro.js
+++ b/components/prism-bro.js
@@ -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': {
@@ -28,13 +26,8 @@ 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,
@@ -42,4 +35,13 @@ Prism.languages.bro = {
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': /[{}[\];(),.:]/
};
diff --git a/components/prism-bro.min.js b/components/prism-bro.min.js
index 5770f8f..bc8a649 100644
--- a/components/prism-bro.min.js
+++ b/components/prism-bro.min.js
@@ -1 +1 @@
-Prism.languages.bro={"comment":{pattern:/(^|[^\\$])#.*/,lookbehind:true},"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)/}},"variable":{pattern:/(?:global|local) [a-zA-Z0-9_]+/i,inside:{keyword:/(?:global|local)/}},"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))/,"constant":{pattern:/const [a-zA-Z0-9_]+/i,inside:{keyword:/const/}},};
\ No newline at end of file
+Prism.languages.bro={comment:{pattern:/(^|[^\\$])#.*/,lookbehind:!0,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:/[{}[\];(),.:]/};
\ No newline at end of file
diff --git a/examples/prism-bro.html b/examples/prism-bro.html
index cddf567..73f0ab7 100644
--- a/examples/prism-bro.html
+++ b/examples/prism-bro.html
@@ -19,6 +19,7 @@
<h2>Misc</h2>
<pre><code>
@ifndef ourexp
+@load-sigs somesigs
</code></pre>
<h2>Full example</h2>