highlight escaped characters in strings

This commit is contained in:
nightwing 2013-02-25 01:52:49 +04:00
commit 9bfdcd4104
5 changed files with 27 additions and 16 deletions

View file

@ -31,6 +31,9 @@
define(function(require, exports, module) {
"use strict";
if (typeof document == "undefined")
return;
var XHTML_NS = "http://www.w3.org/1999/xhtml";
exports.getDocumentHead = function(doc) {

View file

@ -27,7 +27,9 @@
"start",
["identifier","bio"],
["text"," = "],
["string","\"GitHub Cofounder & CEO\\nLikes tater tots and beer.\""]
["string","\"GitHub Cofounder & CEO"],
["constant.language.escape","\\n"],
["string","Likes tater tots and beer.\""]
],[
"start",
["identifier","dob"],

View file

@ -3,7 +3,7 @@
*
* Copyright (c) 2013, 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
@ -14,7 +14,7 @@
* * 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
@ -28,7 +28,7 @@
*
*
* Contributor(s):
*
*
* Garen J. Torikian
*
* ***** END LICENSE BLOCK ***** */
@ -51,7 +51,8 @@ var Mode = function() {
oop.inherits(Mode, TextMode);
(function() {
// Extra logic goes here.
this.lineCommentStart = "#";
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -28,7 +28,7 @@
*
*
* Contributor(s):
*
*
* Garen J. Torikian
*
* ***** END LICENSE BLOCK ***** */
@ -46,10 +46,9 @@ var TomlHighlightRules = function() {
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
this.$rules =
{
this.$rules = {
"start": [
{
{
token: "comment.toml",
regex: /#.*$/
},
@ -65,7 +64,7 @@ var TomlHighlightRules = function() {
{
token : keywordMapper,
regex : identifierRe
},
},
{
token : "support.date.toml",
regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)"
@ -80,12 +79,16 @@ var TomlHighlightRules = function() {
token : "string",
regex : "\\\\$",
next : "qqstring",
},
},
{
token : "constant.language.escape",
regex : '\\\\[0tnr"\\\\]'
},
{
token : "string",
regex : '"|$',
next : "start",
},
},
{
defaultToken: "string"
}

View file

@ -3,7 +3,7 @@
*
* Copyright (c) 2012, 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
@ -14,7 +14,7 @@
* * 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
@ -28,7 +28,7 @@
*
*
* Contributor(s):
*
*
*
*
* ***** END LICENSE BLOCK ***** */
@ -55,7 +55,9 @@ var Mode = function() {
oop.inherits(Mode, TextMode);
(function() {
// Extra logic goes here.
this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;