-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
source.stl.js
78 lines (76 loc) · 2.55 KB
/
source.stl.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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/Alhadis/language-etc>
// and licensed `isc`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
dependencies: ['etc'],
extensions: ['.stl'],
names: ['stl', 'ascii-stl', 'stla'],
patterns: [{include: '#main'}],
repository: {
facet: {
begin: '(?:^|\\G|(?<=\\s))[ \\t]*(facet)(?:$|[ \\t]+)',
beginCaptures: {1: {name: 'keyword.control.begin.facet.stl'}},
end: '(?:^|\\G|(?<=\\s))[ \\t]*(endfacet)(?=$|\\s)',
endCaptures: {1: {name: 'keyword.control.end.facet.stl'}},
name: 'meta.facet.stl',
patterns: [{include: '#normal'}, {include: '#loop'}, {include: '#vertex'}]
},
loop: {
begin: '(?:^|\\G|(?<=\\s))[ \\t]*(outer[ \\t]+loop)(?=$|\\s)',
beginCaptures: {1: {name: 'keyword.control.begin.loop.stl'}},
end: '(?:^|\\G|(?<=\\s))[ \\t]*(endloop)(?=$|\\s)',
endCaptures: {1: {name: 'keyword.control.end.loop.stl'}},
name: 'meta.loop.stl',
patterns: [{include: '#vertex'}]
},
main: {
patterns: [
{include: '#solid'},
{include: '#facet'},
{include: '#loop'},
{include: '#vertex'}
]
},
normal: {
begin: '(?:^|\\G|(?<=\\s))normal(?=$|\\s)',
beginCaptures: {0: {name: 'storage.type.normal.stl'}},
end: '(?=[ \\t]*$)',
name: 'meta.normal.stl',
patterns: [{include: 'etc#num'}]
},
solid: {
begin:
'(?:^?|\\G|(?<=\\s))[ \\t]*(solid)(?:[ \\t]+(\\S+)(?:[ \\t]+(\\S.*))?)?[ \\t]*$',
beginCaptures: {
0: {name: 'meta.definition.header.stl'},
1: {name: 'keyword.control.start.solid.stl'},
2: {name: 'entity.name.solid.stl'},
3: {name: 'comment.line.ignored.stl'}
},
end: '(?:^?|\\G|(?<=\\s))[ \\t]*(endsolid)(?:[ \\t]+(\\2)(?=$|\\s))?(?:[ \\t]+(\\S.*))?[ \\t]*$',
endCaptures: {
0: {name: 'meta.definition.footer.stl'},
1: {name: 'keyword.control.end.solid.stl'},
2: {name: 'entity.name.solid.stl'},
3: {name: 'comment.line.ignored.stl'}
},
name: 'meta.solid.stl',
patterns: [{include: '#facet'}]
},
vertex: {
begin: '(?:^|\\G|(?<=\\s))[ \\t]*(vertex)(?=$|\\s)',
beginCaptures: {1: {name: 'storage.type.vertex.stl'}},
end: '$',
name: 'meta.vertex.stl',
patterns: [{include: 'etc#num'}]
}
},
scopeName: 'source.stl'
}
export default grammar