prism-avro-idl.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // GitHub: https://github.com/apache/avro
  2. // Docs: https://avro.apache.org/docs/current/idl.html
  3. Prism.languages['avro-idl'] = {
  4. 'comment': {
  5. pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
  6. greedy: true
  7. },
  8. 'string': {
  9. pattern: /(^|[^\\])"(?:[^\r\n"\\]|\\.)*"/,
  10. lookbehind: true,
  11. greedy: true
  12. },
  13. 'annotation': {
  14. pattern: /@(?:[$\w.-]|`[^\r\n`]+`)+/,
  15. greedy: true,
  16. alias: 'function'
  17. },
  18. 'function-identifier': {
  19. pattern: /`[^\r\n`]+`(?=\s*\()/,
  20. greedy: true,
  21. alias: 'function'
  22. },
  23. 'identifier': {
  24. pattern: /`[^\r\n`]+`/,
  25. greedy: true
  26. },
  27. 'class-name': {
  28. pattern: /(\b(?:enum|error|protocol|record|throws)\b\s+)[$\w]+/,
  29. lookbehind: true,
  30. greedy: true
  31. },
  32. 'keyword': /\b(?:array|boolean|bytes|date|decimal|double|enum|error|false|fixed|float|idl|import|int|local_timestamp_ms|long|map|null|oneway|protocol|record|schema|string|throws|time_ms|timestamp_ms|true|union|uuid|void)\b/,
  33. 'function': /\b[a-z_]\w*(?=\s*\()/i,
  34. 'number': [
  35. {
  36. pattern: /(^|[^\w.])-?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|0x(?:[a-f0-9]+(?:\.[a-f0-9]*)?|\.[a-f0-9]+)(?:p[+-]?\d+)?)[dfl]?(?![\w.])/i,
  37. lookbehind: true
  38. },
  39. /-?\b(?:Infinity|NaN)\b/
  40. ],
  41. 'operator': /=/,
  42. 'punctuation': /[()\[\]{}<>.:,;-]/
  43. };
  44. Prism.languages.avdl = Prism.languages['avro-idl'];