prism-squirrel.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Prism.languages.squirrel = Prism.languages.extend('clike', {
  2. 'comment': [
  3. Prism.languages.clike['comment'][0],
  4. {
  5. pattern: /(^|[^\\:])(?:\/\/|#).*/,
  6. lookbehind: true,
  7. greedy: true
  8. }
  9. ],
  10. 'string': {
  11. pattern: /(^|[^\\"'@])(?:@"(?:[^"]|"")*"(?!")|"(?:[^\\\r\n"]|\\.)*")/,
  12. lookbehind: true,
  13. greedy: true
  14. },
  15. 'class-name': {
  16. pattern: /(\b(?:class|enum|extends|instanceof)\s+)\w+(?:\.\w+)*/,
  17. lookbehind: true,
  18. inside: {
  19. 'punctuation': /\./
  20. }
  21. },
  22. 'keyword': /\b(?:__FILE__|__LINE__|base|break|case|catch|class|clone|const|constructor|continue|default|delete|else|enum|extends|for|foreach|function|if|in|instanceof|local|null|resume|return|static|switch|this|throw|try|typeof|while|yield)\b/,
  23. 'number': /\b(?:0x[0-9a-fA-F]+|\d+(?:\.(?:\d+|[eE][+-]?\d+))?)\b/,
  24. 'operator': /\+\+|--|<=>|<[-<]|>>>?|&&?|\|\|?|[-+*/%!=<>]=?|[~^]|::?/,
  25. 'punctuation': /[(){}\[\],;.]/
  26. });
  27. Prism.languages.insertBefore('squirrel', 'string', {
  28. 'char': {
  29. pattern: /(^|[^\\"'])'(?:[^\\']|\\(?:[xuU][0-9a-fA-F]{0,8}|[\s\S]))'/,
  30. lookbehind: true,
  31. greedy: true
  32. }
  33. });
  34. Prism.languages.insertBefore('squirrel', 'operator', {
  35. 'attribute-punctuation': {
  36. pattern: /<\/|\/>/,
  37. alias: 'important'
  38. },
  39. 'lambda': {
  40. pattern: /@(?=\()/,
  41. alias: 'operator'
  42. }
  43. });