mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 16:47:28 +01:00
Let an unbroken "while true" terminate a block
This commit is contained in:
1 parent
4a89913a9b
commit
e5c86ec191
2 files changed
+15
-8
No files matched your search
+5
-5
@@ -790,17 +790,17 @@ func (p *parser) parseStatement1() (*a.Node, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
doubleCurly := p.peek1() == t.IDOpenDoubleCurly
|
||||
if doubleCurly && ((condition.Operator() != 0) || (condition.Ident() != t.IDTrue)) {
|
||||
return nil, fmt.Errorf(`parse: double {{ }} while loop condition isn't "true" at %s:%d`,
|
||||
p.filename, p.line())
|
||||
}
|
||||
|
||||
n := a.NewWhile(label, condition, asserts)
|
||||
if !p.loops.Push(n) {
|
||||
return nil, fmt.Errorf(`parse: duplicate loop label %s at %s:%d`,
|
||||
label.Str(p.tm), p.filename, p.line())
|
||||
}
|
||||
doubleCurly := p.peek1() == t.IDOpenDoubleCurly
|
||||
if doubleCurly && !n.IsWhileTrue() {
|
||||
return nil, fmt.Errorf(`parse: double {{ }} while loop condition isn't "true" at %s:%d`,
|
||||
p.filename, p.line())
|
||||
}
|
||||
body, err := p.parseBlock(doubleCurly)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user