Generate placeholder code for "mark in.dst".

This commit is contained in:
Nigel Tao committed 2017-10-22 13:57:37 +11:00
1 parent bcc7171b5a
commit ac793d33bc
9 files changed
+63 -1

No files matched your search

+24
View File
@@ -40,6 +40,7 @@ const (
KField
KFile
KFunc
KIO
KIf
KIterate
KJump
@@ -71,6 +72,7 @@ var kindStrings = [...]string{
KField: "KField",
KFile: "KFile",
KFunc: "KFunc",
KIO: "KIO",
KIf: "KIf",
KIterate: "KIterate",
KJump: "KJump",
@@ -133,6 +135,7 @@ func (n *Node) Expr() *Expr { return (*Expr)(n) }
func (n *Node) Field() *Field { return (*Field)(n) }
func (n *Node) File() *File { return (*File)(n) }
func (n *Node) Func() *Func { return (*Func)(n) }
func (n *Node) IO() *IO { return (*IO)(n) }
func (n *Node) If() *If { return (*If)(n) }
func (n *Node) Iterate() *Iterate { return (*Iterate)(n) }
func (n *Node) Jump() *Jump { return (*Jump)(n) }
@@ -480,6 +483,27 @@ func NewIf(condition *Expr, elseIf *If, bodyIfTrue []*Node, bodyIfFalse []*Node)
}
}
// IO is "mark LHS":
// - ID0: <IDMark>
// - LHS: <Expr>
//
// TODO: "mark LHS { List2 }"?
//
// TODO: also represent "limit LHS"?
type IO Node
func (n *IO) Node() *Node { return (*Node)(n) }
func (n *IO) Keyword() t.ID { return n.id0 }
func (n *IO) Value() *Expr { return n.lhs.Expr() }
func NewIO(keyword t.ID, value *Expr) *IO {
return &IO{
kind: KIO,
id0: keyword,
lhs: value.Node(),
}
}
// Return is "return LHS", "return error ID1" or "return suspension ID1":
// - ID0: <0|IDError|IDSuspension>
// - ID1: message