mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: ~500 more byte=>u8
This commit is contained in:
@ -102,7 +102,7 @@ pub mut:
|
||||
pub:
|
||||
pos token.Pos
|
||||
is_multiline bool
|
||||
quote byte
|
||||
quote u8
|
||||
}
|
||||
|
||||
// str returns the `string` representation of the `Quoted` type.
|
||||
|
@ -159,9 +159,8 @@ pub fn decode_quoted_escapes(mut q ast.Quoted) ? {
|
||||
&& u8(s.peek(3)).is_hex_digit() && u8(s.peek(4)).is_hex_digit()
|
||||
|
||||
if is_valid_short {
|
||||
is_valid_long := u8(s.peek(5)).is_hex_digit()
|
||||
&& u8(s.peek(6)).is_hex_digit() && u8(s.peek(7)).is_hex_digit()
|
||||
&& u8(s.peek(8)).is_hex_digit()
|
||||
is_valid_long := u8(s.peek(5)).is_hex_digit() && u8(s.peek(6)).is_hex_digit()
|
||||
&& u8(s.peek(7)).is_hex_digit() && u8(s.peek(8)).is_hex_digit()
|
||||
// If it's a long type Unicode (\UXXXXXXXX) with a maximum of 10 chars: '\' + 'U' + 8 hex characters
|
||||
// we pass in 10 characters from the `u`/`U` which is the longest possible sequence
|
||||
// of 9 chars plus one extra.
|
||||
|
@ -536,7 +536,7 @@ fn (mut s Scanner) extract_multiline_string() ?string {
|
||||
|
||||
// handle_escapes returns any escape character sequence.
|
||||
// For escape sequence validation see `Checker.check_quoted_escapes`.
|
||||
fn (mut s Scanner) handle_escapes(quote byte, is_multiline bool) (string, int) {
|
||||
fn (mut s Scanner) handle_escapes(quote u8, is_multiline bool) (string, int) {
|
||||
c := u8(s.at())
|
||||
mut lit := c.ascii_str()
|
||||
is_literal_string := quote == `'`
|
||||
@ -597,8 +597,7 @@ fn (mut s Scanner) extract_number() ?string {
|
||||
s.col += 2
|
||||
}
|
||||
c = s.at()
|
||||
if !(u8(c).is_hex_digit() || c in scanner.digit_extras)
|
||||
|| (c == `.` && s.is_left_of_assign) {
|
||||
if !(u8(c).is_hex_digit() || c in scanner.digit_extras) || (c == `.` && s.is_left_of_assign) {
|
||||
break
|
||||
}
|
||||
s.pos++
|
||||
|
@ -4,20 +4,20 @@
|
||||
module util
|
||||
|
||||
[inline]
|
||||
pub fn is_key_char(c byte) bool {
|
||||
pub fn is_key_char(c u8) bool {
|
||||
return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) // || c == `_` || c == `-` <- these are identified when tokenizing
|
||||
}
|
||||
|
||||
// is_ascii_control_character returns true if `byte_char` is an ASCII control character.
|
||||
[inline]
|
||||
pub fn is_ascii_control_character(byte_char byte) bool {
|
||||
pub fn is_ascii_control_character(byte_char u8) bool {
|
||||
return (byte_char >= 0 && byte_char <= 0x1f) || byte_char == 0x7f
|
||||
}
|
||||
|
||||
// is_illegal_ascii_control_character returns true if a `byte_char` ASCII control character
|
||||
// is considered "illegal" in TOML .
|
||||
[inline]
|
||||
pub fn is_illegal_ascii_control_character(byte_char byte) bool {
|
||||
pub fn is_illegal_ascii_control_character(byte_char u8) bool {
|
||||
return byte_char != 0x09 && is_ascii_control_character(byte_char)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user