-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.lolcode.js
117 lines (115 loc) · 3.57 KB
/
source.lolcode.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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/KrazIvan/LOLCODE-grammar-vscode>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.lol'],
names: ['lolcode'],
patterns: [
{include: '#comments'},
{include: '#keywords'},
{include: '#strings'},
{include: '#numbers'},
{include: '#variables'},
{include: '#operators'},
{include: '#parentheses'}
],
repository: {
comments: {
patterns: [
{match: '(?<!\\S)BTW(?:[^\\n]*)', name: 'comment.line.lolcode'},
{
begin: '(?<!\\S)OBTW(?!\\S)',
beginCaptures: {0: {name: 'punctuation.definition.comment.lolcode'}},
end: '(?<!\\S)TLDR(?!\\S)',
endCaptures: {0: {name: 'punctuation.definition.comment.lolcode'}},
name: 'comment.block.lolcode'
}
]
},
keywords: {
patterns: [
{
match:
'(?:(?<=[^a-zA-Z0-9\\?])|(?:^))(O HAI IM|HAI|AWSUM THX|O NOES|KTHX|KTHXBYE|ITZ LIEK|IS NOW A|BOTH SAEM|BIGGR OF|SMALLR OF|UPPIN YR|NERFIN YR|TIL|WILE|DIFFRINT|ITZ A|ITZ|IS|IZ|AN|BIGGR|SMALLR|EITHER|MAEK|WON|NOT|ALL|ANY|MKAY|IF U SAY SO|OIC|I HAS A|IM OUTTA YR|GTFO|WTF\\?|YA RLY|O RLY\\?|MEBBE|IM IN YR|YR|HAS A|NO WAI|FOUND|OF|R|I IZ|OMG|OMGWTF|A)(?:(?=[^a-zA-Z0-9\\?])|(?:$))',
name: 'keyword.control.lolcode'
},
{
captures: {
1: {name: 'keyword.control.lolcode'},
2: {name: 'entity.name.class.lolcode'},
3: {name: 'keyword.control.lolcode'}
},
match: '(CAN HAS )(.*?)(\\?)'
},
{
captures: {
1: {name: 'keyword.control.lolcode'},
2: {name: 'variable.other.lolcode'},
3: {name: 'keyword.control.lolcode'}
},
match: '(PLZ OPEN FILE )(.*?)(\\?)'
},
{
match:
'\\b(?:VISIBLE|GIMMEH|SUM|DIFF|SRS|PRODUKT|QUOSHUNT|MOD|BIGGER THAN|SMALLER THAN|SMOOSH|INVISIBLE)\\b',
name: 'support.function.lolcode'
},
{
match: '\\b(?:HOW IZ I|HOW DUZ I)\\b',
name: 'storage.type.function.lolcode'
},
{
match: '\\b(?:TROOF|NUMBR|NUMBAR|YARN|BUKKIT|NOOB)\\b',
name: 'storage.type.lolcode'
},
{match: '\\b(?:WIN|FAIL)\\b', name: 'constant.language.boolean.lolcode'}
]
},
numbers: {
patterns: [
{match: '\\b\\d+\\.\\d+\\b', name: 'constant.numeric.float.lolcode'},
{match: '\\b\\d+\\b', name: 'constant.numeric.integer.lolcode'}
]
},
operators: {
patterns: [
{
match: '\\+|-|\\*|/|%|>|<|=|!|\\?|:',
name: 'keyword.operator.lolcode'
},
{include: '#parentheses'}
]
},
parentheses: {
patterns: [{match: '\\(|\\)', name: 'punctuation.parenthesis.lolcode'}]
},
strings: {
patterns: [
{
captures: {
1: {name: 'string.quoted.double.lolcode'},
2: {name: 'string.quoted.single.lolcode'}
},
match: '("(?:\\\\.|[^"\\\\])*")|(\'(?:\\\\.|[^\'\\\\])*\')'
}
]
},
variables: {
patterns: [
{
match: '(?<=\\b)([A-Za-z][A-Za-z0-9_]*)\\b',
name: 'variable.other.lolcode'
},
{match: '(?<=CAN HAS )(\\w*)(?=\\?)', name: 'variable.other.lolcode'}
]
}
},
scopeName: 'source.lolcode'
}
export default grammar