mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 09:01:35 +01:00
lang: more anticipating io_forget_history
This commit is contained in:
1 parent
6482ba3923
commit
9fb3859488
5 files changed
+27
-19
No files matched your search
@@ -40,6 +40,7 @@ The dot points below probably aren't of interest unless you're _writing_ Wuffs
|
|||||||
code (instead of writing C/C++ code that _uses_ Wuffs' standard library).
|
code (instead of writing C/C++ code that _uses_ Wuffs' standard library).
|
||||||
|
|
||||||
- Added `if.likely` and `if.unlikely`.
|
- Added `if.likely` and `if.unlikely`.
|
||||||
|
- Added `io_forget_history`.
|
||||||
- Added `slice_var as nptr array[etc] etc` conversion.
|
- Added `slice_var as nptr array[etc] etc` conversion.
|
||||||
- Added read-only type decorators: `roarray`, `roslice` and `rotable`.
|
- Added read-only type decorators: `roarray`, `roslice` and `rotable`.
|
||||||
- Ban recursive function calls.
|
- Ban recursive function calls.
|
||||||
|
|||||||
+3
-2
@@ -607,8 +607,9 @@ func NewField(flags Flags, name t.ID, xType *TypeExpr) *Field {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IOManip is "io_bind (io:LHS, data:MHS, history_position:RHS) { List2 }" or
|
// IOManip is "io_bind (io:LHS, data:MHS, history_position:RHS) { List2 }" or
|
||||||
// "io_limit (io:LHS, limit:MHS) { List2 }":
|
// "io_forget_history (io:LHS) { List2 }" or "io_limit (io:LHS, limit:MHS) {
|
||||||
// - ID0: <IDIOBind|IDIOLimit>
|
// List2 }":
|
||||||
|
// - ID0: <IDIOBind|IDIOForgetHistory|IDIOLimit>
|
||||||
// - LHS: <Expr>
|
// - LHS: <Expr>
|
||||||
// - MHS: <Expr>
|
// - MHS: <Expr>
|
||||||
// - RHS: <Expr>
|
// - RHS: <Expr>
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ func (q *checker) tcheckStatement(n *a.Node) error {
|
|||||||
switch n.Keyword() {
|
switch n.Keyword() {
|
||||||
case t.IDIOBind:
|
case t.IDIOBind:
|
||||||
arg1Typ = typeExprSliceU8
|
arg1Typ = typeExprSliceU8
|
||||||
|
case t.IDIOForgetHistory:
|
||||||
|
// No-op.
|
||||||
case t.IDIOLimit:
|
case t.IDIOLimit:
|
||||||
arg1Typ = typeExprU64
|
arg1Typ = typeExprU64
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -858,7 +858,7 @@ func (p *parser) parseStatement1() (*a.Node, error) {
|
|||||||
}
|
}
|
||||||
return a.NewChoose(name, args).AsNode(), nil
|
return a.NewChoose(name, args).AsNode(), nil
|
||||||
|
|
||||||
case t.IDIOBind, t.IDIOLimit:
|
case t.IDIOBind, t.IDIOForgetHistory, t.IDIOLimit:
|
||||||
return p.parseIOManipNode()
|
return p.parseIOManipNode()
|
||||||
|
|
||||||
case t.IDIf:
|
case t.IDIf:
|
||||||
@@ -1087,6 +1087,8 @@ func (p *parser) parseIOManipNode() (*a.Node, error) {
|
|||||||
return nil, fmt.Errorf(`parse: invalid %s argument %q at %s:%d`,
|
return nil, fmt.Errorf(`parse: invalid %s argument %q at %s:%d`,
|
||||||
keyword.Str(p.tm), io.Str(p.tm), p.filename, p.line())
|
keyword.Str(p.tm), io.Str(p.tm), p.filename, p.line())
|
||||||
}
|
}
|
||||||
|
case t.IDIOForgetHistory:
|
||||||
|
// No-op.
|
||||||
case t.IDIOLimit:
|
case t.IDIOLimit:
|
||||||
arg1Name = t.IDLimit
|
arg1Name = t.IDLimit
|
||||||
if (io.Operator() != 0) && (io.IsArgsDotFoo() == 0) {
|
if (io.Operator() != 0) && (io.IsArgsDotFoo() == 0) {
|
||||||
|
|||||||
+18
-16
@@ -378,22 +378,23 @@ const (
|
|||||||
IDEndwhile = ID(0xB7)
|
IDEndwhile = ID(0xB7)
|
||||||
IDFunc = ID(0xB8)
|
IDFunc = ID(0xB8)
|
||||||
IDIOBind = ID(0xB9)
|
IDIOBind = ID(0xB9)
|
||||||
IDIOLimit = ID(0xBA)
|
IDIOForgetHistory = ID(0xBA)
|
||||||
IDIf = ID(0xBB)
|
IDIOLimit = ID(0xBB)
|
||||||
IDImplements = ID(0xBC)
|
IDIf = ID(0xBC)
|
||||||
IDInv = ID(0xBD)
|
IDImplements = ID(0xBD)
|
||||||
IDIterate = ID(0xBE)
|
IDInv = ID(0xBE)
|
||||||
IDPost = ID(0xBF)
|
IDIterate = ID(0xBF)
|
||||||
IDPre = ID(0xC0)
|
IDPost = ID(0xC0)
|
||||||
IDPri = ID(0xC1)
|
IDPre = ID(0xC1)
|
||||||
IDPub = ID(0xC2)
|
IDPri = ID(0xC2)
|
||||||
IDReturn = ID(0xC3)
|
IDPub = ID(0xC3)
|
||||||
IDStruct = ID(0xC4)
|
IDReturn = ID(0xC4)
|
||||||
IDUse = ID(0xC5)
|
IDStruct = ID(0xC5)
|
||||||
IDVar = ID(0xC6)
|
IDUse = ID(0xC6)
|
||||||
IDVia = ID(0xC7)
|
IDVar = ID(0xC7)
|
||||||
IDWhile = ID(0xC8)
|
IDVia = ID(0xC8)
|
||||||
IDYield = ID(0xC9)
|
IDWhile = ID(0xC9)
|
||||||
|
IDYield = ID(0xCA)
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -826,6 +827,7 @@ var builtInsByID = [nBuiltInIDs]string{
|
|||||||
IDEndwhile: "endwhile",
|
IDEndwhile: "endwhile",
|
||||||
IDFunc: "func",
|
IDFunc: "func",
|
||||||
IDIOBind: "io_bind",
|
IDIOBind: "io_bind",
|
||||||
|
IDIOForgetHistory: "io_forget_history",
|
||||||
IDIOLimit: "io_limit",
|
IDIOLimit: "io_limit",
|
||||||
IDIf: "if",
|
IDIf: "if",
|
||||||
IDImplements: "implements",
|
IDImplements: "implements",
|
||||||
|
|||||||
Reference in new issue
Block a user