mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 16:52:18 +01:00
lang/parse: struct private data now needs a "+"
This commit is contained in:
1 parent
f5eb38d76e
commit
49fa501f0d
13 files changed
+18
-12
No files matched your search
@@ -6,6 +6,7 @@
|
|||||||
The dot points below probably aren't of interest unless you're _writing_ Wuffs
|
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).
|
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
|
- `wuffsfmt` double-indents hanging lines and each indent is now 4 spaces (not
|
||||||
a tab).
|
a tab).
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ to a 100-element array of unsigned 32-bit integers. Types can also be
|
|||||||
## Structs
|
## Structs
|
||||||
|
|
||||||
Structs are a list of fields, enclosed in parentheses: `struct foo(x: base.u32,
|
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.
|
initialized](/doc/note/initialization.md#partial-zero-initialization) fields.
|
||||||
The struct name, `foo`, may be followed by a question mark `?`, which means
|
The struct name, `foo`, may be followed by a question mark `?`, which means
|
||||||
that its methods may be [coroutines](/doc/note/coroutines.md).
|
that its methods may be [coroutines](/doc/note/coroutines.md).
|
||||||
|
|||||||
+6
-1
@@ -344,7 +344,12 @@ func (p *parser) parseTopLevelDecl() (*a.Node, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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)
|
extraFields, err := p.parseList(t.IDCloseParen, (*parser).parseExtraFieldNode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ func Render(w io.Writer, tm *t.Map, src []t.Token, comments []string) (err error
|
|||||||
buf = appendTabs(buf, indent+indentAdjustment)
|
buf = appendTabs(buf, indent+indentAdjustment)
|
||||||
|
|
||||||
// Apply or update varNameLength.
|
// Apply or update varNameLength.
|
||||||
if len(lineTokens) < 3 {
|
if len(lineTokens) < 4 {
|
||||||
varNameLength = 0
|
varNameLength = 0
|
||||||
} else {
|
} else {
|
||||||
id0 := lineTokens[0].ID
|
id0 := lineTokens[0].ID
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ pub struct decoder? implements base.image_decoder(
|
|||||||
|
|
||||||
swizzler : base.pixel_swizzler,
|
swizzler : base.pixel_swizzler,
|
||||||
util : base.utility,
|
util : base.utility,
|
||||||
)(
|
) + (
|
||||||
// scratch is one of:
|
// scratch is one of:
|
||||||
// - 2048 bytes = 256 * (8 bytes per BGRA_NONPREMUL_4X16LE).
|
// - 2048 bytes = 256 * (8 bytes per BGRA_NONPREMUL_4X16LE).
|
||||||
// - 1024 bytes = 1024 * (1 byte per INDEXED__BGRA_BINARY), plus
|
// - 1024 bytes = 1024 * (1 byte per INDEXED__BGRA_BINARY), plus
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ pub struct decoder? implements base.io_transformer(
|
|||||||
code_lengths_bitmask : base.u32,
|
code_lengths_bitmask : base.u32,
|
||||||
|
|
||||||
util : base.utility,
|
util : base.utility,
|
||||||
)(
|
) + (
|
||||||
scratch : base.u32,
|
scratch : base.u32,
|
||||||
|
|
||||||
letter_counts : array[256] base.u32,
|
letter_counts : array[256] base.u32,
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ pub struct decoder? implements base.token_decoder(
|
|||||||
end_of_data : base.bool,
|
end_of_data : base.bool,
|
||||||
|
|
||||||
util : base.utility,
|
util : base.utility,
|
||||||
)(
|
) + (
|
||||||
// stack is conceptually an array of 2-bit integers, implemented as an
|
// 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
|
// array of u32. The N'th 2-bit pair is whether we're in an array or
|
||||||
// object, where N is the recursion depth:
|
// object, where N is the recursion depth:
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ pub struct decoder? implements base.io_transformer(
|
|||||||
end_of_block : base.bool,
|
end_of_block : base.bool,
|
||||||
|
|
||||||
util : base.utility,
|
util : base.utility,
|
||||||
)(
|
) + (
|
||||||
// huffs and n_huffs_bits are the lookup tables for Huffman decodings.
|
// 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
|
// There are up to 2 Huffman decoders active at any one time. As per this
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ pub struct decoder? implements base.image_decoder(
|
|||||||
swizzler : base.pixel_swizzler,
|
swizzler : base.pixel_swizzler,
|
||||||
|
|
||||||
util : base.utility,
|
util : base.utility,
|
||||||
)(
|
) + (
|
||||||
compressed : array[4096] base.u8,
|
compressed : array[4096] base.u8,
|
||||||
|
|
||||||
// palettes[0] and palettes[1] are the Global and Local Color Table.
|
// palettes[0] and palettes[1] are the Global and Local Color Table.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ pub struct decoder? implements base.token_decoder(
|
|||||||
comment_type : base.u8,
|
comment_type : base.u8,
|
||||||
|
|
||||||
util : base.utility,
|
util : base.utility,
|
||||||
)(
|
) + (
|
||||||
// stack is conceptually an array of bits, implemented as an array of u32.
|
// 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
|
// The N'th bit being 0 or 1 means that we're in an array or object, where
|
||||||
// N is the recursion depth.
|
// N is the recursion depth.
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ pub struct decoder? implements base.io_transformer(
|
|||||||
prefixes : array[4096] base.u16[..= 4095],
|
prefixes : array[4096] base.u16[..= 4095],
|
||||||
|
|
||||||
util : base.utility,
|
util : base.utility,
|
||||||
)(
|
) + (
|
||||||
// read_from per-code state.
|
// read_from per-code state.
|
||||||
suffixes : array[4096] array[8] base.u8,
|
suffixes : array[4096] array[8] base.u8,
|
||||||
// lm1s is the "length minus 1"s of the values for the implicit key-value
|
// lm1s is the "length minus 1"s of the values for the implicit key-value
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ pub struct decoder? implements base.image_decoder(
|
|||||||
|
|
||||||
swizzler : base.pixel_swizzler,
|
swizzler : base.pixel_swizzler,
|
||||||
util : base.utility,
|
util : base.utility,
|
||||||
)(
|
) + (
|
||||||
crc32 : crc32.ieee_hasher,
|
crc32 : crc32.ieee_hasher,
|
||||||
zlib : zlib.decoder,
|
zlib : zlib.decoder,
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ pub struct decoder? implements base.image_decoder(
|
|||||||
|
|
||||||
swizzler : base.pixel_swizzler,
|
swizzler : base.pixel_swizzler,
|
||||||
util : base.utility,
|
util : base.utility,
|
||||||
)(
|
) + (
|
||||||
dst_palette : array[4 * 256] base.u8,
|
dst_palette : array[4 * 256] base.u8,
|
||||||
src_palette : array[4 * 256] base.u8,
|
src_palette : array[4 * 256] base.u8,
|
||||||
scratch : array[4] base.u8,
|
scratch : array[4] base.u8,
|
||||||
|
|||||||
Reference in new issue
Block a user