Function parse_typedef

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

Parse a type definition from a string according to the AIM expression grammar syntax.

This function parses type names and array markers to create the appropriate Typedef variant. It supports both basic types and array types.

§Supported Type Names

  • Any - Wildcard type that matches any value
  • Bool - Boolean type
  • Date - Date type
  • Number - Number type
  • Task - Task type
  • Text - Text type

§Special Types

  • Eval - Evaluation type
  • Format - Format type
  • Node - Node type

§Arguments

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

§Returns

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

§Examples

use aimx::typedef::{parse_typedef, Typedef};
 
assert_eq!(parse_typedef("Bool"), Ok(("", Typedef::Bool)));
assert_eq!(parse_typedef("Number[]"), Ok(("", Typedef::NumberArray)));
assert_eq!(parse_typedef("Text[]"), Ok(("", Typedef::TextArray)));