From f79bc8619afad4a236c15659862d49e1c867ea33 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 27 Oct 2021 22:28:10 +0300 Subject: [PATCH] scanner: remove unused .line_ends field --- vlib/v/scanner/scanner.v | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index 5e599090ed..811c8f4a6d 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -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 }