Advertisement
Guest User

Untitled

a guest
May 26th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. // WTFPL licensed
  2. // scratching the surface of research microsoft com/fsharp/manual/spec2.aspx#_Toc207785562
  3. // omits reserved-ident-formats, reserved-symbolic-sequence, quote-op-*, symbolic-op, ...
  4. SyntaxHighlighter.brushes.FSharp = function()
  5. {
  6. var keywords = 'abstract and as assert base begin class default delegate do done ' +
  7. 'downcast downto elif else end exception extern false finally for '+
  8. 'fun function if in inherit inline interface internal lazy let ' +
  9. 'match member module mutable namespace new null of open or '+
  10. 'override private public rec return static struct then to '+
  11. 'true try type upcast use val void when while with yield';
  12. var ocaml = 'asr land lor lsl lsr lxor mod sig';
  13. var reserved ='atomic break checked component const constraint constructor '+
  14. 'continue eager event external fixed functor global include '+
  15. 'method mixin object parallel process protected pure '+
  16. 'sealed tailcall trait virtual volatile';
  17. var symbolic = 'let! use! do! yield! return! \\| -> <- \\. : \\( \\) \\[ \\] \\[< >\\] \\[\\| \\|\\] '+
  18. '\\{ \\} \' # :\\?> :\\? ; ;; :> := _ \\.\\. ::';
  19.  
  20. this.regexList = [
  21. { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
  22. { regex: new RegExp('\\(\\*[\\s\\S]*?\\*\\)', 'gm'), css: 'comments' }, // multiline comments
  23. { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
  24. { regex: new RegExp('^\\s*#.*', 'gm'), css: 'preprocessor' }, // preprocessor tags like #light
  25. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // f# keyword
  26. //{ regex: new RegExp(this.getKeywords(ocaml), 'gm'), css: 'color1' }, // caml keyword
  27. //{ regex: new RegExp(this.getKeywords(reserved), 'gm'), css: 'color2' }, // reserved keyword
  28. //{ regex: new RegExp(this.getKeywords(symbolic), 'gm'), css: 'color3' } // symbolic keyword
  29. ];
  30. }
  31.  
  32. SyntaxHighlighter.brushes.FSharp.prototype = new SyntaxHighlighter.Highlighter();
  33. SyntaxHighlighter.brushes.FSharp.aliases = ['f#', 'f-sharp', 'fsharp'];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement