mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
scanner: small optimisation of the ident_name hot loop
This commit is contained in:
parent
b86c79329b
commit
3d800b12e8
@ -222,10 +222,11 @@ fn (mut s Scanner) ident_name() string {
|
||||
s.pos++
|
||||
for s.pos < s.text.len {
|
||||
c := s.text[s.pos]
|
||||
if !(util.is_name_char(c) || c.is_digit()) {
|
||||
break
|
||||
if (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) || (c >= `0` && c <= `9`) || c == `_` {
|
||||
s.pos++
|
||||
continue
|
||||
}
|
||||
s.pos++
|
||||
break
|
||||
}
|
||||
name := s.text[start..s.pos]
|
||||
s.pos--
|
||||
|
Loading…
Reference in New Issue
Block a user