-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.objectscript_macros.js
141 lines (139 loc) · 4.34 KB
/
source.objectscript_macros.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
dependencies: ['source.objectscript'],
extensions: [],
names: [],
patterns: [
{include: '#include'},
{include: '#dim'},
{include: '#define'},
{include: '#def1arg'},
{include: '#ifdef'},
{include: '#comment-line'}
],
repository: {
'comment-line': {
patterns: [
{match: '^///.*$', name: 'comment.line.objectscript'},
{match: '\\s+//.*$', name: 'comment.line.objectscript'},
{match: '\\s+;.*$', name: 'comment.line.objectscript'},
{match: '^\\s*#;.*$', name: 'comment.line.objectscript'},
{
begin: '/\\*',
beginCaptures: {0: {name: 'punctuation.definition.objectscript'}},
end: '\\*/',
endCaptures: {0: {name: 'punctuation.definition.objectscript'}},
name: 'comment.block.objectscript'
}
]
},
continue: {
patterns: [
{
match: '(\\s+\\#\\#(?i)(continue)\\s*)',
name: 'keyword.control.objectscript'
}
]
},
def1arg: {
patterns: [
{
begin:
'^\\s*(\\#\\s*(?:(?i)def1arg))\\s+((?<id>[a-zA-Z%][a-zA-Z0-9]*))(?:(\\()(\\s*\\g<id>\\s*)(\\)))',
beginCaptures: {
1: {name: 'keyword.control.objectscript'},
2: {name: 'entity.name.objectscript'},
4: {name: 'punctuation.definition.objectscript'},
5: {name: 'variable.parameter.objectscript'},
6: {name: 'punctuation.definition.objectscript'}
},
end: '(?<!\\#\\#continue)\\n',
name: 'meta.preprocessor.objectscript',
patterns: [
{include: '#comment-line'},
{include: '#continue'},
{include: '#digits'},
{include: '#macros'},
{include: 'source.objectscript'}
]
}
]
},
define: {
patterns: [
{
begin:
'^\\s*(\\#\\s*(?:(?i)define))\\s+((?<id>[a-zA-Z%][a-zA-Z0-9]*))(?:(\\()(\\s*\\g<id>\\s*((,)\\s*\\g<id>\\s*)*)(\\)))?',
beginCaptures: {
1: {name: 'keyword.control.objectscript'},
2: {name: 'entity.name.objectscript'},
4: {name: 'punctuation.definition.objectscript'},
5: {name: 'variable.parameter.objectscript'},
7: {name: 'punctuation.definition.objectscript'}
},
end: '(?<!\\#\\#continue)\\n',
name: 'meta.preprocessor.objectscript',
patterns: [
{include: '#comment-line'},
{include: '#continue'},
{include: '#macros'},
{include: 'source.objectscript'}
]
}
]
},
dim: {
patterns: [
{
captures: {
1: {name: 'keyword.control.objectscript'},
2: {name: 'variable.name'},
4: {name: 'punctuation.definition.objectscript'},
5: {name: 'variable.name'},
7: {name: 'keyword.control.objectscript'},
8: {name: 'entity.name.class.objectscript'}
},
match:
'^\\s*(\\#\\s*(?:(?i)dim))\\s+((?<id>[a-zA-Z%][a-zA-Z0-9]*))(?:\\s*(,)\\s*((\\g<id>)*))*(?:\\s+((?i)As)(?:\\s(\\g<id>(?:\\.\\g<id>)*)))?',
name: 'meta.preprocessor.objectscript'
}
]
},
ifdef: {
patterns: [
{
begin: '^\\s*(#\\s*(?i)(?:if|ifdef|ifndef|elif|else|undef|endif))\\b',
beginCaptures: {1: {name: 'keyword.control.objectscript'}},
contentName: 'meta.preprocessor.objectscript',
end: '(?=(?:;|//|/\\*))|$',
patterns: [{include: '#digits'}, {include: '#comment-line'}]
}
]
},
include: {
patterns: [
{
begin: '^\\s*(\\#\\s*(?:(?i)include))\\s+([a-zA-Z%][a-zA-Z0-9]*)',
beginCaptures: {
1: {name: 'keyword.other.objectscript'},
2: {name: 'entity.name.objectscript'}
},
end: '(?=$)'
}
]
},
macros: {
patterns: [
{match: '\\$\\$\\$[a-zA-Z]([a-zA-Z0-9])*', name: 'support.constant'}
]
}
},
scopeName: 'source.objectscript_macros'
}
export default grammar