diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index 09f913112e..c260d1fb3c 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -343,6 +343,19 @@ impl ParserContext<'_> { right: Box::new(args.swap_remove(0)), id: self.node_builder.next_id(), })) + } else if let (2, Some(CoreFunction::SignatureVerify)) = + (args.len(), CoreFunction::from_symbols(sym::signature, method.name)) + { + Ok(Expression::Access(AccessExpression::AssociatedFunction(AssociatedFunction { + ty: Type::Identifier(Identifier::new(sym::signature)), + name: method, + arguments: { + let mut arguments = vec![receiver]; + arguments.extend(args); + arguments + }, + span, + }))) } else { // Attempt to parse the method call as a mapping operation. match (args.len(), CoreFunction::from_symbols(sym::Mapping, method.name)) { diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index 5c814de8b7..15f09c3c72 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -412,6 +412,7 @@ impl Token { "record" => Token::Record, "return" => Token::Return, "scalar" => Token::Scalar, + "signature" => Token::Signature, "self" => Token::SelfLower, "string" => Token::String, "struct" => Token::Struct, diff --git a/compiler/parser/src/tokenizer/mod.rs b/compiler/parser/src/tokenizer/mod.rs index 52889174c8..6942e78a22 100644 --- a/compiler/parser/src/tokenizer/mod.rs +++ b/compiler/parser/src/tokenizer/mod.rs @@ -114,6 +114,7 @@ mod tests { return scalar self + signature string struct test @@ -169,7 +170,7 @@ mod tests { assert_eq!( output, - r#""test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" test_ident 12345 address as assert assert_eq assert_neq async bool const else false field finalize for function group i128 i64 i32 i16 i8 if in inline input let mut private program public return scalar self string struct test then transition true u128 u64 u32 u16 u8 console ! != && ( ) * ** + , - -> => _ . .. / : ; < <= = == > >= [ ] { { } } || ? @ // test + r#""test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" test_ident 12345 address as assert assert_eq assert_neq async bool const else false field finalize for function group i128 i64 i32 i16 i8 if in inline input let mut private program public return scalar self signature string struct test then transition true u128 u64 u32 u16 u8 console ! != && ( ) * ** + , - -> => _ . .. / : ; < <= = == > >= [ ] { { } } || ? @ // test /* test */ // "# ); }); diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index 87abe8e9d6..b346c34d35 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -179,6 +179,7 @@ pub const KEYWORD_TOKENS: &[Token] = &[ Token::Record, Token::Return, Token::SelfLower, + Token::Signature, Token::Scalar, Token::String, Token::Struct,