aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lexlua/context.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/lexlua/context.lua b/lexlua/context.lua
index 5b3510671..a6e6eb4ba 100644
--- a/lexlua/context.lua
+++ b/lexlua/context.lua
@@ -27,14 +27,18 @@ lex:add_rule('section', token('section', '\\' * word_match[[
lex:add_style('section', lexer.STYLE_CLASS)
-- Commands.
-lex:add_rule('command', token(lexer.KEYWORD, '\\' *
- (lexer.alpha^1 + S('#$&~_^%{}'))))
+local command = token('command', '\\' * (lexer.alpha^1 *
+ ('\\' * lexer.alpha^0)^-1 +
+ S('#$&~_^%{}\\')))
+lex:add_rule('command', command)
+lex:add_style('command', lexer.STYLE_KEYWORD)
-- Operators.
lex:add_rule('operator', token(lexer.OPERATOR, S('$&#{}[]')))
-- Fold points.
lex:add_fold_point('environment', '\\start', '\\stop')
+lex:add_fold_point('command', '\\begin', '\\end')
lex:add_fold_point(lexer.OPERATOR, '{', '}')
lex:add_fold_point(lexer.COMMENT, '%', lexer.fold_line_comments('%'))