Struct decleration
This commit is contained in:
@@ -13,14 +13,19 @@ inner_str = @{ (!"\"" ~ ANY)* }
|
||||
|
||||
// ================= TOP LEVEL =================
|
||||
|
||||
top_level = _{ import | function_decl }
|
||||
top_level = _{ import | function_decl | struct_decl }
|
||||
|
||||
export = { "export"? }
|
||||
|
||||
import = { "import" ~ string_lit ~ ";" }
|
||||
|
||||
param_list = { param ~ ("," ~ param)* ~ ","? }
|
||||
param = { identifier ~ ":" ~ type_expr }
|
||||
param_list = { param ~ ("," ~ param)* ~ ","? }
|
||||
param = { identifier ~ ":" ~ type_expr }
|
||||
|
||||
struct_decl = {
|
||||
export ~ "struct" ~ identifier ~ "{" ~ param_list? ~ "}"
|
||||
}
|
||||
|
||||
function_decl = {
|
||||
export ~ "function" ~ identifier ~ "(" ~ param_list? ~ ")" ~ (":" ~ type_expr)? ~ block
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user