-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
source.scilab.js
69 lines (67 loc) · 2.09 KB
/
source.scilab.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
// 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: ['.sci', '.sce'],
names: ['scilab'],
patterns: [
{
begin: '(^[ \\t]+)?(?=//)',
beginCaptures: {
1: {name: 'punctuation.whitespace.comment.leading.scilab'}
},
end: '(?!\\G)',
patterns: [
{
begin: '//',
beginCaptures: {0: {name: 'punctuation.definition.comment.scilab'}},
end: '\\n',
name: 'comment.line.double-slash.scilab'
}
]
},
{
match: '\\b(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?\\b',
name: 'constant.numeric.scilab'
},
{
match: '(%inf|%i|%pi|%eps|%e|%nan|%s|%t|%f)\\b',
name: 'support.constant.scilab'
},
{
begin: '"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.scilab'}},
end: '"(?!")',
endCaptures: {0: {name: 'punctuation.definition.string.end.scilab'}},
name: 'string.quoted.double.scilab',
patterns: [{match: '\'\'|""', name: 'constant.character.escape.scilab'}]
},
{
begin: "(?<![\\w\\]\\)])'",
beginCaptures: {0: {name: 'punctuation.definition.string.begin.scilab'}},
end: "'(?!')",
endCaptures: {0: {name: 'punctuation.definition.string.end.scilab'}},
name: 'string.quoted.single.scilab',
patterns: [{match: '\'\'|""', name: 'constant.character.escape.scilab'}]
},
{
captures: {
1: {name: 'keyword.control.scilab'},
2: {name: 'entity.name.function.scilab'}
},
match: '\\b(function)\\s+(?:[^=]+=\\s*)?(\\w+)(?:\\s*\\(.*\\))?'
},
{
match:
'\\b(if|then|else|elseif|while|for|function|end|endfunction|return|select|case|break|global)\\b',
name: 'keyword.control.scilab'
},
{match: '\\.\\.\\.\\s*$', name: 'punctuation.separator.continuation.scilab'}
],
scopeName: 'source.scilab'
}
export default grammar