-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
source.lisp.js
85 lines (83 loc) · 2.6 KB
/
source.lisp.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is licensed permissive.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.lfe', '.nl', '.nlogo', '.srt'],
extensionsWithDot: ['.md'],
names: [
'gcc-machine-description',
'lfe',
'netlogo',
'newlisp',
'picolisp',
'srecode-template'
],
patterns: [
{
begin: '(^[ \\t]+)?(?=;)',
beginCaptures: {1: {name: 'punctuation.whitespace.comment.leading.lisp'}},
end: '(?!\\G)',
patterns: [
{
begin: ';',
beginCaptures: {0: {name: 'punctuation.definition.comment.lisp'}},
end: '\\n',
name: 'comment.line.semicolon.lisp'
}
]
},
{
captures: {
2: {name: 'storage.type.function-type.lisp'},
4: {name: 'entity.name.function.lisp'}
},
match:
'(\\b(?i:(defun|defgeneric|defmethod|defmacro|defclass|defstruct|defconstant|defvar|defparameter))\\b)(\\s+)((\\w|\\-|\\!|\\?)*)',
name: 'meta.function.lisp'
},
{
captures: {1: {name: 'punctuation.definition.constant.lisp'}},
match: '(#|\\?)(\\w|[\\\\+-=<>\'"&#])+',
name: 'constant.character.lisp'
},
{
captures: {
1: {name: 'punctuation.definition.variable.lisp'},
3: {name: 'punctuation.definition.variable.lisp'}
},
match: '(\\*)(\\S*)(\\*)',
name: 'variable.other.global.lisp'
},
{
match:
'\\b(?i:case|ecase|ccase|typecase|etypecase|ctypecase|do|dolist|dotimes|let|let\\*|labels|flet|loop|if|else|when|unless)\\b',
name: 'keyword.control.lisp'
},
{match: '\\b(?i:eq|neq|and|or|not)\\b', name: 'keyword.operator.lisp'},
{match: '\\b(?i:null|nil)\\b', name: 'constant.language.lisp'},
{
match:
'(?<![-\\w])(?i:cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn)(?![-\\w])',
name: 'support.function.lisp'
},
{
match:
'\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b',
name: 'constant.numeric.lisp'
},
{
begin: '"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.lisp'}},
end: '"',
endCaptures: {0: {name: 'punctuation.definition.string.end.lisp'}},
name: 'string.quoted.double.lisp',
patterns: [{match: '\\\\.', name: 'constant.character.escape.lisp'}]
}
],
scopeName: 'source.lisp'
}
export default grammar