[xml] ensure tag name starts with letter
This commit is contained in:
parent
6b88b939c2
commit
3fe1383cdc
1 changed files with 8 additions and 5 deletions
|
|
@ -35,6 +35,9 @@ var oop = require("../lib/oop");
|
||||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
var XmlHighlightRules = function(normalize) {
|
var XmlHighlightRules = function(normalize) {
|
||||||
|
|
||||||
|
var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
|
||||||
|
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
start : [
|
start : [
|
||||||
{token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
|
{token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
|
||||||
|
|
@ -44,7 +47,7 @@ var XmlHighlightRules = function(normalize) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
|
token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
|
||||||
regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "processing_instruction",
|
regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction",
|
||||||
},
|
},
|
||||||
{token : "comment.xml", regex : "<\\!--", next : "comment"},
|
{token : "comment.xml", regex : "<\\!--", next : "comment"},
|
||||||
{
|
{
|
||||||
|
|
@ -60,7 +63,7 @@ var XmlHighlightRules = function(normalize) {
|
||||||
|
|
||||||
xml_decl : [{
|
xml_decl : [{
|
||||||
token : "entity.other.attribute-name.decl-attribute-name.xml",
|
token : "entity.other.attribute-name.decl-attribute-name.xml",
|
||||||
regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
|
regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator.decl-attribute-equals.xml",
|
token : "keyword.operator.decl-attribute-equals.xml",
|
||||||
regex : "="
|
regex : "="
|
||||||
|
|
@ -96,7 +99,7 @@ var XmlHighlightRules = function(normalize) {
|
||||||
next: "pop"
|
next: "pop"
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
|
token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
|
||||||
regex : "(<\\!)([-_a-zA-Z0-9]+)",
|
regex : "(<\\!)(" + tagRegex + ")",
|
||||||
push : [{
|
push : [{
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
|
@ -132,7 +135,7 @@ var XmlHighlightRules = function(normalize) {
|
||||||
|
|
||||||
tag : [{
|
tag : [{
|
||||||
token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
|
token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
|
||||||
regex : "(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
|
regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
|
||||||
next: [
|
next: [
|
||||||
{include : "attributes"},
|
{include : "attributes"},
|
||||||
{token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
|
{token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
|
||||||
|
|
@ -166,7 +169,7 @@ var XmlHighlightRules = function(normalize) {
|
||||||
|
|
||||||
attributes: [{
|
attributes: [{
|
||||||
token : "entity.other.attribute-name.xml",
|
token : "entity.other.attribute-name.xml",
|
||||||
regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
|
regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator.attribute-equals.xml",
|
token : "keyword.operator.attribute-equals.xml",
|
||||||
regex : "="
|
regex : "="
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue