1
0
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:
Delyan Angelov 2021-10-29 16:18:34 +03:00
parent b86c79329b
commit 3d800b12e8
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -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--