From 3b8a22c3a9cfe053856af925890cd60e775d497b Mon Sep 17 00:00:00 2001 From: mitchell Date: Fri, 10 Aug 2018 09:04:15 -0400 Subject: lexlua: Updated ConTeXt lexer. --- lexlua/context.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lexlua') 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('%')) -- cgit v1.2.3