Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vdoc: fix syntax highlighting for symbols before ! and between (
Browse files Browse the repository at this point in the history
…and `,`
Delta456 committed Nov 15, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 9ee9162 commit 522e83e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/tools/vdoc/utils.v
Original file line number Diff line number Diff line change
@@ -213,10 +213,13 @@ fn color_highlight(code string, tb &ast.Table) string {
} else if
(next_tok.kind in [.lcbr, .rpar, .eof, .comma, .pipe, .name, .rcbr, .assign, .key_pub, .key_mut, .pipe, .comma, .comment, .lt, .lsbr]
&& next_tok.lit !in builtin)
&& (prev.kind in [.name, .amp, .lcbr, .rsbr, .key_type, .assign, .dot, .question, .rpar, .key_struct, .key_enum, .pipe, .key_interface, .comment, .ellipsis]
&& (prev.kind in [.name, .amp, .lcbr, .rsbr, .key_type, .assign, .dot, .not, .question, .rpar, .key_struct, .key_enum, .pipe, .key_interface, .comment, .ellipsis, .comma]
&& prev.lit !in builtin) && ((tok.lit != '' && tok.lit[0].is_capital())
|| prev_prev.lit in ['C', 'JS']) {
tok_typ = .symbol
} else if tok.lit[0].is_capital() && prev.kind == .lpar
&& next_tok.kind == .comma {
tok_typ = .symbol
} else if next_tok.kind == .lpar
|| (!(tok.lit != '' && tok.lit[0].is_capital())
&& next_tok.kind in [.lt, .lsbr] && next_tok.pos == tok.pos + tok.lit.len) {

0 comments on commit 522e83e

Please sign in to comment.