scanner: remove unused .line_ends field

pull/12314/head
Delyan Angelov 2021-10-27 22:28:10 +03:00
parent bc3827ae15
commit f79bc8619a
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 8 additions and 5 deletions

View File

@ -45,10 +45,9 @@ pub mut:
is_print_rel_paths_on_error bool
quote byte // which quote is used to denote current string: ' or "
inter_quote byte
line_ends []int // the positions of source lines ends (i.e. \n signs)
nr_lines int // total number of lines in the source file that were scanned
is_vh bool // Keep newlines
is_fmt bool // Used for v fmt.
nr_lines int // total number of lines in the source file that were scanned
is_vh bool // Keep newlines
is_fmt bool // Used for v fmt.
comments_mode CommentsMode
is_inside_toplvl_statement bool // *only* used in comments_mode: .toplevel_comments, toggled by parser
all_tokens []token.Token // *only* used in comments_mode: .toplevel_comments, contains all tokens
@ -512,6 +511,11 @@ fn (mut s Scanner) ident_number() string {
fn (mut s Scanner) skip_whitespace() {
for s.pos < s.text.len {
c := s.text[s.pos]
if c == 8 {
// tabs are most common
s.pos++
continue
}
if !(c == 32 || (c > 8 && c < 14) || (c == 0x85) || (c == 0xa0)) {
return
}
@ -1354,7 +1358,6 @@ fn (mut s Scanner) inc_line_number() {
s.last_nl_pos++
}
s.line_nr++
s.line_ends << s.pos
if s.line_nr > s.nr_lines {
s.nr_lines = s.line_nr
}