-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshBrushCL.js
62 lines (58 loc) · 3.23 KB
/
shBrushCL.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* sh-brushes Brushes for SyntaxHighlighter
* Copyright (C) 2009 Ivan Chernetsky
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
SyntaxHighlighter.brushes.CL = function () {
var keywords = 'defgeneric defmacro defmethod defsetf define-condition ' +
'define-method-combination define-setf-expander define-compiler-macro ' +
'define-modify-macro define-symbol-macro defconstant defvar defclass ' +
'defpackage defstruct deftype setf cond eval eval-when inline if lambda ' +
'let let* prog prog1 prog2 progn progv unwind-protect while block break ' +
'case ecase typecase declare declaim destructuring-bind do dolist dotimes ' +
'etypecase flet go handler-bind handler-case ignore-errors in-package ' +
'labels locally loop macrolet multiple-value-bind multiple-value-prog1 ' +
'proclaim restart-bind restart-case symbol-macrolet tagbody unless when ' +
'with-accessors with-compilation-unit with-condition-restarts ' +
'with-hash-table-iterator with-input-from-string with-open-file ' +
'with-open-stream with-output-to-string with-package-iterator ' +
'with-simple-restart with-slots with-standard-io-syntax catch throw ' +
'provide require t nil defun defvar defparameter';
var errorKeywords = 'abort assert warn check-type cerror error signal';
var beforeSymbol = '(?:^|\\(|\\s+)';
var symbolRegex = '(?:&|<|>|[-\\w\\d/<>\\=\\?\\*\\+%&]){3,}';
this.regexList = [
// keyword symbols
{ regex: new RegExp(beforeSymbol + '\\:' + symbolRegex, 'g'), css: 'functions' },
// lambda list keywords
{ regex: new RegExp(beforeSymbol + '(?:&|&)' + symbolRegex, 'g'), css: 'value' },
// quoted symbols
{ regex: new RegExp(beforeSymbol + "'" + symbolRegex, 'g'), css: 'variable' },
// constants
{ regex: new RegExp(beforeSymbol + '\\+' + symbolRegex, 'g'), css: 'constants' },
// global variables
{ regex: new RegExp(beforeSymbol + '\\*' + symbolRegex, 'g'), css: 'constants bold' },
// comments
{ regex: new RegExp('(?:^|\\(|\\)|\\s);.*', 'g'), css: 'comments' },
// strings
{ regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' },
// keywords
{ regex: new RegExp(this.getKeywords(keywords), 'g'), css: 'keyword' },
// functions related to signals
{ regex: new RegExp(this.getKeywords(errorKeywords), 'g'), css: 'color3' }
];
};
SyntaxHighlighter.brushes.CL.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.CL.aliases = ['cl'];