mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
lang: remove endwhile keyword
This commit is contained in:
1 parent
6c8a43390b
commit
aae5997e12
56 files changed
+578
-590
No files matched your search
+13
-24
@@ -756,24 +756,6 @@ func (p *parser) parseLabel() (t.ID, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (p *parser) parseEndwhile(label t.ID) bool {
|
||||
if p.peek1() != t.IDEndwhile {
|
||||
return false
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
if label != 0 {
|
||||
if p.peek1() != t.IDDot {
|
||||
return false
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
if p.peek1() != label {
|
||||
return false
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (p *parser) parseStatement1() (*a.Node, error) {
|
||||
x := p.peek1()
|
||||
if x == t.IDVar {
|
||||
@@ -930,14 +912,21 @@ func (p *parser) parseStatement1() (*a.Node, error) {
|
||||
n.SetBody(body)
|
||||
p.loops.Pop()
|
||||
|
||||
if !p.parseEndwhile(label) {
|
||||
dotLabel := ""
|
||||
if label != 0 {
|
||||
dotLabel = "." + label.Str(p.tm)
|
||||
if label != 0 {
|
||||
seenDotLabel := false
|
||||
if p.peek1() == t.IDDot {
|
||||
p.src = p.src[1:]
|
||||
if p.peek1() == label {
|
||||
p.src = p.src[1:]
|
||||
seenDotLabel = true
|
||||
}
|
||||
}
|
||||
if !seenDotLabel {
|
||||
return nil, fmt.Errorf(`parse: expected .%s at %s:%d`,
|
||||
label.Str(p.tm), p.filename, p.line())
|
||||
}
|
||||
return nil, fmt.Errorf(`parse: expected endwhile%s at %s:%d`,
|
||||
dotLabel, p.filename, p.line())
|
||||
}
|
||||
|
||||
if !doubleCurly {
|
||||
// No-op.
|
||||
} else if n.HasContinue() {
|
||||
|
||||
+19
-21
@@ -375,26 +375,25 @@ const (
|
||||
IDConst = ID(0xB4)
|
||||
IDContinue = ID(0xB5)
|
||||
IDElse = ID(0xB6)
|
||||
IDEndwhile = ID(0xB7)
|
||||
IDFunc = ID(0xB8)
|
||||
IDIOBind = ID(0xB9)
|
||||
IDIOForgetHistory = ID(0xBA)
|
||||
IDIOLimit = ID(0xBB)
|
||||
IDIf = ID(0xBC)
|
||||
IDImplements = ID(0xBD)
|
||||
IDInv = ID(0xBE)
|
||||
IDIterate = ID(0xBF)
|
||||
IDPost = ID(0xC0)
|
||||
IDPre = ID(0xC1)
|
||||
IDPri = ID(0xC2)
|
||||
IDPub = ID(0xC3)
|
||||
IDReturn = ID(0xC4)
|
||||
IDStruct = ID(0xC5)
|
||||
IDUse = ID(0xC6)
|
||||
IDVar = ID(0xC7)
|
||||
IDVia = ID(0xC8)
|
||||
IDWhile = ID(0xC9)
|
||||
IDYield = ID(0xCA)
|
||||
IDFunc = ID(0xB7)
|
||||
IDIOBind = ID(0xB8)
|
||||
IDIOForgetHistory = ID(0xB9)
|
||||
IDIOLimit = ID(0xBA)
|
||||
IDIf = ID(0xBB)
|
||||
IDImplements = ID(0xBC)
|
||||
IDInv = ID(0xBD)
|
||||
IDIterate = ID(0xBE)
|
||||
IDPost = ID(0xBF)
|
||||
IDPre = ID(0xC0)
|
||||
IDPri = ID(0xC1)
|
||||
IDPub = ID(0xC2)
|
||||
IDReturn = ID(0xC3)
|
||||
IDStruct = ID(0xC4)
|
||||
IDUse = ID(0xC5)
|
||||
IDVar = ID(0xC6)
|
||||
IDVia = ID(0xC7)
|
||||
IDWhile = ID(0xC8)
|
||||
IDYield = ID(0xC9)
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -826,7 +825,6 @@ var builtInsByID = [nBuiltInIDs]string{
|
||||
IDConst: "const",
|
||||
IDContinue: "continue",
|
||||
IDElse: "else",
|
||||
IDEndwhile: "endwhile",
|
||||
IDFunc: "func",
|
||||
IDIOBind: "io_bind",
|
||||
IDIOForgetHistory: "io_forget_history",
|
||||
|
||||
Reference in new issue
Block a user