Skip to content

Add value literal parser for lossless round-tripping#13

Merged
colinrozzi merged 1 commit into
mainfrom
value-literal-parser
May 6, 2026
Merged

Add value literal parser for lossless round-tripping#13
colinrozzi merged 1 commit into
mainfrom
value-literal-parser

Conversation

@colinrozzi
Copy link
Copy Markdown
Owner

Summary

  • Update Value::Display to emit type suffixes on numbers (42u32, -5s8, 3.14f32), proper string/char escaping, and remove list truncation — making the format lossless
  • Add parse.rs with a hand-written recursive descent parser (FromStr for Value)
  • Fully no_std compatible, supports all Value variants
  • 15 unit tests including full round-trip verification

This enables lossless chain serialization: DisplayFromStrDisplay produces identical output, which is the foundation for chain replay from the human-readable format.

Format examples

42u32
"hello \"world\"\nbye"
actor-state{greeting: "Hello", count: 0u32}
color::rgb(255u8, 0u8, 128u8)
some("hello")
ok((actor-state{greeting: "Hi", count: 1u32}, "response"))

Test plan

  • All 23 existing pack-abi tests pass
  • 15 new parser tests pass
  • Compiles in no_std mode (packr-guest)
  • Round-trip test covers all Value variants

🤖 Generated with Claude Code

@colinrozzi colinrozzi force-pushed the value-literal-parser branch from b74404a to 922fb43 Compare May 6, 2026 04:22
@colinrozzi colinrozzi enabled auto-merge (squash) May 6, 2026 04:22
@colinrozzi colinrozzi merged commit 44b7950 into main May 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant