flix.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. Language: Flix
  3. Category: functional
  4. Author: Magnus Madsen <mmadsen@uwaterloo.ca>
  5. Website: https://flix.dev/
  6. */
  7. /** @type LanguageFn */
  8. function flix(hljs) {
  9. const CHAR = {
  10. className: 'string',
  11. begin: /'(.|\\[xXuU][a-zA-Z0-9]+)'/
  12. };
  13. const STRING = {
  14. className: 'string',
  15. variants: [
  16. {
  17. begin: '"',
  18. end: '"'
  19. }
  20. ]
  21. };
  22. const NAME = {
  23. className: 'title',
  24. relevance: 0,
  25. begin: /[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/
  26. };
  27. const METHOD = {
  28. className: 'function',
  29. beginKeywords: 'def',
  30. end: /[:={\[(\n;]/,
  31. excludeEnd: true,
  32. contains: [ NAME ]
  33. };
  34. return {
  35. name: 'Flix',
  36. keywords: {
  37. keyword: [
  38. "case",
  39. "class",
  40. "def",
  41. "else",
  42. "enum",
  43. "if",
  44. "impl",
  45. "import",
  46. "in",
  47. "lat",
  48. "rel",
  49. "index",
  50. "let",
  51. "match",
  52. "namespace",
  53. "switch",
  54. "type",
  55. "yield",
  56. "with"
  57. ],
  58. literal: [
  59. "true",
  60. "false"
  61. ]
  62. },
  63. contains: [
  64. hljs.C_LINE_COMMENT_MODE,
  65. hljs.C_BLOCK_COMMENT_MODE,
  66. CHAR,
  67. STRING,
  68. METHOD,
  69. hljs.C_NUMBER_MODE
  70. ]
  71. };
  72. }
  73. export { flix as default };