Commit 48cef2b1 authored by ThorbenQuast's avatar ThorbenQuast
Browse files

[editor] add "FIXME" and "TODO" syntax highlighting to cpp, py, xml and json mode

parent be447ecd
......@@ -84,13 +84,18 @@ var c_cppHighlightRules = function() {
"NULL|true|false|TRUE|FALSE|nullptr"
);
var customKeywords = (
"FIXME|TODO"
);
var keywordMapper = this.$keywords = this.createKeywordMapper({
"keyword.control" : keywordControls,
"storage.type" : storageType,
"storage.modifier" : storageModifiers,
"keyword.operator" : keywordOperators,
"variable.language": "this",
"constant.language": builtinConstants
"constant.language": builtinConstants,
"invalid.deprecated": customKeywords
}, "identifier");
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
......
......@@ -5,6 +5,14 @@ var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var JsonHighlightRules = function() {
var customKeywords = (
"FIXME|TODO"
);
var keywordMapper = this.createKeywordMapper({
"invalid.deprecated": customKeywords
}, "identifier");
this.$rules = {
"start" : [
{
......@@ -17,6 +25,9 @@ var JsonHighlightRules = function() {
}, {
token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b"
}, {
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
......
define("ace/mode/python_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
"use strict";
......@@ -5,9 +6,8 @@ var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PythonHighlightRules = function() {
var keywords = (
"and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
"and|wuff|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
"finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" +
"raise|return|try|while|with|yield"
);
......@@ -26,11 +26,17 @@ var PythonHighlightRules = function() {
"__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" +
"buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern"
);
var customKeywords = (
"FIXME|TODO"
);
var keywordMapper = this.createKeywordMapper({
"invalid.deprecated": "debugger",
"support.function": builtinFunctions,
"constant.language": builtinConstants,
"keyword": keywords
"keyword": keywords,
"invalid.deprecated": customKeywords
}, "identifier");
var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
......
......@@ -7,6 +7,14 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var XmlHighlightRules = function(normalize) {
var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
var customKeywords = (
"FIXME|TODO"
);
var keywordMapper = this.createKeywordMapper({
"invalid.deprecated": customKeywords
}, "identifier");
this.$rules = {
start : [
{token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
......@@ -17,7 +25,10 @@ var XmlHighlightRules = function(normalize) {
{
token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction",
},
},{
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
},
{token : "comment.xml", regex : "<\\!--", next : "comment"},
{
token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment