simplifications and different highlight for labels etc.
This commit is contained in:
parent
b4dc4b7694
commit
9fb80fb72c
1 changed files with 18 additions and 23 deletions
|
|
@ -8,21 +8,26 @@ var LatexHighlightRules = function() {
|
|||
|
||||
this.$rules = {
|
||||
"start" : [{
|
||||
token : "keyword",
|
||||
regex : "\\\\(documentclass|usepackage|label)"
|
||||
// A comment. Tex comments start with % and go to
|
||||
// the end of the line
|
||||
token : "comment",
|
||||
regex : "%.*$"
|
||||
},{
|
||||
// Escaped character (including new line)
|
||||
token : "constant.character.escape",
|
||||
regex : "\\\\[^a-zA-Z]"
|
||||
// Documentclass and usepackage
|
||||
token : ["keyword","lparen","variable.parameter","rparen", "lparen","storage.type","rparen"],
|
||||
regex : "(\\\\(?:documentclass|usepackage))(?:(\\[)([^\\]]*)(\\]))?({)(\\w*)(})"
|
||||
},{
|
||||
// A label
|
||||
token : ["keyword","lparen","variable.parameter","rparen"],
|
||||
regex : "(\\\\label)(?:({)([^}]*)(}))?"
|
||||
},{
|
||||
// A block
|
||||
token : "storage.type",
|
||||
regex : "\\\\(:?begin|end)",
|
||||
next : "block"
|
||||
token : ["storage.type", "lparen","variable.parameter","rparen"],
|
||||
regex : "(\\\\(?:begin|end))({)(\\w*)(})"
|
||||
},{
|
||||
// A tex command e.g. \foo
|
||||
token : "storage.type",
|
||||
regex : "\\\\[a-zA-Z\\d]+"
|
||||
regex : "\\\\[a-zA-Z]+"
|
||||
}, {
|
||||
// Curly and square braces
|
||||
token : "lparen",
|
||||
|
|
@ -31,26 +36,16 @@ var LatexHighlightRules = function() {
|
|||
// Curly and square braces
|
||||
token : "rparen",
|
||||
regex : "[\\])}]"
|
||||
}, {
|
||||
// A comment. Tex comments start with % and go to
|
||||
// the end of the line
|
||||
token : "comment",
|
||||
regex : "%.*$"
|
||||
},{
|
||||
// Escaped character (including new line)
|
||||
token : "constant.character.escape",
|
||||
regex : "\\\\[^a-zA-Z]?"
|
||||
},{
|
||||
// An equation
|
||||
token : "string",
|
||||
regex : "\\${1,2}",
|
||||
next : "equation"
|
||||
}],
|
||||
"block" : [{
|
||||
token : ["lparen","variable.parameter","rparen"],
|
||||
regex : "({)([^}\\s]*)(}?)",
|
||||
next : "start"
|
||||
},{
|
||||
token : "",
|
||||
regex : "",
|
||||
next : "start"
|
||||
}],
|
||||
"equation" : [{
|
||||
token : "string",
|
||||
regex : "\\${1,2}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue