diff options
| author | Matěj Cepl <mcepl@cepl.eu> | 2023-08-11 01:27:32 +0200 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2024-03-27 06:04:21 -0600 |
| commit | 4c4392d29df777ff702dfe99b4f3c23142976e05 (patch) | |
| tree | 5355324abe18952f7d19d6cfc5dbeb5d6cb72b84 /lua/lexers/mediawiki.lua | |
| parent | 95bf9f59f8a9a37148bdc0787db378d62c7cd032 (diff) | |
| download | vis-4c4392d29df777ff702dfe99b4f3c23142976e05.tar.gz vis-4c4392d29df777ff702dfe99b4f3c23142976e05.tar.xz | |
update lexers to orbitalquark/scintillua@b789dde
Rather than cherry pick patches from after 6.2 we will just grab
everything as is.
Diffstat (limited to 'lua/lexers/mediawiki.lua')
| -rw-r--r-- | lua/lexers/mediawiki.lua | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/lua/lexers/mediawiki.lua b/lua/lexers/mediawiki.lua index f304a7a..8c005a5 100644 --- a/lua/lexers/mediawiki.lua +++ b/lua/lexers/mediawiki.lua @@ -1,4 +1,4 @@ --- Copyright 2006-2022 Mitchell. See LICENSE. +-- Copyright 2006-2024 Mitchell. See LICENSE. -- MediaWiki LPeg lexer. -- Contributed by Alexander Misel. @@ -12,28 +12,22 @@ local lex = lexer.new('mediawiki') lex:add_rule('comment', token(lexer.COMMENT, lexer.range('<!--', '-->'))) -- HTML-like tags -local tag_start = token('tag_start', '<' * P('/')^-1 * lexer.alnum^1 * lexer.space^0) +local tag_start = token(lexer.TAG, '<' * P('/')^-1 * lexer.alnum^1 * lexer.space^0) local dq_str = '"' * ((lexer.any - S('>"\\')) + ('\\' * lexer.any))^0 * '"' -local tag_attr = token('tag_attr', lexer.alpha^1 * lexer.space^0 * +local tag_attr = token(lexer.ATTRIBUTE, lexer.alpha^1 * lexer.space^0 * ('=' * lexer.space^0 * (dq_str + (lexer.any - lexer.space - '>')^0)^-1)^0 * lexer.space^0) -local tag_end = token('tag_end', P('/')^-1 * '>') +local tag_end = token(lexer.TAG, P('/')^-1 * '>') lex:add_rule('tag', tag_start * tag_attr^0 * tag_end) -lex:add_style('tag_start', lexer.styles.keyword) -lex:add_style('tag_attr', lexer.styles.type) -lex:add_style('tag_end', lexer.styles.keyword) -- Link lex:add_rule('link', token(lexer.STRING, S('[]'))) -lex:add_rule('internal_link', B('[[') * token('link_article', (lexer.any - '|' - ']]')^1)) -lex:add_style('link_article', lexer.styles.string .. {underlined = true}) +lex:add_rule('internal_link', B('[[') * token(lexer.LINK, (lexer.any - '|' - ']]')^1)) -- Templates and parser functions. lex:add_rule('template', token(lexer.OPERATOR, S('{}'))) lex:add_rule('parser_func', - B('{{') * token('parser_func', '#' * lexer.alpha^1 + lexer.upper^1 * ':')) -lex:add_rule('template_name', B('{{') * token('template_name', (lexer.any - S('{}|'))^1)) -lex:add_style('parser_func', lexer.styles['function']) -lex:add_style('template_name', lexer.styles.operator .. {underlined = true}) + B('{{') * token(lexer.FUNCTION, '#' * lexer.alpha^1 + lexer.upper^1 * ':')) +lex:add_rule('template_name', B('{{') * token(lexer.LINK, (lexer.any - S('{}|'))^1)) -- Operators. lex:add_rule('operator', token(lexer.OPERATOR, S('-=|#~!'))) @@ -44,4 +38,7 @@ lex:add_rule('behavior_switch', (B(lexer.space) + start_pat) * token('behavior_s '__TOC__ __FORCETOC__ __NOTOC__ __NOEDITSECTION__ __NOCC__ __NOINDEX__')) * #lexer.space) lex:add_style('behavior_switch', lexer.styles.keyword) +lexer.property['scintillua.comment'] = '<!--|-->' +lexer.property['scintillua.angle.braces'] = '1' + return lex |
