prism-bro.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. Prism.languages.bro = {
  2. 'comment': {
  3. pattern: /(^|[^\\$])#.*/,
  4. lookbehind: true,
  5. inside: {
  6. 'italic': /\b(?:FIXME|TODO|XXX)\b/
  7. }
  8. },
  9. 'string': {
  10. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  11. greedy: true
  12. },
  13. 'boolean': /\b[TF]\b/,
  14. 'function': {
  15. pattern: /(\b(?:event|function|hook)[ \t]+)\w+(?:::\w+)?/,
  16. lookbehind: true
  17. },
  18. 'builtin': /(?:@(?:load(?:-(?:plugin|sigs))?|unload|prefixes|ifn?def|else|(?:end)?if|DIR|FILENAME))|(?:&?(?:add_func|create_expire|default|delete_func|encrypt|error_handler|expire_func|group|log|mergeable|optional|persistent|priority|raw_output|read_expire|redef|rotate_interval|rotate_size|synchronized|type_column|write_expire))/,
  19. 'constant': {
  20. pattern: /(\bconst[ \t]+)\w+/i,
  21. lookbehind: true
  22. },
  23. 'keyword': /\b(?:add|addr|alarm|any|bool|break|const|continue|count|delete|double|else|enum|event|export|file|for|function|global|hook|if|in|int|interval|local|module|next|of|opaque|pattern|port|print|record|return|schedule|set|string|subnet|table|time|timeout|using|vector|when)\b/,
  24. 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/,
  25. 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  26. 'punctuation': /[{}[\];(),.:]/
  27. };