l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

fsharp.js (1884B)


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