Update type syntax
parent
621664a23b
commit
a14471651b
@ -1,40 +1,40 @@
|
||||
|
||||
type Food = enum {
|
||||
Apple Num
|
||||
Banana Num
|
||||
Cereal Num
|
||||
Milk #(String Num)
|
||||
}
|
||||
type Food = (
|
||||
| Apple Num
|
||||
| Banana Num
|
||||
| Cereal Num
|
||||
| Milk #(String, Num)
|
||||
)
|
||||
|
||||
type Utils = enum {
|
||||
Paper Num
|
||||
Detergent Num
|
||||
Pencils Num
|
||||
}
|
||||
type Utils = (
|
||||
| Paper Num
|
||||
| Detergent Num
|
||||
| Pencils Num
|
||||
)
|
||||
|
||||
type Packaging = enum {
|
||||
Bag
|
||||
PlasticBag
|
||||
}
|
||||
type Packaging = (
|
||||
| Bag
|
||||
| PlasticBag
|
||||
)
|
||||
|
||||
type ShoppingList = rec {
|
||||
type ShoppingList = {
|
||||
food: Food
|
||||
utils: Utils
|
||||
packaging: Packaging
|
||||
}
|
||||
|
||||
type NestedHell = enum {
|
||||
NoNesting Num
|
||||
Nesting enum {
|
||||
FirstLevel enum {
|
||||
SecondLevel enum {
|
||||
Third Lvl<a>
|
||||
}
|
||||
Second rec {
|
||||
type NestedHell a = (
|
||||
| NoNesting Num
|
||||
| Nesting (
|
||||
| FirstLevel (
|
||||
| SecondLevel (
|
||||
| Third Lvl
|
||||
)
|
||||
| Second {
|
||||
first: Num
|
||||
second: Num
|
||||
}
|
||||
}
|
||||
StillFirst Num<a>
|
||||
}
|
||||
}
|
||||
)
|
||||
| StillFirst Num a
|
||||
)
|
||||
)
|
||||
|
@ -0,0 +1,23 @@
|
||||
Aliases Test
|
||||
|
||||
======
|
||||
|
||||
type MyNum = Num
|
||||
|
||||
======
|
||||
|
||||
(file
|
||||
(statement
|
||||
(type_decl
|
||||
(type_ident
|
||||
(type_name: "MyNum")
|
||||
)
|
||||
(type_expr
|
||||
(type_ident
|
||||
(type_name: "Num")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(EOI: "")
|
||||
)
|
@ -0,0 +1,32 @@
|
||||
Tuples Test
|
||||
|
||||
======
|
||||
|
||||
type MyTuple = #(Str, Int)
|
||||
|
||||
======
|
||||
|
||||
(file
|
||||
(statement
|
||||
(type_decl
|
||||
(type_ident
|
||||
(type_name: "MyTuple")
|
||||
)
|
||||
(type_expr
|
||||
(tuple
|
||||
(type_expr
|
||||
(type_ident
|
||||
(type_name: "Str")
|
||||
)
|
||||
)
|
||||
(type_expr
|
||||
(type_ident
|
||||
(type_name: "Int")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(EOI: "")
|
||||
)
|
Loading…
Reference in New Issue