Function a2lfile::load_from_string
source · pub fn load_from_string(
a2ldata: &str,
a2ml_spec: Option<String>,
log_msgs: &mut Vec<String>,
strict_parsing: bool
) -> Result<A2lFile, String>Expand description
load a2l data stored in a string
a2ldata contains the text of an a2l file.
a2ml_spec is optional and contains a String that is valid A2ML that can be used while parsing the file in addition to the A2ML that might be contained inside the A2ML block in the file.
If a definition is provided here and there is also an A2ML block in the file, then the definition provided here will be tried first during parsing.
log_msgs is a reference to a Vec<String> which will receive all warning messages generated during parsing
strict_parsing toggles strict parsing: If strict parsing is enabled, most warnings become errors.
let text = r#"
ASAP2_VERSION 1 71
/begin PROJECT new_project ""
/begin MODULE new_module ""
/end MODULE
/end PROJECT
"#;
let mut log_msgs = Vec::<String>::new();
let a2l = a2lfile::load_from_string(&text, None, &mut log_msgs, true).unwrap();
assert_eq!(a2l.project.module[0].name, "new_module");