| 1 |
ace.define("ace/mode/flix_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 2 |
var oop = require("../lib/oop"); |
| 3 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 4 |
var FlixHighlightRules = function () { |
| 5 |
var keywords = ("use|checked_cast|checked_ecast|unchecked_cast|masked_cast|as|discard|from|" + |
| 6 |
"into|inject|project|solve|query|where|select|force|import|region|red|deref"); |
| 7 |
var controlKeywords = ("choose|debug|do|for|forA|forM|foreach|yield|if|else|case|" + |
| 8 |
"match|typematch|try|catch|resume|spawn|par|branch|jumpto"); |
| 9 |
var operators = "not|and|or|fix"; |
| 10 |
var declarations = "eff|def|law|enum|case|type|alias|class|instance|mod|let"; |
| 11 |
var modifiers = "with|without|opaque|lazy|lawful|pub|override|sealed|static"; |
| 12 |
var primitives = "Unit|Bool|Char|Float32|Float64|Int8|Int16|Int32|Int64|BigInt|String"; |
| 13 |
var keywordMapper = this.createKeywordMapper({ |
| 14 |
"keyword": keywords, |
| 15 |
"keyword.control": controlKeywords, |
| 16 |
"keyword.operator": operators, |
| 17 |
"storage.type": declarations, |
| 18 |
"storage.modifier": modifiers, |
| 19 |
"support.type": primitives |
| 20 |
}, "identifier"); |
| 21 |
this.$rules = { |
| 22 |
"start": [ |
| 23 |
{ |
| 24 |
token: "comment.line", |
| 25 |
regex: "\\/\\/.*$" |
| 26 |
}, { |
| 27 |
token: "comment.block", |
| 28 |
regex: "\\/\\*", |
| 29 |
next: "comment" |
| 30 |
}, { |
| 31 |
token: "string", |
| 32 |
regex: '"', |
| 33 |
next: "string" |
| 34 |
}, { |
| 35 |
token: "string.regexp", |
| 36 |
regex: 'regex"', |
| 37 |
next: "regex" |
| 38 |
}, { |
| 39 |
token: "constant.character", |
| 40 |
regex: "'", |
| 41 |
next: "char" |
| 42 |
}, { |
| 43 |
token: "constant.numeric", |
| 44 |
regex: "0x[a-fA-F0-9](_*[a-fA-F0-9])*(i8|i16|i32|i64|ii)?\\b" |
| 45 |
}, { |
| 46 |
token: "constant.numeric", |
| 47 |
regex: "[0-9](_*[0-9])*\\.[0-9](_*[0-9])*(f32|f64)?\\b" |
| 48 |
}, { |
| 49 |
token: "constant.numeric", |
| 50 |
regex: "[0-9](_*[0-9])*(i8|i16|i32|i64|ii)?\\b" |
| 51 |
}, { |
| 52 |
token: "constant.language.boolean", |
| 53 |
regex: "(true|false)\\b" |
| 54 |
}, { |
| 55 |
token: "constant.language", |
| 56 |
regex: "null\\b" |
| 57 |
}, { |
| 58 |
token: "keyword.operator", |
| 59 |
regex: "\\->|~>|<\\-|=>" |
| 60 |
}, { |
| 61 |
token: "storage.modifier", |
| 62 |
regex: "@(Deprecated|Experimental|Internal|ParallelWhenPure|Parallel|LazyWhenPure|Lazy|Skip|Test)\\b" |
| 63 |
}, { |
| 64 |
token: "keyword", |
| 65 |
regex: "(\\?\\?\\?|\\?[a-zA-Z0-9]+)" |
| 66 |
}, { |
| 67 |
token: keywordMapper, |
| 68 |
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" |
| 69 |
}, { |
| 70 |
token: "paren.lparen", |
| 71 |
regex: "[[({]" |
| 72 |
}, { |
| 73 |
token: "paren.rparen", |
| 74 |
regex: "[\\])}]" |
| 75 |
}, { |
| 76 |
token: "text", |
| 77 |
regex: "\\s+" |
| 78 |
} |
| 79 |
], |
| 80 |
"comment": [ |
| 81 |
{ |
| 82 |
token: "comment.block", |
| 83 |
regex: "\\*\\/", |
| 84 |
next: "start" |
| 85 |
}, { |
| 86 |
defaultToken: "comment.block" |
| 87 |
} |
| 88 |
], |
| 89 |
"string": [ |
| 90 |
{ |
| 91 |
token: "constant.character.escape", |
| 92 |
regex: "\\\\(u[0-9a-fA-F]{4})" |
| 93 |
}, { |
| 94 |
token: "constant.character.escape", |
| 95 |
regex: '\\\\.' |
| 96 |
}, { |
| 97 |
token: "string", |
| 98 |
regex: '"', |
| 99 |
next: "start" |
| 100 |
}, { |
| 101 |
token: "string", |
| 102 |
regex: '[^"\\\\]+' |
| 103 |
} |
| 104 |
], |
| 105 |
"regex": [ |
| 106 |
{ |
| 107 |
token: "constant.character.escape", |
| 108 |
regex: "\\\\(u[0-9a-fA-F]{4})" |
| 109 |
}, { |
| 110 |
token: "constant.character.escape", |
| 111 |
regex: '\\\\.' |
| 112 |
}, { |
| 113 |
token: "string.regexp", |
| 114 |
regex: '"', |
| 115 |
next: "start" |
| 116 |
}, { |
| 117 |
token: "string.regexp", |
| 118 |
regex: '[^"\\\\]+' |
| 119 |
} |
| 120 |
], |
| 121 |
"char": [ |
| 122 |
{ |
| 123 |
token: "constant.character.escape", |
| 124 |
regex: "\\\\(u[0-9a-fA-F]{4})" |
| 125 |
}, { |
| 126 |
token: "constant.character.escape", |
| 127 |
regex: '\\\\.' |
| 128 |
}, { |
| 129 |
token: "constant.character", |
| 130 |
regex: "'", |
| 131 |
next: "start" |
| 132 |
}, { |
| 133 |
token: "constant.character", |
| 134 |
regex: "[^'\\\\]+" |
| 135 |
} |
| 136 |
] |
| 137 |
}; |
| 138 |
}; |
| 139 |
oop.inherits(FlixHighlightRules, TextHighlightRules); |
| 140 |
exports.FlixHighlightRules = FlixHighlightRules; |
| 141 |
|
| 142 |
}); |
| 143 |
|
| 144 |
ace.define("ace/mode/flix",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/flix_highlight_rules"], function(require, exports, module){"use strict"; |
| 145 |
var oop = require("../lib/oop"); |
| 146 |
var TextMode = require("./text").Mode; |
| 147 |
var FlixHighlightRules = require("./flix_highlight_rules").FlixHighlightRules; |
| 148 |
var Mode = function () { |
| 149 |
this.HighlightRules = FlixHighlightRules; |
| 150 |
}; |
| 151 |
oop.inherits(Mode, TextMode); |
| 152 |
(function () { |
| 153 |
this.$id = "ace/mode/flix"; |
| 154 |
}).call(Mode.prototype); |
| 155 |
exports.Mode = Mode; |
| 156 |
|
| 157 |
}); (function() { |
| 158 |
ace.require(["ace/mode/flix"], function(m) { |
| 159 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 160 |
module.exports = m; |
| 161 |
} |
| 162 |
}); |
| 163 |
})(); |
| 164 |
|