ace-rails-ap 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ace/rails/version.rb +1 -1
- data/vendor/assets/javascripts/ace.js +15680 -1
- data/vendor/assets/javascripts/keybinding-emacs.js +367 -1
- data/vendor/assets/javascripts/keybinding-vim.js +1635 -1
- data/vendor/assets/javascripts/mode-c9search.js +275 -0
- data/vendor/assets/javascripts/mode-c_cpp.js +744 -1
- data/vendor/assets/javascripts/mode-clojure.js +364 -1
- data/vendor/assets/javascripts/mode-coffee.js +527 -1
- data/vendor/assets/javascripts/mode-coldfusion.js +1966 -1
- data/vendor/assets/javascripts/mode-csharp.js +633 -1
- data/vendor/assets/javascripts/mode-css.js +499 -1
- data/vendor/assets/javascripts/mode-diff.js +250 -0
- data/vendor/assets/javascripts/{mode-c_cpp-uncompressed.js → mode-glsl.js} +147 -244
- data/vendor/assets/javascripts/mode-golang.js +681 -1
- data/vendor/assets/javascripts/mode-groovy.js +1240 -1
- data/vendor/assets/javascripts/mode-haxe.js +633 -1
- data/vendor/assets/javascripts/mode-html.js +2064 -1
- data/vendor/assets/javascripts/mode-java.js +1202 -1
- data/vendor/assets/javascripts/mode-javascript.js +1069 -1
- data/vendor/assets/javascripts/mode-json.js +588 -1
- data/vendor/assets/javascripts/{mode-haxe-uncompressed.js → mode-jsx.js} +189 -312
- data/vendor/assets/javascripts/mode-latex.js +95 -1
- data/vendor/assets/javascripts/mode-less.js +512 -1
- data/vendor/assets/javascripts/mode-liquid.js +1125 -1
- data/vendor/assets/javascripts/mode-lua.js +551 -1
- data/vendor/assets/javascripts/{mode-html-uncompressed.js → mode-luahtml.js} +544 -604
- data/vendor/assets/javascripts/{mode-coldfusion-uncompressed.js → mode-luapage.js} +2326 -2180
- data/vendor/assets/javascripts/mode-markdown.js +2369 -1
- data/vendor/assets/javascripts/mode-ocaml.js +464 -1
- data/vendor/assets/javascripts/mode-perl.js +432 -1
- data/vendor/assets/javascripts/mode-pgsql.js +970 -1
- data/vendor/assets/javascripts/mode-php.js +1718 -1
- data/vendor/assets/javascripts/mode-powershell.js +610 -1
- data/vendor/assets/javascripts/mode-python.js +397 -1
- data/vendor/assets/javascripts/mode-ruby.js +318 -1
- data/vendor/assets/javascripts/mode-scad.js +732 -1
- data/vendor/assets/javascripts/mode-scala.js +1237 -1
- data/vendor/assets/javascripts/mode-scss.js +537 -1
- data/vendor/assets/javascripts/mode-sh.js +250 -1
- data/vendor/assets/javascripts/mode-sql.js +140 -1
- data/vendor/assets/javascripts/mode-svg.js +1681 -1
- data/vendor/assets/javascripts/mode-tcl.js +320 -0
- data/vendor/assets/javascripts/mode-textile.js +182 -1
- data/vendor/assets/javascripts/mode-xml.js +829 -1
- data/vendor/assets/javascripts/mode-xquery.js +605 -1
- data/vendor/assets/javascripts/mode-yaml.js +189 -0
- data/vendor/assets/javascripts/theme-chrome.js +213 -1
- data/vendor/assets/javascripts/theme-clouds.js +167 -1
- data/vendor/assets/javascripts/theme-clouds_midnight.js +168 -1
- data/vendor/assets/javascripts/theme-cobalt.js +194 -1
- data/vendor/assets/javascripts/theme-crimson_editor.js +200 -1
- data/vendor/assets/javascripts/theme-dawn.js +198 -1
- data/vendor/assets/javascripts/theme-dreamweaver.js +230 -1
- data/vendor/assets/javascripts/theme-eclipse.js +157 -1
- data/vendor/assets/javascripts/theme-github.js +182 -0
- data/vendor/assets/javascripts/theme-idle_fingers.js +186 -1
- data/vendor/assets/javascripts/theme-kr_theme.js +189 -1
- data/vendor/assets/javascripts/theme-merbivore.js +189 -1
- data/vendor/assets/javascripts/theme-merbivore_soft.js +195 -1
- data/vendor/assets/javascripts/theme-mono_industrial.js +197 -1
- data/vendor/assets/javascripts/theme-monokai.js +194 -1
- data/vendor/assets/javascripts/theme-pastel_on_dark.js +199 -1
- data/vendor/assets/javascripts/theme-solarized_dark.js +180 -1
- data/vendor/assets/javascripts/theme-solarized_light.js +179 -1
- data/vendor/assets/javascripts/theme-textmate.js +216 -0
- data/vendor/assets/javascripts/theme-tomorrow.js +213 -1
- data/vendor/assets/javascripts/theme-tomorrow_night.js +213 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_blue.js +213 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_bright.js +213 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_eighties.js +209 -1
- data/vendor/assets/javascripts/theme-twilight.js +211 -1
- data/vendor/assets/javascripts/theme-vibrant_ink.js +190 -1
- data/vendor/assets/javascripts/worker-coffee.js +83 -893
- data/vendor/assets/javascripts/worker-css.js +88 -1402
- data/vendor/assets/javascripts/worker-javascript.js +97 -812
- data/vendor/assets/javascripts/worker-json.js +84 -761
- data/vendor/assets/javascripts/worker-xquery.js +66464 -0
- metadata +12 -195
- data/vendor/assets/javascripts/ace-compat-noconflict.js +0 -1
- data/vendor/assets/javascripts/ace-compat-uncompressed-noconflict.js +0 -480
- data/vendor/assets/javascripts/ace-compat-uncompressed.js +0 -480
- data/vendor/assets/javascripts/ace-compat.js +0 -1
- data/vendor/assets/javascripts/ace-noconflict.js +0 -10
- data/vendor/assets/javascripts/ace-uncompressed-noconflict.js +0 -19976
- data/vendor/assets/javascripts/ace-uncompressed.js +0 -19976
- data/vendor/assets/javascripts/keybinding-emacs-noconflict.js +0 -1
- data/vendor/assets/javascripts/keybinding-emacs-uncompressed-noconflict.js +0 -150
- data/vendor/assets/javascripts/keybinding-emacs-uncompressed.js +0 -150
- data/vendor/assets/javascripts/keybinding-vim-noconflict.js +0 -1
- data/vendor/assets/javascripts/keybinding-vim-uncompressed-noconflict.js +0 -138
- data/vendor/assets/javascripts/keybinding-vim-uncompressed.js +0 -138
- data/vendor/assets/javascripts/mode-c_cpp-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-c_cpp-uncompressed-noconflict.js +0 -919
- data/vendor/assets/javascripts/mode-clojure-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-clojure-uncompressed-noconflict.js +0 -422
- data/vendor/assets/javascripts/mode-clojure-uncompressed.js +0 -422
- data/vendor/assets/javascripts/mode-coffee-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-coffee-uncompressed-noconflict.js +0 -607
- data/vendor/assets/javascripts/mode-coffee-uncompressed.js +0 -607
- data/vendor/assets/javascripts/mode-coldfusion-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-coldfusion-uncompressed-noconflict.js +0 -2458
- data/vendor/assets/javascripts/mode-csharp-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-csharp-uncompressed-noconflict.js +0 -769
- data/vendor/assets/javascripts/mode-csharp-uncompressed.js +0 -769
- data/vendor/assets/javascripts/mode-css-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-css-uncompressed-noconflict.js +0 -641
- data/vendor/assets/javascripts/mode-css-uncompressed.js +0 -641
- data/vendor/assets/javascripts/mode-golang-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-golang-uncompressed-noconflict.js +0 -378
- data/vendor/assets/javascripts/mode-golang-uncompressed.js +0 -378
- data/vendor/assets/javascripts/mode-groovy-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-groovy-uncompressed-noconflict.js +0 -1393
- data/vendor/assets/javascripts/mode-groovy-uncompressed.js +0 -1393
- data/vendor/assets/javascripts/mode-haxe-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-haxe-uncompressed-noconflict.js +0 -769
- data/vendor/assets/javascripts/mode-html-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-html-uncompressed-noconflict.js +0 -2475
- data/vendor/assets/javascripts/mode-java-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-java-uncompressed-noconflict.js +0 -1395
- data/vendor/assets/javascripts/mode-java-uncompressed.js +0 -1395
- data/vendor/assets/javascripts/mode-javascript-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-javascript-uncompressed-noconflict.js +0 -1226
- data/vendor/assets/javascripts/mode-javascript-uncompressed.js +0 -1226
- data/vendor/assets/javascripts/mode-json-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-json-uncompressed-noconflict.js +0 -701
- data/vendor/assets/javascripts/mode-json-uncompressed.js +0 -701
- data/vendor/assets/javascripts/mode-latex-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-latex-uncompressed-noconflict.js +0 -95
- data/vendor/assets/javascripts/mode-latex-uncompressed.js +0 -95
- data/vendor/assets/javascripts/mode-less-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-less-uncompressed-noconflict.js +0 -655
- data/vendor/assets/javascripts/mode-less-uncompressed.js +0 -655
- data/vendor/assets/javascripts/mode-liquid-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-liquid-uncompressed-noconflict.js +0 -1353
- data/vendor/assets/javascripts/mode-liquid-uncompressed.js +0 -1353
- data/vendor/assets/javascripts/mode-lua-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-lua-uncompressed-noconflict.js +0 -523
- data/vendor/assets/javascripts/mode-lua-uncompressed.js +0 -523
- data/vendor/assets/javascripts/mode-markdown-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-markdown-uncompressed-noconflict.js +0 -2925
- data/vendor/assets/javascripts/mode-markdown-uncompressed.js +0 -2925
- data/vendor/assets/javascripts/mode-ocaml-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-ocaml-uncompressed-noconflict.js +0 -539
- data/vendor/assets/javascripts/mode-ocaml-uncompressed.js +0 -539
- data/vendor/assets/javascripts/mode-perl-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-perl-uncompressed-noconflict.js +0 -574
- data/vendor/assets/javascripts/mode-perl-uncompressed.js +0 -574
- data/vendor/assets/javascripts/mode-pgsql-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-pgsql-uncompressed-noconflict.js +0 -1104
- data/vendor/assets/javascripts/mode-pgsql-uncompressed.js +0 -1104
- data/vendor/assets/javascripts/mode-php-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-php-uncompressed-noconflict.js +0 -1885
- data/vendor/assets/javascripts/mode-php-uncompressed.js +0 -1885
- data/vendor/assets/javascripts/mode-powershell-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-powershell-uncompressed-noconflict.js +0 -710
- data/vendor/assets/javascripts/mode-powershell-uncompressed.js +0 -710
- data/vendor/assets/javascripts/mode-python-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-python-uncompressed-noconflict.js +0 -507
- data/vendor/assets/javascripts/mode-python-uncompressed.js +0 -507
- data/vendor/assets/javascripts/mode-ruby-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-ruby-uncompressed-noconflict.js +0 -391
- data/vendor/assets/javascripts/mode-ruby-uncompressed.js +0 -391
- data/vendor/assets/javascripts/mode-scad-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-scad-uncompressed-noconflict.js +0 -907
- data/vendor/assets/javascripts/mode-scad-uncompressed.js +0 -907
- data/vendor/assets/javascripts/mode-scala-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-scala-uncompressed-noconflict.js +0 -1395
- data/vendor/assets/javascripts/mode-scala-uncompressed.js +0 -1395
- data/vendor/assets/javascripts/mode-scss-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-scss-uncompressed-noconflict.js +0 -679
- data/vendor/assets/javascripts/mode-scss-uncompressed.js +0 -679
- data/vendor/assets/javascripts/mode-sh-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-sh-uncompressed-noconflict.js +0 -289
- data/vendor/assets/javascripts/mode-sh-uncompressed.js +0 -289
- data/vendor/assets/javascripts/mode-sql-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-sql-uncompressed-noconflict.js +0 -159
- data/vendor/assets/javascripts/mode-sql-uncompressed.js +0 -159
- data/vendor/assets/javascripts/mode-svg-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-svg-uncompressed-noconflict.js +0 -2137
- data/vendor/assets/javascripts/mode-svg-uncompressed.js +0 -2137
- data/vendor/assets/javascripts/mode-text-noconflict.js +0 -0
- data/vendor/assets/javascripts/mode-text-uncompressed-noconflict.js +0 -0
- data/vendor/assets/javascripts/mode-text-uncompressed.js +0 -0
- data/vendor/assets/javascripts/mode-textile-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-textile-uncompressed-noconflict.js +0 -254
- data/vendor/assets/javascripts/mode-textile-uncompressed.js +0 -254
- data/vendor/assets/javascripts/mode-xml-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-xml-uncompressed-noconflict.js +0 -1012
- data/vendor/assets/javascripts/mode-xml-uncompressed.js +0 -1012
- data/vendor/assets/javascripts/mode-xquery-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-xquery-uncompressed-noconflict.js +0 -540
- data/vendor/assets/javascripts/mode-xquery-uncompressed.js +0 -540
- data/vendor/assets/javascripts/theme-chrome-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-chrome-uncompressed-noconflict.js +0 -207
- data/vendor/assets/javascripts/theme-chrome-uncompressed.js +0 -207
- data/vendor/assets/javascripts/theme-clouds-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-clouds-uncompressed-noconflict.js +0 -160
- data/vendor/assets/javascripts/theme-clouds-uncompressed.js +0 -160
- data/vendor/assets/javascripts/theme-clouds_midnight-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed-noconflict.js +0 -161
- data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed.js +0 -161
- data/vendor/assets/javascripts/theme-cobalt-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-cobalt-uncompressed-noconflict.js +0 -187
- data/vendor/assets/javascripts/theme-cobalt-uncompressed.js +0 -187
- data/vendor/assets/javascripts/theme-crimson_editor-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-crimson_editor-uncompressed-noconflict.js +0 -198
- data/vendor/assets/javascripts/theme-crimson_editor-uncompressed.js +0 -198
- data/vendor/assets/javascripts/theme-dawn-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-dawn-uncompressed-noconflict.js +0 -191
- data/vendor/assets/javascripts/theme-dawn-uncompressed.js +0 -191
- data/vendor/assets/javascripts/theme-dreamweaver-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-dreamweaver-uncompressed-noconflict.js +0 -227
- data/vendor/assets/javascripts/theme-dreamweaver-uncompressed.js +0 -227
- data/vendor/assets/javascripts/theme-eclipse-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-eclipse-uncompressed-noconflict.js +0 -147
- data/vendor/assets/javascripts/theme-eclipse-uncompressed.js +0 -147
- data/vendor/assets/javascripts/theme-idle_fingers-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-idle_fingers-uncompressed-noconflict.js +0 -179
- data/vendor/assets/javascripts/theme-idle_fingers-uncompressed.js +0 -179
- data/vendor/assets/javascripts/theme-kr_theme-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-kr_theme-uncompressed-noconflict.js +0 -182
- data/vendor/assets/javascripts/theme-kr_theme-uncompressed.js +0 -182
- data/vendor/assets/javascripts/theme-merbivore-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-merbivore-uncompressed-noconflict.js +0 -182
- data/vendor/assets/javascripts/theme-merbivore-uncompressed.js +0 -182
- data/vendor/assets/javascripts/theme-merbivore_soft-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed-noconflict.js +0 -188
- data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed.js +0 -188
- data/vendor/assets/javascripts/theme-mono_industrial-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-mono_industrial-uncompressed-noconflict.js +0 -190
- data/vendor/assets/javascripts/theme-mono_industrial-uncompressed.js +0 -190
- data/vendor/assets/javascripts/theme-monokai-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-monokai-uncompressed-noconflict.js +0 -191
- data/vendor/assets/javascripts/theme-monokai-uncompressed.js +0 -191
- data/vendor/assets/javascripts/theme-pastel_on_dark-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed-noconflict.js +0 -192
- data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed.js +0 -192
- data/vendor/assets/javascripts/theme-solarized_dark-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-solarized_dark-uncompressed-noconflict.js +0 -176
- data/vendor/assets/javascripts/theme-solarized_dark-uncompressed.js +0 -176
- data/vendor/assets/javascripts/theme-solarized_light-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-solarized_light-uncompressed-noconflict.js +0 -172
- data/vendor/assets/javascripts/theme-solarized_light-uncompressed.js +0 -172
- data/vendor/assets/javascripts/theme-textmate-noconflict.js +0 -0
- data/vendor/assets/javascripts/theme-textmate-uncompressed-noconflict.js +0 -0
- data/vendor/assets/javascripts/theme-textmate-uncompressed.js +0 -0
- data/vendor/assets/javascripts/theme-tomorrow-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow-uncompressed-noconflict.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow-uncompressed.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed-noconflict.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night_blue-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed-noconflict.js +0 -209
- data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed.js +0 -209
- data/vendor/assets/javascripts/theme-tomorrow_night_bright-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed-noconflict.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night_eighties-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed-noconflict.js +0 -202
- data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed.js +0 -202
- data/vendor/assets/javascripts/theme-twilight-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-twilight-uncompressed-noconflict.js +0 -204
- data/vendor/assets/javascripts/theme-twilight-uncompressed.js +0 -204
- data/vendor/assets/javascripts/theme-vibrant_ink-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed-noconflict.js +0 -183
- data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed.js +0 -183
@@ -1 +1,1069 @@
|
|
1
|
-
define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./javascript_highlight_rules").JavaScriptHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=a("../range").Range,j=a("../worker/worker_client").WorkerClient,k=a("./behaviour/cstyle").CstyleBehaviour,l=a("./folding/cstyle").FoldMode,m=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h,this.$behaviour=new k,this.foldingRules=new l};d.inherits(m,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=/^(\s*)\/\//;for(var g=c;g<=d;g++)if(!f.test(b.getLine(g))){e=!1;break}if(e){var h=new i(0,0,0,0);for(var g=c;g<=d;g++){var j=b.getLine(g),k=j.match(f);h.start.row=g,h.end.row=g,h.end.column=k[0].length,b.replace(h,k[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"||a=="regex_allowed"){var h=b.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start"||a=="regex_allowed")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=new j(["ace"],"worker-javascript.js","ace/mode/javascript_worker","JavaScriptWorker");return b.attachToDocument(a.getDocument()),b.on("jslint",function(b){var c=[];for(var d=0;d<b.data.length;d++){var e=b.data[d];e&&c.push({row:e.line-1,column:e.character-1,text:e.reason,type:"warning",lint:e})}a.setAnnotations(c)}),b.on("narcissus",function(b){a.setAnnotations([b.data])}),b.on("terminate",function(){a.clearAnnotations()}),b}}.call(m.prototype),b.Mode=m}),define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/unicode","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("../lib/lang"),f=a("../unicode"),g=a("./doc_comment_highlight_rules").DocCommentHighlightRules,h=a("./text_highlight_rules").TextHighlightRules,i=function(){var a=e.arrayToMap("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document".split("|")),b=e.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|const|yield|import|get|set".split("|")),c="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield",d=e.arrayToMap("__parent__|__count__|escape|unescape|with|__proto__".split("|")),h=e.arrayToMap("const|let|var|function".split("|")),i=e.arrayToMap("null|Infinity|NaN|undefined".split("|")),j=e.arrayToMap("class|enum|extends|super|export|implements|private|public|interface|package|protected|static".split("|")),k="["+f.packages.L+"\\$_]["+f.packages.L+f.packages.Mn+f.packages.Mc+f.packages.Nd+f.packages.Pc+"\\$_]*\\b",l="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)";this.$rules={start:[{token:"comment",regex:/\/\/.*$/},g.getStartRule("doc-start"),{token:"comment",merge:!0,regex:/\/\*/,next:"comment"},{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0[xX][0-9a-fA-F]+\b/},{token:"constant.numeric",regex:/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/},{token:["storage.type","punctuation.operator","support.function","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+k+")(\\.)(prototype)(\\.)("+k+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","punctuation.operator","support.function","punctuation.operator","entity.name.function","text","keyword.operator","text"],regex:"("+k+")(\\.)(prototype)(\\.)("+k+")(\\s*)(=)(\\s*)",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+k+")(\\.)("+k+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+k+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","entity.name.function","text","paren.lparen"],regex:"(function)(\\s+)("+k+")(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","punctuation.operator","text","storage.type","text","paren.lparen"],regex:"("+k+")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["text","text","storage.type","text","paren.lparen"],regex:"(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:"constant.language.boolean",regex:/(?:true|false)\b/},{token:"keyword",regex:"(?:"+c+")\\b",next:"regex_allowed"},{token:["punctuation.operator","support.function"],regex:/(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/},{token:["punctuation.operator","support.function.dom"],regex:/(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/},{token:["punctuation.operator","support.constant"],regex:/(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/},{token:["storage.type","punctuation.operator","support.function.firebug"],regex:/(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/},{token:function(c){return a.hasOwnProperty(c)?"variable.language":d.hasOwnProperty(c)?"invalid.deprecated":h.hasOwnProperty(c)?"storage.type":b.hasOwnProperty(c)?"keyword":i.hasOwnProperty(c)?"constant.language":j.hasOwnProperty(c)?"invalid.illegal":c=="debugger"?"invalid.deprecated":"identifier"},regex:k},{token:"keyword.operator",regex:/!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,next:"regex_allowed"},{token:"punctuation.operator",regex:/\?|\:|\,|\;|\./,next:"regex_allowed"},{token:"paren.lparen",regex:/[\[({]/,next:"regex_allowed"},{token:"paren.rparen",regex:/[\])}]/},{token:"keyword.operator",regex:/\/=?/,next:"regex_allowed"},{token:"comment",regex:/^#!.*$/},{token:"text",regex:/\s+/}],regex_allowed:[g.getStartRule("doc-start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment_regex_allowed"},{token:"comment",regex:"\\/\\/.*$"},{token:"string.regexp",regex:"\\/",next:"regex",merge:!0},{token:"text",regex:"\\s+"},{token:"empty",regex:"",next:"start"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/\\w*",next:"start",merge:!0},{token:"string.regexp",regex:"[^\\\\/\\[]+",merge:!0},{token:"string.regexp.charachterclass",regex:"\\[",next:"regex_character_class",merge:!0},{token:"empty",regex:"",next:"start"}],regex_character_class:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp.charachterclass",regex:"]",next:"regex",merge:!0},{token:"string.regexp.charachterclass",regex:"[^\\\\\\]]+",merge:!0},{token:"empty",regex:"",next:"start"}],function_arguments:[{token:"variable.parameter",regex:k},{token:"punctuation.operator",regex:"[, ]+",merge:!0},{token:"punctuation.operator",regex:"$",merge:!0},{token:"empty",regex:"",next:"start"}],comment_regex_allowed:[{token:"comment",regex:".*?\\*\\/",merge:!0,next:"regex_allowed"},{token:"comment",merge:!0,regex:".+"}],comment:[{token:"comment",regex:".*?\\*\\/",merge:!0,next:"start"},{token:"comment",merge:!0,regex:".+"}],qqstring:[{token:"constant.language.escape",regex:l},{token:"string",regex:'[^"\\\\]+',merge:!0},{token:"string",regex:"\\\\$",next:"qqstring",merge:!0},{token:"string",regex:'"|$',next:"start",merge:!0}],qstring:[{token:"constant.language.escape",regex:l},{token:"string",regex:"[^'\\\\]+",merge:!0},{token:"string",regex:"\\\\$",next:"qstring",merge:!0},{token:"string",regex:"'|$",next:"start",merge:!0}]},this.embedRules(g,"doc-",[g.getEndRule("start")])};d.inherits(i,h),b.JavaScriptHighlightRules=i}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};d.inherits(f,e),f.getStartRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\/\\*(?=\\*)",next:a}},f.getEndRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:a}},b.DocCommentHighlightRules=f}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){"use strict";var d=a("../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/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour"],function(a,b,c){"use strict";var d=a("../../lib/oop"),e=a("../behaviour").Behaviour,f=function(){this.add("braces","insertion",function(a,b,c,d,e){if(e=="{"){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);return g!==""?{text:"{"+g+"}",selection:!1}:{text:"{}",selection:[1,1]}}if(e=="}"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j=="}"){var k=d.$findOpeningBracket("}",{column:h.column+1,row:h.row});if(k!==null)return{text:"",selection:[1,1]}}}else if(e=="\n"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j=="}"){var l=d.findMatchingBracket({row:h.row,column:h.column+1});if(!l)return null;var m=this.getNextLineIndent(a,i.substring(0,i.length-1),d.getTabString()),n=this.$getIndent(d.doc.getLine(l.row));return{text:"\n"+m+"\n"+n,selection:[1,m.length,1,m.length]}}}}),this.add("braces","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=="{"){var g=d.doc.getLine(e.start.row),h=g.substring(e.end.column,e.end.column+1);if(h=="}")return e.end.column++,e}}),this.add("parens","insertion",function(a,b,c,d,e){if(e=="("){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);return g!==""?{text:"("+g+")",selection:!1}:{text:"()",selection:[1,1]}}if(e==")"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j==")"){var k=d.$findOpeningBracket(")",{column:h.column+1,row:h.row});if(k!==null)return{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=="("){var g=d.doc.getLine(e.start.row),h=g.substring(e.start.column+1,e.start.column+2);if(h==")")return e.end.column++,e}}),this.add("string_dquotes","insertion",function(a,b,c,d,e){if(e=='"'||e=="'"){var f=e,g=c.getSelectionRange(),h=d.doc.getTextRange(g);if(h!=="")return{text:f+h+f,selection:!1};var i=c.getCursorPosition(),j=d.doc.getLine(i.row),k=j.substring(i.column-1,i.column);if(k=="\\")return null;var l=d.getTokens(g.start.row,g.start.row)[0].tokens,m=0,n,o=-1;for(var p=0;p<l.length;p++){n=l[p],n.type=="string"?o=-1:o<0&&(o=n.value.indexOf(f));if(n.value.length+m>g.start.column)break;m+=l[p].value.length}if(!n||o<0&&n.type!=="comment"&&(n.type!=="string"||g.start.column!==n.value.length+m-1&&n.value.lastIndexOf(f)===n.value.length-1))return{text:f+f,selection:[1,1]};if(n&&n.type==="string"){var q=j.substring(i.column,i.column+1);if(q==f)return{text:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&(f=='"'||f=="'")){var g=d.doc.getLine(e.start.row),h=g.substring(e.start.column+1,e.start.column+2);if(h=='"')return e.end.column++,e}})};d.inherits(f,e),b.CstyleBehaviour=f}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(a,b,c){"use strict";var d=a("../../lib/oop"),e=a("../../range").Range,f=a("./fold_mode").FoldMode,g=b.FoldMode=function(){};d.inherits(g,f),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.getFoldWidgetRange=function(a,b,c){var d=a.getLine(c),f=d.match(this.foldingStartMarker);if(f){var g=f.index;if(f[1])return this.openingBracketBlock(a,f[1],c,g);var h=a.getCommentFoldRange(c,g+f[0].length);return h.end.column-=2,h}if(b!=="markbeginend")return;var f=d.match(this.foldingStopMarker);if(f){var g=f.index+f[0].length;if(f[2]){var h=a.getCommentFoldRange(c,g);return h.end.column-=2,h}var i={row:c,column:g},j=a.$findOpeningBracket(f[1],i);if(!j)return;return j.column++,i.column--,e.fromPoints(j,i)}}}.call(g.prototype)}),define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(a,b,c){"use strict";var d=a("../../range").Range,e=b.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(a,b,c){var d=a.getLine(c);return this.foldingStartMarker.test(d)?"start":b=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(d)?"end":""},this.getFoldWidgetRange=function(a,b,c){return null},this.indentationBlock=function(a,b,c){var e=/^\s*/,f=b,g=b,h=a.getLine(b),i=c||h.length,j=h.match(e)[0].length,k=a.getLength();while(++b<k){h=a.getLine(b);var l=h.match(e)[0].length;if(l==h.length)continue;if(l<=j)break;g=b}if(g>f){var m=a.getLine(g).length;return new d(f,i,g,m)}},this.openingBracketBlock=function(a,b,c,e){var f={row:c,column:e+1},g=a.$findClosingBracket(b,f);if(!g)return;var h=a.foldWidgets[g.row];return h==null&&(h=this.getFoldWidget(a,g.row)),h=="start"&&(g.row--,g.column=a.getLine(g.row).length),d.fromPoints(f,g)}}).call(e.prototype)})
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
+
*
|
4
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
5
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
* http://www.mozilla.org/MPL/
|
8
|
+
*
|
9
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
+
* for the specific language governing rights and limitations under the
|
12
|
+
* License.
|
13
|
+
*
|
14
|
+
* The Original Code is Ajax.org Code Editor (ACE).
|
15
|
+
*
|
16
|
+
* The Initial Developer of the Original Code is
|
17
|
+
* Ajax.org B.V.
|
18
|
+
* Portions created by the Initial Developer are Copyright (C) 2010
|
19
|
+
* the Initial Developer. All Rights Reserved.
|
20
|
+
*
|
21
|
+
* Contributor(s):
|
22
|
+
* Fabian Jakobs <fabian AT ajax DOT org>
|
23
|
+
*
|
24
|
+
* Alternatively, the contents of this file may be used under the terms of
|
25
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
26
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
27
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
28
|
+
* of those above. If you wish to allow use of your version of this file only
|
29
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
30
|
+
* use your version of this file under the terms of the MPL, indicate your
|
31
|
+
* decision by deleting the provisions above and replace them with the notice
|
32
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
33
|
+
* the provisions above, a recipient may use your version of this file under
|
34
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
35
|
+
*
|
36
|
+
* ***** END LICENSE BLOCK ***** */
|
37
|
+
|
38
|
+
define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
39
|
+
|
40
|
+
|
41
|
+
var oop = require("../lib/oop");
|
42
|
+
var TextMode = require("./text").Mode;
|
43
|
+
var Tokenizer = require("../tokenizer").Tokenizer;
|
44
|
+
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
45
|
+
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
46
|
+
var Range = require("../range").Range;
|
47
|
+
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
48
|
+
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
49
|
+
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
50
|
+
|
51
|
+
var Mode = function() {
|
52
|
+
this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
|
53
|
+
this.$outdent = new MatchingBraceOutdent();
|
54
|
+
this.$behaviour = new CstyleBehaviour();
|
55
|
+
this.foldingRules = new CStyleFoldMode();
|
56
|
+
};
|
57
|
+
oop.inherits(Mode, TextMode);
|
58
|
+
|
59
|
+
(function() {
|
60
|
+
|
61
|
+
|
62
|
+
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
63
|
+
var outdent = true;
|
64
|
+
var re = /^(\s*)\/\//;
|
65
|
+
|
66
|
+
for (var i=startRow; i<= endRow; i++) {
|
67
|
+
if (!re.test(doc.getLine(i))) {
|
68
|
+
outdent = false;
|
69
|
+
break;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
if (outdent) {
|
74
|
+
var deleteRange = new Range(0, 0, 0, 0);
|
75
|
+
for (var i=startRow; i<= endRow; i++)
|
76
|
+
{
|
77
|
+
var line = doc.getLine(i);
|
78
|
+
var m = line.match(re);
|
79
|
+
deleteRange.start.row = i;
|
80
|
+
deleteRange.end.row = i;
|
81
|
+
deleteRange.end.column = m[0].length;
|
82
|
+
doc.replace(deleteRange, m[1]);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
doc.indentRows(startRow, endRow, "//");
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
this.getNextLineIndent = function(state, line, tab) {
|
91
|
+
var indent = this.$getIndent(line);
|
92
|
+
|
93
|
+
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
94
|
+
var tokens = tokenizedLine.tokens;
|
95
|
+
var endState = tokenizedLine.state;
|
96
|
+
|
97
|
+
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
98
|
+
return indent;
|
99
|
+
}
|
100
|
+
|
101
|
+
if (state == "start" || state == "regex_allowed") {
|
102
|
+
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
|
103
|
+
if (match) {
|
104
|
+
indent += tab;
|
105
|
+
}
|
106
|
+
} else if (state == "doc-start") {
|
107
|
+
if (endState == "start" || state == "regex_allowed") {
|
108
|
+
return "";
|
109
|
+
}
|
110
|
+
var match = line.match(/^\s*(\/?)\*/);
|
111
|
+
if (match) {
|
112
|
+
if (match[1]) {
|
113
|
+
indent += " ";
|
114
|
+
}
|
115
|
+
indent += "* ";
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
return indent;
|
120
|
+
};
|
121
|
+
|
122
|
+
this.checkOutdent = function(state, line, input) {
|
123
|
+
return this.$outdent.checkOutdent(line, input);
|
124
|
+
};
|
125
|
+
|
126
|
+
this.autoOutdent = function(state, doc, row) {
|
127
|
+
this.$outdent.autoOutdent(doc, row);
|
128
|
+
};
|
129
|
+
|
130
|
+
this.createWorker = function(session) {
|
131
|
+
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
132
|
+
worker.attachToDocument(session.getDocument());
|
133
|
+
|
134
|
+
worker.on("jslint", function(results) {
|
135
|
+
var errors = [];
|
136
|
+
for (var i=0; i<results.data.length; i++) {
|
137
|
+
var error = results.data[i];
|
138
|
+
if (error)
|
139
|
+
errors.push({
|
140
|
+
row: error.line-1,
|
141
|
+
column: error.character-1,
|
142
|
+
text: error.reason,
|
143
|
+
type: "warning",
|
144
|
+
lint: error
|
145
|
+
});
|
146
|
+
}
|
147
|
+
session.setAnnotations(errors);
|
148
|
+
});
|
149
|
+
|
150
|
+
worker.on("narcissus", function(e) {
|
151
|
+
session.setAnnotations([e.data]);
|
152
|
+
});
|
153
|
+
|
154
|
+
worker.on("terminate", function() {
|
155
|
+
session.clearAnnotations();
|
156
|
+
});
|
157
|
+
|
158
|
+
return worker;
|
159
|
+
};
|
160
|
+
|
161
|
+
}).call(Mode.prototype);
|
162
|
+
|
163
|
+
exports.Mode = Mode;
|
164
|
+
});
|
165
|
+
|
166
|
+
define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/unicode', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
167
|
+
|
168
|
+
|
169
|
+
var oop = require("../lib/oop");
|
170
|
+
var lang = require("../lib/lang");
|
171
|
+
var unicode = require("../unicode");
|
172
|
+
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
173
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
174
|
+
|
175
|
+
var JavaScriptHighlightRules = function() {
|
176
|
+
|
177
|
+
// see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
|
178
|
+
var globals = lang.arrayToMap(
|
179
|
+
// Constructors
|
180
|
+
("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" +
|
181
|
+
// E4X
|
182
|
+
"Namespace|QName|XML|XMLList|" +
|
183
|
+
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
|
184
|
+
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
|
185
|
+
// Errors
|
186
|
+
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
|
187
|
+
"SyntaxError|TypeError|URIError|" +
|
188
|
+
// Non-constructor functions
|
189
|
+
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" +
|
190
|
+
"isNaN|parseFloat|parseInt|" +
|
191
|
+
// Other
|
192
|
+
"JSON|Math|" +
|
193
|
+
// Pseudo
|
194
|
+
"this|arguments|prototype|window|document"
|
195
|
+
).split("|")
|
196
|
+
);
|
197
|
+
|
198
|
+
var keywords = lang.arrayToMap(
|
199
|
+
("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
|
200
|
+
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" +
|
201
|
+
"const|yield|import|get|set").split("|")
|
202
|
+
);
|
203
|
+
|
204
|
+
// keywords which can be followed by regular expressions
|
205
|
+
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";
|
206
|
+
|
207
|
+
var deprecated = lang.arrayToMap(
|
208
|
+
("__parent__|__count__|escape|unescape|with|__proto__").split("|")
|
209
|
+
);
|
210
|
+
|
211
|
+
var definitions = lang.arrayToMap(("const|let|var|function").split("|"));
|
212
|
+
|
213
|
+
var buildinConstants = lang.arrayToMap(
|
214
|
+
("null|Infinity|NaN|undefined").split("|")
|
215
|
+
);
|
216
|
+
|
217
|
+
var futureReserved = lang.arrayToMap(
|
218
|
+
("class|enum|extends|super|export|implements|private|" +
|
219
|
+
"public|interface|package|protected|static").split("|")
|
220
|
+
);
|
221
|
+
|
222
|
+
// TODO: Unicode escape sequences
|
223
|
+
var identifierRe = "[" + unicode.packages.L + "\\$_]["
|
224
|
+
+ unicode.packages.L
|
225
|
+
+ unicode.packages.Mn + unicode.packages.Mc
|
226
|
+
+ unicode.packages.Nd
|
227
|
+
+ unicode.packages.Pc + "\\$_]*\\b";
|
228
|
+
|
229
|
+
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
|
230
|
+
"u[0-9a-fA-F]{4}|" + // unicode
|
231
|
+
"[0-2][0-7]{0,2}|" + // oct
|
232
|
+
"3[0-6][0-7]?|" + // oct
|
233
|
+
"37[0-7]?|" + // oct
|
234
|
+
"[4-7][0-7]?|" + //oct
|
235
|
+
".)";
|
236
|
+
|
237
|
+
// regexp must not have capturing parentheses. Use (?:) instead.
|
238
|
+
// regexps are ordered -> the first match is used
|
239
|
+
|
240
|
+
this.$rules = {
|
241
|
+
"start" : [
|
242
|
+
{
|
243
|
+
token : "comment",
|
244
|
+
regex : /\/\/.*$/
|
245
|
+
},
|
246
|
+
DocCommentHighlightRules.getStartRule("doc-start"),
|
247
|
+
{
|
248
|
+
token : "comment", // multi line comment
|
249
|
+
merge : true,
|
250
|
+
regex : /\/\*/,
|
251
|
+
next : "comment"
|
252
|
+
}, {
|
253
|
+
token : "string",
|
254
|
+
regex : "'(?=.)",
|
255
|
+
next : "qstring"
|
256
|
+
}, {
|
257
|
+
token : "string",
|
258
|
+
regex : '"(?=.)',
|
259
|
+
next : "qqstring"
|
260
|
+
}, {
|
261
|
+
token : "constant.numeric", // hex
|
262
|
+
regex : /0[xX][0-9a-fA-F]+\b/
|
263
|
+
}, {
|
264
|
+
token : "constant.numeric", // float
|
265
|
+
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
266
|
+
}, { // match stuff like: Sound.prototype.play = function() { }
|
267
|
+
token : [
|
268
|
+
"storage.type",
|
269
|
+
"punctuation.operator",
|
270
|
+
"support.function",
|
271
|
+
"punctuation.operator",
|
272
|
+
"entity.name.function",
|
273
|
+
"text",
|
274
|
+
"keyword.operator",
|
275
|
+
"text",
|
276
|
+
"storage.type",
|
277
|
+
"text",
|
278
|
+
"paren.lparen"
|
279
|
+
],
|
280
|
+
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
281
|
+
next: "function_arguments"
|
282
|
+
}, { // match stuff like: Sound.prototype.play = myfunc
|
283
|
+
token : [
|
284
|
+
"storage.type",
|
285
|
+
"punctuation.operator",
|
286
|
+
"support.function",
|
287
|
+
"punctuation.operator",
|
288
|
+
"entity.name.function",
|
289
|
+
"text",
|
290
|
+
"keyword.operator",
|
291
|
+
"text"
|
292
|
+
],
|
293
|
+
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
294
|
+
next: "function_arguments"
|
295
|
+
}, { // match stuff like: Sound.play = function() { }
|
296
|
+
token : [
|
297
|
+
"storage.type",
|
298
|
+
"punctuation.operator",
|
299
|
+
"entity.name.function",
|
300
|
+
"text",
|
301
|
+
"keyword.operator",
|
302
|
+
"text",
|
303
|
+
"storage.type",
|
304
|
+
"text",
|
305
|
+
"paren.lparen"
|
306
|
+
],
|
307
|
+
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
308
|
+
next: "function_arguments"
|
309
|
+
}, { // match stuff like: play = function() { }
|
310
|
+
token : [
|
311
|
+
"entity.name.function",
|
312
|
+
"text",
|
313
|
+
"keyword.operator",
|
314
|
+
"text",
|
315
|
+
"storage.type",
|
316
|
+
"text",
|
317
|
+
"paren.lparen"
|
318
|
+
],
|
319
|
+
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
320
|
+
next: "function_arguments"
|
321
|
+
}, { // match stuff like: Sound.play = function play() { }
|
322
|
+
token : [
|
323
|
+
"storage.type",
|
324
|
+
"punctuation.operator",
|
325
|
+
"entity.name.function",
|
326
|
+
"text",
|
327
|
+
"keyword.operator",
|
328
|
+
"text",
|
329
|
+
"storage.type",
|
330
|
+
"text",
|
331
|
+
"entity.name.function",
|
332
|
+
"text",
|
333
|
+
"paren.lparen"
|
334
|
+
],
|
335
|
+
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
|
336
|
+
next: "function_arguments"
|
337
|
+
}, { // match regular function like: function myFunc(arg) { }
|
338
|
+
token : [
|
339
|
+
"storage.type",
|
340
|
+
"text",
|
341
|
+
"entity.name.function",
|
342
|
+
"text",
|
343
|
+
"paren.lparen"
|
344
|
+
],
|
345
|
+
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
346
|
+
next: "function_arguments"
|
347
|
+
}, { // match stuff like: foobar: function() { }
|
348
|
+
token : [
|
349
|
+
"entity.name.function",
|
350
|
+
"text",
|
351
|
+
"punctuation.operator",
|
352
|
+
"text",
|
353
|
+
"storage.type",
|
354
|
+
"text",
|
355
|
+
"paren.lparen"
|
356
|
+
],
|
357
|
+
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
358
|
+
next: "function_arguments"
|
359
|
+
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
360
|
+
token : [
|
361
|
+
"text",
|
362
|
+
"text",
|
363
|
+
"storage.type",
|
364
|
+
"text",
|
365
|
+
"paren.lparen"
|
366
|
+
],
|
367
|
+
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
368
|
+
next: "function_arguments"
|
369
|
+
}, {
|
370
|
+
token : "constant.language.boolean",
|
371
|
+
regex : /(?:true|false)\b/
|
372
|
+
}, {
|
373
|
+
token : "keyword",
|
374
|
+
regex : "(?:" + kwBeforeRe + ")\\b",
|
375
|
+
next : "regex_allowed"
|
376
|
+
}, {
|
377
|
+
token : ["punctuation.operator", "support.function"],
|
378
|
+
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
379
|
+
}, {
|
380
|
+
token : ["punctuation.operator", "support.function.dom"],
|
381
|
+
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
382
|
+
}, {
|
383
|
+
token : ["punctuation.operator", "support.constant"],
|
384
|
+
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
385
|
+
}, {
|
386
|
+
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
387
|
+
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
388
|
+
}, {
|
389
|
+
token : function(value) {
|
390
|
+
if (globals.hasOwnProperty(value))
|
391
|
+
return "variable.language";
|
392
|
+
else if (deprecated.hasOwnProperty(value))
|
393
|
+
return "invalid.deprecated";
|
394
|
+
else if (definitions.hasOwnProperty(value))
|
395
|
+
return "storage.type";
|
396
|
+
else if (keywords.hasOwnProperty(value))
|
397
|
+
return "keyword";
|
398
|
+
else if (buildinConstants.hasOwnProperty(value))
|
399
|
+
return "constant.language";
|
400
|
+
else if (futureReserved.hasOwnProperty(value))
|
401
|
+
return "invalid.illegal";
|
402
|
+
else if (value == "debugger")
|
403
|
+
return "invalid.deprecated";
|
404
|
+
else
|
405
|
+
return "identifier";
|
406
|
+
},
|
407
|
+
regex : identifierRe
|
408
|
+
}, {
|
409
|
+
token : "keyword.operator",
|
410
|
+
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
411
|
+
next : "regex_allowed"
|
412
|
+
}, {
|
413
|
+
token : "punctuation.operator",
|
414
|
+
regex : /\?|\:|\,|\;|\./,
|
415
|
+
next : "regex_allowed"
|
416
|
+
}, {
|
417
|
+
token : "paren.lparen",
|
418
|
+
regex : /[\[({]/,
|
419
|
+
next : "regex_allowed"
|
420
|
+
}, {
|
421
|
+
token : "paren.rparen",
|
422
|
+
regex : /[\])}]/
|
423
|
+
}, {
|
424
|
+
token : "keyword.operator",
|
425
|
+
regex : /\/=?/,
|
426
|
+
next : "regex_allowed"
|
427
|
+
}, {
|
428
|
+
token: "comment",
|
429
|
+
regex: /^#!.*$/
|
430
|
+
}, {
|
431
|
+
token : "text",
|
432
|
+
regex : /\s+/
|
433
|
+
}
|
434
|
+
],
|
435
|
+
// regular expressions are only allowed after certain tokens. This
|
436
|
+
// makes sure we don't mix up regexps with the divison operator
|
437
|
+
"regex_allowed": [
|
438
|
+
DocCommentHighlightRules.getStartRule("doc-start"),
|
439
|
+
{
|
440
|
+
token : "comment", // multi line comment
|
441
|
+
merge : true,
|
442
|
+
regex : "\\/\\*",
|
443
|
+
next : "comment_regex_allowed"
|
444
|
+
}, {
|
445
|
+
token : "comment",
|
446
|
+
regex : "\\/\\/.*$"
|
447
|
+
}, {
|
448
|
+
token: "string.regexp",
|
449
|
+
regex: "\\/",
|
450
|
+
next: "regex",
|
451
|
+
merge: true
|
452
|
+
}, {
|
453
|
+
token : "text",
|
454
|
+
regex : "\\s+"
|
455
|
+
}, {
|
456
|
+
// immediately return to the start mode without matching
|
457
|
+
// anything
|
458
|
+
token: "empty",
|
459
|
+
regex: "",
|
460
|
+
next: "start"
|
461
|
+
}
|
462
|
+
],
|
463
|
+
"regex": [
|
464
|
+
{
|
465
|
+
token: "regexp.keyword.operator",
|
466
|
+
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
467
|
+
}, {
|
468
|
+
// flag
|
469
|
+
token: "string.regexp",
|
470
|
+
regex: "/\\w*",
|
471
|
+
next: "start",
|
472
|
+
merge: true
|
473
|
+
}, {
|
474
|
+
token: "string.regexp",
|
475
|
+
regex: "[^\\\\/\\[]+",
|
476
|
+
merge: true
|
477
|
+
}, {
|
478
|
+
token: "string.regexp.charachterclass",
|
479
|
+
regex: "\\[",
|
480
|
+
next: "regex_character_class",
|
481
|
+
merge: true
|
482
|
+
}, {
|
483
|
+
token: "empty",
|
484
|
+
regex: "",
|
485
|
+
next: "start"
|
486
|
+
}
|
487
|
+
],
|
488
|
+
"regex_character_class": [
|
489
|
+
{
|
490
|
+
token: "regexp.keyword.operator",
|
491
|
+
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
492
|
+
}, {
|
493
|
+
token: "string.regexp.charachterclass",
|
494
|
+
regex: "]",
|
495
|
+
next: "regex",
|
496
|
+
merge: true
|
497
|
+
}, {
|
498
|
+
token: "string.regexp.charachterclass",
|
499
|
+
regex: "[^\\\\\\]]+",
|
500
|
+
merge: true
|
501
|
+
}, {
|
502
|
+
token: "empty",
|
503
|
+
regex: "",
|
504
|
+
next: "start"
|
505
|
+
}
|
506
|
+
],
|
507
|
+
"function_arguments": [
|
508
|
+
{
|
509
|
+
token: "variable.parameter",
|
510
|
+
regex: identifierRe
|
511
|
+
}, {
|
512
|
+
token: "punctuation.operator",
|
513
|
+
regex: "[, ]+",
|
514
|
+
merge: true
|
515
|
+
}, {
|
516
|
+
token: "punctuation.operator",
|
517
|
+
regex: "$",
|
518
|
+
merge: true
|
519
|
+
}, {
|
520
|
+
token: "empty",
|
521
|
+
regex: "",
|
522
|
+
next: "start"
|
523
|
+
}
|
524
|
+
],
|
525
|
+
"comment_regex_allowed" : [
|
526
|
+
{
|
527
|
+
token : "comment", // closing comment
|
528
|
+
regex : ".*?\\*\\/",
|
529
|
+
merge : true,
|
530
|
+
next : "regex_allowed"
|
531
|
+
}, {
|
532
|
+
token : "comment", // comment spanning whole line
|
533
|
+
merge : true,
|
534
|
+
regex : ".+"
|
535
|
+
}
|
536
|
+
],
|
537
|
+
"comment" : [
|
538
|
+
{
|
539
|
+
token : "comment", // closing comment
|
540
|
+
regex : ".*?\\*\\/",
|
541
|
+
merge : true,
|
542
|
+
next : "start"
|
543
|
+
}, {
|
544
|
+
token : "comment", // comment spanning whole line
|
545
|
+
merge : true,
|
546
|
+
regex : ".+"
|
547
|
+
}
|
548
|
+
],
|
549
|
+
"qqstring" : [
|
550
|
+
{
|
551
|
+
token : "constant.language.escape",
|
552
|
+
regex : escapedRe
|
553
|
+
}, {
|
554
|
+
token : "string",
|
555
|
+
regex : '[^"\\\\]+',
|
556
|
+
merge : true
|
557
|
+
}, {
|
558
|
+
token : "string",
|
559
|
+
regex : "\\\\$",
|
560
|
+
next : "qqstring",
|
561
|
+
merge : true
|
562
|
+
}, {
|
563
|
+
token : "string",
|
564
|
+
regex : '"|$',
|
565
|
+
next : "start",
|
566
|
+
merge : true
|
567
|
+
}
|
568
|
+
],
|
569
|
+
"qstring" : [
|
570
|
+
{
|
571
|
+
token : "constant.language.escape",
|
572
|
+
regex : escapedRe
|
573
|
+
}, {
|
574
|
+
token : "string",
|
575
|
+
regex : "[^'\\\\]+",
|
576
|
+
merge : true
|
577
|
+
}, {
|
578
|
+
token : "string",
|
579
|
+
regex : "\\\\$",
|
580
|
+
next : "qstring",
|
581
|
+
merge : true
|
582
|
+
}, {
|
583
|
+
token : "string",
|
584
|
+
regex : "'|$",
|
585
|
+
next : "start",
|
586
|
+
merge : true
|
587
|
+
}
|
588
|
+
]
|
589
|
+
};
|
590
|
+
|
591
|
+
this.embedRules(DocCommentHighlightRules, "doc-",
|
592
|
+
[ DocCommentHighlightRules.getEndRule("start") ]);
|
593
|
+
};
|
594
|
+
|
595
|
+
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
596
|
+
|
597
|
+
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
|
598
|
+
});
|
599
|
+
|
600
|
+
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
601
|
+
|
602
|
+
|
603
|
+
var oop = require("../lib/oop");
|
604
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
605
|
+
|
606
|
+
var DocCommentHighlightRules = function() {
|
607
|
+
|
608
|
+
this.$rules = {
|
609
|
+
"start" : [ {
|
610
|
+
token : "comment.doc.tag",
|
611
|
+
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
612
|
+
}, {
|
613
|
+
token : "comment.doc",
|
614
|
+
merge : true,
|
615
|
+
regex : "\\s+"
|
616
|
+
}, {
|
617
|
+
token : "comment.doc",
|
618
|
+
merge : true,
|
619
|
+
regex : "TODO"
|
620
|
+
}, {
|
621
|
+
token : "comment.doc",
|
622
|
+
merge : true,
|
623
|
+
regex : "[^@\\*]+"
|
624
|
+
}, {
|
625
|
+
token : "comment.doc",
|
626
|
+
merge : true,
|
627
|
+
regex : "."
|
628
|
+
}]
|
629
|
+
};
|
630
|
+
};
|
631
|
+
|
632
|
+
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
633
|
+
|
634
|
+
DocCommentHighlightRules.getStartRule = function(start) {
|
635
|
+
return {
|
636
|
+
token : "comment.doc", // doc comment
|
637
|
+
merge : true,
|
638
|
+
regex : "\\/\\*(?=\\*)",
|
639
|
+
next : start
|
640
|
+
};
|
641
|
+
};
|
642
|
+
|
643
|
+
DocCommentHighlightRules.getEndRule = function (start) {
|
644
|
+
return {
|
645
|
+
token : "comment.doc", // closing comment
|
646
|
+
merge : true,
|
647
|
+
regex : "\\*\\/",
|
648
|
+
next : start
|
649
|
+
};
|
650
|
+
};
|
651
|
+
|
652
|
+
|
653
|
+
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
654
|
+
|
655
|
+
});
|
656
|
+
|
657
|
+
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
658
|
+
|
659
|
+
|
660
|
+
var Range = require("../range").Range;
|
661
|
+
|
662
|
+
var MatchingBraceOutdent = function() {};
|
663
|
+
|
664
|
+
(function() {
|
665
|
+
|
666
|
+
this.checkOutdent = function(line, input) {
|
667
|
+
if (! /^\s+$/.test(line))
|
668
|
+
return false;
|
669
|
+
|
670
|
+
return /^\s*\}/.test(input);
|
671
|
+
};
|
672
|
+
|
673
|
+
this.autoOutdent = function(doc, row) {
|
674
|
+
var line = doc.getLine(row);
|
675
|
+
var match = line.match(/^(\s*\})/);
|
676
|
+
|
677
|
+
if (!match) return 0;
|
678
|
+
|
679
|
+
var column = match[1].length;
|
680
|
+
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
681
|
+
|
682
|
+
if (!openBracePos || openBracePos.row == row) return 0;
|
683
|
+
|
684
|
+
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
685
|
+
doc.replace(new Range(row, 0, row, column-1), indent);
|
686
|
+
};
|
687
|
+
|
688
|
+
this.$getIndent = function(line) {
|
689
|
+
var match = line.match(/^(\s+)/);
|
690
|
+
if (match) {
|
691
|
+
return match[1];
|
692
|
+
}
|
693
|
+
|
694
|
+
return "";
|
695
|
+
};
|
696
|
+
|
697
|
+
}).call(MatchingBraceOutdent.prototype);
|
698
|
+
|
699
|
+
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
700
|
+
});
|
701
|
+
|
702
|
+
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
|
703
|
+
|
704
|
+
|
705
|
+
var oop = require("../../lib/oop");
|
706
|
+
var Behaviour = require("../behaviour").Behaviour;
|
707
|
+
|
708
|
+
var CstyleBehaviour = function () {
|
709
|
+
|
710
|
+
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
711
|
+
if (text == '{') {
|
712
|
+
var selection = editor.getSelectionRange();
|
713
|
+
var selected = session.doc.getTextRange(selection);
|
714
|
+
if (selected !== "") {
|
715
|
+
return {
|
716
|
+
text: '{' + selected + '}',
|
717
|
+
selection: false
|
718
|
+
};
|
719
|
+
} else {
|
720
|
+
return {
|
721
|
+
text: '{}',
|
722
|
+
selection: [1, 1]
|
723
|
+
};
|
724
|
+
}
|
725
|
+
} else if (text == '}') {
|
726
|
+
var cursor = editor.getCursorPosition();
|
727
|
+
var line = session.doc.getLine(cursor.row);
|
728
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
729
|
+
if (rightChar == '}') {
|
730
|
+
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
731
|
+
if (matching !== null) {
|
732
|
+
return {
|
733
|
+
text: '',
|
734
|
+
selection: [1, 1]
|
735
|
+
};
|
736
|
+
}
|
737
|
+
}
|
738
|
+
} else if (text == "\n") {
|
739
|
+
var cursor = editor.getCursorPosition();
|
740
|
+
var line = session.doc.getLine(cursor.row);
|
741
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
742
|
+
if (rightChar == '}') {
|
743
|
+
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
|
744
|
+
if (!openBracePos)
|
745
|
+
return null;
|
746
|
+
|
747
|
+
var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
|
748
|
+
var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
|
749
|
+
|
750
|
+
return {
|
751
|
+
text: '\n' + indent + '\n' + next_indent,
|
752
|
+
selection: [1, indent.length, 1, indent.length]
|
753
|
+
};
|
754
|
+
}
|
755
|
+
}
|
756
|
+
});
|
757
|
+
|
758
|
+
this.add("braces", "deletion", function (state, action, editor, session, range) {
|
759
|
+
var selected = session.doc.getTextRange(range);
|
760
|
+
if (!range.isMultiLine() && selected == '{') {
|
761
|
+
var line = session.doc.getLine(range.start.row);
|
762
|
+
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
763
|
+
if (rightChar == '}') {
|
764
|
+
range.end.column++;
|
765
|
+
return range;
|
766
|
+
}
|
767
|
+
}
|
768
|
+
});
|
769
|
+
|
770
|
+
this.add("parens", "insertion", function (state, action, editor, session, text) {
|
771
|
+
if (text == '(') {
|
772
|
+
var selection = editor.getSelectionRange();
|
773
|
+
var selected = session.doc.getTextRange(selection);
|
774
|
+
if (selected !== "") {
|
775
|
+
return {
|
776
|
+
text: '(' + selected + ')',
|
777
|
+
selection: false
|
778
|
+
};
|
779
|
+
} else {
|
780
|
+
return {
|
781
|
+
text: '()',
|
782
|
+
selection: [1, 1]
|
783
|
+
};
|
784
|
+
}
|
785
|
+
} else if (text == ')') {
|
786
|
+
var cursor = editor.getCursorPosition();
|
787
|
+
var line = session.doc.getLine(cursor.row);
|
788
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
789
|
+
if (rightChar == ')') {
|
790
|
+
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
791
|
+
if (matching !== null) {
|
792
|
+
return {
|
793
|
+
text: '',
|
794
|
+
selection: [1, 1]
|
795
|
+
};
|
796
|
+
}
|
797
|
+
}
|
798
|
+
}
|
799
|
+
});
|
800
|
+
|
801
|
+
this.add("parens", "deletion", function (state, action, editor, session, range) {
|
802
|
+
var selected = session.doc.getTextRange(range);
|
803
|
+
if (!range.isMultiLine() && selected == '(') {
|
804
|
+
var line = session.doc.getLine(range.start.row);
|
805
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
806
|
+
if (rightChar == ')') {
|
807
|
+
range.end.column++;
|
808
|
+
return range;
|
809
|
+
}
|
810
|
+
}
|
811
|
+
});
|
812
|
+
|
813
|
+
this.add("brackets", "insertion", function (state, action, editor, session, text) {
|
814
|
+
if (text == '[') {
|
815
|
+
var selection = editor.getSelectionRange();
|
816
|
+
var selected = session.doc.getTextRange(selection);
|
817
|
+
if (selected !== "") {
|
818
|
+
return {
|
819
|
+
text: '[' + selected + ']',
|
820
|
+
selection: false
|
821
|
+
};
|
822
|
+
} else {
|
823
|
+
return {
|
824
|
+
text: '[]',
|
825
|
+
selection: [1, 1]
|
826
|
+
};
|
827
|
+
}
|
828
|
+
} else if (text == ']') {
|
829
|
+
var cursor = editor.getCursorPosition();
|
830
|
+
var line = session.doc.getLine(cursor.row);
|
831
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
832
|
+
if (rightChar == ']') {
|
833
|
+
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
834
|
+
if (matching !== null) {
|
835
|
+
return {
|
836
|
+
text: '',
|
837
|
+
selection: [1, 1]
|
838
|
+
};
|
839
|
+
}
|
840
|
+
}
|
841
|
+
}
|
842
|
+
});
|
843
|
+
|
844
|
+
this.add("brackets", "deletion", function (state, action, editor, session, range) {
|
845
|
+
var selected = session.doc.getTextRange(range);
|
846
|
+
if (!range.isMultiLine() && selected == '[') {
|
847
|
+
var line = session.doc.getLine(range.start.row);
|
848
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
849
|
+
if (rightChar == ']') {
|
850
|
+
range.end.column++;
|
851
|
+
return range;
|
852
|
+
}
|
853
|
+
}
|
854
|
+
});
|
855
|
+
|
856
|
+
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
857
|
+
if (text == '"' || text == "'") {
|
858
|
+
var quote = text;
|
859
|
+
var selection = editor.getSelectionRange();
|
860
|
+
var selected = session.doc.getTextRange(selection);
|
861
|
+
if (selected !== "") {
|
862
|
+
return {
|
863
|
+
text: quote + selected + quote,
|
864
|
+
selection: false
|
865
|
+
};
|
866
|
+
} else {
|
867
|
+
var cursor = editor.getCursorPosition();
|
868
|
+
var line = session.doc.getLine(cursor.row);
|
869
|
+
var leftChar = line.substring(cursor.column-1, cursor.column);
|
870
|
+
|
871
|
+
// We're escaped.
|
872
|
+
if (leftChar == '\\') {
|
873
|
+
return null;
|
874
|
+
}
|
875
|
+
|
876
|
+
// Find what token we're inside.
|
877
|
+
var tokens = session.getTokens(selection.start.row);
|
878
|
+
var col = 0, token;
|
879
|
+
var quotepos = -1; // Track whether we're inside an open quote.
|
880
|
+
|
881
|
+
for (var x = 0; x < tokens.length; x++) {
|
882
|
+
token = tokens[x];
|
883
|
+
if (token.type == "string") {
|
884
|
+
quotepos = -1;
|
885
|
+
} else if (quotepos < 0) {
|
886
|
+
quotepos = token.value.indexOf(quote);
|
887
|
+
}
|
888
|
+
if ((token.value.length + col) > selection.start.column) {
|
889
|
+
break;
|
890
|
+
}
|
891
|
+
col += tokens[x].value.length;
|
892
|
+
}
|
893
|
+
|
894
|
+
// Try and be smart about when we auto insert.
|
895
|
+
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
896
|
+
return {
|
897
|
+
text: quote + quote,
|
898
|
+
selection: [1,1]
|
899
|
+
};
|
900
|
+
} else if (token && token.type === "string") {
|
901
|
+
// Ignore input and move right one if we're typing over the closing quote.
|
902
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
903
|
+
if (rightChar == quote) {
|
904
|
+
return {
|
905
|
+
text: '',
|
906
|
+
selection: [1, 1]
|
907
|
+
};
|
908
|
+
}
|
909
|
+
}
|
910
|
+
}
|
911
|
+
}
|
912
|
+
});
|
913
|
+
|
914
|
+
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
915
|
+
var selected = session.doc.getTextRange(range);
|
916
|
+
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
917
|
+
var line = session.doc.getLine(range.start.row);
|
918
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
919
|
+
if (rightChar == '"') {
|
920
|
+
range.end.column++;
|
921
|
+
return range;
|
922
|
+
}
|
923
|
+
}
|
924
|
+
});
|
925
|
+
|
926
|
+
};
|
927
|
+
|
928
|
+
oop.inherits(CstyleBehaviour, Behaviour);
|
929
|
+
|
930
|
+
exports.CstyleBehaviour = CstyleBehaviour;
|
931
|
+
});
|
932
|
+
|
933
|
+
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
934
|
+
|
935
|
+
|
936
|
+
var oop = require("../../lib/oop");
|
937
|
+
var Range = require("../../range").Range;
|
938
|
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
939
|
+
|
940
|
+
var FoldMode = exports.FoldMode = function() {};
|
941
|
+
oop.inherits(FoldMode, BaseFoldMode);
|
942
|
+
|
943
|
+
(function() {
|
944
|
+
|
945
|
+
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
946
|
+
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
947
|
+
|
948
|
+
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
949
|
+
var line = session.getLine(row);
|
950
|
+
var match = line.match(this.foldingStartMarker);
|
951
|
+
if (match) {
|
952
|
+
var i = match.index;
|
953
|
+
|
954
|
+
if (match[1])
|
955
|
+
return this.openingBracketBlock(session, match[1], row, i);
|
956
|
+
|
957
|
+
var range = session.getCommentFoldRange(row, i + match[0].length);
|
958
|
+
range.end.column -= 2;
|
959
|
+
return range;
|
960
|
+
}
|
961
|
+
|
962
|
+
if (foldStyle !== "markbeginend")
|
963
|
+
return;
|
964
|
+
|
965
|
+
var match = line.match(this.foldingStopMarker);
|
966
|
+
if (match) {
|
967
|
+
var i = match.index + match[0].length;
|
968
|
+
|
969
|
+
if (match[2]) {
|
970
|
+
var range = session.getCommentFoldRange(row, i);
|
971
|
+
range.end.column -= 2;
|
972
|
+
return range;
|
973
|
+
}
|
974
|
+
|
975
|
+
var end = {row: row, column: i};
|
976
|
+
var start = session.$findOpeningBracket(match[1], end);
|
977
|
+
|
978
|
+
if (!start)
|
979
|
+
return;
|
980
|
+
|
981
|
+
start.column++;
|
982
|
+
end.column--;
|
983
|
+
|
984
|
+
return Range.fromPoints(start, end);
|
985
|
+
}
|
986
|
+
};
|
987
|
+
|
988
|
+
}).call(FoldMode.prototype);
|
989
|
+
|
990
|
+
});
|
991
|
+
|
992
|
+
define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
993
|
+
|
994
|
+
|
995
|
+
var Range = require("../../range").Range;
|
996
|
+
|
997
|
+
var FoldMode = exports.FoldMode = function() {};
|
998
|
+
|
999
|
+
(function() {
|
1000
|
+
|
1001
|
+
this.foldingStartMarker = null;
|
1002
|
+
this.foldingStopMarker = null;
|
1003
|
+
|
1004
|
+
// must return "" if there's no fold, to enable caching
|
1005
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
1006
|
+
var line = session.getLine(row);
|
1007
|
+
if (this.foldingStartMarker.test(line))
|
1008
|
+
return "start";
|
1009
|
+
if (foldStyle == "markbeginend"
|
1010
|
+
&& this.foldingStopMarker
|
1011
|
+
&& this.foldingStopMarker.test(line))
|
1012
|
+
return "end";
|
1013
|
+
return "";
|
1014
|
+
};
|
1015
|
+
|
1016
|
+
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
1017
|
+
return null;
|
1018
|
+
};
|
1019
|
+
|
1020
|
+
this.indentationBlock = function(session, row, column) {
|
1021
|
+
var re = /\S/;
|
1022
|
+
var line = session.getLine(row);
|
1023
|
+
var startLevel = line.search(re);
|
1024
|
+
if (startLevel == -1)
|
1025
|
+
return;
|
1026
|
+
|
1027
|
+
var startColumn = column || line.length;
|
1028
|
+
var maxRow = session.getLength();
|
1029
|
+
var startRow = row;
|
1030
|
+
var endRow = row;
|
1031
|
+
|
1032
|
+
while (++row < maxRow) {
|
1033
|
+
var level = session.getLine(row).search(re);
|
1034
|
+
|
1035
|
+
if (level == -1)
|
1036
|
+
continue;
|
1037
|
+
|
1038
|
+
if (level <= startLevel)
|
1039
|
+
break;
|
1040
|
+
|
1041
|
+
endRow = row;
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
if (endRow > startRow) {
|
1045
|
+
var endColumn = session.getLine(endRow).length;
|
1046
|
+
return new Range(startRow, startColumn, endRow, endColumn);
|
1047
|
+
}
|
1048
|
+
};
|
1049
|
+
|
1050
|
+
this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
|
1051
|
+
var start = {row: row, column: column + 1};
|
1052
|
+
var end = session.$findClosingBracket(bracket, start, typeRe);
|
1053
|
+
if (!end)
|
1054
|
+
return;
|
1055
|
+
|
1056
|
+
var fw = session.foldWidgets[end.row];
|
1057
|
+
if (fw == null)
|
1058
|
+
fw = this.getFoldWidget(session, end.row);
|
1059
|
+
|
1060
|
+
if (fw == "start" && end.row > start.row) {
|
1061
|
+
end.row --;
|
1062
|
+
end.column = session.getLine(end.row).length;
|
1063
|
+
}
|
1064
|
+
return Range.fromPoints(start, end);
|
1065
|
+
};
|
1066
|
+
|
1067
|
+
}).call(FoldMode.prototype);
|
1068
|
+
|
1069
|
+
});
|