Function parse_literal_type

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

Parse a literal type definition from a string.

This function is similar to parse_typedef but only accepts literal types (Bool, Date, Number, Task, Text) and does not support array types or special types. It’s used in contexts where only basic value types are expected.

§Arguments

  • input - A string slice containing the literal type definition to parse

§Returns

  • IResult<&str, Typedef> - A nom result with remaining input and parsed literal type

§Examples

use aimx::typedef::{parse_literal_type, Typedef};
 
assert_eq!(parse_literal_type("Bool"), Ok(("", Typedef::Bool)));
assert_eq!(parse_literal_type("Number"), Ok(("", Typedef::Number)));
assert_eq!(parse_literal_type("Text"), Ok(("", Typedef::Text)));