parser: fix `rewind_scanner_to_current_token_in_new_mode` (#10495)

pull/10544/head
Yuriy Zymlex 2021-06-23 03:17:36 +10:00 committed by GitHub
parent c43791b0f5
commit 6736817bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -1,3 +1 @@
cmd/tools/vdoc/tests/testdata/project1/main.v:0:1: error: unexpected unknown, expecting `const`
1 | const (
2 | source_root = 'temp'
vdoc: No documentation found for /v/vmaster/cmd/tools/vdoc/tests/testdata/project1/main.v

View File

@ -3261,7 +3261,8 @@ fn (mut p Parser) rewind_scanner_to_current_token_in_new_mode() {
no_token := token.Token{}
p.prev_tok = no_token
p.tok = no_token
p.peek_tok = no_token
p.peek_tok = no_token // requires 2 calls p.next() or check p.tok.kind != token.Kind.unknown
p.next()
for {
p.next()
// eprintln('rewinding to ${p.tok.tidx:5} | goal: ${tidx:5}')