prism-bro.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Prism.languages.bro = {
  2. 'comment': {
  3. pattern: /(^|[^\\$])#.*/,
  4. lookbehind: true,
  5. inside: {
  6. 'italic': /\b(?:TODO|FIXME|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: /(?:function|hook|event) \w+(?:::\w+)?/,
  16. inside: {
  17. keyword: /^(?:function|hook|event)/
  18. }
  19. },
  20. 'variable': {
  21. pattern: /(?:global|local) \w+/i,
  22. inside: {
  23. keyword: /(?:global|local)/
  24. }
  25. },
  26. '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))/,
  27. 'constant': {
  28. pattern: /const \w+/i,
  29. inside: {
  30. keyword: /const/
  31. }
  32. },
  33. '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/,
  34. 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/,
  35. 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
  36. 'punctuation': /[{}[\];(),.:]/
  37. };