forked from AbleOS/ableos
Added ProtocolDeclaration datatype
This commit is contained in:
parent
f9451e3d7d
commit
45950fdb34
|
@ -9,7 +9,7 @@ enum Declaration{
|
||||||
EnumDeclaration(EnumDeclaration),
|
EnumDeclaration(EnumDeclaration),
|
||||||
StructDeclaration(StructDeclaration),
|
StructDeclaration(StructDeclaration),
|
||||||
TypeDeclaration(TypeDeclaration),
|
TypeDeclaration(TypeDeclaration),
|
||||||
ProtocolDeclaration,
|
ProtocolDeclaration(ProtocolDeclaration),
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
struct StructDeclaration {
|
struct StructDeclaration {
|
||||||
|
@ -38,6 +38,19 @@ struct EnumMember {
|
||||||
number: u64,
|
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
|
/// Consume's a token that's expected. If the token that's consumed is not
|
||||||
/// the given expected token then panic
|
/// the given expected token then panic
|
||||||
|
@ -200,3 +213,4 @@ fn parse_number(tokens : &mut Peekable<Iter<'_, Token>>) -> Option<u64> {
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue