1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vdoc: HTML highlight generic function as function, not name (#13923)

This commit is contained in:
Nick Treleaven
2022-04-03 21:41:02 +01:00
committed by GitHub
parent 44603f8e59
commit d10135e2c4
4 changed files with 6 additions and 3 deletions

View File

@@ -326,7 +326,8 @@ fn html_highlight(code string, tb &ast.Table) string {
tok_typ = .builtin
} else if next_tok.kind == .lcbr {
tok_typ = .symbol
} else if next_tok.kind == .lpar {
} else if next_tok.kind == .lpar
|| (!tok.lit[0].is_capital() && next_tok.kind == .lt) {
tok_typ = .function
} else {
tok_typ = .name

View File

@@ -206,7 +206,7 @@ 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]
&& prev.kind in [.name, .amp, .rsbr, .key_type, .assign, .dot, .question, .rpar, .key_struct, .key_enum, .pipe, .key_interface]
&& (tok.lit[0].ascii_str().is_upper() || prev_prev.lit in ['C', 'JS']) {
&& (tok.lit[0].is_capital() || prev_prev.lit in ['C', 'JS']) {
tok_typ = .symbol
} else if next_tok.kind in [.lpar, .lt] {
tok_typ = .function
@@ -214,7 +214,7 @@ fn color_highlight(code string, tb &ast.Table) string {
if tok.lit in ['C', 'JS'] {
tok_typ = .prefix
} else {
if tok.lit[0].ascii_str().is_upper() {
if tok.lit[0].is_capital() {
tok_typ = .symbol
} else {
tok_typ = .module_