From 329559b74b483576a74d5f87eebf951bd12b9200 Mon Sep 17 00:00:00 2001 From: mitchell Date: Tue, 7 Jul 2020 20:14:11 -0400 Subject: lexlua: Added `lexer.colors` and `lexer.styles` tables for themes and lexers. This allows for a more Lua table-oriented approach to defining and using colors and styles, instead of manually manipulating Scintilla property strings. Themes and lexers are still backwards compatible, as the underlying mechanisms are still in place. --- lexlua/diff.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lexlua/diff.lua') diff --git a/lexlua/diff.lua b/lexlua/diff.lua index 2b3b171f1..c5c6b8738 100644 --- a/lexlua/diff.lua +++ b/lexlua/diff.lua @@ -13,7 +13,7 @@ lex:add_rule('separator', token(lexer.COMMENT, ('---' + P('*')^4 + P('=')^1) * lexer.space^0 * -1)) lex:add_rule('header', token('header', (P('*** ') + '--- ' + '+++ ') * lexer.any^1)) -lex:add_style('header', lexer.STYLE_COMMENT) +lex:add_style('header', lexer.styles.comment) -- Location. lex:add_rule('location', token(lexer.NUMBER, ('@@' + lexer.digit^1 + '****') * @@ -21,11 +21,11 @@ lex:add_rule('location', token(lexer.NUMBER, ('@@' + lexer.digit^1 + '****') * -- Additions, deletions, and changes. lex:add_rule('addition', token('addition', S('>+') * lexer.any^0)) -lex:add_style('addition', 'fore:$(color.green)') +lex:add_style('addition', {fore = lexer.colors.green}) lex:add_rule('deletion', token('deletion', S('<-') * lexer.any^0)) -lex:add_style('deletion', 'fore:$(color.red)') +lex:add_style('deletion', {fore = lexer.colors.red}) lex:add_rule('change', token('change', '!' * lexer.any^0)) -lex:add_style('change', 'fore:$(color.yellow)') +lex:add_style('change', {fore = lexer.colors.yellow}) lex:add_rule('any_line', token(lexer.DEFAULT, lexer.any^1)) -- cgit v1.2.3