You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2015/03/23 13:06:41 UTC
[07/52] [partial] fauxton commit: updated refs/heads/master to 2222dcd
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/067b0880/assets/js/libs/ace/mode-plain_text.js
----------------------------------------------------------------------
diff --git a/assets/js/libs/ace/mode-plain_text.js b/assets/js/libs/ace/mode-plain_text.js
new file mode 100644
index 0000000..2eb75e1
--- /dev/null
+++ b/assets/js/libs/ace/mode-plain_text.js
@@ -0,0 +1,25 @@
+define("ace/mode/plain_text",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/text_highlight_rules","ace/mode/behaviour"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var Behaviour = require("./behaviour").Behaviour;
+
+var Mode = function() {
+ this.HighlightRules = TextHighlightRules;
+ this.$behaviour = new Behaviour();
+};
+
+oop.inherits(Mode, TextMode);
+
+(function() {
+ this.type = "text";
+ this.getNextLineIndent = function(state, line, tab) {
+ return '';
+ };
+ this.$id = "ace/mode/plain_text";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/067b0880/assets/js/libs/ace/mode-powershell.js
----------------------------------------------------------------------
diff --git a/assets/js/libs/ace/mode-powershell.js b/assets/js/libs/ace/mode-powershell.js
new file mode 100644
index 0000000..711e35d
--- /dev/null
+++ b/assets/js/libs/ace/mode-powershell.js
@@ -0,0 +1,739 @@
+define("ace/mode/powershell_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PowershellHighlightRules = function() {
+
+ var keywords = (
+ "function|if|else|elseif|switch|while|default|for|do|until|break|continue|" +
+ "foreach|return|filter|in|trap|throw|param|begin|process|end"
+ );
+
+ var builtinFunctions = (
+ "Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" +
+ "Set-Location|Get-ChildItem|Clear-Item|Get-Command|Measure-Command|Trace-Command|" +
+ "Add-Computer|Checkpoint-Computer|Remove-Computer|Restart-Computer|Restore-Computer|Stop-Computer|" +
+ "Reset-ComputerMachinePassword|Test-ComputerSecureChannel|Add-Content|Get-Content|Set-Content|Clear-Content|" +
+ "Get-Command|Invoke-Command|Enable-ComputerRestore|Disable-ComputerRestore|Get-ComputerRestorePoint|Test-Connection|" +
+ "ConvertFrom-CSV|ConvertTo-CSV|ConvertTo-Html|ConvertTo-Xml|ConvertFrom-SecureString|ConvertTo-SecureString|" +
+ "Copy-Item|Export-Counter|Get-Counter|Import-Counter|Get-Credential|Get-Culture|" +
+ "Get-ChildItem|Get-Date|Set-Date|Remove-Item|Compare-Object|Get-Event|" +
+ "Get-WinEvent|New-Event|Remove-Event|Unregister-Event|Wait-Event|Clear-EventLog|" +
+ "Get-Eventlog|Limit-EventLog|New-Eventlog|Remove-EventLog|Show-EventLog|Write-EventLog|" +
+ "Get-EventSubscriber|Register-EngineEvent|Register-ObjectEvent|Register-WmiEvent|Get-ExecutionPolicy|Set-ExecutionPolicy|" +
+ "Export-Alias|Export-Clixml|Export-Console|Export-Csv|ForEach-Object|Format-Custom|" +
+ "Format-List|Format-Table|Format-Wide|Export-FormatData|Get-FormatData|Get-Item|" +
+ "Get-ChildItem|Get-Help|Add-History|Clear-History|Get-History|Invoke-History|" +
+ "Get-Host|Read-Host|Write-Host|Get-HotFix|Import-Clixml|Import-Csv|" +
+ "Invoke-Command|Invoke-Expression|Get-Item|Invoke-Item|New-Item|Remove-Item|" +
+ "Set-Item|Clear-ItemProperty|Copy-ItemProperty|Get-ItemProperty|Move-ItemProperty|New-ItemProperty|" +
+ "Remove-ItemProperty|Rename-ItemProperty|Set-ItemProperty|Get-Job|Receive-Job|Remove-Job|" +
+ "Start-Job|Stop-Job|Wait-Job|Stop-Process|Update-List|Get-Location|" +
+ "Pop-Location|Push-Location|Set-Location|Send-MailMessage|Add-Member|Get-Member|" +
+ "Move-Item|Compare-Object|Group-Object|Measure-Object|New-Object|Select-Object|" +
+ "Sort-Object|Where-Object|Out-Default|Out-File|Out-GridView|Out-Host|" +
+ "Out-Null|Out-Printer|Out-String|Convert-Path|Join-Path|Resolve-Path|" +
+ "Split-Path|Test-Path|Get-Pfxcertificate|Pop-Location|Push-Location|Get-Process|" +
+ "Start-Process|Stop-Process|Wait-Process|Enable-PSBreakpoint|Disable-PSBreakpoint|Get-PSBreakpoint|" +
+ "Set-PSBreakpoint|Remove-PSBreakpoint|Get-PSDrive|New-PSDrive|Remove-PSDrive|Get-PSProvider|" +
+ "Set-PSdebug|Enter-PSSession|Exit-PSSession|Export-PSSession|Get-PSSession|Import-PSSession|" +
+ "New-PSSession|Remove-PSSession|Disable-PSSessionConfiguration|Enable-PSSessionConfiguration|Get-PSSessionConfiguration|Register-PSSessionConfiguration|" +
+ "Set-PSSessionConfiguration|Unregister-PSSessionConfiguration|New-PSSessionOption|Add-PsSnapIn|Get-PsSnapin|Remove-PSSnapin|" +
+ "Get-Random|Read-Host|Remove-Item|Rename-Item|Rename-ItemProperty|Select-Object|" +
+ "Select-XML|Send-MailMessage|Get-Service|New-Service|Restart-Service|Resume-Service|" +
+ "Set-Service|Start-Service|Stop-Service|Suspend-Service|Sort-Object|Start-Sleep|" +
+ "ConvertFrom-StringData|Select-String|Tee-Object|New-Timespan|Trace-Command|Get-Tracesource|" +
+ "Set-Tracesource|Start-Transaction|Complete-Transaction|Get-Transaction|Use-Transaction|Undo-Transaction|" +
+ "Start-Transcript|Stop-Transcript|Add-Type|Update-TypeData|Get-Uiculture|Get-Unique|" +
+ "Update-Formatdata|Update-Typedata|Clear-Variable|Get-Variable|New-Variable|Remove-Variable|" +
+ "Set-Variable|New-WebServiceProxy|Where-Object|Write-Debug|Write-Error|Write-Host|" +
+ "Write-Output|Write-Progress|Write-Verbose|Write-Warning|Set-WmiInstance|Invoke-WmiMethod|" +
+ "Get-WmiObject|Remove-WmiObject|Connect-WSMan|Disconnect-WSMan|Test-WSMan|Invoke-WSManAction|" +
+ "Disable-WSManCredSSP|Enable-WSManCredSSP|Get-WSManCredSSP|New-WSManInstance|Get-WSManInstance|Set-WSManInstance|" +
+ "Remove-WSManInstance|Set-WSManQuickConfig|New-WSManSessionOption"
+ );
+
+ var keywordMapper = this.createKeywordMapper({
+ "support.function": builtinFunctions,
+ "keyword": keywords
+ }, "identifier");
+
+ var binaryOperatorsRe = "eq|ne|ge|gt|lt|le|like|notlike|match|notmatch|replace|contains|notcontains|" +
+ "ieq|ine|ige|igt|ile|ilt|ilike|inotlike|imatch|inotmatch|ireplace|icontains|inotcontains|" +
+ "is|isnot|as|" +
+ "and|or|band|bor|not";
+
+ this.$rules = {
+ "start" : [
+ {
+ token : "comment",
+ regex : "#.*$"
+ }, {
+ token : "comment.start",
+ regex : "<#",
+ next : "comment"
+ }, {
+ token : "string", // single line
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+ }, {
+ token : "string", // single line
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+ }, {
+ token : "constant.numeric", // hex
+ regex : "0[xX][0-9a-fA-F]+\\b"
+ }, {
+ token : "constant.numeric", // float
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+ }, {
+ token : "constant.language.boolean",
+ regex : "[$](?:[Tt]rue|[Ff]alse)\\b"
+ }, {
+ token : "constant.language",
+ regex : "[$][Nn]ull\\b"
+ }, {
+ token : "variable.instance",
+ regex : "[$][a-zA-Z][a-zA-Z0-9_]*\\b"
+ }, {
+ token : keywordMapper,
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
+ }, {
+ token : "keyword.operator",
+ regex : "\\-(?:" + binaryOperatorsRe + ")"
+ }, {
+ token : "keyword.operator",
+ regex : "&|\\*|\\+|\\-|\\=|\\+=|\\-="
+ }, {
+ token : "lparen",
+ regex : "[[({]"
+ }, {
+ token : "rparen",
+ regex : "[\\])}]"
+ }, {
+ token : "text",
+ regex : "\\s+"
+ }
+ ],
+ "comment" : [
+ {
+ token : "comment.end",
+ regex : "#>",
+ next : "start"
+ }, {
+ token : "doc.comment.tag",
+ regex : "^\\.\\w+"
+ }, {
+ token : "comment",
+ regex : "\\w+"
+ }, {
+ token : "comment",
+ regex : "."
+ }
+ ]
+ };
+};
+
+oop.inherits(PowershellHighlightRules, TextHighlightRules);
+
+exports.PowershellHighlightRules = PowershellHighlightRules;
+});
+
+define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+
+var MatchingBraceOutdent = function() {};
+
+(function() {
+
+ this.checkOutdent = function(line, input) {
+ if (! /^\s+$/.test(line))
+ return false;
+
+ return /^\s*\}/.test(input);
+ };
+
+ this.autoOutdent = function(doc, row) {
+ var line = doc.getLine(row);
+ var match = line.match(/^(\s*\})/);
+
+ if (!match) return 0;
+
+ var column = match[1].length;
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+ if (!openBracePos || openBracePos.row == row) return 0;
+
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
+ doc.replace(new Range(row, 0, row, column-1), indent);
+ };
+
+ this.$getIndent = function(line) {
+ return line.match(/^\s*/)[0];
+ };
+
+}).call(MatchingBraceOutdent.prototype);
+
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
+});
+
+define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Behaviour = require("../behaviour").Behaviour;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+var lang = require("../../lib/lang");
+
+var SAFE_INSERT_IN_TOKENS =
+ ["text", "paren.rparen", "punctuation.operator"];
+var SAFE_INSERT_BEFORE_TOKENS =
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
+
+var context;
+var contextCache = {};
+var initContext = function(editor) {
+ var id = -1;
+ if (editor.multiSelect) {
+ id = editor.selection.index;
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
+ }
+ if (contextCache[id])
+ return context = contextCache[id];
+ context = contextCache[id] = {
+ autoInsertedBrackets: 0,
+ autoInsertedRow: -1,
+ autoInsertedLineEnd: "",
+ maybeInsertedBrackets: 0,
+ maybeInsertedRow: -1,
+ maybeInsertedLineStart: "",
+ maybeInsertedLineEnd: ""
+ };
+};
+
+var CstyleBehaviour = function() {
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (text == '{') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
+ return {
+ text: '{' + selected + '}',
+ selection: false
+ };
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
+ return {
+ text: '{}',
+ selection: [1, 1]
+ };
+ } else {
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
+ return {
+ text: '{',
+ selection: [1, 1]
+ };
+ }
+ }
+ } else if (text == '}') {
+ initContext(editor);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == '}') {
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ } else if (text == "\n" || text == "\r\n") {
+ initContext(editor);
+ var closing = "";
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ }
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar === '}') {
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
+ if (!openBracePos)
+ return null;
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
+ } else if (closing) {
+ var next_indent = this.$getIndent(line);
+ } else {
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ return;
+ }
+ var indent = next_indent + session.getTabString();
+
+ return {
+ text: '\n' + indent + '\n' + next_indent + closing,
+ selection: [1, indent.length, 1, indent.length]
+ };
+ } else {
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ }
+ });
+
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '{') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
+ if (rightChar == '}') {
+ range.end.column++;
+ return range;
+ } else {
+ context.maybeInsertedBrackets--;
+ }
+ }
+ });
+
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
+ if (text == '(') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+ return {
+ text: '(' + selected + ')',
+ selection: false
+ };
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
+ return {
+ text: '()',
+ selection: [1, 1]
+ };
+ }
+ } else if (text == ')') {
+ initContext(editor);
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == ')') {
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ });
+
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '(') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == ')') {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
+ if (text == '[') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+ return {
+ text: '[' + selected + ']',
+ selection: false
+ };
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
+ return {
+ text: '[]',
+ selection: [1, 1]
+ };
+ }
+ } else if (text == ']') {
+ initContext(editor);
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == ']') {
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ });
+
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '[') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == ']') {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
+ if (text == '"' || text == "'") {
+ initContext(editor);
+ var quote = text;
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
+ return {
+ text: quote + selected + quote,
+ selection: false
+ };
+ } else {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var leftChar = line.substring(cursor.column-1, cursor.column);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+
+ var token = session.getTokenAt(cursor.row, cursor.column);
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
+ if (leftChar == "\\" && token && /escape/.test(token.type))
+ return null;
+
+ var stringBefore = token && /string/.test(token.type);
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
+
+ var pair;
+ if (rightChar == quote) {
+ pair = stringBefore !== stringAfter;
+ } else {
+ if (stringBefore && !stringAfter)
+ return null; // wrap string with different quote
+ if (stringBefore && stringAfter)
+ return null; // do not pair quotes inside strings
+ var wordRe = session.$mode.tokenRe;
+ wordRe.lastIndex = 0;
+ var isWordBefore = wordRe.test(leftChar);
+ wordRe.lastIndex = 0;
+ var isWordAfter = wordRe.test(leftChar);
+ if (isWordBefore || isWordAfter)
+ return null; // before or after alphanumeric
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
+ return null; // there is rightChar and it isn't closing
+ pair = true;
+ }
+ return {
+ text: pair ? quote + quote : "",
+ selection: [1,1]
+ };
+ }
+ }
+ });
+
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == selected) {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+};
+
+
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
+ var cursor = editor.getCursorPosition();
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
+ return false;
+ }
+ iterator.stepForward();
+ return iterator.getCurrentTokenRow() !== cursor.row ||
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
+};
+
+CstyleBehaviour.$matchTokenType = function(token, types) {
+ return types.indexOf(token.type || token) > -1;
+};
+
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
+ context.autoInsertedBrackets = 0;
+ context.autoInsertedRow = cursor.row;
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
+ context.autoInsertedBrackets++;
+};
+
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (!this.isMaybeInsertedClosing(cursor, line))
+ context.maybeInsertedBrackets = 0;
+ context.maybeInsertedRow = cursor.row;
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
+ context.maybeInsertedBrackets++;
+};
+
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
+ return context.autoInsertedBrackets > 0 &&
+ cursor.row === context.autoInsertedRow &&
+ bracket === context.autoInsertedLineEnd[0] &&
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
+};
+
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
+ return context.maybeInsertedBrackets > 0 &&
+ cursor.row === context.maybeInsertedRow &&
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
+};
+
+CstyleBehaviour.popAutoInsertedClosing = function() {
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
+ context.autoInsertedBrackets--;
+};
+
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
+ if (context) {
+ context.maybeInsertedBrackets = 0;
+ context.maybeInsertedRow = -1;
+ }
+};
+
+
+
+oop.inherits(CstyleBehaviour, Behaviour);
+
+exports.CstyleBehaviour = CstyleBehaviour;
+});
+
+define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+ if (commentRegex) {
+ this.foldingStartMarker = new RegExp(
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+ );
+ this.foldingStopMarker = new RegExp(
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+ );
+ }
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
+ this._getFoldWidgetBase = this.getFoldWidget;
+ this.getFoldWidget = function(session, foldStyle, row) {
+ var line = session.getLine(row);
+
+ if (this.singleLineBlockCommentRe.test(line)) {
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
+ return "";
+ }
+
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
+
+ if (!fw && this.startRegionRe.test(line))
+ return "start"; // lineCommentRegionStart
+
+ return fw;
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
+ var line = session.getLine(row);
+
+ if (this.startRegionRe.test(line))
+ return this.getCommentRegionBlock(session, line, row);
+
+ var match = line.match(this.foldingStartMarker);
+ if (match) {
+ var i = match.index;
+
+ if (match[1])
+ return this.openingBracketBlock(session, match[1], row, i);
+
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
+
+ if (range && !range.isMultiLine()) {
+ if (forceMultiline) {
+ range = this.getSectionRange(session, row);
+ } else if (foldStyle != "all")
+ range = null;
+ }
+
+ return range;
+ }
+
+ if (foldStyle === "markbegin")
+ return;
+
+ var match = line.match(this.foldingStopMarker);
+ if (match) {
+ var i = match.index + match[0].length;
+
+ if (match[1])
+ return this.closingBracketBlock(session, match[1], row, i);
+
+ return session.getCommentFoldRange(row, i, -1);
+ }
+ };
+
+ this.getSectionRange = function(session, row) {
+ var line = session.getLine(row);
+ var startIndent = line.search(/\S/);
+ var startRow = row;
+ var startColumn = line.length;
+ row = row + 1;
+ var endRow = row;
+ var maxRow = session.getLength();
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var indent = line.search(/\S/);
+ if (indent === -1)
+ continue;
+ if (startIndent > indent)
+ break;
+ var subRange = this.getFoldWidgetRange(session, "all", row);
+
+ if (subRange) {
+ if (subRange.start.row <= startRow) {
+ break;
+ } else if (subRange.isMultiLine()) {
+ row = subRange.end.row;
+ } else if (startIndent == indent) {
+ break;
+ }
+ }
+ endRow = row;
+ }
+
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
+ };
+
+ this.getCommentRegionBlock = function(session, line, row) {
+ var startColumn = line.search(/\s*$/);
+ var maxRow = session.getLength();
+ var startRow = row;
+
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
+ var depth = 1;
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var m = re.exec(line);
+ if (!m) continue;
+ if (m[1]) depth--;
+ else depth++;
+
+ if (!depth) break;
+ }
+
+ var endRow = row;
+ if (endRow > startRow) {
+ return new Range(startRow, startColumn, endRow, line.length);
+ }
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+define("ace/mode/powershell",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/powershell_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var PowershellHighlightRules = require("./powershell_highlight_rules").PowershellHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = PowershellHighlightRules;
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CstyleBehaviour();
+ this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"});
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.lineCommentStart = "#";
+ this.blockComment = {start: "<#", end: "#>"};
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+ var tokens = tokenizedLine.tokens;
+
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ if (state == "start") {
+ var match = line.match(/^.*[\{\(\[]\s*$/);
+ if (match) {
+ indent += tab;
+ }
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+
+ this.createWorker = function(session) {
+ return null;
+ };
+
+ this.$id = "ace/mode/powershell";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/067b0880/assets/js/libs/ace/mode-praat.js
----------------------------------------------------------------------
diff --git a/assets/js/libs/ace/mode-praat.js b/assets/js/libs/ace/mode-praat.js
new file mode 100644
index 0000000..1b52fdd
--- /dev/null
+++ b/assets/js/libs/ace/mode-praat.js
@@ -0,0 +1,464 @@
+define("ace/mode/praat_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PraatHighlightRules = function() {
+
+ var keywords = (
+ "if|then|else|elsif|elif|endif|fi|" +
+ "endfor|endproc|" + // related keywords specified below
+ "while|endwhile|" +
+ "repeat|until|" +
+ "select|plus|minus|" +
+ "assert"
+ );
+
+ var predefinedVariables = (
+ "macintosh|windows|unix|" +
+ "praatVersion|praatVersion\\$" +
+ "pi|undefined|" +
+ "newline\\$|tab\\$|" +
+ "shellDirectory\\$|homeDirectory\\$|preferencesDirectory\\$|" +
+ "temporaryDirectory\\$|defaultDirectory\\$"
+ );
+ var directives = (
+ "clearinfo|endSendPraat"
+ );
+
+ var functions = (
+ "writeInfo|writeInfoLine|appendInfo|appendInfoLine|" +
+ "writeFile|writeFileLine|appendFile|appendFileLine|" +
+ "abs|round|floor|ceiling|min|max|imin|imax|" +
+ "sqrt|sin|cos|tan|arcsin|arccos|arctan|arctan2|sinc|sincpi|" +
+ "exp|ln|log10|log2|" +
+ "sinh|cosh|tanh|arcsinh|arccosh|actanh|" +
+ "sigmoid|invSigmoid|erf|erfc|" +
+ "randomUniform|randomInteger|randomGauss|randomPoisson|" +
+ "lnGamma|gaussP|gaussQ|invGaussQ|" +
+ "chiSquareP|chiSquareQ|invChiSquareQ|studentP|studentQ|invStudentQ|" +
+ "fisherP|fisherQ|invFisherQ|" +
+ "binomialP|binomialQ|invBinomialP|invBinomialQ|" +
+ "hertzToBark|barkToHerz|" +
+ "hertzToMel|melToHertz|" +
+ "hertzToSemitones|semitonesToHerz|" +
+ "erb|hertzToErb|erbToHertz|" +
+ "phonToDifferenceLimens|differenceLimensToPhon|" +
+ "beta|besselI|besselK|" +
+ "selected|selected\\$|numberOfSelected|variableExists|"+
+ "index|rindex|startsWith|endsWith|"+
+ "index_regex|rindex_regex|replace_regex\\$|"+
+ "length|extractWord\\$|extractLine\\$|extractNumber|" +
+ "left\\$|right\\$|mid\\$|replace\\$|" +
+ "beginPause|endPause|" +
+ "demoShow|demoWindowTitle|demoInput|demoWaitForInput|" +
+ "demoClicked|demoClickedIn|demoX|demoY|" +
+ "demoKeyPressed|demoKey\\$|" +
+ "demoExtraControlKeyPressed|demoShiftKeyPressed|"+
+ "demoCommandKeyPressed|demoOptionKeyPressed|" +
+ "environment\\$|chooseReadFile\\$|" +
+ "chooseDirectory\\$|createDirectory|fileReadable|deleteFile|" +
+ "selectObject|removeObject|plusObject|minusObject|" +
+ "runScript|exitScript|" +
+ "beginSendPraat|endSendPraat"
+ );
+
+ var objectTypes = (
+ "Activation|AffineTransform|AmplitudeTier|Art|Artword|Autosegment|" +
+ "BarkFilter|CCA|Categories|Cepstrum|Cepstrumc|ChebyshevSeries|" +
+ "ClassificationTable|Cochleagram|Collection|Configuration|" +
+ "Confusion|ContingencyTable|Corpus|Correlation|Covariance|" +
+ "CrossCorrelationTable|CrossCorrelationTables|DTW|Diagonalizer|" +
+ "Discriminant|Dissimilarity|Distance|Distributions|DurationTier|" +
+ "EEG|ERP|ERPTier|Eigen|Excitation|Excitations|ExperimentMFC|FFNet|" +
+ "FeatureWeights|Formant|FormantFilter|FormantGrid|FormantPoint|" +
+ "FormantTier|GaussianMixture|HMM|HMM_Observation|" +
+ "HMM_ObservationSequence|HMM_State|HMM_StateSequence|Harmonicity|" +
+ "ISpline|Index|Intensity|IntensityTier|IntervalTier|KNN|KlattGrid|" +
+ "KlattTable|LFCC|LPC|Label|LegendreSeries|LinearRegression|" +
+ "LogisticRegression|LongSound|Ltas|MFCC|MSpline|ManPages|" +
+ "Manipulation|Matrix|MelFilter|MixingMatrix|Movie|Network|" +
+ "OTGrammar|OTHistory|OTMulti|PCA|PairDistribution|ParamCurve|" +
+ "Pattern|Permutation|Pitch|PitchTier|PointProcess|Polygon|" +
+ "Polynomial|Procrustes|RealPoint|RealTier|ResultsMFC|Roots|SPINET|" +
+ "SSCP|SVD|Salience|ScalarProduct|Similarity|SimpleString|" +
+ "SortedSetOfString|Sound|Speaker|Spectrogram|Spectrum|SpectrumTier|" +
+ "SpeechSynthesizer|SpellingChecker|Strings|StringsIndex|Table|" +
+ "TableOfReal|TextGrid|TextInterval|TextPoint|TextTier|Tier|" +
+ "Transition|VocalTract|Weight|WordList"
+ );
+
+ this.$rules = {
+ "start" : [
+ {
+ token : "string.interpolated",
+ regex : /'((?:[a-z][a-zA-Z0-9_]*)(?:\$|#|:[0-9]+)?)'/
+ }, {
+ token : ["text", "text", "keyword.operator", "text", "keyword"],
+ regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(stopwatch)/
+ }, {
+ token : ["text", "keyword", "text", "string"],
+ regex : /(^\s*)(print(?:line)?|echo|exit|pause|sendpraat|include|execute)(\s+)(.*)/
+ }, {
+ token : ["text", "keyword"],
+ regex : "(^\\s*)(" + directives + ")$"
+ }, {
+ token : ["text", "keyword.operator", "text"],
+ regex : /(\s+)((?:\+|-|\/|\*|<|>)=?|==?|!=|%|\^|\||and|or|not)(\s+)/
+ }, {
+ token : ["text", "text", "keyword.operator", "text", "keyword", "text", "keyword"],
+ regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(?:((?:no)?warn|nocheck|noprogress)(\s+))?((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
+ }, {
+ token : ["text", "keyword", "text", "keyword"],
+ regex : /(^\s*)(?:(demo)?(\s+))((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
+ }, {
+ token : ["text", "keyword", "text", "keyword"],
+ regex : /^(\s*)(?:(demo)(\s+))?(10|12|14|16|24)$/
+ }, {
+ token : ["text", "support.function", "text"],
+ regex : /(\s*)(do\$?)(\s*:\s*|\s*\(\s*)/
+ }, {
+ token : "entity.name.type",
+ regex : "(" + objectTypes + ")"
+ }, {
+ token : "variable.language",
+ regex : "(" + predefinedVariables + ")"
+ }, {
+ token : ["support.function", "text"],
+ regex : "((?:" + functions + ")\\$?)(\\s*(?::|\\())"
+ }, {
+ token : "keyword",
+ regex : /(\bfor\b)/,
+ next : "for"
+ }, {
+ token : "keyword",
+ regex : "(\\b(?:" + keywords + ")\\b)"
+ }, {
+ token : "string",
+ regex : /"[^"]*"/
+ }, {
+ token : "string",
+ regex : /"[^"]*$/,
+ next : "brokenstring"
+ }, {
+ token : ["text", "keyword", "text", "entity.name.section"],
+ regex : /(^\s*)(\bform\b)(\s+)(.*)/,
+ next : "form"
+ }, {
+ token : "constant.numeric",
+ regex : /\b[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
+ }, {
+ token : ["keyword", "text", "entity.name.function"],
+ regex : /(procedure)(\s+)(\S+)/
+ }, {
+ token : ["entity.name.function", "text"],
+ regex : /(@\S+)(:|\s*\()/
+ }, {
+ token : ["text", "keyword", "text", "entity.name.function"],
+ regex : /(^\s*)(call)(\s+)(\S+)/
+ }, {
+ token : "comment",
+ regex : /(^\s*#|;).*$/
+ }, {
+ token : "text",
+ regex : /\s+/
+ }
+ ],
+ "form" : [
+ {
+ token : ["keyword", "text", "constant.numeric"],
+ regex : /((?:optionmenu|choice)\s+)(\S+:\s+)([0-9]+)/
+ }, {
+ token : ["keyword", "constant.numeric"],
+ regex : /((?:option|button)\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
+ }, {
+ token : ["keyword", "string"],
+ regex : /((?:option|button)\s+)(.*)/
+ }, {
+ token : ["keyword", "text", "string"],
+ regex : /((?:sentence|text)\s+)(\S+\s*)(.*)/
+ }, {
+ token : ["keyword", "text", "string", "invalid.illegal"],
+ regex : /(word\s+)(\S+\s*)(\S+)?(\s.*)?/
+ }, {
+ token : ["keyword", "text", "constant.language"],
+ regex : /(boolean\s+)(\S+\s*)(0|1|"?(?:yes|no)"?)/
+ }, {
+ token : ["keyword", "text", "constant.numeric"],
+ regex : /((?:real|natural|positive|integer)\s+)(\S+\s*)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
+ }, {
+ token : ["keyword", "string"],
+ regex : /(comment\s+)(.*)/
+ }, {
+ token : "keyword",
+ regex : 'endform',
+ next : "start"
+ }
+ ],
+ "for" : [
+ {
+ token : ["keyword", "text", "constant.numeric", "text"],
+ regex : /(from|to)(\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?)(\s*)/
+ }, {
+ token : ["keyword", "text"],
+ regex : /(from|to)(\s+\S+\s*)/
+ }, {
+ token : "text",
+ regex : /$/,
+ next : "start"
+ }
+ ],
+ "brokenstring" : [
+ {
+ token : ["text", "string"],
+ regex : /(\s*\.{3})([^"]*)/
+ }, {
+ token : "string",
+ regex : /"/,
+ next : "start"
+ }
+ ],
+ };
+};
+
+oop.inherits(PraatHighlightRules, TextHighlightRules);
+
+exports.PraatHighlightRules = PraatHighlightRules;
+});
+
+define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+
+var MatchingBraceOutdent = function() {};
+
+(function() {
+
+ this.checkOutdent = function(line, input) {
+ if (! /^\s+$/.test(line))
+ return false;
+
+ return /^\s*\}/.test(input);
+ };
+
+ this.autoOutdent = function(doc, row) {
+ var line = doc.getLine(row);
+ var match = line.match(/^(\s*\})/);
+
+ if (!match) return 0;
+
+ var column = match[1].length;
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+ if (!openBracePos || openBracePos.row == row) return 0;
+
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
+ doc.replace(new Range(row, 0, row, column-1), indent);
+ };
+
+ this.$getIndent = function(line) {
+ return line.match(/^\s*/)[0];
+ };
+
+}).call(MatchingBraceOutdent.prototype);
+
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
+});
+
+define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+ if (commentRegex) {
+ this.foldingStartMarker = new RegExp(
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+ );
+ this.foldingStopMarker = new RegExp(
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+ );
+ }
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
+ this._getFoldWidgetBase = this.getFoldWidget;
+ this.getFoldWidget = function(session, foldStyle, row) {
+ var line = session.getLine(row);
+
+ if (this.singleLineBlockCommentRe.test(line)) {
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
+ return "";
+ }
+
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
+
+ if (!fw && this.startRegionRe.test(line))
+ return "start"; // lineCommentRegionStart
+
+ return fw;
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
+ var line = session.getLine(row);
+
+ if (this.startRegionRe.test(line))
+ return this.getCommentRegionBlock(session, line, row);
+
+ var match = line.match(this.foldingStartMarker);
+ if (match) {
+ var i = match.index;
+
+ if (match[1])
+ return this.openingBracketBlock(session, match[1], row, i);
+
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
+
+ if (range && !range.isMultiLine()) {
+ if (forceMultiline) {
+ range = this.getSectionRange(session, row);
+ } else if (foldStyle != "all")
+ range = null;
+ }
+
+ return range;
+ }
+
+ if (foldStyle === "markbegin")
+ return;
+
+ var match = line.match(this.foldingStopMarker);
+ if (match) {
+ var i = match.index + match[0].length;
+
+ if (match[1])
+ return this.closingBracketBlock(session, match[1], row, i);
+
+ return session.getCommentFoldRange(row, i, -1);
+ }
+ };
+
+ this.getSectionRange = function(session, row) {
+ var line = session.getLine(row);
+ var startIndent = line.search(/\S/);
+ var startRow = row;
+ var startColumn = line.length;
+ row = row + 1;
+ var endRow = row;
+ var maxRow = session.getLength();
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var indent = line.search(/\S/);
+ if (indent === -1)
+ continue;
+ if (startIndent > indent)
+ break;
+ var subRange = this.getFoldWidgetRange(session, "all", row);
+
+ if (subRange) {
+ if (subRange.start.row <= startRow) {
+ break;
+ } else if (subRange.isMultiLine()) {
+ row = subRange.end.row;
+ } else if (startIndent == indent) {
+ break;
+ }
+ }
+ endRow = row;
+ }
+
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
+ };
+
+ this.getCommentRegionBlock = function(session, line, row) {
+ var startColumn = line.search(/\s*$/);
+ var maxRow = session.getLength();
+ var startRow = row;
+
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
+ var depth = 1;
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var m = re.exec(line);
+ if (!m) continue;
+ if (m[1]) depth--;
+ else depth++;
+
+ if (!depth) break;
+ }
+
+ var endRow = row;
+ if (endRow > startRow) {
+ return new Range(startRow, startColumn, endRow, line.length);
+ }
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+define("ace/mode/praat",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/praat_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/folding/cstyle"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var PraatHighlightRules = require("./praat_highlight_rules").PraatHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = PraatHighlightRules;
+
+ this.$outdent = new MatchingBraceOutdent();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.lineCommentStart = "#";
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+ var tokens = tokenizedLine.tokens;
+
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ if (state == "start") {
+ var match = line.match(/^.*[\{\(\[\:]\s*$/);
+ if (match) {
+ indent += tab;
+ }
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+ this.$id = "ace/mode/praat";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/067b0880/assets/js/libs/ace/mode-prolog.js
----------------------------------------------------------------------
diff --git a/assets/js/libs/ace/mode-prolog.js b/assets/js/libs/ace/mode-prolog.js
new file mode 100644
index 0000000..270c223
--- /dev/null
+++ b/assets/js/libs/ace/mode-prolog.js
@@ -0,0 +1,364 @@
+define("ace/mode/prolog_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PrologHighlightRules = function() {
+
+ this.$rules = { start:
+ [ { include: '#comment' },
+ { include: '#basic_fact' },
+ { include: '#rule' },
+ { include: '#directive' },
+ { include: '#fact' } ],
+ '#atom':
+ [ { token: 'constant.other.atom.prolog',
+ regex: '\\b[a-z][a-zA-Z0-9_]*\\b' },
+ { token: 'constant.numeric.prolog',
+ regex: '-?\\d+(?:\\.\\d+)?' },
+ { include: '#string' } ],
+ '#basic_elem':
+ [ { include: '#comment' },
+ { include: '#statement' },
+ { include: '#constants' },
+ { include: '#operators' },
+ { include: '#builtins' },
+ { include: '#list' },
+ { include: '#atom' },
+ { include: '#variable' } ],
+ '#basic_fact':
+ [ { token:
+ [ 'entity.name.function.fact.basic.prolog',
+ 'punctuation.end.fact.basic.prolog' ],
+ regex: '([a-z]\\w*)(\\.)' } ],
+ '#builtins':
+ [ { token: 'support.function.builtin.prolog',
+ regex: '\\b(?:abolish|abort|ancestors|arg|ascii|assert[az]|atom(?:ic)?|body|char|close|conc|concat|consult|define|definition|dynamic|dump|fail|file|free|free_proc|functor|getc|goal|halt|head|head|integer|length|listing|match_args|member|next_clause|nl|nonvar|nth|number|cvars|nvars|offset|op|print?|prompt|putc|quoted|ratom|read|redefine|rename|retract(?:all)?|see|seeing|seen|skip|spy|statistics|system|tab|tell|telling|term|time|told|univ|unlink_clause|unspy_predicate|var|write)\\b' } ],
+ '#comment':
+ [ { token:
+ [ 'punctuation.definition.comment.prolog',
+ 'comment.line.percentage.prolog' ],
+ regex: '(%)(.*$)' },
+ { token: 'punctuation.definition.comment.prolog',
+ regex: '/\\*',
+ push:
+ [ { token: 'punctuation.definition.comment.prolog',
+ regex: '\\*/',
+ next: 'pop' },
+ { defaultToken: 'comment.block.prolog' } ] } ],
+ '#constants':
+ [ { token: 'constant.language.prolog',
+ regex: '\\b(?:true|false|yes|no)\\b' } ],
+ '#directive':
+ [ { token: 'keyword.operator.directive.prolog',
+ regex: ':-',
+ push:
+ [ { token: 'meta.directive.prolog', regex: '\\.', next: 'pop' },
+ { include: '#comment' },
+ { include: '#statement' },
+ { defaultToken: 'meta.directive.prolog' } ] } ],
+ '#expr':
+ [ { include: '#comments' },
+ { token: 'meta.expression.prolog',
+ regex: '\\(',
+ push:
+ [ { token: 'meta.expression.prolog', regex: '\\)', next: 'pop' },
+ { include: '#expr' },
+ { defaultToken: 'meta.expression.prolog' } ] },
+ { token: 'keyword.control.cutoff.prolog', regex: '!' },
+ { token: 'punctuation.control.and.prolog', regex: ',' },
+ { token: 'punctuation.control.or.prolog', regex: ';' },
+ { include: '#basic_elem' } ],
+ '#fact':
+ [ { token:
+ [ 'entity.name.function.fact.prolog',
+ 'punctuation.begin.fact.parameters.prolog' ],
+ regex: '([a-z]\\w*)(\\()(?!.*:-)',
+ push:
+ [ { token:
+ [ 'punctuation.end.fact.parameters.prolog',
+ 'punctuation.end.fact.prolog' ],
+ regex: '(\\))(\\.?)',
+ next: 'pop' },
+ { include: '#parameter' },
+ { defaultToken: 'meta.fact.prolog' } ] } ],
+ '#list':
+ [ { token: 'punctuation.begin.list.prolog',
+ regex: '\\[(?=.*\\])',
+ push:
+ [ { token: 'punctuation.end.list.prolog',
+ regex: '\\]',
+ next: 'pop' },
+ { include: '#comment' },
+ { token: 'punctuation.separator.list.prolog', regex: ',' },
+ { token: 'punctuation.concat.list.prolog',
+ regex: '\\|',
+ push:
+ [ { token: 'meta.list.concat.prolog',
+ regex: '(?=\\s*\\])',
+ next: 'pop' },
+ { include: '#basic_elem' },
+ { defaultToken: 'meta.list.concat.prolog' } ] },
+ { include: '#basic_elem' },
+ { defaultToken: 'meta.list.prolog' } ] } ],
+ '#operators':
+ [ { token: 'keyword.operator.prolog',
+ regex: '\\\\\\+|\\bnot\\b|\\bis\\b|->|[><]|[><\\\\:=]?=|(?:=\\\\|\\\\=)=' } ],
+ '#parameter':
+ [ { token: 'variable.language.anonymous.prolog',
+ regex: '\\b_\\b' },
+ { token: 'variable.parameter.prolog',
+ regex: '\\b[A-Z_]\\w*\\b' },
+ { token: 'punctuation.separator.parameters.prolog', regex: ',' },
+ { include: '#basic_elem' },
+ { token: 'text', regex: '[^\\s]' } ],
+ '#rule':
+ [ { token: 'meta.rule.prolog',
+ regex: '(?=[a-z]\\w*.*:-)',
+ push:
+ [ { token: 'punctuation.rule.end.prolog',
+ regex: '\\.',
+ next: 'pop' },
+ { token: 'meta.rule.signature.prolog',
+ regex: '(?=[a-z]\\w*.*:-)',
+ push:
+ [ { token: 'meta.rule.signature.prolog',
+ regex: '(?=:-)',
+ next: 'pop' },
+ { token: 'entity.name.function.rule.prolog',
+ regex: '[a-z]\\w*(?=\\(|\\s*:-)' },
+ { token: 'punctuation.rule.parameters.begin.prolog',
+ regex: '\\(',
+ push:
+ [ { token: 'punctuation.rule.parameters.end.prolog',
+ regex: '\\)',
+ next: 'pop' },
+ { include: '#parameter' },
+ { defaultToken: 'meta.rule.parameters.prolog' } ] },
+ { defaultToken: 'meta.rule.signature.prolog' } ] },
+ { token: 'keyword.operator.definition.prolog',
+ regex: ':-',
+ push:
+ [ { token: 'meta.rule.definition.prolog',
+ regex: '(?=\\.)',
+ next: 'pop' },
+ { include: '#comment' },
+ { include: '#expr' },
+ { defaultToken: 'meta.rule.definition.prolog' } ] },
+ { defaultToken: 'meta.rule.prolog' } ] } ],
+ '#statement':
+ [ { token: 'meta.statement.prolog',
+ regex: '(?=[a-z]\\w*\\()',
+ push:
+ [ { token: 'punctuation.end.statement.parameters.prolog',
+ regex: '\\)',
+ next: 'pop' },
+ { include: '#builtins' },
+ { include: '#atom' },
+ { token: 'punctuation.begin.statement.parameters.prolog',
+ regex: '\\(',
+ push:
+ [ { token: 'meta.statement.parameters.prolog',
+ regex: '(?=\\))',
+ next: 'pop' },
+ { token: 'punctuation.separator.statement.prolog', regex: ',' },
+ { include: '#basic_elem' },
+ { defaultToken: 'meta.statement.parameters.prolog' } ] },
+ { defaultToken: 'meta.statement.prolog' } ] } ],
+ '#string':
+ [ { token: 'punctuation.definition.string.begin.prolog',
+ regex: '\'',
+ push:
+ [ { token: 'punctuation.definition.string.end.prolog',
+ regex: '\'',
+ next: 'pop' },
+ { token: 'constant.character.escape.prolog', regex: '\\\\.' },
+ { token: 'constant.character.escape.quote.prolog',
+ regex: '\'\'' },
+ { defaultToken: 'string.quoted.single.prolog' } ] } ],
+ '#variable':
+ [ { token: 'variable.language.anonymous.prolog',
+ regex: '\\b_\\b' },
+ { token: 'variable.other.prolog',
+ regex: '\\b[A-Z_][a-zA-Z0-9_]*\\b' } ] }
+
+ this.normalizeRules();
+};
+
+PrologHighlightRules.metaData = { fileTypes: [ 'plg', 'prolog' ],
+ foldingStartMarker: '(%\\s*region \\w*)|([a-z]\\w*.*:- ?)',
+ foldingStopMarker: '(%\\s*end(\\s*region)?)|(?=\\.)',
+ keyEquivalent: '^~P',
+ name: 'Prolog',
+ scopeName: 'source.prolog' }
+
+
+oop.inherits(PrologHighlightRules, TextHighlightRules);
+
+exports.PrologHighlightRules = PrologHighlightRules;
+});
+
+define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+ if (commentRegex) {
+ this.foldingStartMarker = new RegExp(
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+ );
+ this.foldingStopMarker = new RegExp(
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+ );
+ }
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
+ this._getFoldWidgetBase = this.getFoldWidget;
+ this.getFoldWidget = function(session, foldStyle, row) {
+ var line = session.getLine(row);
+
+ if (this.singleLineBlockCommentRe.test(line)) {
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
+ return "";
+ }
+
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
+
+ if (!fw && this.startRegionRe.test(line))
+ return "start"; // lineCommentRegionStart
+
+ return fw;
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
+ var line = session.getLine(row);
+
+ if (this.startRegionRe.test(line))
+ return this.getCommentRegionBlock(session, line, row);
+
+ var match = line.match(this.foldingStartMarker);
+ if (match) {
+ var i = match.index;
+
+ if (match[1])
+ return this.openingBracketBlock(session, match[1], row, i);
+
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
+
+ if (range && !range.isMultiLine()) {
+ if (forceMultiline) {
+ range = this.getSectionRange(session, row);
+ } else if (foldStyle != "all")
+ range = null;
+ }
+
+ return range;
+ }
+
+ if (foldStyle === "markbegin")
+ return;
+
+ var match = line.match(this.foldingStopMarker);
+ if (match) {
+ var i = match.index + match[0].length;
+
+ if (match[1])
+ return this.closingBracketBlock(session, match[1], row, i);
+
+ return session.getCommentFoldRange(row, i, -1);
+ }
+ };
+
+ this.getSectionRange = function(session, row) {
+ var line = session.getLine(row);
+ var startIndent = line.search(/\S/);
+ var startRow = row;
+ var startColumn = line.length;
+ row = row + 1;
+ var endRow = row;
+ var maxRow = session.getLength();
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var indent = line.search(/\S/);
+ if (indent === -1)
+ continue;
+ if (startIndent > indent)
+ break;
+ var subRange = this.getFoldWidgetRange(session, "all", row);
+
+ if (subRange) {
+ if (subRange.start.row <= startRow) {
+ break;
+ } else if (subRange.isMultiLine()) {
+ row = subRange.end.row;
+ } else if (startIndent == indent) {
+ break;
+ }
+ }
+ endRow = row;
+ }
+
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
+ };
+
+ this.getCommentRegionBlock = function(session, line, row) {
+ var startColumn = line.search(/\s*$/);
+ var maxRow = session.getLength();
+ var startRow = row;
+
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
+ var depth = 1;
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var m = re.exec(line);
+ if (!m) continue;
+ if (m[1]) depth--;
+ else depth++;
+
+ if (!depth) break;
+ }
+
+ var endRow = row;
+ if (endRow > startRow) {
+ return new Range(startRow, startColumn, endRow, line.length);
+ }
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+define("ace/mode/prolog",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/prolog_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var PrologHighlightRules = require("./prolog_highlight_rules").PrologHighlightRules;
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = PrologHighlightRules;
+ this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+ this.lineCommentStart = "%";
+ this.blockComment = {start: "/*", end: "*/"};
+ this.$id = "ace/mode/prolog";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/067b0880/assets/js/libs/ace/mode-properties.js
----------------------------------------------------------------------
diff --git a/assets/js/libs/ace/mode-properties.js b/assets/js/libs/ace/mode-properties.js
new file mode 100644
index 0000000..38e7e06
--- /dev/null
+++ b/assets/js/libs/ace/mode-properties.js
@@ -0,0 +1,72 @@
+define("ace/mode/properties_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PropertiesHighlightRules = function() {
+
+ var escapeRe = /\\u[0-9a-fA-F]{4}|\\/;
+
+ this.$rules = {
+ "start" : [
+ {
+ token : "comment",
+ regex : /[!#].*$/
+ }, {
+ token : "keyword",
+ regex : /[=:]$/
+ }, {
+ token : "keyword",
+ regex : /[=:]/,
+ next : "value"
+ }, {
+ token : "constant.language.escape",
+ regex : escapeRe
+ }, {
+ defaultToken: "variable"
+ }
+ ],
+ "value" : [
+ {
+ regex : /\\$/,
+ token : "string",
+ next : "value"
+ }, {
+ regex : /$/,
+ token : "string",
+ next : "start"
+ }, {
+ token : "constant.language.escape",
+ regex : escapeRe
+ }, {
+ defaultToken: "string"
+ }
+ ]
+ };
+
+};
+
+oop.inherits(PropertiesHighlightRules, TextHighlightRules);
+
+exports.PropertiesHighlightRules = PropertiesHighlightRules;
+});
+
+define("ace/mode/properties",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/properties_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var PropertiesHighlightRules = require("./properties_highlight_rules").PropertiesHighlightRules;
+
+var Mode = function() {
+ this.HighlightRules = PropertiesHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+ this.$id = "ace/mode/properties";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});