Merge branch 'master' of github.com:ajaxorg/ace
This commit is contained in:
commit
60058ec2be
25 changed files with 638 additions and 217 deletions
13
ChangeLog.txt
Normal file
13
ChangeLog.txt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
2011.02.04, Version 0.1.4
|
||||
|
||||
* Add C/C++ mode contributed by Gastón Kleiman
|
||||
* Fix word wrap bug
|
||||
* Fix exception in key input
|
||||
|
||||
2011.02.04, Version 0.1.3
|
||||
|
||||
* Let the packaged version play nice with requireJS
|
||||
* Add Ruby mode contributed by Shlomo Zalman Heigh
|
||||
* Add Java mode contributed by Tom Tasche
|
||||
* Fix annotation bug
|
||||
* Changing a document added a new empty line at the end
|
||||
|
|
@ -54,6 +54,12 @@ copy({
|
|||
});
|
||||
|
||||
var ace = copy.createDataObject();
|
||||
copy({
|
||||
source: [
|
||||
'build_support/mini_require.js'
|
||||
],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
|
|
@ -96,7 +102,6 @@ copy({
|
|||
});
|
||||
copy({
|
||||
source: [
|
||||
'build_support/mini_require.js',
|
||||
'build_support/boot.js'
|
||||
],
|
||||
dest: ace
|
||||
|
|
@ -164,7 +169,7 @@ copy({
|
|||
// create modes
|
||||
project.assmeAllFilesLoaded();
|
||||
|
||||
["css", "html", "javascript", "php", "python", "xml"].forEach(function(mode) {
|
||||
["css", "html", "javascript", "php", "python", "xml", "ruby", "java", "c_cpp"].forEach(function(mode) {
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
|
|
@ -309,4 +314,4 @@ copy({
|
|||
//copy({
|
||||
// source: aceHome + '/demo/logo.png',
|
||||
// dest: "build/demo/logo.png"
|
||||
//});
|
||||
//});
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
build/src/mode-java.js
Normal file
1
build/src/mode-java.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
build/src/mode-ruby.js
Normal file
1
build/src/mode-ruby.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
}</pre>
|
||||
|
||||
<script src="src/ace-uncompressed.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -40,10 +40,17 @@
|
|||
* @param module a name for the payload
|
||||
* @param payload a function to call with (require, exports, module) params
|
||||
*/
|
||||
function define(module, payload) {
|
||||
|
||||
(function() {
|
||||
|
||||
var _define = function(module, payload) {
|
||||
if (typeof module !== 'string') {
|
||||
console.error('dropping module because define wasn\'t a string.');
|
||||
console.trace();
|
||||
if (_define.original)
|
||||
_define.original.apply(window, arguments);
|
||||
else {
|
||||
console.error('dropping module because define wasn\'t a string.');
|
||||
console.trace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -51,16 +58,24 @@ function define(module, payload) {
|
|||
define.modules = {};
|
||||
|
||||
define.modules[module] = payload;
|
||||
}
|
||||
};
|
||||
if (window.define)
|
||||
_define.original = window.define;
|
||||
|
||||
window.define = _define;
|
||||
|
||||
|
||||
/**
|
||||
* Get at functionality define()ed using the function above
|
||||
*/
|
||||
function require(module, callback) {
|
||||
var _require = function(module, callback) {
|
||||
if (Object.prototype.toString.call(module) === "[object Array]") {
|
||||
var params = [];
|
||||
for (var i = 0, l = module.length; i < l; ++i) {
|
||||
params.push(define.lookup(module[i]));
|
||||
var dep = lookup(module[i]);
|
||||
if (!dep && _require.original)
|
||||
return _require.original.apply(window, arguments);
|
||||
params.push(dep);
|
||||
};
|
||||
if (callback) {
|
||||
callback.apply(null, params);
|
||||
|
|
@ -68,7 +83,10 @@ function require(module, callback) {
|
|||
}
|
||||
|
||||
if (typeof module === 'string') {
|
||||
var payload = define.lookup(module);
|
||||
var payload = lookup(module);
|
||||
if (!payload && _require.original)
|
||||
return _require.original.apply(window, arguments);
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
|
@ -77,13 +95,17 @@ function require(module, callback) {
|
|||
};
|
||||
}
|
||||
|
||||
if (window.require)
|
||||
_require.original = window.require;
|
||||
|
||||
window.require = _require;
|
||||
require.packaged = true;
|
||||
|
||||
/**
|
||||
* Internal function to lookup moduleNames and resolve them by calling the
|
||||
* definition function if needed.
|
||||
*/
|
||||
define.lookup = function(moduleName) {
|
||||
var lookup = function(moduleName) {
|
||||
var module = define.modules[moduleName];
|
||||
if (module == null) {
|
||||
console.error('Missing module: ' + moduleName);
|
||||
|
|
@ -100,3 +122,5 @@ define.lookup = function(moduleName) {
|
|||
|
||||
return module;
|
||||
};
|
||||
|
||||
})();
|
||||
14
demo/demo.js
14
demo/demo.js
|
|
@ -54,6 +54,7 @@ exports.launch = function(env) {
|
|||
var PhpMode = require("ace/mode/php").Mode;
|
||||
var JavaMode = require("ace/mode/java").Mode;
|
||||
var RubyMode = require("ace/mode/ruby").Mode;
|
||||
var CCPPMode = require("ace/mode/c_cpp").Mode;
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
|
||||
|
|
@ -103,7 +104,7 @@ exports.launch = function(env) {
|
|||
docs.php = new EditSession(document.getElementById("phptext").innerHTML);
|
||||
docs.php.setMode(new PhpMode());
|
||||
docs.php.setUndoManager(new UndoManager());
|
||||
|
||||
|
||||
docs.java = new EditSession(document.getElementById("javatext").innerHTML);
|
||||
docs.java.setMode(new JavaMode());
|
||||
docs.java.setUndoManager(new UndoManager());
|
||||
|
|
@ -112,6 +113,9 @@ exports.launch = function(env) {
|
|||
docs.ruby.setMode(new RubyMode());
|
||||
docs.ruby.setUndoManager(new UndoManager());
|
||||
|
||||
docs.c_cpp = new EditSession(document.getElementById("cpptext").innerHTML);
|
||||
docs.c_cpp.setMode(new CCPPMode());
|
||||
docs.c_cpp.setUndoManager(new UndoManager());
|
||||
|
||||
var container = document.getElementById("editor");
|
||||
env.editor = new Editor(new Renderer(container, theme));
|
||||
|
|
@ -125,7 +129,8 @@ exports.launch = function(env) {
|
|||
python: new PythonMode(),
|
||||
php: new PhpMode(),
|
||||
java: new JavaMode(),
|
||||
ruby: new RubyMode()
|
||||
ruby: new RubyMode(),
|
||||
c_cpp: new CCPPMode()
|
||||
};
|
||||
|
||||
function getMode() {
|
||||
|
|
@ -164,6 +169,9 @@ exports.launch = function(env) {
|
|||
else if (mode instanceof RubyMode) {
|
||||
modeEl.value = "ruby";
|
||||
}
|
||||
else if (mode instanceof CCPPMode) {
|
||||
modeEl.value = "c_cpp";
|
||||
}
|
||||
else {
|
||||
modeEl.value = "text";
|
||||
}
|
||||
|
|
@ -293,6 +301,8 @@ exports.launch = function(env) {
|
|||
mode = "java";
|
||||
} else if (/^.*\.rb$/i.test(file.name)) {
|
||||
mode = "ruby";
|
||||
} else if (/^.*\.(c|cpp|h|hpp|cxx)$/i.test(file.name)) {
|
||||
mode = "c_cpp";
|
||||
}
|
||||
|
||||
env.editor.onTextInput(reader.result);
|
||||
|
|
|
|||
17
editor.html
17
editor.html
|
|
@ -21,6 +21,7 @@
|
|||
<option value="php">PHP Document</option>
|
||||
<option value="java">Java Document</option>
|
||||
<option value="ruby">Ruby Document</option>
|
||||
<option value="c_cpp">C++ Document</option>
|
||||
<option value="plain">Text Document</option>
|
||||
</select>
|
||||
</td>
|
||||
|
|
@ -76,6 +77,7 @@
|
|||
<option value="php">PHP</option>
|
||||
<option value="java">Java</option>
|
||||
<option value="ruby">Ruby</option>
|
||||
<option value="c_cpp">C/C++ Document</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
|
|
@ -221,6 +223,21 @@ def fact(n)
|
|||
end
|
||||
|
||||
puts fact(ARGV[0].to_i)
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="cpptext">// compound assignment operators
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int a, b=3; /* foobar */
|
||||
a = b;
|
||||
a+=2; // equivalent to a=a+2
|
||||
cout << a;
|
||||
return 0;
|
||||
}
|
||||
</script>
|
||||
|
||||
<input id="cockpitInput" type="text"/>
|
||||
|
|
|
|||
|
|
@ -856,7 +856,7 @@ var EditSession = function(text, mode) {
|
|||
|
||||
this.getRowHeight = function(config, row) {
|
||||
var rows;
|
||||
if (!this.$useWrapMode) {
|
||||
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
||||
rows = 1;
|
||||
} else {
|
||||
rows = this.$wrapData[row].length + 1;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,10 @@ var TextInput = function(parentNode, host) {
|
|||
else
|
||||
e.preventDefault();
|
||||
text.select();
|
||||
setTimeout(sendText, 0);
|
||||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
|
||||
};
|
||||
|
||||
var onCut = function(e) {
|
||||
|
|
@ -123,7 +126,10 @@ var TextInput = function(parentNode, host) {
|
|||
} else
|
||||
e.preventDefault();
|
||||
text.select();
|
||||
setTimeout(sendText, 0);
|
||||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
|
||||
};
|
||||
|
||||
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
||||
|
|
@ -131,7 +137,8 @@ var TextInput = function(parentNode, host) {
|
|||
if (useragent.isIE) {
|
||||
var keytable = { 13:1, 27:1 };
|
||||
event.addListener(text, "keyup", function (e) {
|
||||
if (inCompostion && (!text.value || keytable[e.keyCode])) setTimeout(onCompositionEnd, 0);
|
||||
if (inCompostion && (!text.value || keytable[e.keyCode]))
|
||||
setTimeout(onCompositionEnd, 0);
|
||||
if ((text.value.charCodeAt(0)|0) < 129) {
|
||||
return;
|
||||
};
|
||||
|
|
|
|||
128
lib/ace/mode/c_cpp.js
Normal file
128
lib/ace/mode/c_cpp.js
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Gastón Kleiman <gaston.kleiman AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var c_cppHighlightRules = require("ace/mode/c_cpp_highlight_rules").c_cppHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new c_cppHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
var outdent = true;
|
||||
var outentedRows = [];
|
||||
var re = /^(\s*)\/\//;
|
||||
|
||||
for (var i=startRow; i<= endRow; i++) {
|
||||
if (!re.test(doc.getLine(i))) {
|
||||
outdent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (outdent) {
|
||||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i).replace(re, "$1");
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = line.length + 2;
|
||||
doc.replace(deleteRange, line);
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
else {
|
||||
return doc.indentRows(startRow, endRow, "//");
|
||||
}
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
if (state == "start") {
|
||||
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
} else if (state == "doc-start") {
|
||||
if (endState == "start") {
|
||||
return "";
|
||||
}
|
||||
var match = line.match(/^\s*(\/?)\*/);
|
||||
if (match) {
|
||||
if (match[1]) {
|
||||
indent += " ";
|
||||
}
|
||||
indent += "* ";
|
||||
}
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
return this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
174
lib/ace/mode/c_cpp_highlight_rules.js
Normal file
174
lib/ace/mode/c_cpp_highlight_rules.js
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Gastón Kleiman <gaston.kleiman AT gmail DOT com>
|
||||
*
|
||||
* Based on Bespin's C/C++ Syntax Plugin by Marc McIntyre.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
|
||||
c_cppHighlightRules = function() {
|
||||
|
||||
var docComment = new DocCommentHighlightRules();
|
||||
|
||||
var keywords = lang.arrayToMap(
|
||||
("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|" +
|
||||
"asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|" +
|
||||
"typeid|bitor|extern|protected|typename|bool|false|public|union|" +
|
||||
"break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|" +
|
||||
"friend|return|virtual|char|goto|short|void|class|if|signed|volatile|" +
|
||||
"compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|" +
|
||||
"static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|" +
|
||||
"switch|delete|new|template|do|not|this|for").split("|")
|
||||
);
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("NULL").split("|")
|
||||
);
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
docComment.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
next : "comment"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
regex : '["].*\\\\$',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
regex : "['].*\\\\$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : "constant", // <CONSTANT>
|
||||
regex : "<[a-zA-Z0-9.]+>"
|
||||
}, {
|
||||
token : "keyword", // pre-compiler directivs
|
||||
regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (value == "this")
|
||||
return "variable.language";
|
||||
else if (keywords[value])
|
||||
return "keyword";
|
||||
else if (buildinConstants[value])
|
||||
return "constant.language";
|
||||
else if (value == "debugger")
|
||||
return "invalid.deprecated";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
|
||||
}, {
|
||||
token : "lparen",
|
||||
regex : "[[({]"
|
||||
}, {
|
||||
token : "rparen",
|
||||
regex : "[\\])}]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}
|
||||
],
|
||||
"comment" : [
|
||||
{
|
||||
token : "comment", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment", // comment spanning whole line
|
||||
regex : ".+"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '.+'
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '.+'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.addRules(docComment.getRules(), "doc-");
|
||||
this.$rules["doc-start"][0].next = "start";
|
||||
};
|
||||
|
||||
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.c_cppHighlightRules = c_cppHighlightRules;
|
||||
});
|
||||
|
|
@ -16,6 +16,7 @@ oop.inherits(JavaScriptWorker, Mirror);
|
|||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
value = value.replace(/^#!.*\n/, "\n");
|
||||
|
||||
// var start = new Date();
|
||||
var parser = require("ace/narcissus/jsparse");
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ var MouseHandler = function(editor) {
|
|||
|
||||
if (self.$clickSelection) {
|
||||
if (self.$clickSelection.contains(cursor.row, cursor.column)) {
|
||||
self.selection.setSelectionRange(self.$clickSelection);
|
||||
editor.selection.setSelectionRange(self.$clickSelection);
|
||||
} else {
|
||||
if (self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
|
||||
var anchor = self.$clickSelection.end;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ var require = function(id) {
|
|||
|
||||
var chunks = id.split("/");
|
||||
chunks[0] = require.tlns[chunks[0]] || chunks[0];
|
||||
path = /*require.baseUrl + "/" +*/ chunks.join("/") + ".js"
|
||||
path = /*require.baseUrl + "/" +*/ chunks.join("/") + ".js";
|
||||
|
||||
require.id = id;
|
||||
// console.log("require " + path + " " + id)
|
||||
|
|
@ -29,14 +29,14 @@ var require = function(id) {
|
|||
|
||||
require.modules = {};
|
||||
require.tlns = {};
|
||||
require.baseUrl;
|
||||
require.baseUrl = "";
|
||||
|
||||
var define = function(id, factory) {
|
||||
if (!factory) {
|
||||
factory = id;
|
||||
id = require.id;
|
||||
}
|
||||
if (id.indexOf("text!") == 0)
|
||||
if (id.indexOf("text!") === 0)
|
||||
return;
|
||||
|
||||
require.modules[id] = {
|
||||
|
|
@ -74,7 +74,7 @@ function initSender() {
|
|||
id: callbackId,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
this.emit = function(name, data) {
|
||||
postMessage({
|
||||
|
|
@ -82,7 +82,8 @@ function initSender() {
|
|||
name: name,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}).call(Sender.prototype);
|
||||
|
||||
return new Sender();
|
||||
|
|
@ -93,15 +94,17 @@ var sender;
|
|||
|
||||
onmessage = function(e) {
|
||||
var msg = e.data;
|
||||
if (msg.command)
|
||||
if (msg.command) {
|
||||
main[msg.command].apply(main, msg.args);
|
||||
}
|
||||
else if (msg.init) {
|
||||
initBaseUrls(msg.base, msg.tlns);
|
||||
require("pilot/fixoldbrowsers");
|
||||
sender = initSender();
|
||||
var clazz = require(msg.module)[msg.classname];
|
||||
main = new clazz(sender);
|
||||
} else if (msg.event) {
|
||||
}
|
||||
else if (msg.event) {
|
||||
sender._dispatchEvent(msg.event, msg.data);
|
||||
}
|
||||
};
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "ace",
|
||||
"description": "Ajax.org Code Editor is a full featured source code highlighting editor that powers the Cloud9 IDE",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.4",
|
||||
"homepage" : "http://github.com/ajaxorg/ace",
|
||||
"engines": {"node": ">= 0.2.0"},
|
||||
"author": "Fabian Jakobs <fabian@ajax.org>",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 67a380309e5b139a9603334ad9d9f917659f04bc
|
||||
Subproject commit c0cab19cbb5d44df98bae0060c782a6f30464afe
|
||||
Loading…
Add table
Add a link
Reference in a new issue