Rename while:label to while.label

This commit is contained in:
Nigel Tao committed 2019-10-12 19:04:32 +11:00
1 parent 5d29c7df61
commit 7872a8893b
8 files changed
+27 -26

No files matched your search

+3 -3
View File
@@ -498,7 +498,7 @@ func NewIOBind(keyword t.ID, io *Expr, arg1 *Expr, body []*Node) *IOBind {
}
// Iterate is
// "iterate:ID1 (assigns)(length:ID2, unroll:ID0), List1 { List2 } else RHS":
// "iterate.ID1 (assigns)(length:ID2, unroll:ID0), List1 { List2 } else RHS":
// - FlagsHasBreak is the iterate has an explicit break
// - FlagsHasContinue is the iterate has an explicit continue
// - ID0: unroll
@@ -537,7 +537,7 @@ func NewIterate(label t.ID, assigns []*Node, length t.ID, unroll t.ID, asserts [
}
}
// While is "while:ID1 MHS, List1 { List2 }":
// While is "while.ID1 MHS, List1 { List2 }":
// - FlagsHasBreak is the while has an explicit break
// - FlagsHasContinue is the while has an explicit continue
// - ID1: <0|label>
@@ -613,7 +613,7 @@ func NewRet(keyword t.ID, value *Expr) *Ret {
}
}
// Jump is "break" or "continue", with an optional label, "break:label":
// Jump is "break" or "continue", with an optional label, "break.label":
// - ID0: <IDBreak|IDContinue>
// - ID1: <0|label>
type Jump Node
+2 -2
View File
@@ -83,13 +83,13 @@ func TestCheck(tt *testing.T) {
assert true
while:label p == q,
while.label p == q,
pre true,
inv true,
post p <> q,
{
// Redundant, but shows the labeled jump syntax.
continue:label
continue.label
}
}
`) + "\n"
+1 -1
View File
@@ -599,7 +599,7 @@ func (p *parser) parseStatement() (*a.Node, error) {
}
func (p *parser) parseLabel() (t.ID, error) {
if p.peek1() == t.IDColon {
if p.peek1() == t.IDDot {
p.src = p.src[1:]
return p.parseIdent()
}