Merge pull request #1369 from nguillaumin/properties-mode
Added .properties files mode
This commit is contained in:
commit
24e09e8056
5 changed files with 149 additions and 0 deletions
|
|
@ -112,6 +112,7 @@ var docs = {
|
|||
"docs/php.php": "PHP",
|
||||
"docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
|
||||
"docs/powershell.ps1": "Powershell",
|
||||
"docs/properties.properties": "Properties",
|
||||
"docs/python.py": "Python",
|
||||
"docs/r.r": "R",
|
||||
"docs/rdoc.Rd": "RDoc",
|
||||
|
|
|
|||
15
demo/kitchen-sink/docs/properties.properties
Normal file
15
demo/kitchen-sink/docs/properties.properties
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# You are reading the ".properties" entry.
|
||||
! The exclamation mark can also mark text as comments.
|
||||
# The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly loaded.
|
||||
website = http\://en.wikipedia.org/
|
||||
language = English
|
||||
# The backslash below tells the application to continue reading
|
||||
# the value onto the next line.
|
||||
message = Welcome to \
|
||||
Wikipedia!
|
||||
# Add spaces to the key
|
||||
key\ with\ spaces = This is the value that could be looked up with the key "key with spaces".
|
||||
# Unicode
|
||||
tab : \u0009
|
||||
empty-key=
|
||||
last.line=value
|
||||
|
|
@ -82,6 +82,7 @@ var modesByName = {
|
|||
pgsql: ["pgSQL" , "pgsql"],
|
||||
php: ["PHP" , "php|phtml"],
|
||||
powershell: ["Powershell" , "ps1"],
|
||||
properties: ["Properties" , "properties"],
|
||||
python: ["Python" , "py"],
|
||||
r: ["R" , "r"],
|
||||
rdoc: ["RDoc" , "Rd"],
|
||||
|
|
|
|||
46
lib/ace/mode/properties.js
Normal file
46
lib/ace/mode/properties.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** 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 PropertiesHighlightRules = require("./properties_highlight_rules").PropertiesHighlightRules;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new PropertiesHighlightRules();
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
86
lib/ace/mode/properties_highlight_rules.js
Normal file
86
lib/ace/mode/properties_highlight_rules.js
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var PropertiesHighlightRules = function() {
|
||||
|
||||
var escapeRe = /\\u[0-9a-fA-F]{4}|\\/;
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : /[!#].*$/
|
||||
}, {
|
||||
// Empty value
|
||||
token : "keyword",
|
||||
regex : /[=:]$/
|
||||
}, {
|
||||
token : "keyword",
|
||||
regex : /[=:]/,
|
||||
next : "value"
|
||||
}, {
|
||||
token : "constant.language.escape",
|
||||
regex : escapeRe,
|
||||
}, {
|
||||
defaultToken: "variable"
|
||||
}
|
||||
],
|
||||
"value" : [
|
||||
{
|
||||
// Multi-line string
|
||||
regex : /\\$/,
|
||||
token : "string",
|
||||
next : "value"
|
||||
}, {
|
||||
regex : /$/,
|
||||
token : "string",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "constant.language.escape",
|
||||
regex : escapeRe
|
||||
}, {
|
||||
defaultToken: "string"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
oop.inherits(PropertiesHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.PropertiesHighlightRules = PropertiesHighlightRules;
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue