Skip to main content

gram_parse_to_json

Function gram_parse_to_json 

Source
pub fn gram_parse_to_json(input: &str) -> Result<String, String>
Expand description

Parse gram notation and return a JSON array string of AstPattern objects.

§Arguments

  • input - Gram notation text

§Returns

  • Ok(String) - JSON array of AstPattern objects
  • Err(String) - Parse error message

§Examples

use gram_codec::json::gram_parse_to_json;

let json = gram_parse_to_json("(alice:Person)").unwrap();
assert!(json.contains("alice"));
assert!(json.contains("Person"));