fixes #19662; Indent level errored for first line (#19718)

This commit is contained in:
flywind 2022-04-25 18:00:23 +08:00 • committed by GitHub
commit 42ac50e988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

View file

@ -2393,6 +2393,10 @@ proc parseAll(p: var Parser): PNode =
if p.tok.indent != 0:
parMessage(p, errInvalidIndentation)
proc checkFirstLineIndentation*(p: var Parser) =
if p.tok.indent != 0 and p.tok.strongSpaceA > 0:
parMessage(p, errInvalidIndentation)
proc parseTopLevelStmt(p: var Parser): PNode =
## Implements an iterator which, when called repeatedly, returns the next
## top-level statement or emptyNode if end of stream.