lang/parse: struct private data now needs a "+"

This commit is contained in:
Nigel Tao committed 2023-04-09 15:45:06 +10:00
1 parent f5eb38d76e
commit 49fa501f0d
13 files changed
+18 -12

No files matched your search

+1
View File
@@ -6,6 +6,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).
- Wuffs struct private data now needs a "+" between the "()" pairs.
- `wuffsfmt` double-indents hanging lines and each indent is now 4 spaces (not
a tab).
+1 -1
View File
@@ -49,7 +49,7 @@ to a 100-element array of unsigned 32-bit integers. Types can also be
## Structs
Structs are a list of fields, enclosed in parentheses: `struct foo(x: base.u32,
y: base.u32)`, possibly extended with a second list of [optionally
y: base.u32)`, possibly extended (by a `+`) with a second list of [optionally
initialized](/doc/note/initialization.md#partial-zero-initialization) fields.
The struct name, `foo`, may be followed by a question mark `?`, which means
that its methods may be [coroutines](/doc/note/coroutines.md).
+6 -1
View File
@@ -344,7 +344,12 @@ func (p *parser) parseTopLevelDecl() (*a.Node, error) {
if err != nil {
return nil, err
}
if x := p.peek1(); x == t.IDOpenParen {
if x := p.peek1(); x == t.IDPlus {
p.src = p.src[1:]
if x := p.peek1(); x != t.IDOpenParen {
return nil, fmt.Errorf(`parse: expected "(", got %q at %s:%d`,
p.tm.ByID(x), p.filename, p.line())
}
extraFields, err := p.parseList(t.IDCloseParen, (*parser).parseExtraFieldNode)
if err != nil {
return nil, err
+1 -1
View File
@@ -120,7 +120,7 @@ func Render(w io.Writer, tm *t.Map, src []t.Token, comments []string) (err error
buf = appendTabs(buf, indent+indentAdjustment)
// Apply or update varNameLength.
if len(lineTokens) < 3 {
if len(lineTokens) < 4 {
varNameLength = 0
} else {
id0 := lineTokens[0].ID
+1 -1
View File
@@ -72,7 +72,7 @@ pub struct decoder? implements base.image_decoder(
swizzler : base.pixel_swizzler,
util : base.utility,
)(
) + (
// scratch is one of:
// - 2048 bytes = 256 * (8 bytes per BGRA_NONPREMUL_4X16LE).
// - 1024 bytes = 1024 * (1 byte per INDEXED__BGRA_BINARY), plus
+1 -1
View File
@@ -57,7 +57,7 @@ pub struct decoder? implements base.io_transformer(
code_lengths_bitmask : base.u32,
util : base.utility,
)(
) + (
scratch : base.u32,
letter_counts : array[256] base.u32,
+1 -1
View File
@@ -94,7 +94,7 @@ pub struct decoder? implements base.token_decoder(
end_of_data : base.bool,
util : base.utility,
)(
) + (
// stack is conceptually an array of 2-bit integers, implemented as an
// array of u32. The N'th 2-bit pair is whether we're in an array or
// object, where N is the recursion depth:
+1 -1
View File
@@ -91,7 +91,7 @@ pub struct decoder? implements base.io_transformer(
end_of_block : base.bool,
util : base.utility,
)(
) + (
// huffs and n_huffs_bits are the lookup tables for Huffman decodings.
//
// There are up to 2 Huffman decoders active at any one time. As per this
+1 -1
View File
@@ -77,7 +77,7 @@ pub struct decoder? implements base.image_decoder(
swizzler : base.pixel_swizzler,
util : base.utility,
)(
) + (
compressed : array[4096] base.u8,
// palettes[0] and palettes[1] are the Global and Local Color Table.
+1 -1
View File
@@ -29,7 +29,7 @@ pub struct decoder? implements base.token_decoder(
comment_type : base.u8,
util : base.utility,
)(
) + (
// stack is conceptually an array of bits, implemented as an array of u32.
// The N'th bit being 0 or 1 means that we're in an array or object, where
// N is the recursion depth.
+1 -1
View File
@@ -58,7 +58,7 @@ pub struct decoder? implements base.io_transformer(
prefixes : array[4096] base.u16[..= 4095],
util : base.utility,
)(
) + (
// read_from per-code state.
suffixes : array[4096] array[8] base.u8,
// lm1s is the "length minus 1"s of the values for the implicit key-value
+1 -1
View File
@@ -143,7 +143,7 @@ pub struct decoder? implements base.image_decoder(
swizzler : base.pixel_swizzler,
util : base.utility,
)(
) + (
crc32 : crc32.ieee_hasher,
zlib : zlib.decoder,
+1 -1
View File
@@ -46,7 +46,7 @@ pub struct decoder? implements base.image_decoder(
swizzler : base.pixel_swizzler,
util : base.utility,
)(
) + (
dst_palette : array[4 * 256] base.u8,
src_palette : array[4 * 256] base.u8,
scratch : array[4] base.u8,