mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
lang: more anticipating io_forget_history
This commit is contained in:
1 parent
6482ba3923
commit
9fb3859488
5 files changed
+63
-55
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).
|
||||
|
||||
- Added `if.likely` and `if.unlikely`.
|
||||
- Added `io_forget_history`.
|
||||
- Added `slice_var as nptr array[etc] etc` conversion.
|
||||
- Added read-only type decorators: `roarray`, `roslice` and `rotable`.
|
||||
- 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
|
||||
// "io_limit (io:LHS, limit:MHS) { List2 }":
|
||||
// - ID0: <IDIOBind|IDIOLimit>
|
||||
// "io_forget_history (io:LHS) { List2 }" or "io_limit (io:LHS, limit:MHS) {
|
||||
// List2 }":
|
||||
// - ID0: <IDIOBind|IDIOForgetHistory|IDIOLimit>
|
||||
// - LHS: <Expr>
|
||||
// - MHS: <Expr>
|
||||
// - RHS: <Expr>
|
||||
|
||||
@@ -164,6 +164,8 @@ func (q *checker) tcheckStatement(n *a.Node) error {
|
||||
switch n.Keyword() {
|
||||
case t.IDIOBind:
|
||||
arg1Typ = typeExprSliceU8
|
||||
case t.IDIOForgetHistory:
|
||||
// No-op.
|
||||
case t.IDIOLimit:
|
||||
arg1Typ = typeExprU64
|
||||
}
|
||||
|
||||
+3
-1
@@ -858,7 +858,7 @@ func (p *parser) parseStatement1() (*a.Node, error) {
|
||||
}
|
||||
return a.NewChoose(name, args).AsNode(), nil
|
||||
|
||||
case t.IDIOBind, t.IDIOLimit:
|
||||
case t.IDIOBind, t.IDIOForgetHistory, t.IDIOLimit:
|
||||
return p.parseIOManipNode()
|
||||
|
||||
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`,
|
||||
keyword.Str(p.tm), io.Str(p.tm), p.filename, p.line())
|
||||
}
|
||||
case t.IDIOForgetHistory:
|
||||
// No-op.
|
||||
case t.IDIOLimit:
|
||||
arg1Name = t.IDLimit
|
||||
if (io.Operator() != 0) && (io.IsArgsDotFoo() == 0) {
|
||||
|
||||
+54
-52
@@ -368,32 +368,33 @@ const (
|
||||
minKeyword = 0xB0
|
||||
maxKeyword = 0xCF
|
||||
|
||||
IDAssert = ID(0xB0)
|
||||
IDBreak = ID(0xB1)
|
||||
IDChoose = ID(0xB2)
|
||||
IDChoosy = ID(0xB3)
|
||||
IDConst = ID(0xB4)
|
||||
IDContinue = ID(0xB5)
|
||||
IDElse = ID(0xB6)
|
||||
IDEndwhile = ID(0xB7)
|
||||
IDFunc = ID(0xB8)
|
||||
IDIOBind = ID(0xB9)
|
||||
IDIOLimit = ID(0xBA)
|
||||
IDIf = ID(0xBB)
|
||||
IDImplements = ID(0xBC)
|
||||
IDInv = ID(0xBD)
|
||||
IDIterate = ID(0xBE)
|
||||
IDPost = ID(0xBF)
|
||||
IDPre = ID(0xC0)
|
||||
IDPri = ID(0xC1)
|
||||
IDPub = ID(0xC2)
|
||||
IDReturn = ID(0xC3)
|
||||
IDStruct = ID(0xC4)
|
||||
IDUse = ID(0xC5)
|
||||
IDVar = ID(0xC6)
|
||||
IDVia = ID(0xC7)
|
||||
IDWhile = ID(0xC8)
|
||||
IDYield = ID(0xC9)
|
||||
IDAssert = ID(0xB0)
|
||||
IDBreak = ID(0xB1)
|
||||
IDChoose = ID(0xB2)
|
||||
IDChoosy = ID(0xB3)
|
||||
IDConst = ID(0xB4)
|
||||
IDContinue = ID(0xB5)
|
||||
IDElse = ID(0xB6)
|
||||
IDEndwhile = ID(0xB7)
|
||||
IDFunc = ID(0xB8)
|
||||
IDIOBind = ID(0xB9)
|
||||
IDIOForgetHistory = ID(0xBA)
|
||||
IDIOLimit = ID(0xBB)
|
||||
IDIf = ID(0xBC)
|
||||
IDImplements = ID(0xBD)
|
||||
IDInv = ID(0xBE)
|
||||
IDIterate = ID(0xBF)
|
||||
IDPost = ID(0xC0)
|
||||
IDPre = ID(0xC1)
|
||||
IDPri = ID(0xC2)
|
||||
IDPub = ID(0xC3)
|
||||
IDReturn = ID(0xC4)
|
||||
IDStruct = ID(0xC5)
|
||||
IDUse = ID(0xC6)
|
||||
IDVar = ID(0xC7)
|
||||
IDVia = ID(0xC8)
|
||||
IDWhile = ID(0xC9)
|
||||
IDYield = ID(0xCA)
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -816,32 +817,33 @@ var builtInsByID = [nBuiltInIDs]string{
|
||||
|
||||
IDNot: "not",
|
||||
|
||||
IDAssert: "assert",
|
||||
IDBreak: "break",
|
||||
IDChoose: "choose",
|
||||
IDChoosy: "choosy",
|
||||
IDConst: "const",
|
||||
IDContinue: "continue",
|
||||
IDElse: "else",
|
||||
IDEndwhile: "endwhile",
|
||||
IDFunc: "func",
|
||||
IDIOBind: "io_bind",
|
||||
IDIOLimit: "io_limit",
|
||||
IDIf: "if",
|
||||
IDImplements: "implements",
|
||||
IDInv: "inv",
|
||||
IDIterate: "iterate",
|
||||
IDPost: "post",
|
||||
IDPre: "pre",
|
||||
IDPri: "pri",
|
||||
IDPub: "pub",
|
||||
IDReturn: "return",
|
||||
IDStruct: "struct",
|
||||
IDUse: "use",
|
||||
IDVar: "var",
|
||||
IDVia: "via",
|
||||
IDWhile: "while",
|
||||
IDYield: "yield",
|
||||
IDAssert: "assert",
|
||||
IDBreak: "break",
|
||||
IDChoose: "choose",
|
||||
IDChoosy: "choosy",
|
||||
IDConst: "const",
|
||||
IDContinue: "continue",
|
||||
IDElse: "else",
|
||||
IDEndwhile: "endwhile",
|
||||
IDFunc: "func",
|
||||
IDIOBind: "io_bind",
|
||||
IDIOForgetHistory: "io_forget_history",
|
||||
IDIOLimit: "io_limit",
|
||||
IDIf: "if",
|
||||
IDImplements: "implements",
|
||||
IDInv: "inv",
|
||||
IDIterate: "iterate",
|
||||
IDPost: "post",
|
||||
IDPre: "pre",
|
||||
IDPri: "pri",
|
||||
IDPub: "pub",
|
||||
IDReturn: "return",
|
||||
IDStruct: "struct",
|
||||
IDUse: "use",
|
||||
IDVar: "var",
|
||||
IDVia: "via",
|
||||
IDWhile: "while",
|
||||
IDYield: "yield",
|
||||
|
||||
IDArray: "array",
|
||||
IDNptr: "nptr",
|
||||
|
||||
Reference in new issue
Block a user