-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
83 lines (66 loc) · 2.56 KB
/
main.js
File metadata and controls
83 lines (66 loc) · 2.56 KB
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
/*jslint regexp: true, vars:true*/
/*global define, $, brackets, console*/
/* KISS Syntax Highlighting to increase readability in Brackets
v1.0 Simon Wall [email protected]
*/
define(function (require, exports, module) {
'use strict';
// Integrate with Brackets Language Manager
var LanguageManager = brackets.getModule("language/LanguageManager");
var CodeMirror = brackets.getModule("thirdparty/CodeMirror2/lib/codemirror");
CodeMirror.defineMode("KISSCODES", function () {
var ExtensionUtils = brackets.getModule("utils/ExtensionUtils");
ExtensionUtils.loadStyleSheet(module, "styles/styles.css");
return {
token: function (stream, state) {
// Program Start %
if (stream.match(/([\/].*)/, false)) {
stream.skipToEnd();
return 'program_start';
}
// Program Number
if (stream.match(/([o][0-9]{1,4})/i)) {
stream.skipToEnd();
return 'program_number';
}
// Block Number
if (stream.match(/([n][0-9]+)/i)) {
return 'block_number';
}
// Comment
// but you can't call it 'comment' or it's overwritten by the defaults
if (stream.match(/(\(.+\))/)) {
stream.skipToEnd();
return 'comment_line';
}
// D-Code
if (stream.match(/([d][0-9]{1,3})/i)) {
return 'dcode';
}
// A-Code
if (stream.match(/([a][0-9]{1,3})/i)) {
return 'acode';
}
// Feed Rate
if (stream.match(/([KISS][0-9]+\.?[0-9]*)/i)) {
return 'KISS';
}
// Skip everything else
stream.eat(/./);
},
startState: function () {
return {
inComment: false
};
}
};
});
CodeMirror.defineMIME("text/x-KISSCODES", "KISSCODES");
LanguageManager.defineLanguage("KISSCODES", {
name: "KISSCODES",
mode: "KISSCODES",
fileExtensions: ["kss"],
blockComment: ["(", ")"],
lineComment: [";"]
});
});