mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Add io_bind history_position arg
This commit is contained in:
1 parent
b60a2cacd9
commit
28a54baa19
11 files changed
+87
-24
No files matched your search
+31
-1
@@ -1123,6 +1123,36 @@ func (p *parser) parseIOBindNode() (*a.Node, error) {
|
||||
io.Str(p.tm), p.filename, p.line())
|
||||
}
|
||||
|
||||
histPos := (*a.Expr)(nil)
|
||||
if keyword == t.IDIOBind {
|
||||
if x := p.peek1(); x != t.IDComma {
|
||||
got := p.tm.ByID(x)
|
||||
return nil, fmt.Errorf(`parse: expected ",", got %q at %s:%d`, got, p.filename, p.line())
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
|
||||
if x := p.peek1(); x != t.IDHistoryPosition {
|
||||
got := p.tm.ByID(x)
|
||||
return nil, fmt.Errorf(`parse: expected "history_position", got %q at %s:%d`, got, p.filename, p.line())
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
|
||||
if x := p.peek1(); x != t.IDColon {
|
||||
got := p.tm.ByID(x)
|
||||
return nil, fmt.Errorf(`parse: expected ":", got %q at %s:%d`, got, p.filename, p.line())
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
|
||||
histPos, err = p.parseExpr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if histPos.Effect() != 0 {
|
||||
return nil, fmt.Errorf(`parse: argument %q is not effect-free at %s:%d`,
|
||||
io.Str(p.tm), p.filename, p.line())
|
||||
}
|
||||
}
|
||||
|
||||
if x := p.peek1(); x != t.IDCloseParen {
|
||||
got := p.tm.ByID(x)
|
||||
return nil, fmt.Errorf(`parse: expected ")", got %q at %s:%d`, got, p.filename, p.line())
|
||||
@@ -1134,7 +1164,7 @@ func (p *parser) parseIOBindNode() (*a.Node, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return a.NewIOBind(keyword, io, arg1, body).AsNode(), nil
|
||||
return a.NewIOBind(keyword, io, arg1, histPos, body).AsNode(), nil
|
||||
}
|
||||
|
||||
func (p *parser) parseIf() (*a.If, error) {
|
||||
|
||||
Reference in new issue
Block a user