mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 00:38:14 +01:00
Raise built-in ident capacity from 96 to 768
This commit is contained in:
1 parent
1702c1e303
commit
e8eeee371a
8 files changed
+129
-105
No files matched your search
@@ -432,7 +432,7 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
||||
|
||||
func (g *gen) writeExprUnaryOp(b *buffer, n *a.Expr, rp replacementPolicy, pp parenthesesPolicy, depth uint32) error {
|
||||
op := n.Operator()
|
||||
opName := cOpNames[0xFF&op]
|
||||
opName := cOpName(op)
|
||||
if opName == "" {
|
||||
return fmt.Errorf("unrecognized operator %q", op.AmbiguousForm().Str(g.tm))
|
||||
}
|
||||
@@ -462,7 +462,7 @@ func (g *gen) writeExprBinaryOp(b *buffer, n *a.Expr, rp replacementPolicy, pp p
|
||||
return g.writeExprAs(b, n.LHS().Expr(), n.RHS().TypeExpr(), rp, depth)
|
||||
|
||||
default:
|
||||
opName = cOpNames[0xFF&op]
|
||||
opName = cOpName(op)
|
||||
if opName == "" {
|
||||
return fmt.Errorf("unrecognized operator %q", op.AmbiguousForm().Str(g.tm))
|
||||
}
|
||||
@@ -501,7 +501,7 @@ func (g *gen) writeExprAs(b *buffer, lhs *a.Expr, rhs *a.TypeExpr, rp replacemen
|
||||
|
||||
func (g *gen) writeExprAssociativeOp(b *buffer, n *a.Expr, rp replacementPolicy, pp parenthesesPolicy, depth uint32) error {
|
||||
op := n.Operator()
|
||||
opName := cOpNames[0xFF&op]
|
||||
opName := cOpName(op)
|
||||
if opName == "" {
|
||||
return fmt.Errorf("unrecognized operator %q", op.AmbiguousForm().Str(g.tm))
|
||||
}
|
||||
@@ -628,7 +628,18 @@ var cTypeNames = [...]string{
|
||||
t.IDIOWriter: "wuffs_base__io_writer",
|
||||
}
|
||||
|
||||
var cOpNames = [256]string{
|
||||
const noSuchCOperator = " no_such_C_operator "
|
||||
|
||||
func cOpName(x t.ID) string {
|
||||
if x < t.ID(len(cOpNames)) {
|
||||
if s := cOpNames[x]; s != "" {
|
||||
return s
|
||||
}
|
||||
}
|
||||
return noSuchCOperator
|
||||
}
|
||||
|
||||
var cOpNames = [...]string{
|
||||
t.IDEq: " = ",
|
||||
t.IDPlusEq: " += ",
|
||||
t.IDMinusEq: " -= ",
|
||||
@@ -642,8 +653,8 @@ var cOpNames = [256]string{
|
||||
t.IDPercentEq: " %= ",
|
||||
t.IDTildeModPlusEq: " += ",
|
||||
t.IDTildeModMinusEq: " -= ",
|
||||
t.IDTildeSatPlusEq: " no_such_C_operator ",
|
||||
t.IDTildeSatMinusEq: " no_such_C_operator ",
|
||||
t.IDTildeSatPlusEq: noSuchCOperator,
|
||||
t.IDTildeSatMinusEq: noSuchCOperator,
|
||||
|
||||
t.IDXUnaryPlus: " + ",
|
||||
t.IDXUnaryMinus: " - ",
|
||||
@@ -663,8 +674,8 @@ var cOpNames = [256]string{
|
||||
t.IDXBinaryPercent: " % ",
|
||||
t.IDXBinaryTildeModPlus: " + ",
|
||||
t.IDXBinaryTildeModMinus: " - ",
|
||||
t.IDXBinaryTildeSatPlus: " no_such_C_operator ",
|
||||
t.IDXBinaryTildeSatMinus: " no_such_C_operator ",
|
||||
t.IDXBinaryTildeSatPlus: noSuchCOperator,
|
||||
t.IDXBinaryTildeSatMinus: noSuchCOperator,
|
||||
t.IDXBinaryNotEq: " != ",
|
||||
t.IDXBinaryLessThan: " < ",
|
||||
t.IDXBinaryLessEq: " <= ",
|
||||
@@ -673,7 +684,7 @@ var cOpNames = [256]string{
|
||||
t.IDXBinaryGreaterThan: " > ",
|
||||
t.IDXBinaryAnd: " && ",
|
||||
t.IDXBinaryOr: " || ",
|
||||
t.IDXBinaryAs: " no_such_C_operator ",
|
||||
t.IDXBinaryAs: noSuchCOperator,
|
||||
|
||||
t.IDXAssociativePlus: " + ",
|
||||
t.IDXAssociativeStar: " * ",
|
||||
|
||||
@@ -402,7 +402,7 @@ func (g *gen) writeFuncImplArgChecks(b *buffer, n *a.Func) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var numTypeBounds = [256][2]*big.Int{
|
||||
var numTypeBounds = [...][2]*big.Int{
|
||||
t.IDI8: {big.NewInt(-1 << 7), big.NewInt(1<<7 - 1)},
|
||||
t.IDI16: {big.NewInt(-1 << 15), big.NewInt(1<<15 - 1)},
|
||||
t.IDI32: {big.NewInt(-1 << 31), big.NewInt(1<<31 - 1)},
|
||||
|
||||
@@ -116,7 +116,7 @@ func (g *gen) writeStatementAssign(b *buffer, n *a.Assign, depth uint32) error {
|
||||
opName, tilde = ",", true
|
||||
|
||||
default:
|
||||
opName = cOpNames[0xFF&op]
|
||||
opName = cOpName(op)
|
||||
if opName == "" {
|
||||
return fmt.Errorf("unrecognized operator %q", op.AmbiguousForm().Str(g.tm))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user