From 45950fdb34cebc44676da06aa30b4432361d5ab7 Mon Sep 17 00:00:00 2001 From: Talha Qamar Date: Wed, 11 Sep 2024 09:00:08 +0500 Subject: [PATCH] Added ProtocolDeclaration datatype --- dev/src/idl/parser.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dev/src/idl/parser.rs b/dev/src/idl/parser.rs index de9b9bd..f3cffa3 100644 --- a/dev/src/idl/parser.rs +++ b/dev/src/idl/parser.rs @@ -9,7 +9,7 @@ enum Declaration{ EnumDeclaration(EnumDeclaration), StructDeclaration(StructDeclaration), TypeDeclaration(TypeDeclaration), - ProtocolDeclaration, + ProtocolDeclaration(ProtocolDeclaration), } #[derive(Debug, Clone, PartialEq)] struct StructDeclaration { @@ -38,6 +38,19 @@ struct EnumMember { number: u64, } +#[derive(Debug, Clone, PartialEq)] +struct ProtocolDeclaration{ + name : String, + interface : Vec, +} + +#[derive(Debug, Clone, PartialEq)] +struct FuncDeclaration { + name : String, + input_types : Vec, + return_type : String, +} + /// Consume's a token that's expected. If the token that's consumed is not /// the given expected token then panic @@ -200,3 +213,4 @@ fn parse_number(tokens : &mut Peekable>) -> Option { } result } +