diff --git a/doc/changelog.md b/doc/changelog.md index 3d774130..4e7399f2 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -38,6 +38,7 @@ faster than Wuffs version 0.1 and about 2x faster than giflib (the C library). - Renamed `$(etc)` to `[etc]`. - Renamed `[i..j]` to `[i ..= j]`, consistent with Rust syntax. - Renamed `[N] T` and `[] T` types to `array[N] T` and `slice T`. +- Renamed `while:label` to `while.label`. - Renamed `u32`, `buf1`, etc to `base.u32`, `base.io_buffer`, etc. - Renamed `unread_u8?` to `undo_byte!`; added `can_undo_byte`. - Renamed some `decode?` methods to `decode_io_writer?`. diff --git a/lang/ast/ast.go b/lang/ast/ast.go index 7edc0b2f..5440f0ca 100644 --- a/lang/ast/ast.go +++ b/lang/ast/ast.go @@ -498,7 +498,7 @@ func NewIOBind(keyword t.ID, io *Expr, arg1 *Expr, body []*Node) *IOBind { } // Iterate is -// "iterate:ID1 (assigns)(length:ID2, unroll:ID0), List1 { List2 } else RHS": +// "iterate.ID1 (assigns)(length:ID2, unroll:ID0), List1 { List2 } else RHS": // - FlagsHasBreak is the iterate has an explicit break // - FlagsHasContinue is the iterate has an explicit continue // - ID0: unroll @@ -537,7 +537,7 @@ func NewIterate(label t.ID, assigns []*Node, length t.ID, unroll t.ID, asserts [ } } -// While is "while:ID1 MHS, List1 { List2 }": +// While is "while.ID1 MHS, List1 { List2 }": // - FlagsHasBreak is the while has an explicit break // - FlagsHasContinue is the while has an explicit continue // - ID1: <0|label> @@ -613,7 +613,7 @@ func NewRet(keyword t.ID, value *Expr) *Ret { } } -// Jump is "break" or "continue", with an optional label, "break:label": +// Jump is "break" or "continue", with an optional label, "break.label": // - ID0: // - ID1: <0|label> type Jump Node diff --git a/lang/check/check_test.go b/lang/check/check_test.go index a5cb210b..7e4f67cf 100644 --- a/lang/check/check_test.go +++ b/lang/check/check_test.go @@ -83,13 +83,13 @@ func TestCheck(tt *testing.T) { assert true - while:label p == q, + while.label p == q, pre true, inv true, post p <> q, { // Redundant, but shows the labeled jump syntax. - continue:label + continue.label } } `) + "\n" diff --git a/lang/parse/parse.go b/lang/parse/parse.go index bb2e1c4b..3c30e2f0 100644 --- a/lang/parse/parse.go +++ b/lang/parse/parse.go @@ -599,7 +599,7 @@ func (p *parser) parseStatement() (*a.Node, error) { } func (p *parser) parseLabel() (t.ID, error) { - if p.peek1() == t.IDColon { + if p.peek1() == t.IDDot { p.src = p.src[1:] return p.parseIdent() } diff --git a/std/deflate/decode_deflate.wuffs b/std/deflate/decode_deflate.wuffs index 9592d88d..412e8922 100644 --- a/std/deflate/decode_deflate.wuffs +++ b/std/deflate/decode_deflate.wuffs @@ -207,7 +207,7 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader) { var type base.u32 var status base.status - while:outer final == 0 { + while.outer final == 0 { while this.n_bits < 3, post this.n_bits >= 3, { @@ -247,11 +247,11 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader) { return status } if this.end_of_block { - continue:outer + continue.outer } this.decode_huffman_slow?(dst:args.dst, src:args.src) if this.end_of_block { - continue:outer + continue.outer } } } diff --git a/std/deflate/decode_huffman_fast.wuffs b/std/deflate/decode_huffman_fast.wuffs index 50c50dc3..c322c0b9 100644 --- a/std/deflate/decode_huffman_fast.wuffs +++ b/std/deflate/decode_huffman_fast.wuffs @@ -71,7 +71,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba // for each. There are also up to 13 extra bits, or 2 bytes. Thus, each // code requires up to 2 + 2 + 2 == 6 bytes, and there are two codes (one // from H-L and one from H-D). Therefore, we check for at least 12 bytes. - while:loop(args.dst.available() >= 258) and (args.src.available() >= 12) { + while.loop(args.dst.available() >= 258) and (args.src.available() >= 12) { // Ensure that we have at least 15 bits of input. if n_bits < 15 { assert n_bits >= 0 // TODO: this shouldn't be necessary. @@ -100,14 +100,14 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba if (table_entry >> 31) <> 0 { // Literal. args.dst.write_fast_u8!(a:((table_entry >> 8) & 0xFF) as base.u8) - continue:loop + continue.loop } else if (table_entry >> 30) <> 0 { // No-op; code continues past the if-else chain. assert args.src.available() >= 8 } else if (table_entry >> 29) <> 0 { // End of block. this.end_of_block = true - break:loop + break.loop } else if (table_entry >> 28) <> 0 { // Redirect. @@ -138,13 +138,13 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba if (table_entry >> 31) <> 0 { // Literal. args.dst.write_fast_u8!(a:((table_entry >> 8) & 0xFF) as base.u8) - continue:loop + continue.loop } else if (table_entry >> 30) <> 0 { // No-op; code continues past the if-else chain. } else if (table_entry >> 29) <> 0 { // End of block. this.end_of_block = true - break:loop + break.loop } else if (table_entry >> 28) <> 0 { return "#internal error: inconsistent Huffman decoder state" } else if (table_entry >> 27) <> 0 { @@ -342,7 +342,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba if length == 0 { // No need to copy from args.dst. - continue:loop + continue.loop } if ((dist_minus_1 + 1) as base.u64) > args.dst.history_available() { diff --git a/std/deflate/decode_huffman_slow.wuffs b/std/deflate/decode_huffman_slow.wuffs index c35e6f4c..e52d3a43 100644 --- a/std/deflate/decode_huffman_slow.wuffs +++ b/std/deflate/decode_huffman_slow.wuffs @@ -48,7 +48,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) { lmask = ((1 as base.u32) << this.n_huffs_bits[0]) - 1 dmask = ((1 as base.u32) << this.n_huffs_bits[1]) - 1 - while:loop not coroutine_resumed { + while.loop not coroutine_resumed { // Decode an lcode symbol from H-L. while true { table_entry = this.huffs[0][bits & lmask] @@ -67,13 +67,13 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) { if (table_entry >> 31) <> 0 { // Literal. args.dst.write_u8?(a:((table_entry >> 8) & 0xFF) as base.u8) - continue:loop + continue.loop } else if (table_entry >> 30) <> 0 { // No-op; code continues past the if-else chain. } else if (table_entry >> 29) <> 0 { // End of block. this.end_of_block = true - break:loop + break.loop } else if (table_entry >> 28) <> 0 { // Redirect. redir_top = (table_entry >> 8) & 0xFFFF @@ -95,13 +95,13 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) { if (table_entry >> 31) <> 0 { // Literal. args.dst.write_u8?(a:((table_entry >> 8) & 0xFF) as base.u8) - continue:loop + continue.loop } else if (table_entry >> 30) <> 0 { // No-op; code continues past the if-else chain. } else if (table_entry >> 29) <> 0 { // End of block. this.end_of_block = true - break:loop + break.loop } else if (table_entry >> 28) <> 0 { return "#internal error: inconsistent Huffman decoder state" } else if (table_entry >> 27) <> 0 { @@ -259,7 +259,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) { if length == 0 { // No need to copy from args.dst. - continue:loop + continue.loop } } diff --git a/std/gif/decode_gif.wuffs b/std/gif/decode_gif.wuffs index 1fa25fb3..93103546 100644 --- a/std/gif/decode_gif.wuffs +++ b/std/gif/decode_gif.wuffs @@ -1004,7 +1004,7 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader, var uncompressed slice base.u8 need_block_size = true - while:outer true { + while.outer true { if need_block_size { need_block_size = false block_size = args.src.read_u8_as_u64?() @@ -1044,7 +1044,7 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader, return base."#bad workbuf length" } - while:inner true { + while.inner true { if (this.compressed_ri > this.compressed_wi) or (this.compressed_wi > 4096) { return "#internal error: inconsistent ri/wi" } @@ -1072,11 +1072,11 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader, this.skip_blocks?(src:args.src) } - break:outer + break.outer } else if lzw_status == base."$short read" { - continue:outer + continue.outer } else if lzw_status == base."$short write" { - continue:inner + continue.inner } return lzw_status }