Export parsing

This commit is contained in:
2026-04-14 02:59:45 +02:00
parent 00569da11d
commit 2aef4c20be
2 changed files with 8 additions and 1 deletions
+2
View File
@@ -11,10 +11,12 @@ pub enum TypeExpr {
pub enum TopLevel { pub enum TopLevel {
Import(String), Import(String),
StructDecl { StructDecl {
export: bool,
name: String, name: String,
fields: ParamList, fields: ParamList,
}, },
FunctionDecl { FunctionDecl {
export: bool,
name: String, name: String,
params: ParamList, params: ParamList,
return_type: Option<TypeExpr>, return_type: Option<TypeExpr>,
+6 -1
View File
@@ -92,6 +92,7 @@ impl TopLevel {
// For now, we'll just ignore the function body and return an empty vector // For now, we'll just ignore the function body and return an empty vector
Some(TopLevel::FunctionDecl { Some(TopLevel::FunctionDecl {
export,
name, name,
params, params,
return_type, return_type,
@@ -115,7 +116,11 @@ impl TopLevel {
let fields_pair = inner.next().unwrap(); let fields_pair = inner.next().unwrap();
let fields = ParamList::from_pair(fields_pair); let fields = ParamList::from_pair(fields_pair);
Some(TopLevel::StructDecl { name, fields }) Some(TopLevel::StructDecl {
export,
name,
fields,
})
} }
Rule::EOI => None, Rule::EOI => None,