| 1 |
ace.define("ace/mode/ada_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 AdaHighlightRules = function () { |
| 5 |
var keywords = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|" + |
| 6 |
"access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|" + |
| 7 |
"array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|" + |
| 8 |
"body|private|then|if|procedure|type|case|in|protected|constant|interface|until|" + |
| 9 |
"|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor"; |
| 10 |
var builtinConstants = ("true|false|null"); |
| 11 |
var builtinFunctions = ("count|min|max|avg|sum|rank|now|coalesce|main"); |
| 12 |
var keywordMapper = this.createKeywordMapper({ |
| 13 |
"support.function": builtinFunctions, |
| 14 |
"keyword": keywords, |
| 15 |
"constant.language": builtinConstants |
| 16 |
}, "identifier", true); |
| 17 |
this.$rules = { |
| 18 |
"start": [{ |
| 19 |
token: "comment", |
| 20 |
regex: "--.*$" |
| 21 |
}, { |
| 22 |
token: "string", |
| 23 |
regex: '".*?"' |
| 24 |
}, { |
| 25 |
token: "string", |
| 26 |
regex: "'.'" |
| 27 |
}, { |
| 28 |
token: "constant.numeric", |
| 29 |
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" |
| 30 |
}, { |
| 31 |
token: keywordMapper, |
| 32 |
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" |
| 33 |
}, { |
| 34 |
token: "keyword.operator", |
| 35 |
regex: "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=" |
| 36 |
}, { |
| 37 |
token: "paren.lparen", |
| 38 |
regex: "[\\(]" |
| 39 |
}, { |
| 40 |
token: "paren.rparen", |
| 41 |
regex: "[\\)]" |
| 42 |
}, { |
| 43 |
token: "text", |
| 44 |
regex: "\\s+" |
| 45 |
}] |
| 46 |
}; |
| 47 |
}; |
| 48 |
oop.inherits(AdaHighlightRules, TextHighlightRules); |
| 49 |
exports.AdaHighlightRules = AdaHighlightRules; |
| 50 |
|
| 51 |
}); |
| 52 |
|
| 53 |
ace.define("ace/mode/ada",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ada_highlight_rules","ace/range"], function(require, exports, module){"use strict"; |
| 54 |
var oop = require("../lib/oop"); |
| 55 |
var TextMode = require("./text").Mode; |
| 56 |
var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules; |
| 57 |
var Range = require("../range").Range; |
| 58 |
var Mode = function () { |
| 59 |
this.HighlightRules = AdaHighlightRules; |
| 60 |
this.$behaviour = this.$defaultBehaviour; |
| 61 |
}; |
| 62 |
oop.inherits(Mode, TextMode); |
| 63 |
(function () { |
| 64 |
this.lineCommentStart = "--"; |
| 65 |
this.getNextLineIndent = function (state, line, tab) { |
| 66 |
var indent = this.$getIndent(line); |
| 67 |
var tokenizedLine = this.getTokenizer().getLineTokens(line, state); |
| 68 |
var tokens = tokenizedLine.tokens; |
| 69 |
if (tokens.length && tokens[tokens.length - 1].type == "comment") { |
| 70 |
return indent; |
| 71 |
} |
| 72 |
if (state == "start") { |
| 73 |
var match = line.match(/^.*(begin|loop|then|is|do)\s*$/); |
| 74 |
if (match) { |
| 75 |
indent += tab; |
| 76 |
} |
| 77 |
} |
| 78 |
return indent; |
| 79 |
}; |
| 80 |
this.checkOutdent = function (state, line, input) { |
| 81 |
var complete_line = line + input; |
| 82 |
if (complete_line.match(/^\s*(begin|end)$/)) { |
| 83 |
return true; |
| 84 |
} |
| 85 |
return false; |
| 86 |
}; |
| 87 |
this.autoOutdent = function (state, session, row) { |
| 88 |
var line = session.getLine(row); |
| 89 |
var prevLine = session.getLine(row - 1); |
| 90 |
var prevIndent = this.$getIndent(prevLine).length; |
| 91 |
var indent = this.$getIndent(line).length; |
| 92 |
if (indent <= prevIndent) { |
| 93 |
return; |
| 94 |
} |
| 95 |
session.outdentRows(new Range(row, 0, row + 2, 0)); |
| 96 |
}; |
| 97 |
this.$id = "ace/mode/ada"; |
| 98 |
}).call(Mode.prototype); |
| 99 |
exports.Mode = Mode; |
| 100 |
|
| 101 |
}); (function() { |
| 102 |
ace.require(["ace/mode/ada"], function(m) { |
| 103 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 104 |
module.exports = m; |
| 105 |
} |
| 106 |
}); |
| 107 |
})(); |
| 108 |
|