PageRenderTime 45ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/assets/support/node_modules/highlight.js/clojure.js

https://bitbucket.org/byronsanchez/tehpotatoking.com
JavaScript | 95 lines | 90 code | 4 blank | 1 comment | 4 complexity | 9b595d50f66de8fc43e81668561c5d43 MD5 | raw file
  1. module.exports = function(hljs) {
  2. var keywords = {
  3. built_in:
  4. // Clojure keywords
  5. 'def cond apply if-not if-let if not not= = &lt; < > &lt;= <= >= == + / * - rem '+
  6. 'quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? '+
  7. 'set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? '+
  8. 'class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? '+
  9. 'string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . '+
  10. 'inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last '+
  11. 'drop-while while intern condp case reduced cycle split-at split-with repeat replicate '+
  12. 'iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext '+
  13. 'nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends '+
  14. 'add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler '+
  15. 'set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter '+
  16. 'monitor-exit defmacro defn defn- macroexpand macroexpand-1 for doseq dosync dotimes and or '+
  17. 'when when-not when-let comp juxt partial sequence memoize constantly complement identity assert '+
  18. 'peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast '+
  19. 'sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import '+
  20. 'intern refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! '+
  21. 'assoc! dissoc! pop! disj! import use class type num float double short byte boolean bigint biginteger '+
  22. 'bigdec print-method print-dup throw-if throw printf format load compile get-in update-in pr pr-on newline '+
  23. 'flush read slurp read-line subvec with-open memfn time ns assert re-find re-groups rand-int rand mod locking '+
  24. 'assert-valid-fdecl alias namespace resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! '+
  25. 'reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! '+
  26. 'new next conj set! memfn to-array future future-call into-array aset gen-class reduce merge map filter find empty '+
  27. 'hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list '+
  28. 'disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer '+
  29. 'chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate '+
  30. 'unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta '+
  31. 'lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize'
  32. };
  33. var CLJ_IDENT_RE = '[a-zA-Z_0-9\\!\\.\\?\\-\\+\\*\\/\\<\\=\\>\\&\\#\\$\';]+';
  34. var SIMPLE_NUMBER_RE = '[\\s:\\(\\{]+\\d+(\\.\\d+)?';
  35. var NUMBER = {
  36. className: 'number', begin: SIMPLE_NUMBER_RE,
  37. relevance: 0
  38. };
  39. var STRING = {
  40. className: 'string',
  41. begin: '"', end: '"',
  42. contains: [hljs.BACKSLASH_ESCAPE],
  43. relevance: 0
  44. };
  45. var COMMENT = {
  46. className: 'comment',
  47. begin: ';', end: '$',
  48. relevance: 0
  49. };
  50. var COLLECTION = {
  51. className: 'collection',
  52. begin: '[\\[\\{]', end: '[\\]\\}]'
  53. };
  54. var HINT = {
  55. className: 'comment',
  56. begin: '\\^' + CLJ_IDENT_RE
  57. };
  58. var HINT_COL = {
  59. className: 'comment',
  60. begin: '\\^\\{', end: '\\}'
  61. };
  62. var KEY = {
  63. className: 'attribute',
  64. begin: '[:]' + CLJ_IDENT_RE
  65. };
  66. var LIST = {
  67. className: 'list',
  68. begin: '\\(', end: '\\)'
  69. };
  70. var BODY = {
  71. endsWithParent: true,
  72. keywords: {literal: 'true false nil'},
  73. relevance: 0
  74. };
  75. var TITLE = {
  76. keywords: keywords,
  77. lexems: CLJ_IDENT_RE,
  78. className: 'title', begin: CLJ_IDENT_RE,
  79. starts: BODY
  80. };
  81. LIST.contains = [{className: 'comment', begin: 'comment'}, TITLE, BODY];
  82. BODY.contains = [LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER];
  83. COLLECTION.contains = [LIST, STRING, HINT, COMMENT, KEY, COLLECTION, NUMBER];
  84. return {
  85. illegal: /\S/,
  86. contains: [
  87. COMMENT,
  88. LIST
  89. ]
  90. }
  91. };