This commit is contained in:
Resolver Developers 2011-10-05 14:32:22 +01:00
commit 19ea6a93f3
85 changed files with 1971 additions and 1016 deletions

View file

@ -185,6 +185,7 @@ if (target == "normal") {
copy({ copy({
source: ace, source: ace,
filter: [ filter: [
filterTextPlugin,
shadow shadow
], ],
dest: targetDir + '/src/ace-uncompressed.js' dest: targetDir + '/src/ace-uncompressed.js'
@ -212,7 +213,7 @@ project.assumeAllFilesLoaded();
[ [
"css", "html", "javascript", "php", "python", "lua", "xml", "ruby", "java", "c_cpp", "css", "html", "javascript", "php", "python", "lua", "xml", "ruby", "java", "c_cpp",
"coffee", "perl", "csharp", "svg", "clojure", "scss", "json", "groovy", "coffee", "perl", "csharp", "svg", "clojure", "scss", "json", "groovy",
"ocaml", "scala", "textile", "scad", "markdown", "latex" "ocaml", "scala", "textile", "scad", "markdown", "latex", "powershell"
].forEach(function(mode) { ].forEach(function(mode) {
console.log("mode " + mode); console.log("mode " + mode);
copy({ copy({

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -11,7 +11,7 @@
Ace Ace
version 0.2.0 version 0.2.0
commit 3a0ec51aef11f74857b6a285b9c36a0b9118ca89 commit 32db0a33738c3660da851d595da68da88007ad00
--> -->
@ -47,6 +47,7 @@
<option value="groovy">Groovy</option> <option value="groovy">Groovy</option>
<option value="scala">Scala</option> <option value="scala">Scala</option>
<option value="latex">LaTeX</option> <option value="latex">LaTeX</option>
<option value="powershell">Powershell</option>
</select> </select>
</td> </td>
</tr> </tr>
@ -79,6 +80,7 @@
<option value="groovy">Groovy</option> <option value="groovy">Groovy</option>
<option value="scala">Scala</option> <option value="scala">Scala</option>
<option value="latex">LaTeX</option> <option value="latex">LaTeX</option>
<option value="powershell">Powershell</option>
</select> </select>
</td> </td>
</tr> </tr>

File diff suppressed because it is too large Load diff

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

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

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

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

View file

@ -1 +1 @@
define("ace/mode/python",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/python_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d};var a={pass:1,"return":1,raise:1,"break":1,"continue":1};this.checkOutdent=function(b,c,d){if(d!=="\r\n"&&d!=="\r"&&d!=="\n")return!1;var e=this.$tokenizer.getLineTokens(c.trim(),b).tokens;if(!e)return!1;do var f=e.pop();while(f&&(f.type=="comment"||f.type=="text"&&f.value.match(/^\s+$/)));return f?f.type=="keyword"&&a[f.value]:!1},this.autoOutdent=function(a,b,c){c+=1;var d=this.$getIndent(b.getLine(c)),e=b.getTabString();d.slice(-e.length)==e&&b.remove(new i(c,d.length-e.length,c,d.length))}}.call(j.prototype),b.Mode=j}),define("ace/mode/python_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",merge:!0,regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",merge:!0,regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\[\\(\\{]"},{token:"rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(g,f),b.PythonHighlightRules=g}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e}) define("ace/mode/python",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/python_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d};var a={pass:1,"return":1,raise:1,"break":1,"continue":1};this.checkOutdent=function(b,c,d){if(d!=="\r\n"&&d!=="\r"&&d!=="\n")return!1;var e=this.$tokenizer.getLineTokens(c.trim(),b).tokens;if(!e)return!1;do var f=e.pop();while(f&&(f.type=="comment"||f.type=="text"&&f.value.match(/^\s+$/)));return f?f.type=="keyword"&&a[f.value]:!1},this.autoOutdent=function(a,b,c){c+=1;var d=this.$getIndent(b.getLine(c)),e=b.getTabString();d.slice(-e.length)==e&&b.remove(new i(c,d.length-e.length,c,d.length))}}.call(j.prototype),b.Mode=j}),define("ace/mode/python_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",merge:!0,regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",merge:!0,regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen.paren",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(g,f),b.PythonHighlightRules=g}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e})

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

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

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

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

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

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

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

View file

@ -1 +1 @@
__ace_shadowed__.define("ace/mode/python",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/python_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d};var a={pass:1,"return":1,raise:1,"break":1,"continue":1};this.checkOutdent=function(b,c,d){if(d!=="\r\n"&&d!=="\r"&&d!=="\n")return!1;var e=this.$tokenizer.getLineTokens(c.trim(),b).tokens;if(!e)return!1;do var f=e.pop();while(f&&(f.type=="comment"||f.type=="text"&&f.value.match(/^\s+$/)));return f?f.type=="keyword"&&a[f.value]:!1},this.autoOutdent=function(a,b,c){c+=1;var d=this.$getIndent(b.getLine(c)),e=b.getTabString();d.slice(-e.length)==e&&b.remove(new i(c,d.length-e.length,c,d.length))}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/python_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",merge:!0,regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",merge:!0,regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\[\\(\\{]"},{token:"rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(g,f),b.PythonHighlightRules=g}),__ace_shadowed__.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e}) __ace_shadowed__.define("ace/mode/python",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/python_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d};var a={pass:1,"return":1,raise:1,"break":1,"continue":1};this.checkOutdent=function(b,c,d){if(d!=="\r\n"&&d!=="\r"&&d!=="\n")return!1;var e=this.$tokenizer.getLineTokens(c.trim(),b).tokens;if(!e)return!1;do var f=e.pop();while(f&&(f.type=="comment"||f.type=="text"&&f.value.match(/^\s+$/)));return f?f.type=="keyword"&&a[f.value]:!1},this.autoOutdent=function(a,b,c){c+=1;var d=this.$getIndent(b.getLine(c)),e=b.getTabString();d.slice(-e.length)==e&&b.remove(new i(c,d.length-e.length,c,d.length))}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/python_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",merge:!0,regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",merge:!0,regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen.paren",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(g,f),b.PythonHighlightRules=g}),__ace_shadowed__.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e})

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -187,8 +187,8 @@ function setupContainer(element, getValue) {
var oldSumit = parentNode.onsubmit; var oldSumit = parentNode.onsubmit;
// Override the onsubmit function of the form. // Override the onsubmit function of the form.
parentNode.onsubmit = function(evt) { parentNode.onsubmit = function(evt) {
element.value = getValue();
element.innerHTML = getValue(); element.innerHTML = getValue();
element.value = getValue();
// If there is a onsubmit function already, then call // If there is a onsubmit function already, then call
// it with the current context and pass the event. // it with the current context and pass the event.
if (oldSumit) { if (oldSumit) {

View file

@ -73,6 +73,7 @@ var TextMode = require("ace/mode/text").Mode;
var GroovyMode = require("ace/mode/groovy").Mode; var GroovyMode = require("ace/mode/groovy").Mode;
var ScalaMode = require("ace/mode/scala").Mode; var ScalaMode = require("ace/mode/scala").Mode;
var LatexMode = require("ace/mode/latex").Mode; var LatexMode = require("ace/mode/latex").Mode;
var PowershellMode = require("ace/mode/powershell").Mode;
var UndoManager = require("ace/undomanager").UndoManager; var UndoManager = require("ace/undomanager").UndoManager;
var vim = require("ace/keyboard/keybinding/vim").Vim; var vim = require("ace/keyboard/keybinding/vim").Vim;
@ -201,6 +202,10 @@ exports.launch = function(env) {
docs.latex.setMode(new LatexMode()); docs.latex.setMode(new LatexMode());
docs.latex.setUndoManager(new UndoManager()); docs.latex.setUndoManager(new UndoManager());
docs.powershell = new EditSession(require("ace/requirejs/text!demo/docs/powershell.ps1"));
docs.powershell.setMode(new PowershellMode());
docs.powershell.setUndoManager(new UndoManager());
// Add a "name" property to all docs // Add a "name" property to all docs
for (var doc in docs) { for (var doc in docs) {
docs[doc].name = doc; docs[doc].name = doc;
@ -245,7 +250,8 @@ exports.launch = function(env) {
csharp: new CSharpMode(), csharp: new CSharpMode(),
groovy: new GroovyMode(), groovy: new GroovyMode(),
scala: new ScalaMode(), scala: new ScalaMode(),
latex: new LatexMode() latex: new LatexMode(),
powershell: new PowershellMode()
}; };
function getMode() { function getMode() {
@ -352,6 +358,9 @@ exports.launch = function(env) {
else if (mode instanceof LatexMode) { else if (mode instanceof LatexMode) {
modeEl.value = "latex"; modeEl.value = "latex";
} }
else if (mode instanceof PowershellMode) {
modeEl.value = "powershell";
}
else { else {
modeEl.value = "text"; modeEl.value = "text";
} }
@ -503,7 +512,8 @@ exports.launch = function(env) {
} }
function onResize() { function onResize() {
var width = (document.documentElement.clientWidth - 280); var left = env.split.$container.offsetLeft;
var width = document.documentElement.clientWidth - left;
container.style.width = width + "px"; container.style.width = width + "px";
container.style.height = document.documentElement.clientHeight + "px"; container.style.height = document.documentElement.clientHeight + "px";
env.split.resize(); env.split.resize();
@ -511,7 +521,7 @@ exports.launch = function(env) {
}; };
window.onresize = onResize; window.onresize = onResize;
onResize(); env.editor.renderer.onResize(true)
event.addListener(container, "dragover", function(e) { event.addListener(container, "dragover", function(e) {
return event.preventDefault(e); return event.preventDefault(e);

24
demo/docs/powershell.ps1 Normal file
View file

@ -0,0 +1,24 @@
# This is a simple comment
function Hello($name) {
Write-host "Hello $name"
}
function add($left, $right=4) {
if ($right -ne 4) {
return $left
} elseif ($left -eq $null -and $right -eq 2) {
return 3
} else {
return 2
}
}
$number = 1 + 2;
$number += 3
Write-Host Hello -name "World"
$an_array = @(1, 2, 3)
$a_hash = @{"something" = "something else"}
& notepad .\readme.md

View file

@ -46,6 +46,7 @@
<option value="groovy">Groovy</option> <option value="groovy">Groovy</option>
<option value="scala">Scala</option> <option value="scala">Scala</option>
<option value="latex">LaTeX</option> <option value="latex">LaTeX</option>
<option value="powershell">Powershell</option>
</select> </select>
</td> </td>
</tr> </tr>
@ -78,6 +79,7 @@
<option value="groovy">Groovy</option> <option value="groovy">Groovy</option>
<option value="scala">Scala</option> <option value="scala">Scala</option>
<option value="latex">LaTeX</option> <option value="latex">LaTeX</option>
<option value="powershell">Powershell</option>
</select> </select>
</td> </td>
</tr> </tr>

View file

@ -303,7 +303,7 @@ canon.addCommand({
canon.addCommand({ canon.addCommand({
name: "del", name: "del",
bindKey: bindKey("Delete", "Delete|Ctrl-D"), bindKey: bindKey("Delete", "Delete|Ctrl-D"),
exec: function(env, args, request) { env.editor.removeRight(); } exec: function(env, args, request) { env.editor.remove("right"); }
}); });
canon.addCommand({ canon.addCommand({
name: "backspace", name: "backspace",
@ -311,16 +311,16 @@ canon.addCommand({
"Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace", "Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H" "Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
), ),
exec: function(env, args, request) { env.editor.removeLeft(); } exec: function(env, args, request) { env.editor.remove("left"); }
}); });
canon.addCommand({ canon.addCommand({
name: "removetolinestart", name: "removetolinestart",
bindKey: bindKey(null, "Option-Backspace"), bindKey: bindKey("Alt-Backspace", "Option-Backspace"),
exec: function(env, args, request) { env.editor.removeToLineStart(); } exec: function(env, args, request) { env.editor.removeToLineStart(); }
}); });
canon.addCommand({ canon.addCommand({
name: "removetolineend", name: "removetolineend",
bindKey: bindKey(null, "Ctrl-K"), bindKey: bindKey("Alt-Delete", "Ctrl-K"),
exec: function(env, args, request) { env.editor.removeToLineEnd(); } exec: function(env, args, request) { env.editor.removeToLineEnd(); }
}); });
canon.addCommand({ canon.addCommand({
@ -330,7 +330,7 @@ canon.addCommand({
}); });
canon.addCommand({ canon.addCommand({
name: "removewordright", name: "removewordright",
bindKey: bindKey(null, "Alt-Delete"), bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
exec: function(env, args, request) { env.editor.removeWordRight(); } exec: function(env, args, request) { env.editor.removeWordRight(); }
}); });
canon.addCommand({ canon.addCommand({

View file

@ -19,6 +19,13 @@
box-sizing: border-box; box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
cursor: text;
}
/* setting pointer-events: auto; on node under the mouse, which changes during scroll,
will break mouse wheel scrolling in Safari */
.ace_content * {
pointer-events: none;
} }
.ace_composition { .ace_composition {
@ -110,8 +117,6 @@
.ace_cursor-layer { .ace_cursor-layer {
z-index: 4; z-index: 4;
cursor: text;
/* setting pointer-events: none; here will break mouse wheel scrolling in Safari */
} }
.ace_cursor { .ace_cursor {
@ -127,11 +132,6 @@
white-space: nowrap; white-space: nowrap;
} }
.ace_marker-layer {
cursor: text;
pointer-events: none;
}
.ace_marker-layer .ace_step { .ace_marker-layer .ace_step {
position: absolute; position: absolute;
z-index: 3; z-index: 3;
@ -162,8 +162,14 @@
.ace_line .ace_fold { .ace_line .ace_fold {
cursor: pointer; cursor: pointer;
pointer-events: auto;
color: darkred;
} }
.ace_dragging .ace_marker-layer, .ace_dragging .ace_text-layer { .ace_fold:hover{
background: gold!important;
}
.ace_dragging .ace_content {
cursor: move; cursor: move;
} }

View file

@ -230,7 +230,7 @@ var Editor =function(renderer, session) {
this.unsetStyle = function(style) { this.unsetStyle = function(style) {
this.renderer.unsetStyle(style); this.renderer.unsetStyle(style);
}; };
this.setFontSize = function(size) { this.setFontSize = function(size) {
this.container.style.fontSize = size; this.container.style.fontSize = size;
}; };
@ -269,7 +269,7 @@ var Editor =function(renderer, session) {
}); });
this.textInput.focus(); this.textInput.focus();
}; };
this.isFocused = function() { this.isFocused = function() {
return this.textInput.isFocused(); return this.textInput.isFocused();
}; };
@ -407,7 +407,7 @@ var Editor =function(renderer, session) {
var text = ""; var text = "";
if (!this.selection.isEmpty()) if (!this.selection.isEmpty())
text = this.session.getTextRange(this.getSelectionRange()); text = this.session.getTextRange(this.getSelectionRange());
this._emit("copy", text); this._emit("copy", text);
return text; return text;
}; };
@ -523,7 +523,7 @@ var Editor =function(renderer, session) {
this.onTextInput = function(text, notPasted) { this.onTextInput = function(text, notPasted) {
if (!notPasted) if (!notPasted)
this._emit("paste", text); this._emit("paste", text);
// In case the text was not pasted and we got only one character, then // In case the text was not pasted and we got only one character, then
// handel it as a command key stroke. // handel it as a command key stroke.
if (notPasted && text.length == 1) { if (notPasted && text.length == 1) {
@ -656,32 +656,24 @@ var Editor =function(renderer, session) {
return this.$modeBehaviours; return this.$modeBehaviours;
}; };
this.removeRight = function() { this.remove = function(dir) {
if (this.$readOnly) if (this.$readOnly)
return; return;
if (this.selection.isEmpty()) { if (this.selection.isEmpty()){
this.selection.selectRight(); if(dir == "left")
this.selection.selectLeft();
else
this.selection.selectRight();
} }
this.session.remove(this.getSelectionRange());
this.clearSelection();
};
this.removeLeft = function() {
if (this.$readOnly)
return;
if (this.selection.isEmpty())
this.selection.selectLeft();
var range = this.getSelectionRange(); var range = this.getSelectionRange();
if (this.getBehavioursEnabled()) { if (this.getBehavioursEnabled()) {
var session = this.session; var session = this.session;
var state = session.getState(range.start.row); var state = session.getState(range.start.row);
var new_range = session.getMode().transformAction(state, 'deletion', this, session, range); var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
if (new_range !== false) { if (new_range)
range = new_range; range = new_range;
}
} }
this.session.remove(range); this.session.remove(range);

View file

@ -78,7 +78,7 @@ var CstyleBehaviour = function () {
if (rightChar == '}') { if (rightChar == '}') {
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1}); var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
if (!openBracePos) if (!openBracePos)
return false; return null;
var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString()); var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row)); var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
@ -89,7 +89,6 @@ var CstyleBehaviour = function () {
} }
} }
} }
return false;
}); });
this.add("braces", "deletion", function (state, action, editor, session, range) { this.add("braces", "deletion", function (state, action, editor, session, range) {
@ -102,7 +101,6 @@ var CstyleBehaviour = function () {
return range; return range;
} }
} }
return false;
}); });
this.add("parens", "insertion", function (state, action, editor, session, text) { this.add("parens", "insertion", function (state, action, editor, session, text) {
@ -134,7 +132,6 @@ var CstyleBehaviour = function () {
} }
} }
} }
return false;
}); });
this.add("parens", "deletion", function (state, action, editor, session, range) { this.add("parens", "deletion", function (state, action, editor, session, range) {
@ -147,7 +144,6 @@ var CstyleBehaviour = function () {
return range; return range;
} }
} }
return false;
}); });
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) { this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
@ -166,7 +162,7 @@ var CstyleBehaviour = function () {
// We're escaped. // We're escaped.
if (leftChar == '\\') { if (leftChar == '\\') {
return false; return null;
} }
// Find what token we're inside. // Find what token we're inside.
@ -205,7 +201,6 @@ var CstyleBehaviour = function () {
} }
} }
} }
return false;
}); });
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) { this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
@ -218,7 +213,6 @@ var CstyleBehaviour = function () {
return range; return range;
} }
} }
return false;
}); });
} }

View file

@ -82,7 +82,6 @@ var XmlBehaviour = function () {
} }
} }
} }
return false;
}); });
} }

View file

@ -121,10 +121,13 @@ var c_cppHighlightRules = function() {
token : "keyword.operator", token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
}, { }, {
token : "lparen", token : "punctuation.operator",
regex : "\\?|\\:|\\,|\\;|\\."
}, {
token : "paren.lparen",
regex : "[[({]" regex : "[[({]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "text", token : "text",

View file

@ -97,17 +97,8 @@ oop.inherits(Mode, TextMode);
}; };
this.createWorker = function(session) { this.createWorker = function(session) {
var doc = session.getDocument();
var worker = new WorkerClient(["ace", "pilot"], "worker-coffee.js", "ace/mode/coffee_worker", "Worker"); var worker = new WorkerClient(["ace", "pilot"], "worker-coffee.js", "ace/mode/coffee_worker", "Worker");
worker.call("setValue", [doc.getValue()]); worker.attachToDocument(session.getDocument());
doc.on("change", function(e) {
e.range = {
start: e.data.range.start,
end: e.data.range.end
};
worker.emit("change", e);
});
worker.on("error", function(e) { worker.on("error", function(e) {
session.setAnnotations([e.data]); session.setAnnotations([e.data]);

View file

@ -148,10 +148,13 @@ define(function(require, exports, module) {
token : "comment", token : "comment",
regex : "#.*" regex : "#.*"
}, { }, {
token : "lparen", token : "punctuation.operator",
regex : "\\?|\\:|\\,|\\."
}, {
token : "paren.lparen",
regex : "[({[]" regex : "[({[]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\]})]" regex : "[\\]})]"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -67,10 +67,13 @@ var CSharpHighlightRules = function() {
token : "keyword.operator", token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
}, { }, {
token : "lparen", token : "punctuation.operator",
regex : "\\?|\\:|\\,|\\;|\\."
}, {
token : "paren.lparen",
regex : "[[({]" regex : "[[({]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "text", token : "text",

View file

@ -78,17 +78,8 @@ oop.inherits(Mode, TextMode);
}; };
this.createWorker = function(session) { this.createWorker = function(session) {
var doc = session.getDocument();
var worker = new WorkerClient(["ace", "pilot"], "worker-css.js", "ace/mode/css_worker", "Worker"); var worker = new WorkerClient(["ace", "pilot"], "worker-css.js", "ace/mode/css_worker", "Worker");
worker.call("setValue", [doc.getValue()]); worker.attachToDocument(session.getDocument());
doc.on("change", function(e) {
e.range = {
start: e.data.range.start,
end: e.data.range.end
};
worker.emit("change", e);
});
worker.on("csslint", function(e) { worker.on("csslint", function(e) {
var errors = []; var errors = [];

View file

@ -215,14 +215,14 @@ var CssHighlightRules = function() {
var ruleset = lang.copyArray(base_ruleset); var ruleset = lang.copyArray(base_ruleset);
ruleset.unshift({ ruleset.unshift({
token : "rparen", token : "paren.rparen",
regex : "\\}", regex : "\\}",
next: "start" next: "start"
}); });
var media_ruleset = lang.copyArray( base_ruleset ); var media_ruleset = lang.copyArray( base_ruleset );
media_ruleset.unshift({ media_ruleset.unshift({
token : "rparen", token : "paren.rparen",
regex : "\\}", regex : "\\}",
next: "media" next: "media"
}); });
@ -261,7 +261,7 @@ var CssHighlightRules = function() {
regex : "\\/\\*", regex : "\\/\\*",
next : "comment" next : "comment"
}, { }, {
token: "lparen", token: "paren.lparen",
regex: "\\{", regex: "\\{",
next: "ruleset" next: "ruleset"
}, { }, {
@ -288,7 +288,7 @@ var CssHighlightRules = function() {
regex : "\\/\\*", regex : "\\/\\*",
next : "media_comment" next : "media_comment"
}, { }, {
token: "lparen", token: "paren.lparen",
regex: "\\{", regex: "\\{",
next: "media_ruleset" next: "media_ruleset"
},{ },{

View file

@ -86,17 +86,17 @@ var HtmlHighlightRules = function() {
}, { }, {
token : "meta.tag", token : "meta.tag",
regex : "[-_a-zA-Z0-9:]+", regex : "[-_a-zA-Z0-9:]+",
next : name + "-attribute-list" next : name + "embed-attribute-list"
}, { }, {
token: "empty", token: "empty",
regex: "", regex: "",
next : name + "-attribute-list" next : name + "embed-attribute-list"
}]; }];
states[name + "-qstring"] = multiLineString("'", name); states[name + "-qstring"] = multiLineString("'", name);
states[name + "-qqstring"] = multiLineString("\"", name); states[name + "-qqstring"] = multiLineString("\"", name);
states[name + "-attribute-list"] = [{ states[name + "embed-attribute-list"] = [{
token : "text", token : "text",
regex : ">", regex : ">",
next : nextState next : nextState

View file

@ -125,17 +125,8 @@ oop.inherits(Mode, TextMode);
}; };
this.createWorker = function(session) { this.createWorker = function(session) {
var doc = session.getDocument();
var worker = new WorkerClient(["ace", "pilot"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker"); var worker = new WorkerClient(["ace", "pilot"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
worker.call("setValue", [doc.getValue()]); worker.attachToDocument(session.getDocument());
doc.on("change", function(e) {
e.range = {
start: e.data.range.start,
end: e.data.range.end
};
worker.emit("change", e);
});
worker.on("jslint", function(results) { worker.on("jslint", function(results) {
var errors = []; var errors = [];

View file

@ -46,15 +46,42 @@ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightR
var JavaScriptHighlightRules = function() { var JavaScriptHighlightRules = function() {
// see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
var globals = lang.arrayToMap(
// Constructors
("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" +
// E4X
"Namespace|QName|XML|XMLList|" +
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
// Errors
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
"SyntaxError|TypeError|URIError|" +
// Non-constructor functions
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" +
"isNaN|parseFloat|parseInt|" +
// Other
"JSON|Math|" +
// Pseudo
"this|arguments|prototype|window|document"
).split("|")
);
var keywords = lang.arrayToMap( var keywords = lang.arrayToMap(
("break|case|catch|continue|default|delete|do|else|finally|for|function|" + ("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" + "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" +
"const|yield|import|get|set").split("|") "const|yield|import|get|set").split("|")
); );
// keywords which can be followed by regular expressions // keywords which can be followed by regular expressions
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield"; var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";
var deprecated = lang.arrayToMap(
("__parent__|__count__|escape|unescape|with|__proto__").split("|")
);
var definitions = lang.arrayToMap(("const|let|var|function").split("|"));
var buildinConstants = lang.arrayToMap( var buildinConstants = lang.arrayToMap(
("null|Infinity|NaN|undefined").split("|") ("null|Infinity|NaN|undefined").split("|")
); );
@ -109,7 +136,7 @@ var JavaScriptHighlightRules = function() {
token : "constant.numeric", // float token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, { }, {
token : ["keyword", "text", "entity.name.function"], token : ["keyword.definition", "text", "entity.name.function"],
regex : "(function)(\\s+)(" + identifierRe + ")" regex : "(function)(\\s+)(" + identifierRe + ")"
}, { }, {
token : "constant.language.boolean", token : "constant.language.boolean",
@ -120,8 +147,12 @@ var JavaScriptHighlightRules = function() {
next : "regex_allowed" next : "regex_allowed"
}, { }, {
token : function(value) { token : function(value) {
if (value == "this") if (globals.hasOwnProperty(value))
return "variable.language"; return "variable.language";
else if (deprecated.hasOwnProperty(value))
return "invalid.deprecated";
else if (definitions.hasOwnProperty(value))
return "keyword.definition";
else if (keywords.hasOwnProperty(value)) else if (keywords.hasOwnProperty(value))
return "keyword"; return "keyword";
else if (buildinConstants.hasOwnProperty(value)) else if (buildinConstants.hasOwnProperty(value))
@ -139,11 +170,15 @@ var JavaScriptHighlightRules = function() {
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
next : "regex_allowed" next : "regex_allowed"
}, { }, {
token : "lparen", token : "punctuation.operator",
regex : "\\?|\\:|\\,|\\;|\\.",
next : "regex_allowed"
}, {
token : "paren.lparen",
regex : "[[({]", regex : "[[({]",
next : "regex_allowed" next : "regex_allowed"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -67,10 +67,10 @@ var JsonHighlightRules = function() {
token : "invalid.illegal", // comments are not allowed token : "invalid.illegal", // comments are not allowed
regex : "\\/\\/.*$" regex : "\\/\\/.*$"
}, { }, {
token : "lparen", token : "paren.lparen",
regex : "[[({]" regex : "[[({]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "text", token : "text",
@ -84,4 +84,4 @@ var JsonHighlightRules = function() {
oop.inherits(JsonHighlightRules, TextHighlightRules); oop.inherits(JsonHighlightRules, TextHighlightRules);
exports.JsonHighlightRules = JsonHighlightRules; exports.JsonHighlightRules = JsonHighlightRules;
}); });

View file

@ -279,10 +279,10 @@ var LuaHighlightRules = function() {
token : "keyword.operator", token : "keyword.operator",
regex : "\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\." regex : "\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\."
}, { }, {
token : "lparen", token : "paren.lparen",
regex : "[\\[\\(\\{]" regex : "[\\[\\(\\{]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\]\\)\\}]" regex : "[\\]\\)\\}]"
}, { }, {
token : "text", token : "text",

View file

@ -309,11 +309,11 @@ var OcamlHighlightRules = function() {
regex : "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|=" regex : "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|="
}, },
{ {
token : "lparen", token : "paren.lparen",
regex : "[[({]" regex : "[[({]"
}, },
{ {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, },
{ {

View file

@ -1004,10 +1004,10 @@ var PhpHighlightRules = function() {
token : "keyword.operator", token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
}, { }, {
token : "lparen", token : "paren.lparen",
regex : "[[({]" regex : "[[({]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "text", token : "text",

View file

@ -0,0 +1,56 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var PowershellHighlightRules = require("ace/mode/powershell_highlight_rules").PowershellHighlightRules;
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
var Mode = function() {
this.$tokenizer = new Tokenizer(new PowershellHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
};
oop.inherits(Mode, TextMode);
(function() {
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;
}
}
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;
};
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,138 @@
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;
var PowershellHighlightRules = function() {
var keywords = lang.arrayToMap(
("function|if|else|elseif|switch|while|default|for|do|until|break|continue|" +
"foreach|return|filter|in|trap|throw|param|begin|process|end").split("|")
);
var builtinFunctions = lang.arrayToMap(
("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").split("|"));
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";
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [
{
token : "comment",
regex : "#.*$"
}, {
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 : function(value) {
if (keywords.hasOwnProperty(value))
return "keyword";
else if (builtinFunctions.hasOwnProperty(value))
return "support.function";
else
return "identifier";
},
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
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", // closing comment
regex : ".*?\\*\\/",
next : "start"
}, {
token : "comment", // comment spanning whole line
merge : true,
regex : ".+"
}
]
};
};
oop.inherits(PowershellHighlightRules, TextHighlightRules);
exports.PowershellHighlightRules = PowershellHighlightRules;
});

View file

@ -145,10 +145,10 @@ var PythonHighlightRules = function() {
token : "keyword.operator", token : "keyword.operator",
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|=" regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
}, { }, {
token : "lparen", token : "lparen.paren",
regex : "[\\[\\(\\{]" regex : "[\\[\\(\\{]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\]\\)\\}]" regex : "[\\]\\)\\}]"
}, { }, {
token : "text", token : "text",
@ -178,4 +178,4 @@ var PythonHighlightRules = function() {
oop.inherits(PythonHighlightRules, TextHighlightRules); oop.inherits(PythonHighlightRules, TextHighlightRules);
exports.PythonHighlightRules = PythonHighlightRules; exports.PythonHighlightRules = PythonHighlightRules;
}); });

View file

@ -163,10 +163,10 @@ var RubyHighlightRules = function() {
token : "keyword.operator", token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
}, { }, {
token : "lparen", token : "paren.lparen",
regex : "[[({]" regex : "[[({]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "text", token : "text",

View file

@ -112,10 +112,10 @@ var scadHighlightRules = function() {
token : "keyword.operator", token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
}, { }, {
token : "lparen", token : "paren.lparen",
regex : "[[({]" regex : "[[({]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "text", token : "text",

View file

@ -110,10 +110,10 @@ var ScalaHighlightRules = function() {
token : "keyword.operator", token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
}, { }, {
token : "lparen", token : "paren.lparen",
regex : "[[({]" regex : "[[({]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "text", token : "text",

View file

@ -310,10 +310,10 @@ var ScssHighlightRules = function() {
token : "keyword.operator", token : "keyword.operator",
regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*" regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
}, { }, {
token : "lparen", token : "paren.lparen",
regex : "[[({]" regex : "[[({]"
}, { }, {
token : "rparen", token : "paren.rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "text", token : "text",

View file

@ -116,7 +116,7 @@ function DefaultHandlers(editor) {
onStartSelect(pos); onStartSelect(pos);
} }
var mousePageX, mousePageY; var mousePageX = pageX, mousePageY = pageY;
var overwrite = editor.getOverwrite(); var overwrite = editor.getOverwrite();
var mousedownTime = (new Date()).getTime(); var mousedownTime = (new Date()).getTime();
var dragCursor, dragRange; var dragCursor, dragRange;
@ -167,9 +167,6 @@ function DefaultHandlers(editor) {
}; };
var onSelectionInterval = function() { var onSelectionInterval = function() {
if (mousePageX === undefined || mousePageY === undefined)
return;
if (state == STATE_UNKNOWN) { if (state == STATE_UNKNOWN) {
var distance = calcDistance(pageX, pageY, mousePageX, mousePageY); var distance = calcDistance(pageX, pageY, mousePageX, mousePageY);
var time = (new Date()).getTime(); var time = (new Date()).getTime();

View file

@ -42,7 +42,7 @@ var EventEmitter = require("pilot/event_emitter").EventEmitter;
var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) { var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
this.callbacks = []; this.changeListener = this.changeListener.bind(this);
if (require.packaged) { if (require.packaged) {
var base = this.$guessBasePath(); var base = this.$guessBasePath();
@ -104,9 +104,9 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
this.$normalizePath = function(path) { this.$normalizePath = function(path) {
if (!path.match(/^\w+:/)) { if (!path.match(/^\w+:/)) {
path = location.protocol + "//" + location.host path = location.protocol + "//" + location.host
// paths starting with a slash are relative to the root (host) // paths starting with a slash are relative to the root (host)
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, "")) + (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, ""); + "/" + path.replace(/^[\/]+/, "");
} }
return path; return path;
@ -115,7 +115,7 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
this.$guessBasePath = function() { this.$guessBasePath = function() {
if (require.aceBaseUrl) if (require.aceBaseUrl)
return require.aceBaseUrl; return require.aceBaseUrl;
var scripts = document.getElementsByTagName("script"); var scripts = document.getElementsByTagName("script");
for (var i=0; i<scripts.length; i++) { for (var i=0; i<scripts.length; i++) {
var script = scripts[i]; var script = scripts[i];
@ -123,7 +123,7 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
var base = script.getAttribute("data-ace-base"); var base = script.getAttribute("data-ace-base");
if (base) if (base)
return base.replace(/\/*$/, "/"); return base.replace(/\/*$/, "/");
var src = script.src || script.getAttribute("src"); var src = script.src || script.getAttribute("src");
if (!src) { if (!src) {
continue; continue;
@ -138,6 +138,9 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
this.terminate = function() { this.terminate = function() {
this._dispatchEvent("terminate", {}); this._dispatchEvent("terminate", {});
this.$worker.terminate(); this.$worker.terminate();
this.$worker = null;
this.$doc.removeEventListener("change", this.changeListener);
this.$doc = null;
}; };
this.send = function(cmd, args) { this.send = function(cmd, args) {
@ -155,11 +158,30 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
this.emit = function(event, data) { this.emit = function(event, data) {
try { try {
this.$worker.postMessage({event: event, data: data}); // firefox refuses to clone objects which have function properties
// TODO: cleanup event
this.$worker.postMessage({event: event, data: {data: data.data}});
} }
catch(ex) {} catch(ex) {}
}; };
this.attachToDocument = function(doc) {
if(this.$doc)
this.terminate();
this.$doc = doc;
this.call("setValue", [doc.getValue()]);
doc.on("change", this.changeListener);
};
this.changeListener = function(e) {
e.range = {
start: e.data.range.start,
end: e.data.range.end
};
this.emit("change", e);
};
}).call(WorkerClient.prototype); }).call(WorkerClient.prototype);
exports.WorkerClient = WorkerClient; exports.WorkerClient = WorkerClient;

@ -1 +1 @@
Subproject commit 5b4cd5f0592257e93e340db6171e9d7b9e501c56 Subproject commit 48ddaa841476ddf9210ccbb2b310952db8212084