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

toml: update value_opt syntax and add missing documentation (#16510)

This commit is contained in:
Subhomoy Haldar
2022-11-22 17:45:12 +00:00
committed by GitHub
parent 7c7ebd648d
commit f7a11b8e50
9 changed files with 18 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
// that can be found in the LICENSE file.
module util
// is_key_char returns true if the given u8 is a valid key character.
[inline]
pub fn is_key_char(c u8) bool {
return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) // || c == `_` || c == `-` <- these are identified when tokenizing
@@ -21,6 +22,8 @@ pub fn is_illegal_ascii_control_character(byte_char u8) bool {
return byte_char != 0x09 && is_ascii_control_character(byte_char)
}
// printdbg is a utility function for displaying a key:pair error message
// when `-d trace_toml` is passed to the compiler.
[if trace_toml ?]
pub fn printdbg(id string, message string) {
eprintln(id + ' ' + message)