Export parsing
This commit is contained in:
@@ -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
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user