-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (33 loc) · 1.18 KB
/
index.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
/**
* @fileoverview Syntax Highlighting for JS-flavored CocoaScript
* @author Andrew Holloway
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
var requireIndex = require("requireindex");
//------------------------------------------------------------------------------
// Plugin Definition
//------------------------------------------------------------------------------
var re_importStatement = /\@import[ ]+[A-Za-z0-9\/\.\"\']+\;/;
var re_nilStatement = /(nil|NIL)/;
function stripImports(fromString) {
return fromString.replace(re_importStatement, '');
}
function replaceNil(inString) {
return inString.replace(re_nilStatement, 'null');
}
// import processors
module.exports.processors = {
// add your processors here
".sketchscript": {
preprocess: function(text, filename) {
// parsing on two things to start (run all preprocess methods above):
return [stripImports(replaceNil(text))];
},
postprocess: function(messages, filename) {
return messages[0];
}
}
};