From c130678cafd70251052360b4327d5ae7bc3f46fd Mon Sep 17 00:00:00 2001 From: Mark <> Date: Thu, 15 Feb 2024 09:30:00 +0100 Subject: [PATCH] Change reference type syntax from &{t/y/p/e} to &[t/y/p/e] to avoid ambiguity with &{my: Int, object: String} --- mers_lib/src/parsing/types.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mers_lib/src/parsing/types.rs b/mers_lib/src/parsing/types.rs index 99b37bc..a6b3c70 100755 --- a/mers_lib/src/parsing/types.rs +++ b/mers_lib/src/parsing/types.rs @@ -14,6 +14,7 @@ pub enum ParsedType { Tuple(Vec>), Object(Vec<(String, Vec)>), Type(String), + Function(Vec<(Self, Self)>), TypeWithInfo(String, String), } @@ -24,18 +25,18 @@ pub fn parse_single_type(src: &mut Source, srca: &Arc) -> Result { src.next_char(); - if let Some('{') = src.peek_char() { + if let Some('[') = src.peek_char() { src.next_char(); let types = parse_type(src, srca)?; let nc = src.next_char(); - if !matches!(nc, Some('}')) { + if !matches!(nc, Some(']')) { let nc = if let Some(nc) = nc { format!("'{nc}'") } else { format!("EOF") }; return Err(CheckError::new().msg(format!( - "No closing }} in reference type with opening {{! Found {nc} instead" + "No closing ] in reference type with opening [! Found {nc} instead" ))); } ParsedType::Reference(types)