scanner: minor cleanup of scanner.v (#7467)
parent
a8447398f5
commit
c11928260d
|
@ -1170,10 +1170,7 @@ fn (mut s Scanner) ident_char() string {
|
||||||
[inline]
|
[inline]
|
||||||
fn (s &Scanner) expect(want string, start_pos int) bool {
|
fn (s &Scanner) expect(want string, start_pos int) bool {
|
||||||
end_pos := start_pos + want.len
|
end_pos := start_pos + want.len
|
||||||
if start_pos < 0 || start_pos >= s.text.len {
|
if start_pos < 0 || end_pos < 0 || start_pos >= s.text.len || end_pos > s.text.len {
|
||||||
return false
|
|
||||||
}
|
|
||||||
if end_pos < 0 || end_pos > s.text.len {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for pos in start_pos .. end_pos {
|
for pos in start_pos .. end_pos {
|
||||||
|
@ -1273,8 +1270,7 @@ pub fn (mut s Scanner) error(msg string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut s Scanner) vet_error(msg string) {
|
fn (mut s Scanner) vet_error(msg string) {
|
||||||
eline := '$s.file_path:$s.line_nr: $msg'
|
s.vet_errors << '$s.file_path:$s.line_nr: $msg'
|
||||||
s.vet_errors << eline
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn verror(s string) {
|
pub fn verror(s string) {
|
||||||
|
|
Loading…
Reference in New Issue