fsharp.js 1.7 KB

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