Function axon_parser::parse_func[][src]

pub fn parse_func(axon: &str) -> Result<Func, Error>
Expand description

If the axon input represents a function, return a ast::Func.

The axon argument to this function should be a string containing the output of running toAxonCode(parseAst( ... )) in SkySpark.

Example

use axon_parser::parse_func;

let axon = r###"{type:"func", params:[], body:{type:"block", exprs:[{type:"literal", val:"hello world"}]}}"###;
let func = parse_func(axon).unwrap();
assert!(func.params.len() == 0)