mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 16:47:28 +01:00
Tweak io_bind syntax
This commit is contained in:
1 parent
e992921dce
commit
badbdfc487
7 files changed
+62
-88
No files matched your search
+9
-13
@@ -482,30 +482,26 @@ func NewField(name t.ID, xType *TypeExpr) *Field {
|
||||
}
|
||||
}
|
||||
|
||||
// IOBind is "io_bind (in_fields) { List2 }" or "io_limit (io:LHS, limit:MHS)":
|
||||
// IOBind is "io_bind (io:LHS) { List2 }" or "io_limit (io:LHS, limit:MHS) {
|
||||
// List2 }":
|
||||
// - ID0: <IDIOBind|IDIOLimit>
|
||||
// - LHS: <nil|Expr>
|
||||
// - LHS: <Expr>
|
||||
// - MHS: <nil|Expr>
|
||||
// - List0: <Expr> in.something fields
|
||||
// - List2: <Statement> body
|
||||
//
|
||||
// TODO: in_fields and "in.something" isn't right.
|
||||
type IOBind Node
|
||||
|
||||
func (n *IOBind) AsNode() *Node { return (*Node)(n) }
|
||||
func (n *IOBind) Keyword() t.ID { return n.id0 }
|
||||
func (n *IOBind) IO() *Expr { return n.lhs.AsExpr() }
|
||||
func (n *IOBind) Limit() *Expr { return n.mhs.AsExpr() }
|
||||
func (n *IOBind) InFields() []*Node { return n.list0 }
|
||||
func (n *IOBind) Body() []*Node { return n.list2 }
|
||||
func (n *IOBind) AsNode() *Node { return (*Node)(n) }
|
||||
func (n *IOBind) Keyword() t.ID { return n.id0 }
|
||||
func (n *IOBind) IO() *Expr { return n.lhs.AsExpr() }
|
||||
func (n *IOBind) Limit() *Expr { return n.mhs.AsExpr() }
|
||||
func (n *IOBind) Body() []*Node { return n.list2 }
|
||||
|
||||
func NewIOBind(keyword t.ID, io *Expr, limit *Expr, in_fields []*Node, body []*Node) *IOBind {
|
||||
func NewIOBind(keyword t.ID, io *Expr, limit *Expr, body []*Node) *IOBind {
|
||||
return &IOBind{
|
||||
kind: KIOBind,
|
||||
id0: keyword,
|
||||
lhs: io.AsNode(),
|
||||
mhs: limit.AsNode(),
|
||||
list0: in_fields,
|
||||
list2: body,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user