1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

scanner: fix eof token position (#9432)

This commit is contained in:
Ned Palacios 2021-03-23 15:51:09 +08:00 committed by GitHub
parent aa4e22c287
commit b9cbb4f177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1,3 @@
vlib/v/parser/tests/fn_decl_unexpected_eof.vv:1:12: error: unexpected eof, expecting `}`
1 | fn main() {
| ^

View File

@ -0,0 +1 @@
fn main() {

View File

@ -191,7 +191,7 @@ fn (s &Scanner) new_eof_token() token.Token {
kind: .eof
lit: ''
line_nr: s.line_nr + 1
col: 1
col: s.current_column()
pos: s.pos
len: 1
tidx: s.tidx
@ -576,7 +576,7 @@ pub fn (mut s Scanner) buffer_scan() token.Token {
}
return s.all_tokens[cidx]
}
return s.new_token(.eof, '', 1)
return s.new_eof_token()
}
[inline]