-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.wollok.js
83 lines (81 loc) · 2.39 KB
/
source.wollok.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
// 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 = {
extensions: ['.wlk'],
names: ['wollok'],
patterns: [{include: '#general'}],
repository: {
commentBlock: {
patterns: [
{match: '(//).*', name: 'comment.line.double-slash.source.wollok'},
{begin: '/\\*', end: '\\*/', name: 'comment.block.source.wollok'}
]
},
general: {
patterns: [
{include: '#commentBlock'},
{include: '#operators'},
{include: '#keywords'},
{include: '#numbers'},
{include: '#stringSingleQuote'},
{include: '#stringDoubleQuote'}
]
},
keywords: {
match:
'\\b(object|class|package|program|test|describe|method|override|constructor|native|var|const|property|inherits|new|if|else|self|super|import|null|true|false|return|throw|then always|try|catch|mixed with|with|mixin|fixture)\\b',
name: 'keyword.source.wollok'
},
numbers: {
match:
'(?<![\\d.])\\s0x[a-fA-F\\d]+|\\b\\d+(\\.\\d+)?([eE]-?\\d+)?|\\.\\d+([eE]-?\\d+)?',
name: 'constant.numeric.source.wollok'
},
operators: {
match:
'(\\b(and|or|not)\\b)|(\\+|-|%|#|\\*|\\/|\\^|==?|~=|<=?|>=?|(?<!\\.)\\.{2}(?!\\.))',
name: 'keyword.operator.source.wollok'
},
stringDoubleQuote: {
begin: '"',
beginCaptures: {
0: {name: 'punctuation.definition.string.begin.source.wollok'}
},
end: '"',
endCaptures: {
0: {name: 'punctuation.definition.string.end.source.wollok'}
},
name: 'string.quoted.double.source.wollok',
patterns: [
{
match: '\\\\(\\d{1,3}|.)',
name: 'constant.character.escape.source.wollok'
}
]
},
stringSingleQuote: {
begin: "'",
beginCaptures: {
0: {name: 'punctuation.definition.string.begin.source.wollok'}
},
end: "'",
endCaptures: {
0: {name: 'punctuation.definition.string.end.source.wollok'}
},
name: 'string.quoted.single.source.wollok',
patterns: [
{
match: '\\\\(\\d{1,3}|.)',
name: 'constant.character.escape.source.wollok'
}
]
}
},
scopeName: 'source.wollok'
}
export default grammar