-
Notifications
You must be signed in to change notification settings - Fork 1
/
rwhile_highlight_rules.js
68 lines (59 loc) · 2.2 KB
/
rwhile_highlight_rules.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
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var RwhileHighlightRules = function() {
var keyword = ("cons|hd|tl|if|fi|from|until|show|then|else|do|loop|read|write|macro");
// 組み込み定数
var builtinConstants = ("nil");
var keywordMapper = this.createKeywordMapper({
"keyword": keyword,
"constant.language": builtinConstants,
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [
{
token : "comment", // multi line comment
regex : "\\(\\*",
next : "comment"
}, {
token: keywordMapper, // String, Array, or Function: the CSS token to apply
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b", // String or RegExp: the regexp to match
}, {
token : "keyword.operator",
regex : "\\^=|<=|=\\?"
}, {
token : "variable",
regex : /'(?!\s|\.|;|,|\))/,
next : "variable"
}
],
"variable" : [
{
token : "variable",
regex : /[a-zA-Z0-9](?=\s|\.|;|,|\))/,
next : "start"
}, {
token : "variable",
regex : /^\s*/,
next : "start"
}, {
defaultToken : "variable"
}
],
"comment" : [
{
token : "comment", // closing comment
regex : "\\*\\)",
next : "start"
}, {
defaultToken : "comment"
}
]
};
};
oop.inherits(RwhileHighlightRules, TextHighlightRules);
exports.RwhileHighlightRules = RwhileHighlightRules;
});