mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-24 16:08:55 +03:00
Add parser support
This commit is contained in:
parent
e96475b3e2
commit
1049822979
@ -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)) {
|
||||
|
@ -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,
|
||||
|
@ -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 */ // "#
|
||||
);
|
||||
});
|
||||
|
@ -179,6 +179,7 @@ pub const KEYWORD_TOKENS: &[Token] = &[
|
||||
Token::Record,
|
||||
Token::Return,
|
||||
Token::SelfLower,
|
||||
Token::Signature,
|
||||
Token::Scalar,
|
||||
Token::String,
|
||||
Token::Struct,
|
||||
|
Loading…
Reference in New Issue
Block a user