highlight escaped characters in strings
This commit is contained in:
parent
7f90df40b2
commit
9bfdcd4104
5 changed files with 27 additions and 16 deletions
|
|
@ -31,6 +31,9 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
if (typeof document == "undefined")
|
||||||
|
return;
|
||||||
|
|
||||||
var XHTML_NS = "http://www.w3.org/1999/xhtml";
|
var XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||||
|
|
||||||
exports.getDocumentHead = function(doc) {
|
exports.getDocumentHead = function(doc) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,9 @@
|
||||||
"start",
|
"start",
|
||||||
["identifier","bio"],
|
["identifier","bio"],
|
||||||
["text"," = "],
|
["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",
|
"start",
|
||||||
["identifier","dob"],
|
["identifier","dob"],
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013, Ajax.org B.V.
|
* Copyright (c) 2013, Ajax.org B.V.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* * Neither the name of Ajax.org B.V. nor the
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* 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
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*
|
*
|
||||||
* Garen J. Torikian
|
* Garen J. Torikian
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
@ -51,7 +51,8 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
// Extra logic goes here.
|
this.lineCommentStart = "#";
|
||||||
|
// Extra logic goes here.
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*
|
*
|
||||||
* Garen J. Torikian
|
* Garen J. Torikian
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
@ -46,10 +46,9 @@ var TomlHighlightRules = function() {
|
||||||
|
|
||||||
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
|
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
|
||||||
|
|
||||||
this.$rules =
|
this.$rules = {
|
||||||
{
|
|
||||||
"start": [
|
"start": [
|
||||||
{
|
{
|
||||||
token: "comment.toml",
|
token: "comment.toml",
|
||||||
regex: /#.*$/
|
regex: /#.*$/
|
||||||
},
|
},
|
||||||
|
|
@ -65,7 +64,7 @@ var TomlHighlightRules = function() {
|
||||||
{
|
{
|
||||||
token : keywordMapper,
|
token : keywordMapper,
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
token : "support.date.toml",
|
token : "support.date.toml",
|
||||||
regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)"
|
regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)"
|
||||||
|
|
@ -80,12 +79,16 @@ var TomlHighlightRules = function() {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "\\\\$",
|
regex : "\\\\$",
|
||||||
next : "qqstring",
|
next : "qqstring",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : '\\\\[0tnr"\\\\]'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '"|$',
|
regex : '"|$',
|
||||||
next : "start",
|
next : "start",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
defaultToken: "string"
|
defaultToken: "string"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012, Ajax.org B.V.
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* * Neither the name of Ajax.org B.V. nor the
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* 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
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
@ -55,7 +55,9 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
// Extra logic goes here.
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
// Extra logic goes here.
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue