Skip to main content

parse_expression

Function parse_expression 

Source
pub fn parse_expression(
    expression: &str,
    default_namespace: &str,
    model: Option<&Model>,
) -> Result<Atom, ExpressionParseError>
Expand description

Parse graph input using canonical graph and tensor heads in function position. Bare scalars can name parameters and couplings of the supplied model, or the standard constants dim and Nc. Qualified names, Symbolica built-ins and the caller’s namespace for unknown symbols retain their ordinary Symbolica meanings. GammaLoop DOT retains its native spatial dot head in the gammalooprs namespace.

use feynkit_graph::symbols;
use feynkit_model::Model;
use symbolica::parse;
let weight = symbols::parse_expression("lam*Q(0,cind(0))", "example", Some(&Model::phi4()))?;
assert_eq!(weight, parse!("UFO::lam*gammalooprs::Q(0,spenso::cind(0))"));

§Errors

Returns the Symbolica parse error for invalid input.