diff --git a/cmd/tools/vdoc/html.v b/cmd/tools/vdoc/html.v index 4a2e8f4133..efba062bb4 100644 --- a/cmd/tools/vdoc/html.v +++ b/cmd/tools/vdoc/html.v @@ -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 diff --git a/cmd/tools/vdoc/utils.v b/cmd/tools/vdoc/utils.v index 63f5aa0325..08f800abd6 100644 --- a/cmd/tools/vdoc/utils.v +++ b/cmd/tools/vdoc/utils.v @@ -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_ diff --git a/vlib/builtin/int.v b/vlib/builtin/int.v index efd93a47ad..236448bcd1 100644 --- a/vlib/builtin/int.v +++ b/vlib/builtin/int.v @@ -449,6 +449,7 @@ pub fn (nn u64) hex_full() string { } // str returns the contents of `byte` as a zero terminated `string`. +// See also: [`byte.ascii_str`](#byte.ascii_str) // Example: assert byte(111).str() == '111' pub fn (b byte) str() string { return int(b).str_l(7) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 70bbd013dc..c1a8f81ab2 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -1208,6 +1208,7 @@ pub fn (s string) to_upper() string { } // is_upper returns `true` if all characters in the string is uppercase. +// See also: [`byte.is_capital`](#byte.is_capital) // Example: assert 'HELLO V'.is_upper() == true [direct_array_access] pub fn (s string) is_upper() bool {