From 35639dbdc920db207c4dcba5ede40c4f9abfa355 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Sat, 9 Apr 2022 15:58:49 +0100 Subject: [PATCH] toml.scanner: make end_of_text, at and next return u32 like peek --- vlib/toml/scanner/scanner.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/toml/scanner/scanner.v b/vlib/toml/scanner/scanner.v index 45c928ad9f..7b7d206f4b 100644 --- a/vlib/toml/scanner/scanner.v +++ b/vlib/toml/scanner/scanner.v @@ -10,7 +10,7 @@ import toml.util pub const ( digit_extras = [`_`, `.`, `x`, `o`, `b`, `e`, `E`] - end_of_text = -1 + end_of_text = math.max_u32 ) // Scanner contains the necessary fields for the state of the scan process. @@ -263,7 +263,7 @@ pub fn (s &Scanner) remaining() int { // next returns the next character code from the input text. // next returns `end_of_text` if it can't reach the next character. [direct_array_access; inline] -pub fn (mut s Scanner) next() int { +pub fn (mut s Scanner) next() u32 { if s.pos < s.text.len { opos := s.pos s.pos++ @@ -299,7 +299,7 @@ pub fn (mut s Scanner) skip_n(n int) { // at returns `end_of_text` if it can't get the current character. // unlike `next()`, `at()` does not change the state of the scanner. [direct_array_access; inline] -pub fn (s &Scanner) at() int { +pub fn (s &Scanner) at() u32 { if s.pos < s.text.len { return s.text[s.pos] }