From 9d33a066339469d9ab988b59a91e73c313f0126b Mon Sep 17 00:00:00 2001 From: Meg Sharkey Date: Mon, 12 Mar 2012 15:47:01 -0700 Subject: [PATCH 01/13] added yaml syntax highlighter --- Makefile.dryice.js | 2 +- build/kitchen-sink.html | 2 +- build/src/mode-yaml-noconflict.js | 1 + .../src/mode-yaml-uncompressed-noconflict.js | 261 ++++++++++++++++++ build/src/mode-yaml-uncompressed.js | 261 ++++++++++++++++++ build/src/mode-yaml.js | 1 + build/textarea/src/mode-yaml.js | 261 ++++++++++++++++++ lib/ace/mode/yaml.js | 64 +++++ lib/ace/mode/yaml_highlight_rules.js | 116 ++++++++ 9 files changed, 967 insertions(+), 2 deletions(-) create mode 100644 build/src/mode-yaml-noconflict.js create mode 100644 build/src/mode-yaml-uncompressed-noconflict.js create mode 100644 build/src/mode-yaml-uncompressed.js create mode 100644 build/src/mode-yaml.js create mode 100644 build/textarea/src/mode-yaml.js create mode 100644 lib/ace/mode/yaml.js create mode 100644 lib/ace/mode/yaml_highlight_rules.js diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 650527a5..5bb222ef 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -221,7 +221,7 @@ function buildAce(aceProject, options) { "css", "html", "javascript", "php", "coldfusion", "python", "lua", "xml", "ruby", "java", "c_cpp", "coffee", "perl", "csharp", "haxe", "svg", "clojure", "scss", "json", "groovy", "ocaml", "scala", "textile", "scad", "markdown", "latex", "powershell", "sql", - "text", "pgsql" + "text", "pgsql", "yaml" ], themes: [ "chrome", "clouds", "clouds_midnight", "cobalt", "crimson_editor", "dawn", diff --git a/build/kitchen-sink.html b/build/kitchen-sink.html index 78460423..171907b7 100644 --- a/build/kitchen-sink.html +++ b/build/kitchen-sink.html @@ -11,7 +11,7 @@ Ace version 0.2.0 - commit 903d06c07f9549a84a0e66f51e3be082dfeda54a + commit fcded20cbe9527fc2d980b7e6a563ea44b2f95ce --> diff --git a/build/src/mode-yaml-noconflict.js b/build/src/mode-yaml-noconflict.js new file mode 100644 index 00000000..f888d1c7 --- /dev/null +++ b/build/src/mode-yaml-noconflict.js @@ -0,0 +1 @@ +ace.define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").SqlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),ace.define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|]\\w*",next:"qqstring"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=JsonHighlightRules}),ace.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}) \ No newline at end of file diff --git a/build/src/mode-yaml-uncompressed-noconflict.js b/build/src/mode-yaml-uncompressed-noconflict.js new file mode 100644 index 00000000..a40910ec --- /dev/null +++ b/build/src/mode-yaml-uncompressed-noconflict.js @@ -0,0 +1,261 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* The Original Code is Ajax.org Code Editor (ACE). +* +* Contributor(s): +* Meg Sharkey +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the MPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the MPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** */ + +ace.define('ace/mode/yaml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/yaml_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var YamlHighlightRules = require("./yaml_highlight_rules").SqlHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; + +var Mode = function() { + this.$tokenizer = new Tokenizer(new YamlHighlightRules().getRules()); + this.$outdent = new MatchingBraceOutdent(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + 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); + }; + + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Ajax.org Code Editor (ACE). + * + * The Initial Developer of the Original Code is + * Ajax.org B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Meg Sharkey + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +ace.define('ace/mode/yaml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var YamlHighlightRules = function() { + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + this.$rules = { + "start" : [ + { + token : "comment", + regex : "#.*$" + }, { + token : "comment", + regex : "^---" + }, { + token: "variable", + regex: "[&\\*][a-zA-Z0-9-_]+" + }, { + token: "identifier", + regex: "(\\w+\\s*:)(?:\\w*)" + }, { + token : "keyword.operator", + regex : "<<\\w*:\\w*" + }, { + token : "keyword.operator", + regex : "-\\s*(?=[{])" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // multi line string start + merge : true, + regex : '[\\|]\\w*', + next : "qqstring" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false|yes|no)\\b" + }, { + token : "string", // single quoted string + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "invalid.illegal", // comments are not allowed + regex : "\\/\\/.*$" + }, { + token : "paren.lparen", + regex : "[[({]" + }, { + token : "paren.rparen", + regex : "[\\])}]" + }, { + token : "text", + regex : "\\s+" + } + ], + "qqstring" : [ + { + token : "string", + regex : '(?=(?:(?:\\\\.)|(?:[^:]))*?:)', + next : "start" + }, { + token : "string", + merge : true, + regex : '.+' + } + ]} + +}; + +oop.inherits(YamlHighlightRules, TextHighlightRules); + +exports.YamlHighlightRules = JsonHighlightRules; +}); +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Ajax.org Code Editor (ACE). + * + * The Initial Developer of the Original Code is + * Ajax.org B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +var MatchingBraceOutdent = function() {}; + +(function() { + + this.checkOutdent = function(line, input) { + if (! /^\s+$/.test(line)) + return false; + + return /^\s*\}/.test(input); + }; + + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + + if (!match) return 0; + + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({row: row, column: column}); + + if (!openBracePos || openBracePos.row == row) return 0; + + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column-1), indent); + }; + + this.$getIndent = function(line) { + var match = line.match(/^(\s+)/); + if (match) { + return match[1]; + } + + return ""; + }; + +}).call(MatchingBraceOutdent.prototype); + +exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); diff --git a/build/src/mode-yaml-uncompressed.js b/build/src/mode-yaml-uncompressed.js new file mode 100644 index 00000000..90fe23dc --- /dev/null +++ b/build/src/mode-yaml-uncompressed.js @@ -0,0 +1,261 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* The Original Code is Ajax.org Code Editor (ACE). +* +* Contributor(s): +* Meg Sharkey +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the MPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the MPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** */ + +define('ace/mode/yaml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/yaml_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var YamlHighlightRules = require("./yaml_highlight_rules").SqlHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; + +var Mode = function() { + this.$tokenizer = new Tokenizer(new YamlHighlightRules().getRules()); + this.$outdent = new MatchingBraceOutdent(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + 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); + }; + + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Ajax.org Code Editor (ACE). + * + * The Initial Developer of the Original Code is + * Ajax.org B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Meg Sharkey + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +define('ace/mode/yaml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var YamlHighlightRules = function() { + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + this.$rules = { + "start" : [ + { + token : "comment", + regex : "#.*$" + }, { + token : "comment", + regex : "^---" + }, { + token: "variable", + regex: "[&\\*][a-zA-Z0-9-_]+" + }, { + token: "identifier", + regex: "(\\w+\\s*:)(?:\\w*)" + }, { + token : "keyword.operator", + regex : "<<\\w*:\\w*" + }, { + token : "keyword.operator", + regex : "-\\s*(?=[{])" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // multi line string start + merge : true, + regex : '[\\|]\\w*', + next : "qqstring" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false|yes|no)\\b" + }, { + token : "string", // single quoted string + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "invalid.illegal", // comments are not allowed + regex : "\\/\\/.*$" + }, { + token : "paren.lparen", + regex : "[[({]" + }, { + token : "paren.rparen", + regex : "[\\])}]" + }, { + token : "text", + regex : "\\s+" + } + ], + "qqstring" : [ + { + token : "string", + regex : '(?=(?:(?:\\\\.)|(?:[^:]))*?:)', + next : "start" + }, { + token : "string", + merge : true, + regex : '.+' + } + ]} + +}; + +oop.inherits(YamlHighlightRules, TextHighlightRules); + +exports.YamlHighlightRules = JsonHighlightRules; +}); +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Ajax.org Code Editor (ACE). + * + * The Initial Developer of the Original Code is + * Ajax.org B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +var MatchingBraceOutdent = function() {}; + +(function() { + + this.checkOutdent = function(line, input) { + if (! /^\s+$/.test(line)) + return false; + + return /^\s*\}/.test(input); + }; + + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + + if (!match) return 0; + + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({row: row, column: column}); + + if (!openBracePos || openBracePos.row == row) return 0; + + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column-1), indent); + }; + + this.$getIndent = function(line) { + var match = line.match(/^(\s+)/); + if (match) { + return match[1]; + } + + return ""; + }; + +}).call(MatchingBraceOutdent.prototype); + +exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); diff --git a/build/src/mode-yaml.js b/build/src/mode-yaml.js new file mode 100644 index 00000000..f8ec6a8e --- /dev/null +++ b/build/src/mode-yaml.js @@ -0,0 +1 @@ +define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").SqlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|]\\w*",next:"qqstring"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=JsonHighlightRules}),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}) \ No newline at end of file diff --git a/build/textarea/src/mode-yaml.js b/build/textarea/src/mode-yaml.js new file mode 100644 index 00000000..a454db7b --- /dev/null +++ b/build/textarea/src/mode-yaml.js @@ -0,0 +1,261 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* The Original Code is Ajax.org Code Editor (ACE). +* +* Contributor(s): +* Meg Sharkey +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the MPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the MPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** */ + +__ace_shadowed__.define('ace/mode/yaml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/yaml_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var YamlHighlightRules = require("./yaml_highlight_rules").SqlHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; + +var Mode = function() { + this.$tokenizer = new Tokenizer(new YamlHighlightRules().getRules()); + this.$outdent = new MatchingBraceOutdent(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + 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); + }; + + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Ajax.org Code Editor (ACE). + * + * The Initial Developer of the Original Code is + * Ajax.org B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Meg Sharkey + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +__ace_shadowed__.define('ace/mode/yaml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var YamlHighlightRules = function() { + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + this.$rules = { + "start" : [ + { + token : "comment", + regex : "#.*$" + }, { + token : "comment", + regex : "^---" + }, { + token: "variable", + regex: "[&\\*][a-zA-Z0-9-_]+" + }, { + token: "identifier", + regex: "(\\w+\\s*:)(?:\\w*)" + }, { + token : "keyword.operator", + regex : "<<\\w*:\\w*" + }, { + token : "keyword.operator", + regex : "-\\s*(?=[{])" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // multi line string start + merge : true, + regex : '[\\|]\\w*', + next : "qqstring" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false|yes|no)\\b" + }, { + token : "string", // single quoted string + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "invalid.illegal", // comments are not allowed + regex : "\\/\\/.*$" + }, { + token : "paren.lparen", + regex : "[[({]" + }, { + token : "paren.rparen", + regex : "[\\])}]" + }, { + token : "text", + regex : "\\s+" + } + ], + "qqstring" : [ + { + token : "string", + regex : '(?=(?:(?:\\\\.)|(?:[^:]))*?:)', + next : "start" + }, { + token : "string", + merge : true, + regex : '.+' + } + ]} + +}; + +oop.inherits(YamlHighlightRules, TextHighlightRules); + +exports.YamlHighlightRules = JsonHighlightRules; +}); +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Ajax.org Code Editor (ACE). + * + * The Initial Developer of the Original Code is + * Ajax.org B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Fabian Jakobs + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +__ace_shadowed__.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +var MatchingBraceOutdent = function() {}; + +(function() { + + this.checkOutdent = function(line, input) { + if (! /^\s+$/.test(line)) + return false; + + return /^\s*\}/.test(input); + }; + + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + + if (!match) return 0; + + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({row: row, column: column}); + + if (!openBracePos || openBracePos.row == row) return 0; + + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column-1), indent); + }; + + this.$getIndent = function(line) { + var match = line.match(/^(\s+)/); + if (match) { + return match[1]; + } + + return ""; + }; + +}).call(MatchingBraceOutdent.prototype); + +exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); diff --git a/lib/ace/mode/yaml.js b/lib/ace/mode/yaml.js new file mode 100644 index 00000000..496e7e6d --- /dev/null +++ b/lib/ace/mode/yaml.js @@ -0,0 +1,64 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* The Original Code is Ajax.org Code Editor (ACE). +* +* Contributor(s): +* Meg Sharkey +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the MPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the MPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var YamlHighlightRules = require("./yaml_highlight_rules").SqlHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; + +var Mode = function() { + this.$tokenizer = new Tokenizer(new YamlHighlightRules().getRules()); + this.$outdent = new MatchingBraceOutdent(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + 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); + }; + + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); diff --git a/lib/ace/mode/yaml_highlight_rules.js b/lib/ace/mode/yaml_highlight_rules.js new file mode 100644 index 00000000..35feb24f --- /dev/null +++ b/lib/ace/mode/yaml_highlight_rules.js @@ -0,0 +1,116 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Ajax.org Code Editor (ACE). + * + * The Initial Developer of the Original Code is + * Ajax.org B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Meg Sharkey + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var YamlHighlightRules = function() { + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + this.$rules = { + "start" : [ + { + token : "comment", + regex : "#.*$" + }, { + token : "comment", + regex : "^---" + }, { + token: "variable", + regex: "[&\\*][a-zA-Z0-9-_]+" + }, { + token: "identifier", + regex: "(\\w+\\s*:)(?:\\w*)" + }, { + token : "keyword.operator", + regex : "<<\\w*:\\w*" + }, { + token : "keyword.operator", + regex : "-\\s*(?=[{])" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // multi line string start + merge : true, + regex : '[\\|]\\w*', + next : "qqstring" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false|yes|no)\\b" + }, { + token : "string", // single quoted string + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "invalid.illegal", // comments are not allowed + regex : "\\/\\/.*$" + }, { + token : "paren.lparen", + regex : "[[({]" + }, { + token : "paren.rparen", + regex : "[\\])}]" + }, { + token : "text", + regex : "\\s+" + } + ], + "qqstring" : [ + { + token : "string", + regex : '(?=(?:(?:\\\\.)|(?:[^:]))*?:)', + next : "start" + }, { + token : "string", + merge : true, + regex : '.+' + } + ]} + +}; + +oop.inherits(YamlHighlightRules, TextHighlightRules); + +exports.YamlHighlightRules = JsonHighlightRules; +}); From 889368019e62e852c2dc8080c2eb055bd9f75ee1 Mon Sep 17 00:00:00 2001 From: Meg Sharkey Date: Mon, 12 Mar 2012 15:53:00 -0700 Subject: [PATCH 02/13] fixed reference error --- lib/ace/mode/yaml_highlight_rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/yaml_highlight_rules.js b/lib/ace/mode/yaml_highlight_rules.js index 35feb24f..ec98d36c 100644 --- a/lib/ace/mode/yaml_highlight_rules.js +++ b/lib/ace/mode/yaml_highlight_rules.js @@ -112,5 +112,5 @@ var YamlHighlightRules = function() { oop.inherits(YamlHighlightRules, TextHighlightRules); -exports.YamlHighlightRules = JsonHighlightRules; +exports.YamlHighlightRules = YamlHighlightRules; }); From 8be362ab54de2e6ff4b9994d8913fc978b6b8da0 Mon Sep 17 00:00:00 2001 From: Meg Sharkey Date: Mon, 12 Mar 2012 16:03:12 -0700 Subject: [PATCH 03/13] fixed reference --- build/kitchen-sink.html | 2 +- build/src/mode-yaml-noconflict.js | 2 +- build/src/mode-yaml-uncompressed-noconflict.js | 4 ++-- build/src/mode-yaml-uncompressed.js | 4 ++-- build/src/mode-yaml.js | 2 +- build/textarea/src/mode-yaml.js | 4 ++-- lib/ace/mode/yaml.js | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/kitchen-sink.html b/build/kitchen-sink.html index 171907b7..4b49cbd7 100644 --- a/build/kitchen-sink.html +++ b/build/kitchen-sink.html @@ -11,7 +11,7 @@ Ace version 0.2.0 - commit fcded20cbe9527fc2d980b7e6a563ea44b2f95ce + commit 889368019e62e852c2dc8080c2eb055bd9f75ee1 --> diff --git a/build/src/mode-yaml-noconflict.js b/build/src/mode-yaml-noconflict.js index f888d1c7..d9aaa611 100644 --- a/build/src/mode-yaml-noconflict.js +++ b/build/src/mode-yaml-noconflict.js @@ -1 +1 @@ -ace.define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").SqlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),ace.define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|]\\w*",next:"qqstring"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=JsonHighlightRules}),ace.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}) \ No newline at end of file +ace.define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").YamlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),ace.define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|]\\w*",next:"qqstring"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=f}),ace.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}) \ No newline at end of file diff --git a/build/src/mode-yaml-uncompressed-noconflict.js b/build/src/mode-yaml-uncompressed-noconflict.js index a40910ec..fa412f8d 100644 --- a/build/src/mode-yaml-uncompressed-noconflict.js +++ b/build/src/mode-yaml-uncompressed-noconflict.js @@ -24,7 +24,7 @@ ace.define('ace/mode/yaml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ac var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var Tokenizer = require("../tokenizer").Tokenizer; -var YamlHighlightRules = require("./yaml_highlight_rules").SqlHighlightRules; +var YamlHighlightRules = require("./yaml_highlight_rules").YamlHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { @@ -176,7 +176,7 @@ var YamlHighlightRules = function() { oop.inherits(YamlHighlightRules, TextHighlightRules); -exports.YamlHighlightRules = JsonHighlightRules; +exports.YamlHighlightRules = YamlHighlightRules; }); /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 diff --git a/build/src/mode-yaml-uncompressed.js b/build/src/mode-yaml-uncompressed.js index 90fe23dc..c284fb19 100644 --- a/build/src/mode-yaml-uncompressed.js +++ b/build/src/mode-yaml-uncompressed.js @@ -24,7 +24,7 @@ define('ace/mode/yaml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mo var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var Tokenizer = require("../tokenizer").Tokenizer; -var YamlHighlightRules = require("./yaml_highlight_rules").SqlHighlightRules; +var YamlHighlightRules = require("./yaml_highlight_rules").YamlHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { @@ -176,7 +176,7 @@ var YamlHighlightRules = function() { oop.inherits(YamlHighlightRules, TextHighlightRules); -exports.YamlHighlightRules = JsonHighlightRules; +exports.YamlHighlightRules = YamlHighlightRules; }); /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 diff --git a/build/src/mode-yaml.js b/build/src/mode-yaml.js index f8ec6a8e..224bfc17 100644 --- a/build/src/mode-yaml.js +++ b/build/src/mode-yaml.js @@ -1 +1 @@ -define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").SqlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|]\\w*",next:"qqstring"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=JsonHighlightRules}),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}) \ No newline at end of file +define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").YamlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|]\\w*",next:"qqstring"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=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}) \ No newline at end of file diff --git a/build/textarea/src/mode-yaml.js b/build/textarea/src/mode-yaml.js index a454db7b..b6dbceaf 100644 --- a/build/textarea/src/mode-yaml.js +++ b/build/textarea/src/mode-yaml.js @@ -24,7 +24,7 @@ __ace_shadowed__.define('ace/mode/yaml', ['require', 'exports', 'module' , 'ace/ var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var Tokenizer = require("../tokenizer").Tokenizer; -var YamlHighlightRules = require("./yaml_highlight_rules").SqlHighlightRules; +var YamlHighlightRules = require("./yaml_highlight_rules").YamlHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { @@ -176,7 +176,7 @@ var YamlHighlightRules = function() { oop.inherits(YamlHighlightRules, TextHighlightRules); -exports.YamlHighlightRules = JsonHighlightRules; +exports.YamlHighlightRules = YamlHighlightRules; }); /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 diff --git a/lib/ace/mode/yaml.js b/lib/ace/mode/yaml.js index 496e7e6d..a252308e 100644 --- a/lib/ace/mode/yaml.js +++ b/lib/ace/mode/yaml.js @@ -24,7 +24,7 @@ define(function(require, exports, module) { var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var Tokenizer = require("../tokenizer").Tokenizer; -var YamlHighlightRules = require("./yaml_highlight_rules").SqlHighlightRules; +var YamlHighlightRules = require("./yaml_highlight_rules").YamlHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { From f684fed674e9fc9c71c8edf17334a3eb79702411 Mon Sep 17 00:00:00 2001 From: Meg Sharkey Date: Mon, 12 Mar 2012 16:39:06 -0700 Subject: [PATCH 04/13] added example for yaml --- .../kitchen-sink/kitchen-sink-uncompressed.js | 226 +++++++++++++++++- build/kitchen-sink.html | 2 +- build/src/mode-yaml-noconflict.js | 2 +- .../src/mode-yaml-uncompressed-noconflict.js | 8 +- build/src/mode-yaml-uncompressed.js | 8 +- build/src/mode-yaml.js | 2 +- build/textarea/src/mode-yaml.js | 8 +- demo/kitchen-sink/demo.js | 7 +- demo/kitchen-sink/docs/yaml.yaml | 35 +++ lib/ace/mode/yaml_highlight_rules.js | 8 +- 10 files changed, 284 insertions(+), 22 deletions(-) create mode 100644 demo/kitchen-sink/docs/yaml.yaml diff --git a/build/demo/kitchen-sink/kitchen-sink-uncompressed.js b/build/demo/kitchen-sink/kitchen-sink-uncompressed.js index e73aa14f..9466866c 100644 --- a/build/demo/kitchen-sink/kitchen-sink-uncompressed.js +++ b/build/demo/kitchen-sink/kitchen-sink-uncompressed.js @@ -244,7 +244,7 @@ exportAce(ACE_NAMESPACE); * ***** END LICENSE BLOCK ***** */ -define('kitchen-sink/demo', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/net', 'ace/lib/event', 'ace/theme/textmate', 'ace/edit_session', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'ace/mode/c_cpp', 'ace/mode/clojure', 'ace/mode/coffee', 'ace/mode/coldfusion', 'ace/mode/csharp', 'ace/mode/css', 'ace/mode/groovy', 'ace/mode/haxe', 'ace/mode/html', 'ace/mode/java', 'ace/mode/javascript', 'ace/mode/json', 'ace/mode/latex', 'ace/mode/lua', 'ace/mode/markdown', 'ace/mode/ocaml', 'ace/mode/perl', 'ace/mode/pgsql', 'ace/mode/php', 'ace/mode/powershell', 'ace/mode/python', 'ace/mode/scala', 'ace/mode/scss', 'ace/mode/ruby', 'ace/mode/sql', 'ace/mode/SVG', 'ace/mode/text', 'ace/mode/textile', 'ace/mode/xml', 'text!kitchen-sink/docs/plaintext.txt', 'text!kitchen-sink/docs/javascript.js', 'text!kitchen-sink/docs/coffeescript.coffee', 'text!kitchen-sink/docs/json.json', 'text!kitchen-sink/docs/css.css', 'text!kitchen-sink/docs/scss.scss', 'text!kitchen-sink/docs/html.html', 'text!kitchen-sink/docs/xml.xml', 'text!kitchen-sink/docs/svg.svg', 'text!kitchen-sink/docs/php.php', 'text!kitchen-sink/docs/coldfusion.cfm', 'text!kitchen-sink/docs/python.py', 'text!kitchen-sink/docs/ruby.rb', 'text!kitchen-sink/docs/perl.pl', 'text!kitchen-sink/docs/ocaml.ml', 'text!kitchen-sink/docs/lua.lua', 'text!kitchen-sink/docs/java.java', 'text!kitchen-sink/docs/clojure.clj', 'text!kitchen-sink/docs/groovy.groovy', 'text!kitchen-sink/docs/scala.scala', 'text!kitchen-sink/docs/csharp.cs', 'text!kitchen-sink/docs/powershell.ps1', 'text!kitchen-sink/docs/cpp.cpp', 'text!kitchen-sink/docs/Haxe.hx', 'text!kitchen-sink/docs/markdown.md', 'text!kitchen-sink/docs/textile.textile', 'text!kitchen-sink/docs/latex.tex', 'text!kitchen-sink/docs/sql.sql', 'text!kitchen-sink/docs/pgsql.pgsql', 'ace/split'], function(require, exports, module) { +define('kitchen-sink/demo', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/net', 'ace/lib/event', 'ace/theme/textmate', 'ace/edit_session', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'ace/mode/c_cpp', 'ace/mode/clojure', 'ace/mode/coffee', 'ace/mode/coldfusion', 'ace/mode/csharp', 'ace/mode/css', 'ace/mode/groovy', 'ace/mode/haxe', 'ace/mode/html', 'ace/mode/java', 'ace/mode/javascript', 'ace/mode/json', 'ace/mode/latex', 'ace/mode/lua', 'ace/mode/markdown', 'ace/mode/ocaml', 'ace/mode/perl', 'ace/mode/pgsql', 'ace/mode/php', 'ace/mode/powershell', 'ace/mode/python', 'ace/mode/scala', 'ace/mode/scss', 'ace/mode/ruby', 'ace/mode/sql', 'ace/mode/SVG', 'ace/mode/text', 'ace/mode/textile', 'ace/mode/xml', 'ace/mode/yaml', 'text!kitchen-sink/docs/plaintext.txt', 'text!kitchen-sink/docs/javascript.js', 'text!kitchen-sink/docs/coffeescript.coffee', 'text!kitchen-sink/docs/json.json', 'text!kitchen-sink/docs/css.css', 'text!kitchen-sink/docs/scss.scss', 'text!kitchen-sink/docs/html.html', 'text!kitchen-sink/docs/xml.xml', 'text!kitchen-sink/docs/yaml.yaml', 'text!kitchen-sink/docs/svg.svg', 'text!kitchen-sink/docs/php.php', 'text!kitchen-sink/docs/coldfusion.cfm', 'text!kitchen-sink/docs/python.py', 'text!kitchen-sink/docs/ruby.rb', 'text!kitchen-sink/docs/perl.pl', 'text!kitchen-sink/docs/ocaml.ml', 'text!kitchen-sink/docs/lua.lua', 'text!kitchen-sink/docs/java.java', 'text!kitchen-sink/docs/clojure.clj', 'text!kitchen-sink/docs/groovy.groovy', 'text!kitchen-sink/docs/scala.scala', 'text!kitchen-sink/docs/csharp.cs', 'text!kitchen-sink/docs/powershell.ps1', 'text!kitchen-sink/docs/cpp.cpp', 'text!kitchen-sink/docs/Haxe.hx', 'text!kitchen-sink/docs/markdown.md', 'text!kitchen-sink/docs/textile.textile', 'text!kitchen-sink/docs/latex.tex', 'text!kitchen-sink/docs/sql.sql', 'text!kitchen-sink/docs/pgsql.pgsql', 'ace/split'], function(require, exports, module) { require("ace/lib/fixoldbrowsers"); var env = {}; @@ -331,7 +331,8 @@ var modes = [ new Mode("svg", "SVG", require("ace/mode/SVG").Mode, ["svg"]), new Mode("text", "Text", require("ace/mode/text").Mode, ["txt"]), new Mode("textile", "Textile", require("ace/mode/textile").Mode, ["textile"]), - new Mode("xml", "XML", require("ace/mode/xml").Mode, ["xml"]) + new Mode("xml", "XML", require("ace/mode/xml").Mode, ["xml"]), + new Mode("yaml", "YAML", require("ace/mode/yaml").Mode, ["yaml"]) ]; modesByName = {}; @@ -374,6 +375,10 @@ var docs = [ "xml", "XML", require("text!./docs/xml.xml") ), + new Doc( + "yaml", "YAML", + require("text!./docs/yaml.yaml") + ), new Doc( "svg", "SVG", require("text!./docs/svg.svg") @@ -19987,6 +19992,186 @@ oop.inherits(TextileHighlightRules, TextHighlightRules); exports.TextileHighlightRules = TextileHighlightRules; +}); +/* ***** BEGIN LICENSE BLOCK ***** +* The Original Code is Ajax.org Code Editor (ACE). +* +* Contributor(s): +* Meg Sharkey +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the MPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the MPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** */ + +define('ace/mode/yaml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/yaml_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var YamlHighlightRules = require("./yaml_highlight_rules").YamlHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; + +var Mode = function() { + this.$tokenizer = new Tokenizer(new YamlHighlightRules().getRules()); + this.$outdent = new MatchingBraceOutdent(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + 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); + }; + + +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Ajax.org Code Editor (ACE). + * + * The Initial Developer of the Original Code is + * Ajax.org B.V. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Meg Sharkey + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +define('ace/mode/yaml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var YamlHighlightRules = function() { + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + this.$rules = { + "start" : [ + { + token : "comment", + regex : "#.*$" + }, { + token : "comment", + regex : "^---" + }, { + token: "variable", + regex: "[&\\*][a-zA-Z0-9-_]+" + }, { + token: "identifier", + regex: "(\\w+\\s*:)(?:\\w*)" + }, { + token : "keyword.operator", + regex : "<<\\w*:\\w*" + }, { + token : "keyword.operator", + regex : "-\\s*(?=[{])" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // multi line string start + merge : true, + regex : '[\\|>]\\w*', + next : "qqstring" + }, { + token : "string", // single quoted string + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false|yes|no)\\b" + }, { + token : "invalid.illegal", // comments are not allowed + regex : "\\/\\/.*$" + }, { + token : "paren.lparen", + regex : "[[({]" + }, { + token : "paren.rparen", + regex : "[\\])}]" + }, { + token : "text", + regex : "\\s+" + } + ], + "qqstring" : [ + { + token : "string", + regex : '(?=(?:(?:\\\\.)|(?:[^:]))*?:)', + next : "start" + }, { + token : "string", + merge : true, + regex : '.+' + } + ]} + +}; + +oop.inherits(YamlHighlightRules, TextHighlightRules); + +exports.YamlHighlightRules = YamlHighlightRules; }); define("text!kitchen-sink/docs/plaintext.txt", [], "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\n" + "\n" + @@ -20219,6 +20404,43 @@ define("text!kitchen-sink/docs/xml.xml", [], "\n" + ""); +define("text!kitchen-sink/docs/yaml.yaml", [], "# This sample document was taken from wikipedia:\n" + + "# http://en.wikipedia.org/wiki/YAML#Sample_document\n" + + "---\n" + + "receipt: Oz-Ware Purchase Invoice\n" + + "date: 2007-08-06\n" + + "customer:\n" + + " given: Dorothy\n" + + " family: Gale\n" + + "\n" + + "items:\n" + + " - part_no: 'A4786'\n" + + " descrip: Water Bucket (Filled)\n" + + " price: 1.47\n" + + " quantity: 4\n" + + "\n" + + " - part_no: 'E1628'\n" + + " descrip: High Heeled \"Ruby\" Slippers\n" + + " size: 8\n" + + " price: 100.27\n" + + " quantity: 1\n" + + "\n" + + "bill-to: &id001\n" + + " street: |\n" + + " 123 Tornado Alley\n" + + " Suite 16\n" + + " city: East Centerville\n" + + " state: KS\n" + + "\n" + + "ship-to: *id001\n" + + "\n" + + "specialDelivery: >\n" + + " Follow the Yellow Brick\n" + + " Road to the Emerald City.\n" + + " Pay no attention to the\n" + + " man behind the curtain.\n" + + ""); + define("text!kitchen-sink/docs/svg.svg", [], " diff --git a/build/src/mode-yaml-noconflict.js b/build/src/mode-yaml-noconflict.js index d9aaa611..93e5139d 100644 --- a/build/src/mode-yaml-noconflict.js +++ b/build/src/mode-yaml-noconflict.js @@ -1 +1 @@ -ace.define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").YamlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),ace.define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|]\\w*",next:"qqstring"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=f}),ace.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}) \ No newline at end of file +ace.define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").YamlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),ace.define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|>]\\w*",next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=f}),ace.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}) \ No newline at end of file diff --git a/build/src/mode-yaml-uncompressed-noconflict.js b/build/src/mode-yaml-uncompressed-noconflict.js index fa412f8d..354ff49d 100644 --- a/build/src/mode-yaml-uncompressed-noconflict.js +++ b/build/src/mode-yaml-uncompressed-noconflict.js @@ -135,8 +135,11 @@ var YamlHighlightRules = function() { }, { token : "string", // multi line string start merge : true, - regex : '[\\|]\\w*', + regex : '[\\|>]\\w*', next : "qqstring" + }, { + token : "string", // single quoted string + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" @@ -144,9 +147,6 @@ var YamlHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false|yes|no)\\b" }, { - token : "string", // single quoted string - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { token : "invalid.illegal", // comments are not allowed regex : "\\/\\/.*$" }, { diff --git a/build/src/mode-yaml-uncompressed.js b/build/src/mode-yaml-uncompressed.js index c284fb19..357d7f0b 100644 --- a/build/src/mode-yaml-uncompressed.js +++ b/build/src/mode-yaml-uncompressed.js @@ -135,8 +135,11 @@ var YamlHighlightRules = function() { }, { token : "string", // multi line string start merge : true, - regex : '[\\|]\\w*', + regex : '[\\|>]\\w*', next : "qqstring" + }, { + token : "string", // single quoted string + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" @@ -144,9 +147,6 @@ var YamlHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false|yes|no)\\b" }, { - token : "string", // single quoted string - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { token : "invalid.illegal", // comments are not allowed regex : "\\/\\/.*$" }, { diff --git a/build/src/mode-yaml.js b/build/src/mode-yaml.js index 224bfc17..7ce90502 100644 --- a/build/src/mode-yaml.js +++ b/build/src/mode-yaml.js @@ -1 +1 @@ -define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").YamlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|]\\w*",next:"qqstring"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=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}) \ No newline at end of file +define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./yaml_highlight_rules").YamlHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);if(a=="start"){var e=b.match(/^.*[\{\(\[]\s*$/);e&&(d+=c)}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)}}.call(i.prototype),b.Mode=i}),define("ace/mode/yaml_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",regex:"#.*$"},{token:"comment",regex:"^---"},{token:"variable",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:"identifier",regex:"(\\w+\\s*:)(?:\\w*)"},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:"[\\|>]\\w*",next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false|yes|no)\\b"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:"(?=(?:(?:\\\\.)|(?:[^:]))*?:)",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(f,e),b.YamlHighlightRules=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}) \ No newline at end of file diff --git a/build/textarea/src/mode-yaml.js b/build/textarea/src/mode-yaml.js index b6dbceaf..6438aff7 100644 --- a/build/textarea/src/mode-yaml.js +++ b/build/textarea/src/mode-yaml.js @@ -135,8 +135,11 @@ var YamlHighlightRules = function() { }, { token : "string", // multi line string start merge : true, - regex : '[\\|]\\w*', + regex : '[\\|>]\\w*', next : "qqstring" + }, { + token : "string", // single quoted string + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" @@ -144,9 +147,6 @@ var YamlHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false|yes|no)\\b" }, { - token : "string", // single quoted string - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { token : "invalid.illegal", // comments are not allowed regex : "\\/\\/.*$" }, { diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js index 242b87a4..e3a4a7b7 100644 --- a/demo/kitchen-sink/demo.js +++ b/demo/kitchen-sink/demo.js @@ -125,7 +125,8 @@ var modes = [ new Mode("svg", "SVG", require("ace/mode/SVG").Mode, ["svg"]), new Mode("text", "Text", require("ace/mode/text").Mode, ["txt"]), new Mode("textile", "Textile", require("ace/mode/textile").Mode, ["textile"]), - new Mode("xml", "XML", require("ace/mode/xml").Mode, ["xml"]) + new Mode("xml", "XML", require("ace/mode/xml").Mode, ["xml"]), + new Mode("yaml", "YAML", require("ace/mode/yaml").Mode, ["yaml"]) ]; modesByName = {}; @@ -168,6 +169,10 @@ var docs = [ "xml", "XML", require("ace/requirejs/text!./docs/xml.xml") ), + new Doc( + "yaml", "YAML", + require("ace/requirejs/text!./docs/yaml.yaml") + ), new Doc( "svg", "SVG", require("ace/requirejs/text!./docs/svg.svg") diff --git a/demo/kitchen-sink/docs/yaml.yaml b/demo/kitchen-sink/docs/yaml.yaml new file mode 100644 index 00000000..52ee320e --- /dev/null +++ b/demo/kitchen-sink/docs/yaml.yaml @@ -0,0 +1,35 @@ +# This sample document was taken from wikipedia: +# http://en.wikipedia.org/wiki/YAML#Sample_document +--- +receipt: Oz-Ware Purchase Invoice +date: 2007-08-06 +customer: + given: Dorothy + family: Gale + +items: + - part_no: 'A4786' + descrip: Water Bucket (Filled) + price: 1.47 + quantity: 4 + + - part_no: 'E1628' + descrip: High Heeled "Ruby" Slippers + size: 8 + price: 100.27 + quantity: 1 + +bill-to: &id001 + street: | + 123 Tornado Alley + Suite 16 + city: East Centerville + state: KS + +ship-to: *id001 + +specialDelivery: > + Follow the Yellow Brick + Road to the Emerald City. + Pay no attention to the + man behind the curtain. diff --git a/lib/ace/mode/yaml_highlight_rules.js b/lib/ace/mode/yaml_highlight_rules.js index ec98d36c..72dd0153 100644 --- a/lib/ace/mode/yaml_highlight_rules.js +++ b/lib/ace/mode/yaml_highlight_rules.js @@ -71,8 +71,11 @@ var YamlHighlightRules = function() { }, { token : "string", // multi line string start merge : true, - regex : '[\\|]\\w*', + regex : '[\\|>]\\w*', next : "qqstring" + }, { + token : "string", // single quoted string + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" @@ -80,9 +83,6 @@ var YamlHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false|yes|no)\\b" }, { - token : "string", // single quoted string - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { token : "invalid.illegal", // comments are not allowed regex : "\\/\\/.*$" }, { From 94d62a20f9bf409852c2ff8478bd09a85147e8e5 Mon Sep 17 00:00:00 2001 From: danyaPostfactum Date: Tue, 22 May 2012 04:33:50 +1200 Subject: [PATCH 05/13] Update lib/ace/theme/crimson_editor.js --- lib/ace/theme/crimson_editor.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/ace/theme/crimson_editor.js b/lib/ace/theme/crimson_editor.js index d38f0d5c..c0981537 100644 --- a/lib/ace/theme/crimson_editor.js +++ b/lib/ace/theme/crimson_editor.js @@ -46,7 +46,6 @@ exports.cssText = ".ace-crimson-editor .ace_editor {\ }\ \ .ace-crimson-editor .ace_gutter {\ - width: 50px;\ background: #e8e8e8;\ color: #333;\ overflow : hidden;\ @@ -57,10 +56,6 @@ exports.cssText = ".ace-crimson-editor .ace_editor {\ text-align: right;\ }\ \ -.ace-crimson-editor .ace_gutter-layer .ace_gutter-cell {\ - padding-right: 6px;\ -}\ -\ .ace-crimson-editor .ace_print_margin {\ width: 1px;\ background: #e8e8e8;\ From e140a4185c624552bbb5b5709b77459f62c1cc3b Mon Sep 17 00:00:00 2001 From: danyaPostfactum Date: Tue, 22 May 2012 21:30:58 +1200 Subject: [PATCH 06/13] Delete unnecessary css-rule --- lib/ace/theme/chrome.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/ace/theme/chrome.js b/lib/ace/theme/chrome.js index 60fdf458..ae9f05da 100644 --- a/lib/ace/theme/chrome.js +++ b/lib/ace/theme/chrome.js @@ -52,11 +52,6 @@ exports.cssText = ".ace-chrome .ace_editor {\ overflow : hidden;\ }\ \ -.ace-chrome .ace_gutter-layer {\ - width: 100%;\ - text-align: right;\ -}\ -\ .ace-chrome .ace_print_margin {\ width: 1px;\ background: #e8e8e8;\ From dc710d63cbadb4294c85413aa85cd077522433dd Mon Sep 17 00:00:00 2001 From: danyaPostfactum Date: Tue, 22 May 2012 21:35:48 +1200 Subject: [PATCH 07/13] Fix IE bug (remove width: 100%) --- lib/ace/css/editor.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css index e8eec1e9..af1cecf3 100644 --- a/lib/ace/css/editor.css +++ b/lib/ace/css/editor.css @@ -1,4 +1,3 @@ - .ace_editor { position: absolute; overflow: hidden; @@ -37,8 +36,8 @@ .ace_gutter_active_line { position: absolute; + left: 0; right: 0; - width: 100%; } .ace_scroller.horscroll { From 5efb3cc7298c003a7432aa755bc81e105467cd11 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 22 May 2012 12:35:33 -0700 Subject: [PATCH 08/13] Update GA file --- api/ace.html | 4 +-- api/anchor.html | 4 +-- api/background_tokenizer.html | 4 +-- api/document.html | 4 +-- api/edit_session.html | 4 +-- api/editor.html | 4 +-- api/index.html | 4 +-- api/multi_select.html | 4 +-- api/placeholder.html | 4 +-- api/range.html | 4 +-- api/resources/csses/ace_api.css | 29 +------------------- api/resources/javascripts/ga.js | 2 +- api/resources/javascripts/ux.js | 1 - api/scrollbar.html | 4 +-- api/search.html | 4 +-- api/selection.html | 12 ++++---- api/split.html | 4 +-- api/token_iterator.html | 4 +-- api/tokenizer.html | 4 +-- api/undefined.html | 4 +-- api/undomanager.html | 4 +-- api/virtual_renderer.html | 4 +-- doc/resources/ace/skeleton/csses/ace_api.css | 29 +------------------- doc/resources/ace/skeleton/javascripts/ga.js | 2 +- doc/resources/ace/skeleton/javascripts/ux.js | 1 - doc/resources/ace/templates/layout.jade | 6 +--- doc/resources/ace/templates/lib.jade | 1 - doc/resources/common_layout.jade | 9 +++--- 28 files changed, 52 insertions(+), 112 deletions(-) diff --git a/api/ace.html b/api/ace.html index f917c97b..555ad9ff 100644 --- a/api/ace.html +++ b/api/ace.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/anchor.html b/api/anchor.html index b886f630..4b8d347d 100644 --- a/api/anchor.html +++ b/api/anchor.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/background_tokenizer.html b/api/background_tokenizer.html index 5380ec80..f1d0637c 100644 --- a/api/background_tokenizer.html +++ b/api/background_tokenizer.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/document.html b/api/document.html index ca7de45b..c6a162ee 100644 --- a/api/document.html +++ b/api/document.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/edit_session.html b/api/edit_session.html index e092110a..b5536b53 100644 --- a/api/edit_session.html +++ b/api/edit_session.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/editor.html b/api/editor.html index e2569cc9..c5725498 100644 --- a/api/editor.html +++ b/api/editor.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/index.html b/api/index.html index 6696b726..e1572a3a 100644 --- a/api/index.html +++ b/api/index.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/multi_select.html b/api/multi_select.html index 7d1db650..49be8126 100644 --- a/api/multi_select.html +++ b/api/multi_select.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/placeholder.html b/api/placeholder.html index 00cd688f..661efe05 100644 --- a/api/placeholder.html +++ b/api/placeholder.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/range.html b/api/range.html index 0e1690b9..b00a1b67 100644 --- a/api/range.html +++ b/api/range.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/resources/csses/ace_api.css b/api/resources/csses/ace_api.css index eed01b4e..b703b26b 100644 --- a/api/resources/csses/ace_api.css +++ b/api/resources/csses/ace_api.css @@ -132,28 +132,6 @@ blockquote p{ left: 210px; } -.masthead { - background: #101010 url(../images/dashed_back.png) repeat 0 0; -} -.masthead .container { - /*width: 680px;*/ - padding-left: 285px; - margin: 0 auto; - color: white; -} -.jumbotron { - min-width: 1000px; - padding-top: 40px; - position: relative; -} - -.jumbotron .inner { -/* background: transparent url(../images/header-back.png) top center;*/ - padding: 45px 0; -/* -webkit-box-shadow: inset 0 10px 30px rgba(0,0,0,.3); - -moz-box-shadow: inset 0 10px 30px rgba(0,0,0,.3);*/ -} - .headerTitle { position: relative; top: 100px; @@ -545,10 +523,6 @@ header.filler { margin-left: 30px; } -#mainContent .hero-unit { - background: rgba(255, 255, 255, 0.5); -} - #documentation { padding-bottom: 10px; } @@ -688,6 +662,7 @@ li.signature { .signature-call { cursor: pointer; } + .signature-call a { color: #8e487e; } @@ -777,8 +752,6 @@ li.signature { .table-striped tbody tr:nth-child(even) td, .table-striped tbody tr:nth-child(even) th { background-color: #fbfbfb; } -.table-striped tbody tr:hover td, .table-striped tbody tr:hover th { -} .argument-list { margin-bottom : 13px; diff --git a/api/resources/javascripts/ga.js b/api/resources/javascripts/ga.js index f0035835..e381972d 100644 --- a/api/resources/javascripts/ga.js +++ b/api/resources/javascripts/ga.js @@ -1,5 +1,5 @@ var _gaq = _gaq || []; - _gaq.push(['_setAccount', 'UA-18736001-1']); + _gaq.push(['_setAccount', 'UA-31998201-1']); _gaq.push(['_trackPageview']); (function() { diff --git a/api/resources/javascripts/ux.js b/api/resources/javascripts/ux.js index 49557601..53e6c0fe 100644 --- a/api/resources/javascripts/ux.js +++ b/api/resources/javascripts/ux.js @@ -52,7 +52,6 @@ $(function () { // init prettyprint $('pre > code').addClass('prettyprint'); prettyPrint(); - }); $(document).ready(function () { diff --git a/api/scrollbar.html b/api/scrollbar.html index 75249b08..917b5279 100644 --- a/api/scrollbar.html +++ b/api/scrollbar.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/search.html b/api/search.html index f604715a..80a9656b 100644 --- a/api/search.html +++ b/api/search.html @@ -1,6 +1,6 @@ - - + + diff --git a/api/selection.html b/api/selection.html index 77553b89..1fbd7a4e 100644 --- a/api/selection.html +++ b/api/selection.html @@ -1,6 +1,6 @@ - - + + @@ -112,7 +112,7 @@