Function parse_format

Source
pub fn parse_format(input: &str) -> IResult<&str, Value>
Expand description

Parses a format value from input text.

This function parses format values according to the AIMX grammar syntax: "Instruction" <format> "Example1", "Example2", ...

The parser expects:

  1. Optional whitespace
  2. A quoted instruction text
  3. Optional whitespace
  4. A format specification enclosed in angle brackets
  5. Optional whitespace
  6. A comma-separated list of quoted example texts

§Arguments

  • input - The input string to parse

§Returns

  • IResult<&str, Value> - A nom result with remaining input and parsed format value

§Examples

use aimx::values::parse_format;
 
let result = parse_format(r#""Display as currency" <$0.00> "$42.00", "$123.45""#);
assert!(result.is_ok());
 
let (remaining, format_value) = result.unwrap();
assert!(format_value.is_format());
assert_eq!(remaining, "");

See also: crate::values::format::parse_string_array, crate::literals::parse_text, crate::literals::parse_tag