scanner: minor cleanup in scanner.v (#14565)
parent
db34adaec8
commit
80cc88427b
|
@ -39,7 +39,6 @@ pub mut:
|
|||
is_enclosed_inter bool
|
||||
line_comment string
|
||||
last_lt int = -1 // position of latest <
|
||||
// prev_tok TokenKind
|
||||
is_started bool
|
||||
is_print_line_on_error bool
|
||||
is_print_colored_error bool
|
||||
|
@ -240,15 +239,15 @@ fn (s Scanner) num_lit(start int, end int) string {
|
|||
unsafe {
|
||||
txt := s.text.str
|
||||
mut b := malloc_noscan(end - start + 1) // add a byte for the endstring 0
|
||||
mut i1 := 0
|
||||
for i := start; i < end; i++ {
|
||||
mut i_no_sep := 0
|
||||
for i in start .. end {
|
||||
if txt[i] != scanner.num_sep {
|
||||
b[i1] = txt[i]
|
||||
i1++
|
||||
b[i_no_sep] = txt[i]
|
||||
i_no_sep++
|
||||
}
|
||||
}
|
||||
b[i1] = 0 // C string compatibility
|
||||
return b.vstring_with_len(i1)
|
||||
b[i_no_sep] = 0 // C string compatibility
|
||||
return b.vstring_with_len(i_no_sep)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1052,6 @@ fn (mut s Scanner) text_scan() token.Token {
|
|||
}
|
||||
return s.new_token(.comment, comment, comment.len + 2)
|
||||
}
|
||||
// s.fgenln('// ${s.prev_tok.str()} "$s.line_comment"')
|
||||
// Skip the comment (return the next token)
|
||||
continue
|
||||
} else if nextc == `*` { // Multiline comments
|
||||
|
|
Loading…
Reference in New Issue