From be2b4322cbb398b33ee9641d04463b663c781e1a Mon Sep 17 00:00:00 2001 From: mitchell Date: Wed, 8 Jul 2020 10:18:42 -0400 Subject: lexlua: Convert uses of `lexer.STYLE_*` to `lexer.styles.*`. --- lexlua/html.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lexlua/html.lua') diff --git a/lexlua/html.lua b/lexlua/html.lua index 5ce566750..787566949 100644 --- a/lexlua/html.lua +++ b/lexlua/html.lua @@ -17,7 +17,7 @@ lex:add_rule('comment', token(lexer.COMMENT, lexer.range(''))) -- Doctype. lex:add_rule('doctype', token('doctype', lexer.range(''))) -lex:add_style('doctype', lexer.STYLE_COMMENT) +lex:add_style('doctype', lexer.styles.comment) -- Elements. local single_element = token('single_element', '<' * P('/')^-1 * word_match([[ @@ -39,9 +39,9 @@ local unknown_element = token('unknown_element', '<' * P('/')^-1 * (lexer.alnum + '-')^1) local element = known_element + unknown_element lex:add_rule('element', element) -lex:add_style('single_element', lexer.STYLE_KEYWORD) -lex:add_style('element', lexer.STYLE_KEYWORD) -lex:add_style('unknown_element', lexer.STYLE_KEYWORD .. {italics = true}) +lex:add_style('single_element', lexer.styles.keyword) +lex:add_style('element', lexer.styles.keyword) +lex:add_style('unknown_element', lexer.styles.keyword .. {italics = true}) -- Closing tags. local tag_close = token('element', P('/')^-1 * '>') @@ -64,8 +64,8 @@ local known_attribute = token('attribute', word_match([[ local unknown_attribute = token('unknown_attribute', (lexer.alnum + '-')^1) local attribute = (known_attribute + unknown_attribute) * #(lexer.space^0 * '=') lex:add_rule('attribute', attribute) -lex:add_style('attribute', lexer.STYLE_TYPE) -lex:add_style('unknown_attribute', lexer.STYLE_TYPE .. {italics = true}) +lex:add_style('attribute', lexer.styles.type) +lex:add_style('unknown_attribute', lexer.styles.type .. {italics = true}) -- TODO: performance is terrible on large files. local in_tag = P(function(input, index) @@ -92,7 +92,7 @@ lex:add_rule('number', #lexer.digit * lexer.last_char_includes('=') * -- Entities. lex:add_rule('entity', token('entity', '&' * (lexer.any - lexer.space - ';')^1 * ';')) -lex:add_style('entity', lexer.STYLE_COMMENT) +lex:add_style('entity', lexer.styles.comment) -- Fold points. local function disambiguate_lt(text, pos, line, s) -- cgit v1.2.3