| 1 |
ace.define("ace/mode/fsl_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 FSLHighlightRules = function () { |
| 5 |
this.$rules = { |
| 6 |
start: [{ |
| 7 |
token: "punctuation.definition.comment.mn", |
| 8 |
regex: /\/\*/, |
| 9 |
push: [{ |
| 10 |
token: "punctuation.definition.comment.mn", |
| 11 |
regex: /\*\//, |
| 12 |
next: "pop" |
| 13 |
}, { |
| 14 |
defaultToken: "comment.block.fsl" |
| 15 |
}] |
| 16 |
}, { |
| 17 |
token: "comment.line.fsl", |
| 18 |
regex: /\/\//, |
| 19 |
push: [{ |
| 20 |
token: "comment.line.fsl", |
| 21 |
regex: /$/, |
| 22 |
next: "pop" |
| 23 |
}, { |
| 24 |
defaultToken: "comment.line.fsl" |
| 25 |
}] |
| 26 |
}, { |
| 27 |
token: "entity.name.function", |
| 28 |
regex: /\${/, |
| 29 |
push: [{ |
| 30 |
token: "entity.name.function", |
| 31 |
regex: /}/, |
| 32 |
next: "pop" |
| 33 |
}, { |
| 34 |
defaultToken: "keyword.other" |
| 35 |
}], |
| 36 |
comment: "js outcalls" |
| 37 |
}, { |
| 38 |
token: "constant.numeric", |
| 39 |
regex: /[0-9]*\.[0-9]*\.[0-9]*/, |
| 40 |
comment: "semver" |
| 41 |
}, { |
| 42 |
token: "constant.language.fslLanguage", |
| 43 |
regex: "(?:" |
| 44 |
+ "graph_layout|machine_name|machine_author|machine_license|machine_comment|machine_language" |
| 45 |
+ "|machine_version|machine_reference|npm_name|graph_layout|on_init|on_halt|on_end|on_terminate|on_finalize|on_transition" |
| 46 |
+ "|on_action|on_stochastic_action|on_legal|on_main|on_forced|on_validation|on_validation_failure|on_transition_refused|on_forced_transition_refused" |
| 47 |
+ "|on_action_refused|on_enter|on_exit|start_states|end_states|terminal_states|final_states|fsl_version" |
| 48 |
+ ")\\s*:" |
| 49 |
}, { |
| 50 |
token: "keyword.control.transition.fslArrow", |
| 51 |
regex: /<->|<-|->|<=>|=>|<=|<~>|~>|<~|<-=>|<=->|<-~>|<~->|<=~>|<~=>/ |
| 52 |
}, { |
| 53 |
token: "constant.numeric.fslProbability", |
| 54 |
regex: /[0-9]+%/, |
| 55 |
comment: "edge probability annotation" |
| 56 |
}, { |
| 57 |
token: "constant.character.fslAction", |
| 58 |
regex: /\'[^']*\'/, |
| 59 |
comment: "action annotation" |
| 60 |
}, { |
| 61 |
token: "string.quoted.double.fslLabel.doublequoted", |
| 62 |
regex: /\"[^"]*\"/, |
| 63 |
comment: "fsl label annotation" |
| 64 |
}, { |
| 65 |
token: "entity.name.tag.fslLabel.atom", |
| 66 |
regex: /[a-zA-Z0-9_.+&()#@!?,]/, |
| 67 |
comment: "fsl label annotation" |
| 68 |
}] |
| 69 |
}; |
| 70 |
this.normalizeRules(); |
| 71 |
}; |
| 72 |
FSLHighlightRules.metaData = { |
| 73 |
fileTypes: ["fsl", "fsl_state"], |
| 74 |
name: "FSL", |
| 75 |
scopeName: "source.fsl" |
| 76 |
}; |
| 77 |
oop.inherits(FSLHighlightRules, TextHighlightRules); |
| 78 |
exports.FSLHighlightRules = FSLHighlightRules; |
| 79 |
|
| 80 |
}); |
| 81 |
|
| 82 |
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict"; |
| 83 |
var oop = require("../../lib/oop"); |
| 84 |
var Range = require("../../range").Range; |
| 85 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 86 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 87 |
if (commentRegex) { |
| 88 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 89 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 90 |
} |
| 91 |
}; |
| 92 |
oop.inherits(FoldMode, BaseFoldMode); |
| 93 |
(function () { |
| 94 |
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
| 95 |
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
| 96 |
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; |
| 97 |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
| 98 |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
| 99 |
this._getFoldWidgetBase = this.getFoldWidget; |
| 100 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 101 |
var line = session.getLine(row); |
| 102 |
if (this.singleLineBlockCommentRe.test(line)) { |
| 103 |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
| 104 |
return ""; |
| 105 |
} |
| 106 |
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
| 107 |
if (!fw && this.startRegionRe.test(line)) |
| 108 |
return "start"; |
| 109 |
return fw; |
| 110 |
}; |
| 111 |
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { |
| 112 |
var line = session.getLine(row); |
| 113 |
if (this.startRegionRe.test(line)) |
| 114 |
return this.getCommentRegionBlock(session, line, row); |
| 115 |
var match = line.match(this.foldingStartMarker); |
| 116 |
if (match) { |
| 117 |
var i = match.index; |
| 118 |
if (match[1]) |
| 119 |
return this.openingBracketBlock(session, match[1], row, i); |
| 120 |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
| 121 |
if (range && !range.isMultiLine()) { |
| 122 |
if (forceMultiline) { |
| 123 |
range = this.getSectionRange(session, row); |
| 124 |
} |
| 125 |
else if (foldStyle != "all") |
| 126 |
range = null; |
| 127 |
} |
| 128 |
return range; |
| 129 |
} |
| 130 |
if (foldStyle === "markbegin") |
| 131 |
return; |
| 132 |
var match = line.match(this.foldingStopMarker); |
| 133 |
if (match) { |
| 134 |
var i = match.index + match[0].length; |
| 135 |
if (match[1]) |
| 136 |
return this.closingBracketBlock(session, match[1], row, i); |
| 137 |
return session.getCommentFoldRange(row, i, -1); |
| 138 |
} |
| 139 |
}; |
| 140 |
this.getSectionRange = function (session, row) { |
| 141 |
var line = session.getLine(row); |
| 142 |
var startIndent = line.search(/\S/); |
| 143 |
var startRow = row; |
| 144 |
var startColumn = line.length; |
| 145 |
row = row + 1; |
| 146 |
var endRow = row; |
| 147 |
var maxRow = session.getLength(); |
| 148 |
while (++row < maxRow) { |
| 149 |
line = session.getLine(row); |
| 150 |
var indent = line.search(/\S/); |
| 151 |
if (indent === -1) |
| 152 |
continue; |
| 153 |
if (startIndent > indent) |
| 154 |
break; |
| 155 |
var subRange = this.getFoldWidgetRange(session, "all", row); |
| 156 |
if (subRange) { |
| 157 |
if (subRange.start.row <= startRow) { |
| 158 |
break; |
| 159 |
} |
| 160 |
else if (subRange.isMultiLine()) { |
| 161 |
row = subRange.end.row; |
| 162 |
} |
| 163 |
else if (startIndent == indent) { |
| 164 |
break; |
| 165 |
} |
| 166 |
} |
| 167 |
endRow = row; |
| 168 |
} |
| 169 |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
| 170 |
}; |
| 171 |
this.getCommentRegionBlock = function (session, line, row) { |
| 172 |
var startColumn = line.search(/\s*$/); |
| 173 |
var maxRow = session.getLength(); |
| 174 |
var startRow = row; |
| 175 |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
| 176 |
var depth = 1; |
| 177 |
while (++row < maxRow) { |
| 178 |
line = session.getLine(row); |
| 179 |
var m = re.exec(line); |
| 180 |
if (!m) |
| 181 |
continue; |
| 182 |
if (m[1]) |
| 183 |
depth--; |
| 184 |
else |
| 185 |
depth++; |
| 186 |
if (!depth) |
| 187 |
break; |
| 188 |
} |
| 189 |
var endRow = row; |
| 190 |
if (endRow > startRow) { |
| 191 |
return new Range(startRow, startColumn, endRow, line.length); |
| 192 |
} |
| 193 |
}; |
| 194 |
}).call(FoldMode.prototype); |
| 195 |
|
| 196 |
}); |
| 197 |
|
| 198 |
ace.define("ace/mode/fsl",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/fsl_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){ |
| 199 |
|
| 200 |
|
| 201 |
"use strict"; |
| 202 |
var oop = require("../lib/oop"); |
| 203 |
var TextMode = require("./text").Mode; |
| 204 |
var FSLHighlightRules = require("./fsl_highlight_rules").FSLHighlightRules; |
| 205 |
var FoldMode = require("./folding/cstyle").FoldMode; |
| 206 |
var Mode = function () { |
| 207 |
this.HighlightRules = FSLHighlightRules; |
| 208 |
this.foldingRules = new FoldMode(); |
| 209 |
}; |
| 210 |
oop.inherits(Mode, TextMode); |
| 211 |
(function () { |
| 212 |
this.lineCommentStart = "//"; |
| 213 |
this.blockComment = { start: "/*", end: "*/" }; |
| 214 |
this.$id = "ace/mode/fsl"; |
| 215 |
this.snippetFileId = "ace/snippets/fsl"; |
| 216 |
}).call(Mode.prototype); |
| 217 |
exports.Mode = Mode; |
| 218 |
|
| 219 |
}); (function() { |
| 220 |
ace.require(["ace/mode/fsl"], function(m) { |
| 221 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 222 |
module.exports = m; |
| 223 |
} |
| 224 |
}); |
| 225 |
})(); |
| 226 |
|