latex mode

This commit is contained in:
Fabian Jakobs 2011-09-06 14:47:39 +02:00
commit 5379fa6647
2 changed files with 44 additions and 23 deletions

View file

@ -6,29 +6,28 @@ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightR
var LatexHighlightRules = function()
{
this.$rules = {
"start" : [
{
// A tex command e.g. \foo
token : "keyword",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)",
},
{
// Curly and square braces
token : "keyword",
regex : "[\\{\\}\\]\\[]"
},
{
// Inline math between two $ symbols
token : "string",
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
},
{
// A comment. Tex comments start with % and go to
// the end of the line
token : "comment",
regex : "%.*$"
}
]
"start" : [{
// A tex command e.g. \foo
token : "keyword",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)",
}, {
// Curly and square braces
token : "lparen",
regex : "[[({]"
}, {
// Curly and square braces
token : "rparen",
regex : "[\\])}]"
}, {
// Inline math between two $ symbols
token : "string",
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
}, {
// A comment. Tex comments start with % and go to
// the end of the line
token : "comment",
regex : "%.*$"
}]
};
};