mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
scanner: fix bin/oct/hex without number parts
This commit is contained in:
parent
3c0b73c2d6
commit
794ee6fc9d
@ -147,6 +147,9 @@ fn (s mut Scanner) ident_bin_number() string {
|
||||
}
|
||||
s.pos++
|
||||
}
|
||||
if start_pos + 2 == s.pos {
|
||||
s.error('number part of this binary is not provided')
|
||||
}
|
||||
number := filter_num_sep(s.text.str, start_pos, s.pos)
|
||||
s.pos--
|
||||
return number
|
||||
@ -165,6 +168,9 @@ fn (s mut Scanner) ident_hex_number() string {
|
||||
}
|
||||
s.pos++
|
||||
}
|
||||
if start_pos + 2 == s.pos {
|
||||
s.error('number part of this hexadecimal is not provided')
|
||||
}
|
||||
number := filter_num_sep(s.text.str, start_pos, s.pos)
|
||||
s.pos--
|
||||
return number
|
||||
@ -183,6 +189,9 @@ fn (s mut Scanner) ident_oct_number() string {
|
||||
}
|
||||
s.pos++
|
||||
}
|
||||
if start_pos + 2 == s.pos {
|
||||
s.error('number part of this octal is not provided')
|
||||
}
|
||||
number := filter_num_sep(s.text.str, start_pos, s.pos)
|
||||
s.pos--
|
||||
return number
|
||||
|
@ -143,6 +143,9 @@ fn (s mut Scanner) ident_bin_number() string {
|
||||
}
|
||||
s.pos++
|
||||
}
|
||||
if start_pos + 2 == s.pos {
|
||||
s.error('number part of this binary is not provided')
|
||||
}
|
||||
number := filter_num_sep(s.text.str, start_pos, s.pos)
|
||||
s.pos--
|
||||
return number
|
||||
@ -161,6 +164,9 @@ fn (s mut Scanner) ident_hex_number() string {
|
||||
}
|
||||
s.pos++
|
||||
}
|
||||
if start_pos + 2 == s.pos {
|
||||
s.error('number part of this hexadecimal is not provided')
|
||||
}
|
||||
number := filter_num_sep(s.text.str, start_pos, s.pos)
|
||||
s.pos--
|
||||
return number
|
||||
@ -179,6 +185,9 @@ fn (s mut Scanner) ident_oct_number() string {
|
||||
}
|
||||
s.pos++
|
||||
}
|
||||
if start_pos + 2 == s.pos {
|
||||
s.error('number part of this octal is not provided')
|
||||
}
|
||||
number := filter_num_sep(s.text.str, start_pos, s.pos)
|
||||
s.pos--
|
||||
return number
|
||||
|
Loading…
Reference in New Issue
Block a user