v.scanner: use mathutil instead of `mu` (easier to search)
parent
54f6dc70c3
commit
1e6230a441
|
@ -3,7 +3,7 @@
|
||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
module scanner
|
module scanner
|
||||||
|
|
||||||
import math.mathutil as mu
|
import math.mathutil
|
||||||
import os
|
import os
|
||||||
import strconv
|
import strconv
|
||||||
import v.token
|
import v.token
|
||||||
|
@ -178,7 +178,7 @@ fn (mut s Scanner) new_token(tok_kind token.Kind, lit string, len int) token.Tok
|
||||||
kind: tok_kind
|
kind: tok_kind
|
||||||
lit: lit
|
lit: lit
|
||||||
line_nr: s.line_nr + line_offset
|
line_nr: s.line_nr + line_offset
|
||||||
col: mu.max(1, s.current_column() - len + 1)
|
col: mathutil.max(1, s.current_column() - len + 1)
|
||||||
pos: s.pos - len + 1
|
pos: s.pos - len + 1
|
||||||
len: len
|
len: len
|
||||||
tidx: cidx
|
tidx: cidx
|
||||||
|
@ -206,7 +206,7 @@ fn (mut s Scanner) new_multiline_token(tok_kind token.Kind, lit string, len int,
|
||||||
kind: tok_kind
|
kind: tok_kind
|
||||||
lit: lit
|
lit: lit
|
||||||
line_nr: start_line + 1
|
line_nr: start_line + 1
|
||||||
col: mu.max(1, s.current_column() - len + 1)
|
col: mathutil.max(1, s.current_column() - len + 1)
|
||||||
pos: s.pos - len + 1
|
pos: s.pos - len + 1
|
||||||
len: len
|
len: len
|
||||||
tidx: cidx
|
tidx: cidx
|
||||||
|
@ -1068,7 +1068,7 @@ fn (mut s Scanner) text_scan() token.Token {
|
||||||
|
|
||||||
fn (mut s Scanner) invalid_character() {
|
fn (mut s Scanner) invalid_character() {
|
||||||
len := utf8_char_len(s.text[s.pos])
|
len := utf8_char_len(s.text[s.pos])
|
||||||
end := mu.min(s.pos + len, s.text.len)
|
end := mathutil.min(s.pos + len, s.text.len)
|
||||||
c := s.text[s.pos..end]
|
c := s.text[s.pos..end]
|
||||||
s.error('invalid character `$c`')
|
s.error('invalid character `$c`')
|
||||||
}
|
}
|
||||||
|
@ -1310,7 +1310,7 @@ fn (mut s Scanner) eat_to_end_of_line() {
|
||||||
|
|
||||||
[inline]
|
[inline]
|
||||||
fn (mut s Scanner) inc_line_number() {
|
fn (mut s Scanner) inc_line_number() {
|
||||||
s.last_nl_pos = mu.min(s.text.len - 1, s.pos)
|
s.last_nl_pos = mathutil.min(s.text.len - 1, s.pos)
|
||||||
if s.is_crlf {
|
if s.is_crlf {
|
||||||
s.last_nl_pos++
|
s.last_nl_pos++
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue