vdoc: don't highlight less than expression as generic function (#13938)

pull/13945/head
Nick Treleaven 2022-04-05 03:58:47 +01:00 committed by GitHub
parent f6b8e1e13f
commit 7d8db1042d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -326,8 +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
|| (!tok.lit[0].is_capital() && next_tok.kind == .lt) {
} else if next_tok.kind == .lpar || (!tok.lit[0].is_capital()
&& next_tok.kind == .lt && next_tok.pos == tok.pos + tok.lit.len) {
tok_typ = .function
} else {
tok_typ = .name

View File

@ -211,7 +211,8 @@ fn color_highlight(code string, tb &ast.Table) string {
&& prev.kind in [.name, .amp, .rsbr, .key_type, .assign, .dot, .question, .rpar, .key_struct, .key_enum, .pipe, .key_interface]
&& (tok.lit[0].is_capital() || prev_prev.lit in ['C', 'JS']) {
tok_typ = .symbol
} else if next_tok.kind in [.lpar, .lt] {
} else if next_tok.kind == .lpar || (!tok.lit[0].is_capital()
&& next_tok.kind == .lt && next_tok.pos == tok.pos + tok.lit.len) {
tok_typ = .function
} else if next_tok.kind == .dot {
if tok.lit in ['C', 'JS'] {