prism-gap.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // https://www.gap-system.org/Manuals/doc/ref/chap4.html
  2. // https://www.gap-system.org/Manuals/doc/ref/chap27.html
  3. Prism.languages.gap = {
  4. 'shell': {
  5. pattern: /^gap>[\s\S]*?(?=^gap>|$(?![\s\S]))/m,
  6. greedy: true,
  7. inside: {
  8. 'gap': {
  9. pattern: /^(gap>).+(?:(?:\r(?:\n|(?!\n))|\n)>.*)*/,
  10. lookbehind: true,
  11. inside: null // see below
  12. },
  13. 'punctuation': /^gap>/
  14. }
  15. },
  16. 'comment': {
  17. pattern: /#.*/,
  18. greedy: true
  19. },
  20. 'string': {
  21. pattern: /(^|[^\\'"])(?:'(?:[^\r\n\\']|\\.){1,10}'|"(?:[^\r\n\\"]|\\.)*"(?!")|"""[\s\S]*?""")/,
  22. lookbehind: true,
  23. greedy: true,
  24. inside: {
  25. 'continuation': {
  26. pattern: /([\r\n])>/,
  27. lookbehind: true,
  28. alias: 'punctuation'
  29. }
  30. }
  31. },
  32. 'keyword': /\b(?:Assert|Info|IsBound|QUIT|TryNextMethod|Unbind|and|atomic|break|continue|do|elif|else|end|fi|for|function|if|in|local|mod|not|od|or|quit|readonly|readwrite|rec|repeat|return|then|until|while)\b/,
  33. 'boolean': /\b(?:false|true)\b/,
  34. 'function': /\b[a-z_]\w*(?=\s*\()/i,
  35. 'number': {
  36. pattern: /(^|[^\w.]|\.\.)(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:_[a-z]?)?(?=$|[^\w.]|\.\.)/,
  37. lookbehind: true
  38. },
  39. 'continuation': {
  40. pattern: /([\r\n])>/,
  41. lookbehind: true,
  42. alias: 'punctuation'
  43. },
  44. 'operator': /->|[-+*/^~=!]|<>|[<>]=?|:=|\.\./,
  45. 'punctuation': /[()[\]{},;.:]/
  46. };
  47. Prism.languages.gap.shell.inside.gap.inside = Prism.languages.gap;