mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Parse opaque types
This commit is contained in:
parent
ab6019d402
commit
fa24e51593
13 changed files with 201 additions and 113 deletions
|
@ -47,7 +47,8 @@ pub enum BinOp {
|
|||
Or,
|
||||
Pizza,
|
||||
Assignment,
|
||||
HasType,
|
||||
IsAliasType,
|
||||
IsOpaqueType,
|
||||
Backpassing,
|
||||
// lowest precedence
|
||||
}
|
||||
|
@ -59,7 +60,7 @@ impl BinOp {
|
|||
Caret | Star | Slash | Percent | Plus | Minus | LessThan | GreaterThan => 1,
|
||||
DoubleSlash | DoublePercent | Equals | NotEquals | LessThanOrEq | GreaterThanOrEq
|
||||
| And | Or | Pizza => 2,
|
||||
Assignment | HasType | Backpassing => unreachable!(),
|
||||
Assignment | IsAliasType | IsOpaqueType | Backpassing => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +104,7 @@ impl BinOp {
|
|||
Equals | NotEquals | LessThan | GreaterThan | LessThanOrEq | GreaterThanOrEq => {
|
||||
NonAssociative
|
||||
}
|
||||
Assignment | HasType | Backpassing => unreachable!(),
|
||||
Assignment | IsAliasType | IsOpaqueType | Backpassing => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +117,7 @@ impl BinOp {
|
|||
And => 3,
|
||||
Or => 2,
|
||||
Pizza => 1,
|
||||
Assignment | HasType | Backpassing => unreachable!(),
|
||||
Assignment | IsAliasType | IsOpaqueType | Backpassing => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +155,8 @@ impl std::fmt::Display for BinOp {
|
|||
Or => "||",
|
||||
Pizza => "|>",
|
||||
Assignment => "=",
|
||||
HasType => ":",
|
||||
IsAliasType => ":",
|
||||
IsOpaqueType => ":=",
|
||||
Backpassing => "<-",
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue