Skip to content

Fix string literal escaping and allow variable-width runtime state - #236

Merged
someone235 merged 2 commits into
kaspanet:masterfrom
someone235:fixes2
Aug 30, 2026
Merged

Fix string literal escaping and allow variable-width runtime state#236
someone235 merged 2 commits into
kaspanet:masterfrom
someone235:fixes2

Conversation

@someone235

Copy link
Copy Markdown
Contributor

This change makes SilverScript string literals follow JSON escape semantics and allows portable artifacts to contain canonically encoded variable-width runtime state.

Language Behavior Changes

  • String literals must now use double quotes. Single-quoted strings are no longer accepted.
string valid = "It's working";
// string invalid = 'text';
  • Escape sequences are decoded using JSON semantics, including escaped quotes, backslashes, control characters, Unicode escapes, and surrogate pairs. Malformed or unsupported escapes are
    rejected.
string message = "line 1\nline 2";
string quoted = "She said \"hello\"";
string path = "left\\right";
string unicode = "\u6771";
  • Formatting SilverScript produces canonical double-quoted strings without changing their decoded bytes. In particular, a literal backslash followed by a quote remains distinct:
string constant VALUE = "\\\"";
  • Portable ABI artifacts now accept canonically encoded variable-width runtime state, including strings, dynamic byte arrays, and dynamic arrays with decodable elements.
contract VariableState(string initial) {
    string stored = initial;

    entry main() {
        require(stored == "hello");
    }
}

Compiler and CLI artifacts containing this state can now be verified and consumed normally.

@someone235
someone235 merged commit eedf555 into kaspanet:master Aug 30, 2026
4 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