1
0
Fork 0
forked from AbleOS/ableos

Added ProtocolDeclaration datatype

This commit is contained in:
Talha Qamar 2024-09-11 09:00:08 +05:00
parent f9451e3d7d
commit 45950fdb34

View file

@ -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<FuncDeclaration>,
}
#[derive(Debug, Clone, PartialEq)]
struct FuncDeclaration {
name : String,
input_types : Vec<String>,
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<Iter<'_, Token>>) -> Option<u64> {
}
result
}