diff options
Diffstat (limited to 'lexlua/xml.lua')
| -rw-r--r-- | lexlua/xml.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lexlua/xml.lua b/lexlua/xml.lua index 3acee7d22..5b1e58128 100644 --- a/lexlua/xml.lua +++ b/lexlua/xml.lua @@ -14,7 +14,7 @@ lex:add_rule('whitespace', ws) -- Comments and CDATA. lex:add_rule('comment', token(lexer.COMMENT, lexer.range('<!--', '-->'))) lex:add_rule('cdata', token('cdata', lexer.range('<![CDATA[', ']]>'))) -lex:add_style('cdata', lexer.STYLE_COMMENT) +lex:add_style('cdata', lexer.styles.comment) local alpha = R('az', 'AZ', '\127\255') local word_char = lexer.alnum + S('_-:.??') @@ -24,19 +24,19 @@ local identifier = (alpha + S('_-:.?')) * word_char^0 lex:add_rule('doctype', token('doctype', P('<!DOCTYPE')) * ws * token('doctype', identifier) * (ws * identifier)^-1 * (1 - P('>'))^0 * token('doctype', '>')) -lex:add_style('doctype', lexer.STYLE_COMMENT) +lex:add_style('doctype', lexer.styles.comment) -- Processing instructions. lex:add_rule('proc_insn', token('proc_insn', P('<?') * (1 - P('?>'))^0 * P('?>')^-1)) -lex:add_style('proc_insn', lexer.STYLE_COMMENT) +lex:add_style('proc_insn', lexer.styles.comment) -- Elements. local namespace = token(lexer.OPERATOR, ':') * token('namespace', identifier) lex:add_rule('element', token('element', '<' * P('/')^-1 * identifier) * namespace^-1) -lex:add_style('element', lexer.STYLE_KEYWORD) -lex:add_style('namespace', lexer.STYLE_CLASS) +lex:add_style('element', lexer.styles.keyword) +lex:add_style('namespace', lexer.styles.class) -- Closing tags. lex:add_rule('close_tag', token('element', P('/')^-1 * '>')) @@ -44,7 +44,7 @@ lex:add_rule('close_tag', token('element', P('/')^-1 * '>')) -- Attributes. lex:add_rule('attribute', token('attribute', identifier) * namespace^-1 * #(lexer.space^0 * '=')) -lex:add_style('attribute', lexer.STYLE_TYPE) +lex:add_style('attribute', lexer.styles.type) -- TODO: performance is terrible on large files. local in_tag = P(function(input, index) @@ -72,7 +72,7 @@ lex:add_rule('number', #lexer.digit * lexer.last_char_includes('=') * lex:add_rule('entity', token('entity', '&' * word_match[[ lt gt amp apos quot ]] * ';')) -lex:add_style('entity', lexer.STYLE_OPERATOR) +lex:add_style('entity', lexer.styles.operator) -- Fold Points. local function disambiguate_lt(text, pos, line, s) |
