flix.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. begin: '"',
  17. end: '"'
  18. }]
  19. };
  20. const NAME = {
  21. className: 'title',
  22. relevance: 0,
  23. begin: /[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/
  24. };
  25. const METHOD = {
  26. className: 'function',
  27. beginKeywords: 'def',
  28. end: /[:={\[(\n;]/,
  29. excludeEnd: true,
  30. contains: [NAME]
  31. };
  32. return {
  33. name: 'Flix',
  34. keywords: {
  35. literal: 'true false',
  36. keyword: 'case class def else enum if impl import in lat rel index let match namespace switch type yield with'
  37. },
  38. contains: [
  39. hljs.C_LINE_COMMENT_MODE,
  40. hljs.C_BLOCK_COMMENT_MODE,
  41. CHAR,
  42. STRING,
  43. METHOD,
  44. hljs.C_NUMBER_MODE
  45. ]
  46. };
  47. }
  48. module.exports = flix;