Update to 8.0
This commit is contained in:
@@ -4,7 +4,7 @@ Description: Clojure syntax (based on lisp.js)
|
||||
Author: mfornos
|
||||
*/
|
||||
|
||||
hljs.LANGUAGES['clojure'] = function(hljs) {
|
||||
function(hljs) {
|
||||
var keywords = {
|
||||
built_in:
|
||||
// Clojure keywords
|
||||
@@ -19,17 +19,17 @@ hljs.LANGUAGES['clojure'] = function(hljs) {
|
||||
'nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends '+
|
||||
'add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler '+
|
||||
'set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter '+
|
||||
'monitor-exit defmacro defn defn- macroexpand macroexpand-1 for doseq dosync dotimes and or '+
|
||||
'monitor-exit defmacro defn defn- macroexpand macroexpand-1 for dosync and or '+
|
||||
'when when-not when-let comp juxt partial sequence memoize constantly complement identity assert '+
|
||||
'peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast '+
|
||||
'sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import '+
|
||||
'intern refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! '+
|
||||
'assoc! dissoc! pop! disj! import use class type num float double short byte boolean bigint biginteger '+
|
||||
'bigdec print-method print-dup throw-if throw printf format load compile get-in update-in pr pr-on newline '+
|
||||
'flush read slurp read-line subvec with-open memfn time ns assert re-find re-groups rand-int rand mod locking '+
|
||||
'assert-valid-fdecl alias namespace resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! '+
|
||||
'refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! '+
|
||||
'assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger '+
|
||||
'bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline '+
|
||||
'flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking '+
|
||||
'assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! '+
|
||||
'reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! '+
|
||||
'new next conj set! memfn to-array future future-call into-array aset gen-class reduce merge map filter find empty '+
|
||||
'new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty '+
|
||||
'hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list '+
|
||||
'disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer '+
|
||||
'chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate '+
|
||||
@@ -44,12 +44,7 @@ hljs.LANGUAGES['clojure'] = function(hljs) {
|
||||
className: 'number', begin: SIMPLE_NUMBER_RE,
|
||||
relevance: 0
|
||||
};
|
||||
var STRING = {
|
||||
className: 'string',
|
||||
begin: '"', end: '"',
|
||||
contains: [hljs.BACKSLASH_ESCAPE],
|
||||
relevance: 0
|
||||
};
|
||||
var STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null});
|
||||
var COMMENT = {
|
||||
className: 'comment',
|
||||
begin: ';', end: '$',
|
||||
@@ -66,6 +61,7 @@ hljs.LANGUAGES['clojure'] = function(hljs) {
|
||||
var HINT_COL = {
|
||||
className: 'comment',
|
||||
begin: '\\^\\{', end: '\\}'
|
||||
|
||||
};
|
||||
var KEY = {
|
||||
className: 'attribute',
|
||||
@@ -73,33 +69,35 @@ hljs.LANGUAGES['clojure'] = function(hljs) {
|
||||
};
|
||||
var LIST = {
|
||||
className: 'list',
|
||||
begin: '\\(', end: '\\)',
|
||||
relevance: 0
|
||||
begin: '\\(', end: '\\)'
|
||||
};
|
||||
var BODY = {
|
||||
endsWithParent: true, excludeEnd: true,
|
||||
endsWithParent: true,
|
||||
keywords: {literal: 'true false nil'},
|
||||
relevance: 0
|
||||
};
|
||||
var TITLE = {
|
||||
keywords: keywords,
|
||||
lexems: CLJ_IDENT_RE,
|
||||
lexemes: CLJ_IDENT_RE,
|
||||
className: 'title', begin: CLJ_IDENT_RE,
|
||||
starts: BODY
|
||||
};
|
||||
|
||||
LIST.contains = [{className: 'comment', begin: 'comment'}, TITLE];
|
||||
LIST.contains = [{className: 'comment', begin: 'comment'}, TITLE, BODY];
|
||||
BODY.contains = [LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER];
|
||||
COLLECTION.contains = [LIST, STRING, HINT, COMMENT, KEY, COLLECTION, NUMBER];
|
||||
|
||||
return {
|
||||
case_insensitive: true,
|
||||
defaultMode: {
|
||||
illegal: '\\S',
|
||||
contains: [
|
||||
COMMENT,
|
||||
LIST
|
||||
]
|
||||
}
|
||||
aliases: ['clj'],
|
||||
illegal: /\S/,
|
||||
contains: [
|
||||
COMMENT,
|
||||
LIST,
|
||||
{
|
||||
className: 'prompt',
|
||||
begin: /^=> /,
|
||||
starts: {end: /\n\n|\Z/} // eat up prompt output to not interfere with the illegal
|
||||
}
|
||||
]
|
||||
}
|
||||
}(hljs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user