scanner: small optimisation of the ident_name hot loop
parent
b86c79329b
commit
3d800b12e8
|
@ -222,10 +222,11 @@ fn (mut s Scanner) ident_name() string {
|
||||||
s.pos++
|
s.pos++
|
||||||
for s.pos < s.text.len {
|
for s.pos < s.text.len {
|
||||||
c := s.text[s.pos]
|
c := s.text[s.pos]
|
||||||
if !(util.is_name_char(c) || c.is_digit()) {
|
if (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) || (c >= `0` && c <= `9`) || c == `_` {
|
||||||
break
|
s.pos++
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
s.pos++
|
break
|
||||||
}
|
}
|
||||||
name := s.text[start..s.pos]
|
name := s.text[start..s.pos]
|
||||||
s.pos--
|
s.pos--
|
||||||
|
|
Loading…
Reference in New Issue