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