This commit is contained in:
Daniel Felder 2014-08-11 11:57:29 +00:00
commit 917c4da39d

View file

@ -12,19 +12,19 @@ var LatexHighlightRules = function() {
// the end of the line // the end of the line
token : "comment", token : "comment",
regex : "%.*$" regex : "%.*$"
},{ }, {
// Documentclass and usepackage // Documentclass and usepackage
token : ["keyword","lparen","variable.parameter","rparen", "lparen","storage.type","rparen"], token : ["keyword","lparen","variable.parameter","rparen", "lparen","storage.type","rparen"],
regex : "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})" regex : "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})"
},{ }, {
// A label // A label
token : ["keyword","lparen","variable.parameter","rparen"], token : ["keyword","lparen","variable.parameter","rparen"],
regex : "(\\\\label)(?:({)([^}]*)(}))?" regex : "(\\\\label)(?:({)([^}]*)(}))?"
},{ }, {
// A block // A block
token : ["storage.type", "lparen","variable.parameter","rparen"], token : ["storage.type", "lparen","variable.parameter","rparen"],
regex : "(\\\\(?:begin|end))({)(\\w*)(})" regex : "(\\\\(?:begin|end))({)(\\w*)(})"
},{ }, {
// A tex command e.g. \foo // A tex command e.g. \foo
token : "storage.type", token : "storage.type",
regex : "\\\\[a-zA-Z]+" regex : "\\\\[a-zA-Z]+"
@ -36,11 +36,11 @@ var LatexHighlightRules = function() {
// Curly and square braces // Curly and square braces
token : "rparen", token : "rparen",
regex : "[\\])}]" regex : "[\\])}]"
},{ }, {
// Escaped character (including new line) // Escaped character (including new line)
token : "constant.character.escape", token : "constant.character.escape",
regex : "\\\\[^a-zA-Z]?" regex : "\\\\[^a-zA-Z]?"
},{ }, {
// An equation // An equation
token : "string", token : "string",
regex : "\\${1,2}", regex : "\\${1,2}",
@ -49,18 +49,18 @@ var LatexHighlightRules = function() {
"equation" : [{ "equation" : [{
token : "comment", token : "comment",
regex : "%.*$" regex : "%.*$"
},{ }, {
token : "string", token : "string",
regex : "\\${1,2}", regex : "\\${1,2}",
next : "start" next : "start"
},{ }, {
token : "constant.character.escape", token : "constant.character.escape",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)" regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
},{ }, {
token : "error", token : "error",
regex : "^\\s*$", regex : "^\\s*$",
next : "start" next : "start"
},{ }, {
defaultToken : "string" defaultToken : "string"
}] }]