mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
all: byte => u8
This commit is contained in:
parent
b49d873217
commit
d4a0d6f73c
221 changed files with 1365 additions and 1365 deletions
|
@ -104,20 +104,20 @@ fn (c Checker) check_number(num ast.Number) ? {
|
|||
is_float := lit_lower_case.all_before('e').contains('.')
|
||||
has_exponent_notation := lit_lower_case.contains('e')
|
||||
float_decimal_index := lit.index('.') or { -1 }
|
||||
// mut is_first_digit := byte(lit[0]).is_digit()
|
||||
mut ascii := byte(lit[0]).ascii_str()
|
||||
// mut is_first_digit := u8(lit[0]).is_digit()
|
||||
mut ascii := u8(lit[0]).ascii_str()
|
||||
is_sign_prefixed := lit[0] in [`+`, `-`]
|
||||
mut lit_sans_sign := lit
|
||||
if is_sign_prefixed { // +/- ...
|
||||
lit_sans_sign = lit[1..]
|
||||
hex_bin_oct = is_hex_bin_oct_prefixed(lit_sans_sign)
|
||||
if hex_bin_oct {
|
||||
ascii = byte(lit[0]).ascii_str()
|
||||
ascii = u8(lit[0]).ascii_str()
|
||||
return error(@MOD + '.' + @STRUCT + '.' + @FN +
|
||||
' numbers like "$lit" (hex, octal and binary) can not start with `$ascii` in ...${c.excerpt(num.pos)}...')
|
||||
}
|
||||
if lit.len > 1 && lit_sans_sign.starts_with('0') && !lit_sans_sign.starts_with('0.') {
|
||||
ascii = byte(lit_sans_sign[0]).ascii_str()
|
||||
ascii = u8(lit_sans_sign[0]).ascii_str()
|
||||
return error(@MOD + '.' + @STRUCT + '.' + @FN +
|
||||
' numbers like "$lit" can not start with `$ascii` in ...${c.excerpt(num.pos)}...')
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ fn (c Checker) check_number(num ast.Number) ? {
|
|||
}
|
||||
last := lit[lit.len - 1]
|
||||
if last in scanner.digit_extras {
|
||||
ascii = byte(last).ascii_str()
|
||||
ascii = u8(last).ascii_str()
|
||||
return error(@MOD + '.' + @STRUCT + '.' + @FN +
|
||||
' numbers like "$lit" (float) can not end with `$ascii` in ...${c.excerpt(num.pos)}...')
|
||||
}
|
||||
|
@ -215,12 +215,12 @@ fn (c Checker) check_number(num ast.Number) ? {
|
|||
if r !in [`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `.`, `e`, `E`, `-`, `+`,
|
||||
`_`] {
|
||||
return error(@MOD + '.' + @STRUCT + '.' + @FN +
|
||||
' numbers like "$lit" (float) can not contain `${byte(r).ascii_str()}` in ...${c.excerpt(num.pos)}...')
|
||||
' numbers like "$lit" (float) can not contain `${u8(r).ascii_str()}` in ...${c.excerpt(num.pos)}...')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if lit.len > 1 && lit.starts_with('0') && lit[1] !in [`b`, `o`, `x`] {
|
||||
ascii = byte(lit[0]).ascii_str()
|
||||
ascii = u8(lit[0]).ascii_str()
|
||||
return error(@MOD + '.' + @STRUCT + '.' + @FN +
|
||||
' numbers like "$lit" can not start with `$ascii` in ...${c.excerpt(num.pos)}...')
|
||||
}
|
||||
|
@ -425,9 +425,9 @@ fn (c Checker) check_quoted_escapes(q ast.Quoted) ? {
|
|||
if ch == scanner.end_of_text {
|
||||
break
|
||||
}
|
||||
ch_byte := byte(ch)
|
||||
ch_byte := u8(ch)
|
||||
if ch == `\\` {
|
||||
next_ch := byte(s.at())
|
||||
next_ch := u8(s.at())
|
||||
|
||||
if next_ch == `\\` {
|
||||
s.next()
|
||||
|
@ -452,7 +452,7 @@ fn (c Checker) check_quoted_escapes(q ast.Quoted) ? {
|
|||
if !(ch_ == ` ` || ch_ == `\t`) {
|
||||
st := s.state()
|
||||
return error(@MOD + '.' + @STRUCT + '.' + @FN +
|
||||
' invalid character `${byte(ch_).ascii_str()}` after `$escape` at ($st.line_nr,$st.col) in ...${c.excerpt(q.pos)}...')
|
||||
' invalid character `${u8(ch_).ascii_str()}` after `$escape` at ($st.line_nr,$st.col) in ...${c.excerpt(q.pos)}...')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ pub fn (c Checker) check_comment(comment ast.Comment) ? {
|
|||
if ch == scanner.end_of_text {
|
||||
break
|
||||
}
|
||||
ch_byte := byte(ch)
|
||||
ch_byte := u8(ch)
|
||||
// Check for carrige return
|
||||
if ch_byte == 0x0D {
|
||||
st := s.state()
|
||||
|
@ -569,7 +569,7 @@ pub fn (c Checker) check_comment(comment ast.Comment) ? {
|
|||
if util.is_illegal_ascii_control_character(ch_byte) {
|
||||
st := s.state()
|
||||
return error(@MOD + '.' + @STRUCT + '.' + @FN +
|
||||
' control character `$ch_byte.hex()` is not allowed ($st.line_nr,$st.col) "${byte(s.at()).ascii_str()}" near ...${s.excerpt(st.pos, 10)}...')
|
||||
' control character `$ch_byte.hex()` is not allowed ($st.line_nr,$st.col) "${u8(s.at()).ascii_str()}" near ...${s.excerpt(st.pos, 10)}...')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue