prism-go-module.js 556 B

123456789101112131415161718192021222324
  1. // https://go.dev/ref/mod#go-mod-file-module
  2. Prism.languages['go-mod'] = Prism.languages['go-module'] = {
  3. 'comment': {
  4. pattern: /\/\/.*/,
  5. greedy: true
  6. },
  7. 'version': {
  8. pattern: /(^|[\s()[\],])v\d+\.\d+\.\d+(?:[+-][-+.\w]*)?(?![^\s()[\],])/,
  9. lookbehind: true,
  10. alias: 'number'
  11. },
  12. 'go-version': {
  13. pattern: /((?:^|\s)go\s+)\d+(?:\.\d+){1,2}/,
  14. lookbehind: true,
  15. alias: 'number'
  16. },
  17. 'keyword': {
  18. pattern: /^([ \t]*)(?:exclude|go|module|replace|require|retract)\b/m,
  19. lookbehind: true
  20. },
  21. 'operator': /=>/,
  22. 'punctuation': /[()[\],]/
  23. };