v.scanner: fix error messages with unexpected token `?` (#11428)

pull/11438/head
Enzo 2021-09-07 19:46:56 +02:00 committed by GitHub
parent bee5e7de03
commit 79c2bca401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,5 @@
vlib/v/parser/tests/unexpected_token.vv:2:10: error: unexpected token `?`
1 | fn main() {
2 | println(?)
| ^
3 | }

View File

@ -0,0 +1,3 @@
fn main() {
println(?)
}

View File

@ -771,7 +771,7 @@ fn (mut s Scanner) text_scan() token.Token {
return s.new_token(.mod, '', 1) return s.new_token(.mod, '', 1)
} }
`?` { `?` {
return s.new_token(.question, '', 1) return s.new_token(.question, '?', 1)
} }
scanner.single_quote, scanner.double_quote { scanner.single_quote, scanner.double_quote {
start_line := s.line_nr start_line := s.line_nr