mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 08:52:18 +01:00
Remove the 'mark' concept, no longer necessary.
This commit is contained in:
1 parent
4aa9fce311
commit
6f132a74e2
14 files changed
+83
-176
No files matched your search
@@ -54,12 +54,6 @@ typedef struct {
|
|||||||
bool closed; // No further writes are expected.
|
bool closed; // No further writes are expected.
|
||||||
} puffs_base_buf1;
|
} puffs_base_buf1;
|
||||||
|
|
||||||
// puffs_base_buf1_mark marks a position (pointer + offset) in a
|
|
||||||
// puffs_base_buf1.
|
|
||||||
typedef struct {
|
|
||||||
uint8_t* ptr;
|
|
||||||
} puffs_base_buf1_mark;
|
|
||||||
|
|
||||||
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
||||||
// its first N bytes. That N can be greater than a buffer's current read or
|
// its first N bytes. That N can be greater than a buffer's current read or
|
||||||
// write capacity. N decreases naturally over time as bytes are read from or
|
// write capacity. N decreases naturally over time as bytes are read from or
|
||||||
|
|||||||
@@ -79,20 +79,6 @@ static inline puffs_base_slice_u8 puffs_base_make_slice_u8_from_ints(
|
|||||||
return ((puffs_base_slice_u8){});
|
return ((puffs_base_slice_u8){});
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline puffs_base_slice_u8 puffs_base_make_slice_u8_from_ptrs(
|
|
||||||
uint8_t* start,
|
|
||||||
uint8_t* mark0,
|
|
||||||
uint8_t* mark1,
|
|
||||||
uint8_t* end) {
|
|
||||||
if ((start <= mark0) && (mark0 <= mark1) && (mark1 <= end)) {
|
|
||||||
return ((puffs_base_slice_u8){
|
|
||||||
.ptr = mark0,
|
|
||||||
.len = mark1 - mark0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return ((puffs_base_slice_u8){});
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_i(
|
static inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_i(
|
||||||
puffs_base_slice_u8 s,
|
puffs_base_slice_u8 s,
|
||||||
uint64_t i) {
|
uint64_t i) {
|
||||||
|
|||||||
@@ -7,17 +7,16 @@ package cgen
|
|||||||
|
|
||||||
const baseHeader = "" +
|
const baseHeader = "" +
|
||||||
"#ifndef PUFFS_BASE_HEADER_H\n#define PUFFS_BASE_HEADER_H\n\n// Use of this source code is governed by a BSD-style license that can be found\n// in the LICENSE file.\n\n#include <stdbool.h>\n#include <stdint.h>\n#include <string.h>\n\n// Puffs requires a word size of at least 32 bits because it assumes that\n// converting a u32 to usize will never overflow. For example, the size of a\n// decoded image is often represented, explicitly or implicitly in an image\n// file, as a u32, and it is convenient to compare that to a buffer size.\n//\n// Similarly, the word size is at most 64 bits because it assumes that\n// converting a usize to u64 will never overflow.\n#if __WORDSIZE < 32\n#error \"Puffs requires a word size of at least 32 bits\"\n#elif __WORDSIZE > 64\n#error \"Puffs requires a word size of at most 64 bits\"\n#endif\n\n// PUFFS_VERSION is the major.minor version number as a uint32. The major\n// number is the high 16 bits. The minor number is the low 16 bits.\n//\n// The intention is to bump the version number at least on every API " +
|
"#ifndef PUFFS_BASE_HEADER_H\n#define PUFFS_BASE_HEADER_H\n\n// Use of this source code is governed by a BSD-style license that can be found\n// in the LICENSE file.\n\n#include <stdbool.h>\n#include <stdint.h>\n#include <string.h>\n\n// Puffs requires a word size of at least 32 bits because it assumes that\n// converting a u32 to usize will never overflow. For example, the size of a\n// decoded image is often represented, explicitly or implicitly in an image\n// file, as a u32, and it is convenient to compare that to a buffer size.\n//\n// Similarly, the word size is at most 64 bits because it assumes that\n// converting a usize to u64 will never overflow.\n#if __WORDSIZE < 32\n#error \"Puffs requires a word size of at least 32 bits\"\n#elif __WORDSIZE > 64\n#error \"Puffs requires a word size of at most 64 bits\"\n#endif\n\n// PUFFS_VERSION is the major.minor version number as a uint32. The major\n// number is the high 16 bits. The minor number is the low 16 bits.\n//\n// The intention is to bump the version number at least on every API " +
|
||||||
"/ ABI\n// backwards incompatible change.\n//\n// For now, the API and ABI are simply unstable and can change at any time.\n//\n// TODO: don't hard code this in base-header.h.\n#define PUFFS_VERSION (0x00001)\n\n// puffs_base_slice_u8 is a 1-dimensional buffer (a pointer and length).\n//\n// A value with all fields NULL or zero is a valid, empty slice.\ntypedef struct {\n uint8_t* ptr;\n size_t len;\n} puffs_base_slice_u8;\n\n// puffs_base_buf1 is a 1-dimensional buffer (a pointer and length), plus\n// additional indexes into that buffer, plus an opened / closed flag.\n//\n// A value with all fields NULL or zero is a valid, empty buffer.\ntypedef struct {\n uint8_t* ptr; // Pointer.\n size_t len; // Length.\n size_t wi; // Write index. Invariant: wi <= len.\n size_t ri; // Read index. Invariant: ri <= wi.\n bool closed; // No further writes are expected.\n} puffs_base_buf1;\n\n// puffs_base_buf1_mark marks a position (pointer + offset) in a\n// puffs_base_buf1.\ntypedef struct {\n uint8_t* ptr;\n} puffs_base_buf1_mark;" +
|
"/ ABI\n// backwards incompatible change.\n//\n// For now, the API and ABI are simply unstable and can change at any time.\n//\n// TODO: don't hard code this in base-header.h.\n#define PUFFS_VERSION (0x00001)\n\n// puffs_base_slice_u8 is a 1-dimensional buffer (a pointer and length).\n//\n// A value with all fields NULL or zero is a valid, empty slice.\ntypedef struct {\n uint8_t* ptr;\n size_t len;\n} puffs_base_slice_u8;\n\n// puffs_base_buf1 is a 1-dimensional buffer (a pointer and length), plus\n// additional indexes into that buffer, plus an opened / closed flag.\n//\n// A value with all fields NULL or zero is a valid, empty buffer.\ntypedef struct {\n uint8_t* ptr; // Pointer.\n size_t len; // Length.\n size_t wi; // Write index. Invariant: wi <= len.\n size_t ri; // Read index. Invariant: ri <= wi.\n bool closed; // No further writes are expected.\n} puffs_base_buf1;\n\n// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:\n// its first N bytes. That N can be greater than a buffer's curr" +
|
||||||
"\n\n// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:\n// its first N bytes. That N can be greater than a buffer's current read or\n// write capacity. N decreases naturally over time as bytes are read from or\n// written to the stream.\n//\n// A value with all fields NULL or zero is a valid, unlimited view.\ntypedef struct puffs_base_limit1 {\n uint64_t* ptr_to_len; // Pointer to N.\n struct puffs_base_limit1* next; // Linked list of limits.\n} puffs_base_limit1;\n\ntypedef struct {\n puffs_base_buf1* buf;\n puffs_base_limit1 limit;\n} puffs_base_reader1;\n\ntypedef struct {\n puffs_base_buf1* buf;\n puffs_base_limit1 limit;\n} puffs_base_writer1;\n\n#endif // PUFFS_BASE_HEADER_H\n" +
|
"ent read or\n// write capacity. N decreases naturally over time as bytes are read from or\n// written to the stream.\n//\n// A value with all fields NULL or zero is a valid, unlimited view.\ntypedef struct puffs_base_limit1 {\n uint64_t* ptr_to_len; // Pointer to N.\n struct puffs_base_limit1* next; // Linked list of limits.\n} puffs_base_limit1;\n\ntypedef struct {\n puffs_base_buf1* buf;\n puffs_base_limit1 limit;\n} puffs_base_reader1;\n\ntypedef struct {\n puffs_base_buf1* buf;\n puffs_base_limit1 limit;\n} puffs_base_writer1;\n\n#endif // PUFFS_BASE_HEADER_H\n" +
|
||||||
""
|
""
|
||||||
|
|
||||||
const baseImpl = "" +
|
const baseImpl = "" +
|
||||||
"#ifndef PUFFS_BASE_IMPL_H\n#define PUFFS_BASE_IMPL_H\n\n// Use of this source code is governed by a BSD-style license that can be found\n// in the LICENSE file.\n\n#define PUFFS_IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x)\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use a trivial macro instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define PUFFS_COROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; \\\n case n:\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define PUFFS_LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define PUFFS_UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n// Declare the printf prototype. The generated code shouldn't need this at all,\n// but it's useful for manual printf debugging.\nextern int printf(const char* __restrict __format, ...);\n#else\n#define PUFFS_LIKELY(expr) (expr)\n#de" +
|
"#ifndef PUFFS_BASE_IMPL_H\n#define PUFFS_BASE_IMPL_H\n\n// Use of this source code is governed by a BSD-style license that can be found\n// in the LICENSE file.\n\n#define PUFFS_IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x)\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use a trivial macro instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define PUFFS_COROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; \\\n case n:\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define PUFFS_LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define PUFFS_UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n// Declare the printf prototype. The generated code shouldn't need this at all,\n// but it's useful for manual printf debugging.\nextern int printf(const char* __restrict __format, ...);\n#else\n#define PUFFS_LIKELY(expr) (expr)\n#de" +
|
||||||
"fine PUFFS_UNLIKELY(expr) (expr)\n#endif\n\n// ---------------- Static Inline Functions\n//\n// The helpers below are functions, instead of macros, because their arguments\n// can be an expression that we shouldn't evaluate more than once.\n//\n// They are in base-impl.h and hence copy/pasted into every generated C file,\n// instead of being in some \"base.c\" file, since a design goal is that users of\n// the generated C code can often just #include a single .c file, such as\n// \"gif.c\", without having to additionally include or otherwise build and link\n// a \"base.c\" file.\n//\n// They are static, so that linking multiple puffs .o files won't complain about\n// duplicate function definitions.\n//\n// They are explicitly marked inline, even if modern compilers don't use the\n// inline attribute to guide optimizations such as inlining, to avoid the\n// -Wunused-function warning, and we like to compile with -Wall -Werror.\n\nstatic inline uint16_t puffs_base_load_u16be(uint8_t* p) {\n return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1" +
|
"fine PUFFS_UNLIKELY(expr) (expr)\n#endif\n\n// ---------------- Static Inline Functions\n//\n// The helpers below are functions, instead of macros, because their arguments\n// can be an expression that we shouldn't evaluate more than once.\n//\n// They are in base-impl.h and hence copy/pasted into every generated C file,\n// instead of being in some \"base.c\" file, since a design goal is that users of\n// the generated C code can often just #include a single .c file, such as\n// \"gif.c\", without having to additionally include or otherwise build and link\n// a \"base.c\" file.\n//\n// They are static, so that linking multiple puffs .o files won't complain about\n// duplicate function definitions.\n//\n// They are explicitly marked inline, even if modern compilers don't use the\n// inline attribute to guide optimizations such as inlining, to avoid the\n// -Wunused-function warning, and we like to compile with -Wall -Werror.\n\nstatic inline uint16_t puffs_base_load_u16be(uint8_t* p) {\n return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1" +
|
||||||
"]) << 0);\n}\n\nstatic inline uint16_t puffs_base_load_u16le(uint8_t* p) {\n return ((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8);\n}\n\nstatic inline uint32_t puffs_base_load_u32be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |\n ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0);\n}\n\nstatic inline uint32_t puffs_base_load_u32le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24);\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_make_slice_u8_from_ints(\n uint8_t* start,\n uint64_t i,\n uint64_t j,\n uint64_t k) {\n if ((i <= j) && (j <= k) && (k <= SIZE_MAX)) {\n return ((puffs_base_slice_u8){\n .ptr = start + i,\n .len = j - i,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_make_slice_u8_from_ptrs(\n uint8_t* start,\n uint8_t* mark0,\n uint8_t* mark1,\n uint8_t* end) {\n if ((start <= mark0) && (mark0 <= mark1) && " +
|
"]) << 0);\n}\n\nstatic inline uint16_t puffs_base_load_u16le(uint8_t* p) {\n return ((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8);\n}\n\nstatic inline uint32_t puffs_base_load_u32be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |\n ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0);\n}\n\nstatic inline uint32_t puffs_base_load_u32le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24);\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_make_slice_u8_from_ints(\n uint8_t* start,\n uint64_t i,\n uint64_t j,\n uint64_t k) {\n if ((i <= j) && (j <= k) && (k <= SIZE_MAX)) {\n return ((puffs_base_slice_u8){\n .ptr = start + i,\n .len = j - i,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_i(\n puffs_base_slice_u8 s,\n uint64_t i) {\n if ((i <= SIZE_MAX) && (i <= s.len)) {\n return ((puffs_base_slice_u8){\n " +
|
||||||
"(mark1 <= end)) {\n return ((puffs_base_slice_u8){\n .ptr = mark0,\n .len = mark1 - mark0,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_i(\n puffs_base_slice_u8 s,\n uint64_t i) {\n if ((i <= SIZE_MAX) && (i <= s.len)) {\n return ((puffs_base_slice_u8){\n .ptr = s.ptr + i,\n .len = s.len - i,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_j(\n puffs_base_slice_u8 s,\n uint64_t j) {\n if ((j <= SIZE_MAX) && (j <= s.len)) {\n return ((puffs_base_slice_u8){.ptr = s.ptr, .len = j});\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_ij(\n puffs_base_slice_u8 s,\n uint64_t i,\n uint64_t j) {\n if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) {\n return ((puffs_base_slice_u8){\n .ptr = s.ptr + i,\n .len = j - i,\n });\n }\n return ((puffs_base_slice_u8){" +
|
" .ptr = s.ptr + i,\n .len = s.len - i,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_j(\n puffs_base_slice_u8 s,\n uint64_t j) {\n if ((j <= SIZE_MAX) && (j <= s.len)) {\n return ((puffs_base_slice_u8){.ptr = s.ptr, .len = j});\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_ij(\n puffs_base_slice_u8 s,\n uint64_t i,\n uint64_t j) {\n if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) {\n return ((puffs_base_slice_u8){\n .ptr = s.ptr + i,\n .len = j - i,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\n// puffs_base_slice_u8_prefix returns up to the first n bytes of s.\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_prefix(\n puffs_base_slice_u8 s,\n uint64_t n) {\n if ((uint64_t)(s.len) > n) {\n s.len = n;\n }\n return s;\n}\n\n// puffs_base_slice_u8_suffix returns up to the last n bytes of s.\nstatic inline puffs_base_slice_u8 puff" +
|
||||||
"});\n}\n\n// puffs_base_slice_u8_prefix returns up to the first n bytes of s.\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_prefix(\n puffs_base_slice_u8 s,\n uint64_t n) {\n if ((uint64_t)(s.len) > n) {\n s.len = n;\n }\n return s;\n}\n\n// puffs_base_slice_u8_suffix returns up to the last n bytes of s.\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_suffix(\n puffs_base_slice_u8 s,\n uint64_t n) {\n if ((uint64_t)(s.len) > n) {\n s.ptr += (uint64_t)(s.len) - n;\n s.len = n;\n }\n return s;\n}\n\n// puffs_base_slice_u8_copy_from calls memmove(dst.ptr, src.ptr, n) where n is\n// the minimum of dst.len and src.len.\n//\n// Passing a puffs_base_slice_u8 with all fields NULL or zero (a valid, empty\n// slice) is valid and results in a no-op.\nstatic inline uint64_t puffs_base_slice_u8_copy_from(puffs_base_slice_u8 dst,\n puffs_base_slice_u8 src) {\n size_t n = dst.len < src.len ? dst.len : src.len;\n if (n > 0) {\n memmove(dst.ptr, src.ptr, n);\n " +
|
"s_base_slice_u8_suffix(\n puffs_base_slice_u8 s,\n uint64_t n) {\n if ((uint64_t)(s.len) > n) {\n s.ptr += (uint64_t)(s.len) - n;\n s.len = n;\n }\n return s;\n}\n\n// puffs_base_slice_u8_copy_from calls memmove(dst.ptr, src.ptr, n) where n is\n// the minimum of dst.len and src.len.\n//\n// Passing a puffs_base_slice_u8 with all fields NULL or zero (a valid, empty\n// slice) is valid and results in a no-op.\nstatic inline uint64_t puffs_base_slice_u8_copy_from(puffs_base_slice_u8 dst,\n puffs_base_slice_u8 src) {\n size_t n = dst.len < src.len ? dst.len : src.len;\n if (n > 0) {\n memmove(dst.ptr, src.ptr, n);\n }\n return n;\n}\n\n#endif // PUFFS_BASE_IMPL_H\n" +
|
||||||
" }\n return n;\n}\n\n#endif // PUFFS_BASE_IMPL_H\n" +
|
|
||||||
""
|
""
|
||||||
|
|
||||||
type template_args_short_read struct {
|
type template_args_short_read struct {
|
||||||
|
|||||||
@@ -148,16 +148,6 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
|||||||
b.writes(")")
|
b.writes(")")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if isInDst(g.tm, n, t.KeyMark, 0) {
|
|
||||||
if pp == parenthesesMandatory {
|
|
||||||
b.writeb('(')
|
|
||||||
}
|
|
||||||
b.printf("(puffs_base_buf1_mark){.ptr= %swptr_dst}", bPrefix)
|
|
||||||
if pp == parenthesesMandatory {
|
|
||||||
b.writeb(')')
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if isInDst(g.tm, n, t.KeySlice, 0) {
|
if isInDst(g.tm, n, t.KeySlice, 0) {
|
||||||
b.printf("((puffs_base_slice_u8){ .ptr = %swstart_dst, .len = %swptr_dst - %swstart_dst, })",
|
b.printf("((puffs_base_slice_u8){ .ptr = %swstart_dst, .len = %swptr_dst - %swstart_dst, })",
|
||||||
bPrefix, bPrefix, bPrefix)
|
bPrefix, bPrefix, bPrefix)
|
||||||
@@ -452,21 +442,20 @@ func (g *gen) writeCTypeName(b *buffer, n *a.TypeExpr, varNamePrefix string, var
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cTypeNames = [...]string{
|
var cTypeNames = [...]string{
|
||||||
t.KeyI8: "int8_t",
|
t.KeyI8: "int8_t",
|
||||||
t.KeyI16: "int16_t",
|
t.KeyI16: "int16_t",
|
||||||
t.KeyI32: "int32_t",
|
t.KeyI32: "int32_t",
|
||||||
t.KeyI64: "int64_t",
|
t.KeyI64: "int64_t",
|
||||||
t.KeyU8: "uint8_t",
|
t.KeyU8: "uint8_t",
|
||||||
t.KeyU16: "uint16_t",
|
t.KeyU16: "uint16_t",
|
||||||
t.KeyU32: "uint32_t",
|
t.KeyU32: "uint32_t",
|
||||||
t.KeyU64: "uint64_t",
|
t.KeyU64: "uint64_t",
|
||||||
t.KeyUsize: "size_t",
|
t.KeyUsize: "size_t",
|
||||||
t.KeyBool: "bool",
|
t.KeyBool: "bool",
|
||||||
t.KeyBuf1: "puffs_base_buf1",
|
t.KeyBuf1: "puffs_base_buf1",
|
||||||
t.KeyBuf1Mark: "puffs_base_buf1_mark",
|
t.KeyReader1: "puffs_base_reader1",
|
||||||
t.KeyReader1: "puffs_base_reader1",
|
t.KeyWriter1: "puffs_base_writer1",
|
||||||
t.KeyWriter1: "puffs_base_writer1",
|
t.KeyBuf2: "puffs_base_buf2",
|
||||||
t.KeyBuf2: "puffs_base_buf2",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var cOpNames = [256]string{
|
var cOpNames = [256]string{
|
||||||
|
|||||||
@@ -454,8 +454,8 @@ func (g *gen) writeCallSuspendibles(b *buffer, n *a.Expr, depth uint32) error {
|
|||||||
// TODO: it's not a BAD_ARGUMENT if we can copy from the sliding window.
|
// TODO: it's not a BAD_ARGUMENT if we can copy from the sliding window.
|
||||||
//
|
//
|
||||||
// TODO: %s%s.buf->ptr might be a NULL pointer dereference. In any
|
// TODO: %s%s.buf->ptr might be a NULL pointer dereference. In any
|
||||||
// case, we need to compare the (resumed) distance against a mark, not
|
// case, we need to compare the (resumed) distance against the
|
||||||
// against the beginning of the dst buffer.
|
// b_wstart_dst pointer, not against the beginning of the dst buffer.
|
||||||
b.printf("if (PUFFS_UNLIKELY((%s%d == 0) || (%s%d > (%swptr_%s - %s%s.buf->ptr)))) { "+
|
b.printf("if (PUFFS_UNLIKELY((%s%d == 0) || (%s%d > (%swptr_%s - %s%s.buf->ptr)))) { "+
|
||||||
"status = %sERROR_BAD_ARGUMENT; goto exit; }\n",
|
"status = %sERROR_BAD_ARGUMENT; goto exit; }\n",
|
||||||
tPrefix, temp0, tPrefix, temp0, bPrefix, wName, aPrefix, wName, g.PKGPREFIX)
|
tPrefix, temp0, tPrefix, temp0, bPrefix, wName, aPrefix, wName, g.PKGPREFIX)
|
||||||
@@ -709,7 +709,7 @@ func isInSrc(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
|
func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
|
||||||
callSuspendible := methodName != t.KeyMark && methodName != t.KeySlice
|
callSuspendible := methodName != t.KeySlice
|
||||||
// TODO: check that n.Args() is "(x:bar)".
|
// TODO: check that n.Args() is "(x:bar)".
|
||||||
if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
|
if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -57,12 +57,6 @@ typedef struct {
|
|||||||
bool closed; // No further writes are expected.
|
bool closed; // No further writes are expected.
|
||||||
} puffs_base_buf1;
|
} puffs_base_buf1;
|
||||||
|
|
||||||
// puffs_base_buf1_mark marks a position (pointer + offset) in a
|
|
||||||
// puffs_base_buf1.
|
|
||||||
typedef struct {
|
|
||||||
uint8_t* ptr;
|
|
||||||
} puffs_base_buf1_mark;
|
|
||||||
|
|
||||||
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
||||||
// its first N bytes. That N can be greater than a buffer's current read or
|
// its first N bytes. That N can be greater than a buffer's current read or
|
||||||
// write capacity. N decreases naturally over time as bytes are read from or
|
// write capacity. N decreases naturally over time as bytes are read from or
|
||||||
@@ -368,20 +362,6 @@ static inline puffs_base_slice_u8 puffs_base_make_slice_u8_from_ints(
|
|||||||
return ((puffs_base_slice_u8){});
|
return ((puffs_base_slice_u8){});
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline puffs_base_slice_u8 puffs_base_make_slice_u8_from_ptrs(
|
|
||||||
uint8_t* start,
|
|
||||||
uint8_t* mark0,
|
|
||||||
uint8_t* mark1,
|
|
||||||
uint8_t* end) {
|
|
||||||
if ((start <= mark0) && (mark0 <= mark1) && (mark1 <= end)) {
|
|
||||||
return ((puffs_base_slice_u8){
|
|
||||||
.ptr = mark0,
|
|
||||||
.len = mark1 - mark0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return ((puffs_base_slice_u8){});
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_i(
|
static inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_i(
|
||||||
puffs_base_slice_u8 s,
|
puffs_base_slice_u8 s,
|
||||||
uint64_t i) {
|
uint64_t i) {
|
||||||
|
|||||||
@@ -57,12 +57,6 @@ typedef struct {
|
|||||||
bool closed; // No further writes are expected.
|
bool closed; // No further writes are expected.
|
||||||
} puffs_base_buf1;
|
} puffs_base_buf1;
|
||||||
|
|
||||||
// puffs_base_buf1_mark marks a position (pointer + offset) in a
|
|
||||||
// puffs_base_buf1.
|
|
||||||
typedef struct {
|
|
||||||
uint8_t* ptr;
|
|
||||||
} puffs_base_buf1_mark;
|
|
||||||
|
|
||||||
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
||||||
// its first N bytes. That N can be greater than a buffer's current read or
|
// its first N bytes. That N can be greater than a buffer's current read or
|
||||||
// write capacity. N decreases naturally over time as bytes are read from or
|
// write capacity. N decreases naturally over time as bytes are read from or
|
||||||
@@ -338,20 +332,6 @@ static inline puffs_base_slice_u8 puffs_base_make_slice_u8_from_ints(
|
|||||||
return ((puffs_base_slice_u8){});
|
return ((puffs_base_slice_u8){});
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline puffs_base_slice_u8 puffs_base_make_slice_u8_from_ptrs(
|
|
||||||
uint8_t* start,
|
|
||||||
uint8_t* mark0,
|
|
||||||
uint8_t* mark1,
|
|
||||||
uint8_t* end) {
|
|
||||||
if ((start <= mark0) && (mark0 <= mark1) && (mark1 <= end)) {
|
|
||||||
return ((puffs_base_slice_u8){
|
|
||||||
.ptr = mark0,
|
|
||||||
.len = mark1 - mark0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return ((puffs_base_slice_u8){});
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_i(
|
static inline puffs_base_slice_u8 puffs_base_make_slice_u8_subslice_i(
|
||||||
puffs_base_slice_u8 s,
|
puffs_base_slice_u8 s,
|
||||||
uint64_t i) {
|
uint64_t i) {
|
||||||
|
|||||||
@@ -57,12 +57,6 @@ typedef struct {
|
|||||||
bool closed; // No further writes are expected.
|
bool closed; // No further writes are expected.
|
||||||
} puffs_base_buf1;
|
} puffs_base_buf1;
|
||||||
|
|
||||||
// puffs_base_buf1_mark marks a position (pointer + offset) in a
|
|
||||||
// puffs_base_buf1.
|
|
||||||
typedef struct {
|
|
||||||
uint8_t* ptr;
|
|
||||||
} puffs_base_buf1_mark;
|
|
||||||
|
|
||||||
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
||||||
// its first N bytes. That N can be greater than a buffer's current read or
|
// its first N bytes. That N can be greater than a buffer's current read or
|
||||||
// write capacity. N decreases naturally over time as bytes are read from or
|
// write capacity. N decreases naturally over time as bytes are read from or
|
||||||
|
|||||||
@@ -57,12 +57,6 @@ typedef struct {
|
|||||||
bool closed; // No further writes are expected.
|
bool closed; // No further writes are expected.
|
||||||
} puffs_base_buf1;
|
} puffs_base_buf1;
|
||||||
|
|
||||||
// puffs_base_buf1_mark marks a position (pointer + offset) in a
|
|
||||||
// puffs_base_buf1.
|
|
||||||
typedef struct {
|
|
||||||
uint8_t* ptr;
|
|
||||||
} puffs_base_buf1_mark;
|
|
||||||
|
|
||||||
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:
|
||||||
// its first N bytes. That N can be greater than a buffer's current read or
|
// its first N bytes. That N can be greater than a buffer's current read or
|
||||||
// write capacity. N decreases naturally over time as bytes are read from or
|
// write capacity. N decreases naturally over time as bytes are read from or
|
||||||
|
|||||||
+1
-1
@@ -519,7 +519,7 @@ func (n *TypeExpr) HasPointers() bool {
|
|||||||
case 0:
|
case 0:
|
||||||
// TODO: add t.KeyReader1, after figuring out how limit's should really work.
|
// TODO: add t.KeyReader1, after figuring out how limit's should really work.
|
||||||
switch n.id1.Key() {
|
switch n.id1.Key() {
|
||||||
case t.KeyBuf1, t.KeyBuf1Mark, t.KeyWriter1, t.KeyBuf2:
|
case t.KeyBuf1, t.KeyWriter1, t.KeyBuf2:
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
case t.KeyPtr, t.KeyNptr, t.KeyColon:
|
case t.KeyPtr, t.KeyNptr, t.KeyColon:
|
||||||
|
|||||||
@@ -654,7 +654,7 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
|
|||||||
isInSrc(q.tm, n, t.KeySkip32, 1) ||
|
isInSrc(q.tm, n, t.KeySkip32, 1) ||
|
||||||
isInDst(q.tm, n, t.KeyWrite, 1) || isInDst(q.tm, n, t.KeyWriteU8, 1) ||
|
isInDst(q.tm, n, t.KeyWrite, 1) || isInDst(q.tm, n, t.KeyWriteU8, 1) ||
|
||||||
isInDst(q.tm, n, t.KeyCopyFrom32, 2) || isInDst(q.tm, n, t.KeyCopyHistory32, 2) ||
|
isInDst(q.tm, n, t.KeyCopyFrom32, 2) || isInDst(q.tm, n, t.KeyCopyHistory32, 2) ||
|
||||||
isInDst(q.tm, n, t.KeyMark, 0) || isInDst(q.tm, n, t.KeySlice, 0) ||
|
isInDst(q.tm, n, t.KeySlice, 0) ||
|
||||||
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
|
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
|
||||||
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
|
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
|
||||||
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_huffman", 2) ||
|
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_huffman", 2) ||
|
||||||
|
|||||||
+7
-8
@@ -56,14 +56,13 @@ func trimQuotes(s string) string {
|
|||||||
|
|
||||||
// typeExprFoo is an *ast.Node MType (implicit type).
|
// typeExprFoo is an *ast.Node MType (implicit type).
|
||||||
var (
|
var (
|
||||||
typeExprBool = a.NewTypeExpr(0, t.IDBool, nil, nil, nil)
|
typeExprBool = a.NewTypeExpr(0, t.IDBool, nil, nil, nil)
|
||||||
typeExprIdeal = a.NewTypeExpr(0, t.IDDoubleZ, nil, nil, nil)
|
typeExprIdeal = a.NewTypeExpr(0, t.IDDoubleZ, nil, nil, nil)
|
||||||
typeExprList = a.NewTypeExpr(0, t.IDDollar, nil, nil, nil)
|
typeExprList = a.NewTypeExpr(0, t.IDDollar, nil, nil, nil)
|
||||||
typeExprBuf1Mark = a.NewTypeExpr(0, t.IDBuf1Mark, nil, nil, nil)
|
typeExprStatus = a.NewTypeExpr(0, t.IDStatus, nil, nil, nil)
|
||||||
typeExprStatus = a.NewTypeExpr(0, t.IDStatus, nil, nil, nil)
|
typeExprU8 = a.NewTypeExpr(0, t.IDU8, nil, nil, nil)
|
||||||
typeExprU8 = a.NewTypeExpr(0, t.IDU8, nil, nil, nil)
|
typeExprU64 = a.NewTypeExpr(0, t.IDU64, nil, nil, nil)
|
||||||
typeExprU64 = a.NewTypeExpr(0, t.IDU64, nil, nil, nil)
|
typeExprSliceU8 = a.NewTypeExpr(t.IDColon, 0, nil, nil, typeExprU8)
|
||||||
typeExprSliceU8 = a.NewTypeExpr(t.IDColon, 0, nil, nil, typeExprU8)
|
|
||||||
|
|
||||||
// TODO: delete this.
|
// TODO: delete this.
|
||||||
typeExprPlaceholder = a.NewTypeExpr(0, t.IDU8, nil, nil, nil)
|
typeExprPlaceholder = a.NewTypeExpr(0, t.IDU8, nil, nil, nil)
|
||||||
|
|||||||
+3
-5
@@ -354,7 +354,7 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
|
|||||||
isInSrc(q.tm, n, t.KeySkip32, 1) ||
|
isInSrc(q.tm, n, t.KeySkip32, 1) ||
|
||||||
isInDst(q.tm, n, t.KeyWrite, 1) || isInDst(q.tm, n, t.KeyWriteU8, 1) ||
|
isInDst(q.tm, n, t.KeyWrite, 1) || isInDst(q.tm, n, t.KeyWriteU8, 1) ||
|
||||||
isInDst(q.tm, n, t.KeyCopyFrom32, 2) || isInDst(q.tm, n, t.KeyCopyHistory32, 2) ||
|
isInDst(q.tm, n, t.KeyCopyFrom32, 2) || isInDst(q.tm, n, t.KeyCopyHistory32, 2) ||
|
||||||
isInDst(q.tm, n, t.KeyMark, 0) || isInDst(q.tm, n, t.KeySlice, 0) ||
|
isInDst(q.tm, n, t.KeySlice, 0) ||
|
||||||
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
|
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
|
||||||
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
|
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
|
||||||
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_huffman", 2) ||
|
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_huffman", 2) ||
|
||||||
@@ -376,8 +376,6 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
|
|||||||
n.SetMType(typeExprPlaceholder32) // HACK.
|
n.SetMType(typeExprPlaceholder32) // HACK.
|
||||||
} else if isInSrc(q.tm, n, t.KeyReadU16BE, 0) || isInSrc(q.tm, n, t.KeyReadU16LE, 0) {
|
} else if isInSrc(q.tm, n, t.KeyReadU16BE, 0) || isInSrc(q.tm, n, t.KeyReadU16LE, 0) {
|
||||||
n.SetMType(typeExprPlaceholder16) // HACK.
|
n.SetMType(typeExprPlaceholder16) // HACK.
|
||||||
} else if isInDst(q.tm, n, t.KeyMark, 0) {
|
|
||||||
n.SetMType(typeExprBuf1Mark)
|
|
||||||
} else if isInDst(q.tm, n, t.KeySlice, 0) {
|
} else if isInDst(q.tm, n, t.KeySlice, 0) {
|
||||||
n.SetMType(typeExprSliceU8) // HACK.
|
n.SetMType(typeExprSliceU8) // HACK.
|
||||||
} else {
|
} else {
|
||||||
@@ -593,7 +591,7 @@ func isInSrc(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
|
func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
|
||||||
callSuspendible := methodName != t.KeyMark && methodName != t.KeySlice
|
callSuspendible := methodName != t.KeySlice
|
||||||
// TODO: check that n.Args() is "(x:bar)".
|
// TODO: check that n.Args() is "(x:bar)".
|
||||||
if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
|
if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
|
||||||
return false
|
return false
|
||||||
@@ -958,7 +956,7 @@ swtch:
|
|||||||
// TODO: reject. You can only refine numeric types.
|
// TODO: reject. You can only refine numeric types.
|
||||||
}
|
}
|
||||||
if name := n.Name().Key(); name == t.KeyBool || name == t.KeyStatus ||
|
if name := n.Name().Key(); name == t.KeyBool || name == t.KeyStatus ||
|
||||||
name == t.KeyBuf1Mark || name == t.KeyReader1 || name == t.KeyWriter1 {
|
name == t.KeyReader1 || name == t.KeyWriter1 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
for _, s := range q.c.structs {
|
for _, s := range q.c.structs {
|
||||||
|
|||||||
+49
-55
@@ -231,22 +231,21 @@ const (
|
|||||||
KeyTrue = Key(IDTrue >> KeyShift)
|
KeyTrue = Key(IDTrue >> KeyShift)
|
||||||
KeyZero = Key(IDZero >> KeyShift)
|
KeyZero = Key(IDZero >> KeyShift)
|
||||||
|
|
||||||
KeyI8 = Key(IDI8 >> KeyShift)
|
KeyI8 = Key(IDI8 >> KeyShift)
|
||||||
KeyI16 = Key(IDI16 >> KeyShift)
|
KeyI16 = Key(IDI16 >> KeyShift)
|
||||||
KeyI32 = Key(IDI32 >> KeyShift)
|
KeyI32 = Key(IDI32 >> KeyShift)
|
||||||
KeyI64 = Key(IDI64 >> KeyShift)
|
KeyI64 = Key(IDI64 >> KeyShift)
|
||||||
KeyU8 = Key(IDU8 >> KeyShift)
|
KeyU8 = Key(IDU8 >> KeyShift)
|
||||||
KeyU16 = Key(IDU16 >> KeyShift)
|
KeyU16 = Key(IDU16 >> KeyShift)
|
||||||
KeyU32 = Key(IDU32 >> KeyShift)
|
KeyU32 = Key(IDU32 >> KeyShift)
|
||||||
KeyU64 = Key(IDU64 >> KeyShift)
|
KeyU64 = Key(IDU64 >> KeyShift)
|
||||||
KeyUsize = Key(IDUsize >> KeyShift)
|
KeyUsize = Key(IDUsize >> KeyShift)
|
||||||
KeyBool = Key(IDBool >> KeyShift)
|
KeyBool = Key(IDBool >> KeyShift)
|
||||||
KeyBuf1 = Key(IDBuf1 >> KeyShift)
|
KeyBuf1 = Key(IDBuf1 >> KeyShift)
|
||||||
KeyBuf1Mark = Key(IDBuf1Mark >> KeyShift)
|
KeyReader1 = Key(IDReader1 >> KeyShift)
|
||||||
KeyReader1 = Key(IDReader1 >> KeyShift)
|
KeyWriter1 = Key(IDWriter1 >> KeyShift)
|
||||||
KeyWriter1 = Key(IDWriter1 >> KeyShift)
|
KeyBuf2 = Key(IDBuf2 >> KeyShift)
|
||||||
KeyBuf2 = Key(IDBuf2 >> KeyShift)
|
KeyStatus = Key(IDStatus >> KeyShift)
|
||||||
KeyStatus = Key(IDStatus >> KeyShift)
|
|
||||||
|
|
||||||
KeyUnderscore = Key(IDUnderscore >> KeyShift)
|
KeyUnderscore = Key(IDUnderscore >> KeyShift)
|
||||||
KeyThis = Key(IDThis >> KeyShift)
|
KeyThis = Key(IDThis >> KeyShift)
|
||||||
@@ -281,7 +280,6 @@ const (
|
|||||||
KeySkip32 = Key(IDSkip32 >> KeyShift)
|
KeySkip32 = Key(IDSkip32 >> KeyShift)
|
||||||
KeySkip64 = Key(IDSkip64 >> KeyShift)
|
KeySkip64 = Key(IDSkip64 >> KeyShift)
|
||||||
KeyCopyHistory32 = Key(IDCopyHistory32 >> KeyShift)
|
KeyCopyHistory32 = Key(IDCopyHistory32 >> KeyShift)
|
||||||
KeyMark = Key(IDMark >> KeyShift)
|
|
||||||
KeySlice = Key(IDSlice >> KeyShift)
|
KeySlice = Key(IDSlice >> KeyShift)
|
||||||
KeyLength = Key(IDLength >> KeyShift)
|
KeyLength = Key(IDLength >> KeyShift)
|
||||||
KeyPrefix = Key(IDPrefix >> KeyShift)
|
KeyPrefix = Key(IDPrefix >> KeyShift)
|
||||||
@@ -411,22 +409,21 @@ const (
|
|||||||
IDTrue = ID(0x81<<KeyShift | FlagsLiteral | FlagsImplicitSemicolon)
|
IDTrue = ID(0x81<<KeyShift | FlagsLiteral | FlagsImplicitSemicolon)
|
||||||
IDZero = ID(0x82<<KeyShift | FlagsLiteral | FlagsImplicitSemicolon | FlagsNumLiteral)
|
IDZero = ID(0x82<<KeyShift | FlagsLiteral | FlagsImplicitSemicolon | FlagsNumLiteral)
|
||||||
|
|
||||||
IDI8 = ID(0x90<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
IDI8 = ID(0x90<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
||||||
IDI16 = ID(0x91<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
IDI16 = ID(0x91<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
||||||
IDI32 = ID(0x92<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
IDI32 = ID(0x92<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
||||||
IDI64 = ID(0x93<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
IDI64 = ID(0x93<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
||||||
IDU8 = ID(0x94<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
IDU8 = ID(0x94<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
||||||
IDU16 = ID(0x95<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
IDU16 = ID(0x95<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
||||||
IDU32 = ID(0x96<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
IDU32 = ID(0x96<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
||||||
IDU64 = ID(0x97<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
IDU64 = ID(0x97<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
||||||
IDUsize = ID(0x98<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
IDUsize = ID(0x98<<KeyShift | FlagsIdent | FlagsImplicitSemicolon | FlagsNumType)
|
||||||
IDBool = ID(0x99<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDBool = ID(0x99<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDBuf1 = ID(0x9A<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDBuf1 = ID(0x9A<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDBuf1Mark = ID(0x9B<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDReader1 = ID(0x9B<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDReader1 = ID(0x9C<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDWriter1 = ID(0x9C<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDWriter1 = ID(0x9D<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDBuf2 = ID(0x9D<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDBuf2 = ID(0x9E<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDStatus = ID(0x9E<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDStatus = ID(0x9F<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
|
||||||
|
|
||||||
IDUnderscore = ID(0xA0<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDUnderscore = ID(0xA0<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDThis = ID(0xA1<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDThis = ID(0xA1<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
@@ -461,11 +458,10 @@ const (
|
|||||||
IDSkip32 = ID(0xC6<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDSkip32 = ID(0xC6<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDSkip64 = ID(0xC7<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDSkip64 = ID(0xC7<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDCopyHistory32 = ID(0xC8<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDCopyHistory32 = ID(0xC8<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDMark = ID(0xC9<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDSlice = ID(0xC9<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDSlice = ID(0xCA<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDLength = ID(0xCA<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDLength = ID(0xCB<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDPrefix = ID(0xCB<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDPrefix = ID(0xCC<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
IDSuffix = ID(0xCC<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
||||||
IDSuffix = ID(0xCD<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// The IDXFoo IDs are not returned by the tokenizer. They are used by the
|
// The IDXFoo IDs are not returned by the tokenizer. They are used by the
|
||||||
@@ -613,22 +609,21 @@ var builtInsByKey = [nBuiltInKeys]struct {
|
|||||||
|
|
||||||
// Change MaxIntBits if a future update adds an i128 or u128 type.
|
// Change MaxIntBits if a future update adds an i128 or u128 type.
|
||||||
|
|
||||||
KeyI8: {"i8", IDI8},
|
KeyI8: {"i8", IDI8},
|
||||||
KeyI16: {"i16", IDI16},
|
KeyI16: {"i16", IDI16},
|
||||||
KeyI32: {"i32", IDI32},
|
KeyI32: {"i32", IDI32},
|
||||||
KeyI64: {"i64", IDI64},
|
KeyI64: {"i64", IDI64},
|
||||||
KeyU8: {"u8", IDU8},
|
KeyU8: {"u8", IDU8},
|
||||||
KeyU16: {"u16", IDU16},
|
KeyU16: {"u16", IDU16},
|
||||||
KeyU32: {"u32", IDU32},
|
KeyU32: {"u32", IDU32},
|
||||||
KeyU64: {"u64", IDU64},
|
KeyU64: {"u64", IDU64},
|
||||||
KeyUsize: {"usize", IDUsize},
|
KeyUsize: {"usize", IDUsize},
|
||||||
KeyBool: {"bool", IDBool},
|
KeyBool: {"bool", IDBool},
|
||||||
KeyBuf1: {"buf1", IDBuf1},
|
KeyBuf1: {"buf1", IDBuf1},
|
||||||
KeyBuf1Mark: {"buf1_mark", IDBuf1Mark},
|
KeyReader1: {"reader1", IDReader1},
|
||||||
KeyReader1: {"reader1", IDReader1},
|
KeyWriter1: {"writer1", IDWriter1},
|
||||||
KeyWriter1: {"writer1", IDWriter1},
|
KeyBuf2: {"buf2", IDBuf2},
|
||||||
KeyBuf2: {"buf2", IDBuf2},
|
KeyStatus: {"status", IDStatus},
|
||||||
KeyStatus: {"status", IDStatus},
|
|
||||||
|
|
||||||
KeyUnderscore: {"_", IDUnderscore},
|
KeyUnderscore: {"_", IDUnderscore},
|
||||||
KeyThis: {"this", IDThis},
|
KeyThis: {"this", IDThis},
|
||||||
@@ -663,7 +658,6 @@ var builtInsByKey = [nBuiltInKeys]struct {
|
|||||||
KeySkip32: {"skip32", IDSkip32},
|
KeySkip32: {"skip32", IDSkip32},
|
||||||
KeySkip64: {"skip64", IDSkip64},
|
KeySkip64: {"skip64", IDSkip64},
|
||||||
KeyCopyHistory32: {"copy_history32", IDCopyHistory32},
|
KeyCopyHistory32: {"copy_history32", IDCopyHistory32},
|
||||||
KeyMark: {"mark", IDMark},
|
|
||||||
KeySlice: {"slice", IDSlice},
|
KeySlice: {"slice", IDSlice},
|
||||||
KeyLength: {"length", IDLength},
|
KeyLength: {"length", IDLength},
|
||||||
KeyPrefix: {"prefix", IDPrefix},
|
KeyPrefix: {"prefix", IDPrefix},
|
||||||
|
|||||||
Reference in new issue
Block a user