Skip to main content

parse_string

Function parse_string 

Source
pub fn parse_string(input: &str) -> Result<Program, Error>
Expand description

Parses a Tx3 source string into a Program AST.

§Arguments

  • input - String containing Tx3 source code

§Returns

  • Result<Program, Error> - The parsed Program AST or an error

§Errors

Returns an error if:

  • The input string is not valid Tx3 syntax
  • The AST construction fails

§Example

use tx3_lang::parsing::parse_string;
let program = parse_string("tx swap() {}").unwrap();