diff --git a/src/ast/mod.rs b/src/ast/mod.rs index 3386c9c..067b266 100644 --- a/src/ast/mod.rs +++ b/src/ast/mod.rs @@ -1,42 +1,42 @@ pub mod node { include!(concat!(env!("OUT_DIR"), "/src/ast/node.rs")); - + impl Default for Parameters { fn default() -> Self { Self::new(vec![]) - } + } } - + impl Default for GenericParameters { fn default() -> Self { Self::new(Box::new(IdentifierList::new(vec![]))) } } - + impl Default for GenericArguments { fn default() -> Self { Self::new(Box::new(TypeUseList::new(vec![]))) } } - + impl Default for ImplementsList { fn default() -> Self { Self::new(vec![]) } } - + impl ReturnType { pub fn void() -> Self { Self::new(Box::new(TypeUse::PrimitiveType(PrimitiveType::Void))) } } - + impl Default for ClassConstructor { fn default() -> Self { Self::new(vec![]) } } - + impl Default for ClosureParameters { fn default() -> Self { Self::new(vec![]) diff --git a/src/parser/ast.yaml b/src/parser/ast.yaml index 9893252..48554f0 100644 --- a/src/parser/ast.yaml +++ b/src/parser/ast.yaml @@ -143,13 +143,17 @@ ReturnType: # Top-level constructs CompilationUnit: children: - - parent_mod + - parent_mod: + optional: true - use_statements: rule: UseStatement vec: true - module_level_declarations: rule: ModuleLevelDeclaration vec: true + - eoi: + rule: EOI + skip: true ParentMod: children: - mod_kw: