mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 16:55:11 +01:00
Reassign built-in idents' token ID values
This commit is contained in:
1 parent
d371cc097a
commit
c762d50fb1
1 file changed
+97
-84
+97
-84
@@ -383,50 +383,64 @@ const (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
minBuiltInIdent = 0x100
|
minBuiltInIdent = 0x100
|
||||||
minNumTypeOrIdeal = 0x100
|
minNumTypeOrIdeal = 0x10F
|
||||||
minNumType = 0x100
|
minNumType = 0x110
|
||||||
maxNumType = 0x107
|
maxNumType = 0x117
|
||||||
maxNumTypeOrIdeal = 0x108
|
maxNumTypeOrIdeal = 0x117
|
||||||
maxBuiltInIdent = 0x3FF
|
maxBuiltInIdent = 0x3FF
|
||||||
|
|
||||||
IDI8 = ID(0x100)
|
// -------- 0x100 block.
|
||||||
IDI16 = ID(0x101)
|
|
||||||
IDI32 = ID(0x102)
|
IDEmptyStruct = ID(0x100)
|
||||||
IDI64 = ID(0x103)
|
IDBool = ID(0x101)
|
||||||
IDU8 = ID(0x104)
|
IDStatus = ID(0x102)
|
||||||
IDU16 = ID(0x105)
|
IDIOReader = ID(0x103)
|
||||||
IDU32 = ID(0x106)
|
IDIOWriter = ID(0x104)
|
||||||
IDU64 = ID(0x107)
|
IDCapitalT = ID(0x105)
|
||||||
|
IDImageConfig = ID(0x106)
|
||||||
|
|
||||||
|
IDDiamond = ID(0x10E)
|
||||||
|
|
||||||
// It is important that IDDoubleZ is right next to the IDI8..IDU64 block.
|
// It is important that IDDoubleZ is right next to the IDI8..IDU64 block.
|
||||||
// See the ID.IsNumTypeOrIdeal method.
|
// See the ID.IsNumTypeOrIdeal method.
|
||||||
IDDoubleZ = ID(0x108)
|
IDDoubleZ = ID(0x10F)
|
||||||
|
|
||||||
IDDiamond = ID(0x110)
|
IDI8 = ID(0x110)
|
||||||
|
IDI16 = ID(0x111)
|
||||||
|
IDI32 = ID(0x112)
|
||||||
|
IDI64 = ID(0x113)
|
||||||
|
IDU8 = ID(0x114)
|
||||||
|
IDU16 = ID(0x115)
|
||||||
|
IDU32 = ID(0x116)
|
||||||
|
IDU64 = ID(0x117)
|
||||||
|
|
||||||
IDUnderscore = ID(0x120)
|
// TODO Read/Write 24 bits? It might be useful for RGB triples.
|
||||||
IDThis = ID(0x121)
|
|
||||||
IDIn = ID(0x122)
|
|
||||||
IDOut = ID(0x123)
|
|
||||||
IDCapitalT = ID(0x124)
|
|
||||||
IDBase = ID(0x125)
|
|
||||||
|
|
||||||
IDMark = ID(0x180)
|
IDUnreadU8 = ID(0x120)
|
||||||
IDReadU8 = ID(0x181)
|
IDReadU8 = ID(0x121)
|
||||||
IDReadU16BE = ID(0x182)
|
IDReadU16BE = ID(0x122)
|
||||||
IDReadU16LE = ID(0x183)
|
IDReadU16LE = ID(0x123)
|
||||||
IDReadU32BE = ID(0x184)
|
IDReadU32BE = ID(0x124)
|
||||||
IDReadU32LE = ID(0x185)
|
IDReadU32LE = ID(0x125)
|
||||||
IDReadU64BE = ID(0x186)
|
IDReadU64BE = ID(0x126)
|
||||||
IDReadU64LE = ID(0x187)
|
IDReadU64LE = ID(0x127)
|
||||||
IDSinceMark = ID(0x188)
|
|
||||||
IDWriteU8 = ID(0x189)
|
// TODO: IDUnwriteU8?
|
||||||
IDWriteU16BE = ID(0x18A)
|
IDWriteU8 = ID(0x131)
|
||||||
IDWriteU16LE = ID(0x18B)
|
IDWriteU16BE = ID(0x132)
|
||||||
IDWriteU32BE = ID(0x18C)
|
IDWriteU16LE = ID(0x133)
|
||||||
IDWriteU32LE = ID(0x18D)
|
IDWriteU32BE = ID(0x134)
|
||||||
IDWriteU64BE = ID(0x18E)
|
IDWriteU32LE = ID(0x135)
|
||||||
IDWriteU64LE = ID(0x18F)
|
IDWriteU64BE = ID(0x136)
|
||||||
|
IDWriteU64LE = ID(0x137)
|
||||||
|
|
||||||
|
IDUnderscore = ID(0x140)
|
||||||
|
IDThis = ID(0x141)
|
||||||
|
IDIn = ID(0x142)
|
||||||
|
IDOut = ID(0x143)
|
||||||
|
IDBase = ID(0x144)
|
||||||
|
|
||||||
|
// -------- 0x200 block.
|
||||||
|
|
||||||
IDIsError = ID(0x200)
|
IDIsError = ID(0x200)
|
||||||
IDIsOK = ID(0x201)
|
IDIsOK = ID(0x201)
|
||||||
@@ -444,15 +458,9 @@ const (
|
|||||||
IDSetLimit = ID(0x20D)
|
IDSetLimit = ID(0x20D)
|
||||||
IDLowBits = ID(0x20E)
|
IDLowBits = ID(0x20E)
|
||||||
IDHighBits = ID(0x20F)
|
IDHighBits = ID(0x20F)
|
||||||
IDUnreadU8 = ID(0x210)
|
IDUnroll = ID(0x210)
|
||||||
IDUnroll = ID(0x211)
|
IDMark = ID(0x211)
|
||||||
|
IDSinceMark = ID(0x212)
|
||||||
IDEmptyStruct = ID(0x308)
|
|
||||||
IDBool = ID(0x309)
|
|
||||||
IDStatus = ID(0x30A)
|
|
||||||
IDIOReader = ID(0x30B)
|
|
||||||
IDIOWriter = ID(0x30C)
|
|
||||||
IDImageConfig = ID(0x30D)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var builtInsByID = [nBuiltInIDs]string{
|
var builtInsByID = [nBuiltInIDs]string{
|
||||||
@@ -561,6 +569,32 @@ var builtInsByID = [nBuiltInIDs]string{
|
|||||||
ID128: "128",
|
ID128: "128",
|
||||||
ID256: "256",
|
ID256: "256",
|
||||||
|
|
||||||
|
// -------- 0x100 block.
|
||||||
|
|
||||||
|
IDEmptyStruct: "empty_struct",
|
||||||
|
IDBool: "bool",
|
||||||
|
IDStatus: "status",
|
||||||
|
IDIOReader: "io_reader",
|
||||||
|
IDIOWriter: "io_writer",
|
||||||
|
IDCapitalT: "T",
|
||||||
|
IDImageConfig: "image_config",
|
||||||
|
|
||||||
|
// IDDiamond and IDDoubleZ are never returned by the tokenizer, as the
|
||||||
|
// tokenizer rejects non-ASCII input.
|
||||||
|
//
|
||||||
|
// The string representations ""◊ and "ℤ" are specifically non-ASCII so
|
||||||
|
// that no user-defined (non built-in) identifier will conflict with them.
|
||||||
|
|
||||||
|
// IDDiamond is used by the type checker as a dummy-valued built-in ID to
|
||||||
|
// represent a generic type.
|
||||||
|
IDDiamond: "◊", // U+25C7 WHITE DIAMOND
|
||||||
|
|
||||||
|
// IDDoubleZ is used by the type checker as a dummy-valued built-in ID to
|
||||||
|
// represent an ideal integer type (in mathematical terms, the integer ring
|
||||||
|
// ℤ), as opposed to a realized integer type whose range is restricted. For
|
||||||
|
// example, the base.u16 type is restricted to [0x0000, 0xFFFF].
|
||||||
|
IDDoubleZ: "ℤ", // U+2124 DOUBLE-STRUCK CAPITAL Z
|
||||||
|
|
||||||
// Change MaxIntBits if a future update adds an i128 or u128 type.
|
// Change MaxIntBits if a future update adds an i128 or u128 type.
|
||||||
IDI8: "i8",
|
IDI8: "i8",
|
||||||
IDI16: "i16",
|
IDI16: "i16",
|
||||||
@@ -571,38 +605,15 @@ var builtInsByID = [nBuiltInIDs]string{
|
|||||||
IDU32: "u32",
|
IDU32: "u32",
|
||||||
IDU64: "u64",
|
IDU64: "u64",
|
||||||
|
|
||||||
// IDDoubleZ and IDDiamond are never returned by the tokenizer, as the
|
IDUnreadU8: "unread_u8",
|
||||||
// tokenizer rejects non-ASCII input.
|
IDReadU8: "read_u8",
|
||||||
//
|
IDReadU16BE: "read_u16be",
|
||||||
// The string representations "ℤ" and "◊" are specifically non-ASCII so
|
IDReadU16LE: "read_u16le",
|
||||||
// that no user-defined (non built-in) identifier will conflict with them.
|
IDReadU32BE: "read_u32be",
|
||||||
|
IDReadU32LE: "read_u32le",
|
||||||
|
IDReadU64BE: "read_u64be",
|
||||||
|
IDReadU64LE: "read_u64le",
|
||||||
|
|
||||||
// IDDoubleZ is used by the type checker as a dummy-valued built-in ID to
|
|
||||||
// represent an ideal integer type (in mathematical terms, the integer ring
|
|
||||||
// ℤ), as opposed to a realized integer type whose range is restricted. For
|
|
||||||
// example, the base.u16 type is restricted to [0x0000, 0xFFFF].
|
|
||||||
IDDoubleZ: "ℤ", // U+2124 DOUBLE-STRUCK CAPITAL Z
|
|
||||||
|
|
||||||
// IDDiamond is used by the type checker as a dummy-valued built-in ID to
|
|
||||||
// represent a generic type.
|
|
||||||
IDDiamond: "◊", // U+25C7 WHITE DIAMOND
|
|
||||||
|
|
||||||
IDUnderscore: "_",
|
|
||||||
IDThis: "this",
|
|
||||||
IDIn: "in",
|
|
||||||
IDOut: "out",
|
|
||||||
IDCapitalT: "T",
|
|
||||||
IDBase: "base",
|
|
||||||
|
|
||||||
IDMark: "mark",
|
|
||||||
IDReadU8: "read_u8",
|
|
||||||
IDReadU16BE: "read_u16be",
|
|
||||||
IDReadU16LE: "read_u16le",
|
|
||||||
IDReadU32BE: "read_u32be",
|
|
||||||
IDReadU32LE: "read_u32le",
|
|
||||||
IDReadU64BE: "read_u64be",
|
|
||||||
IDReadU64LE: "read_u64le",
|
|
||||||
IDSinceMark: "since_mark",
|
|
||||||
IDWriteU8: "write_u8",
|
IDWriteU8: "write_u8",
|
||||||
IDWriteU16BE: "write_u16be",
|
IDWriteU16BE: "write_u16be",
|
||||||
IDWriteU16LE: "write_u16le",
|
IDWriteU16LE: "write_u16le",
|
||||||
@@ -611,6 +622,14 @@ var builtInsByID = [nBuiltInIDs]string{
|
|||||||
IDWriteU64BE: "write_u64be",
|
IDWriteU64BE: "write_u64be",
|
||||||
IDWriteU64LE: "write_u64le",
|
IDWriteU64LE: "write_u64le",
|
||||||
|
|
||||||
|
IDUnderscore: "_",
|
||||||
|
IDThis: "this",
|
||||||
|
IDIn: "in",
|
||||||
|
IDOut: "out",
|
||||||
|
IDBase: "base",
|
||||||
|
|
||||||
|
// -------- 0x200 block.
|
||||||
|
|
||||||
IDIsError: "is_error",
|
IDIsError: "is_error",
|
||||||
IDIsOK: "is_ok",
|
IDIsOK: "is_ok",
|
||||||
IDIsSuspension: "is_suspension",
|
IDIsSuspension: "is_suspension",
|
||||||
@@ -627,15 +646,9 @@ var builtInsByID = [nBuiltInIDs]string{
|
|||||||
IDSetLimit: "set_limit",
|
IDSetLimit: "set_limit",
|
||||||
IDLowBits: "low_bits",
|
IDLowBits: "low_bits",
|
||||||
IDHighBits: "high_bits",
|
IDHighBits: "high_bits",
|
||||||
IDUnreadU8: "unread_u8",
|
|
||||||
IDUnroll: "unroll",
|
IDUnroll: "unroll",
|
||||||
|
IDMark: "mark",
|
||||||
IDEmptyStruct: "empty_struct",
|
IDSinceMark: "since_mark",
|
||||||
IDBool: "bool",
|
|
||||||
IDStatus: "status",
|
|
||||||
IDIOReader: "io_reader",
|
|
||||||
IDIOWriter: "io_writer",
|
|
||||||
IDImageConfig: "image_config",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var builtInsByName = map[string]ID{}
|
var builtInsByName = map[string]ID{}
|
||||||
|
|||||||
Reference in new issue
Block a user