fsharp.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. module.exports = function(hljs) {
  2. var TYPEPARAM = {
  3. begin: '<', end: '>',
  4. contains: [
  5. hljs.inherit(hljs.TITLE_MODE, {begin: /'[a-zA-Z0-9_]+/})
  6. ]
  7. };
  8. return {
  9. aliases: ['fs'],
  10. keywords:
  11. 'abstract and as assert base begin class default delegate do done ' +
  12. 'downcast downto elif else end exception extern false finally for ' +
  13. 'fun function global if in inherit inline interface internal lazy let ' +
  14. 'match member module mutable namespace new null of open or ' +
  15. 'override private public rec return sig static struct then to ' +
  16. 'true try type upcast use val void when while with yield',
  17. illegal: /\/\*/,
  18. contains: [
  19. {
  20. // monad builder keywords (matches before non-bang kws)
  21. className: 'keyword',
  22. begin: /\b(yield|return|let|do)!/
  23. },
  24. {
  25. className: 'string',
  26. begin: '@"', end: '"',
  27. contains: [{begin: '""'}]
  28. },
  29. {
  30. className: 'string',
  31. begin: '"""', end: '"""'
  32. },
  33. hljs.COMMENT('\\(\\*', '\\*\\)'),
  34. {
  35. className: 'class',
  36. beginKeywords: 'type', end: '\\(|=|$', excludeEnd: true,
  37. contains: [
  38. hljs.UNDERSCORE_TITLE_MODE,
  39. TYPEPARAM
  40. ]
  41. },
  42. {
  43. className: 'meta',
  44. begin: '\\[<', end: '>\\]',
  45. relevance: 10
  46. },
  47. {
  48. className: 'symbol',
  49. begin: '\\B(\'[A-Za-z])\\b',
  50. contains: [hljs.BACKSLASH_ESCAPE]
  51. },
  52. hljs.C_LINE_COMMENT_MODE,
  53. hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
  54. hljs.C_NUMBER_MODE
  55. ]
  56. };
  57. };