feat: remove check assignment
This commit is contained in:
parent
21251d6499
commit
88ce8ba8b9
|
@ -769,7 +769,6 @@ impl<A, B> Pattern<A, B> {
|
||||||
pub enum AssignmentKind {
|
pub enum AssignmentKind {
|
||||||
Let,
|
Let,
|
||||||
Assert,
|
Assert,
|
||||||
Check,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type MultiPattern<PatternConstructor, Type> = Vec<Pattern<PatternConstructor, Type>>;
|
pub type MultiPattern<PatternConstructor, Type> = Vec<Pattern<PatternConstructor, Type>>;
|
||||||
|
|
|
@ -607,7 +607,6 @@ impl<'comments> Formatter<'comments> {
|
||||||
let keyword = match kind {
|
let keyword = match kind {
|
||||||
Some(AssignmentKind::Let) => "let ",
|
Some(AssignmentKind::Let) => "let ",
|
||||||
Some(AssignmentKind::Assert) => "assert ",
|
Some(AssignmentKind::Assert) => "assert ",
|
||||||
Some(AssignmentKind::Check) => "check ",
|
|
||||||
None => "try ",
|
None => "try ",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1043,21 +1043,6 @@ pub fn expr_parser(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let check_parser = just(Token::Check)
|
|
||||||
.ignore_then(pattern_parser())
|
|
||||||
.then(just(Token::Colon).ignore_then(type_parser()).or_not())
|
|
||||||
.then_ignore(just(Token::Equal))
|
|
||||||
.then(r.clone())
|
|
||||||
.map_with_span(
|
|
||||||
|((pattern, annotation), value), span| expr::UntypedExpr::Assignment {
|
|
||||||
location: span,
|
|
||||||
value: Box::new(value),
|
|
||||||
pattern,
|
|
||||||
kind: ast::AssignmentKind::Check,
|
|
||||||
annotation,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
let if_parser = just(Token::If)
|
let if_parser = just(Token::If)
|
||||||
.ignore_then(r.clone().then(block_parser.clone()).map_with_span(
|
.ignore_then(r.clone().then(block_parser.clone()).map_with_span(
|
||||||
|(condition, body), span| ast::IfBranch {
|
|(condition, body), span| ast::IfBranch {
|
||||||
|
@ -1109,7 +1094,6 @@ pub fn expr_parser(
|
||||||
when_parser,
|
when_parser,
|
||||||
let_parser,
|
let_parser,
|
||||||
assert_parser,
|
assert_parser,
|
||||||
check_parser,
|
|
||||||
if_parser,
|
if_parser,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ pub enum Token {
|
||||||
// Keywords (alphabetically):
|
// Keywords (alphabetically):
|
||||||
As,
|
As,
|
||||||
Assert,
|
Assert,
|
||||||
Check,
|
|
||||||
Const,
|
Const,
|
||||||
Fn,
|
Fn,
|
||||||
If,
|
If,
|
||||||
|
@ -142,7 +141,6 @@ impl fmt::Display for Token {
|
||||||
Token::NewLine => "NEWLINE",
|
Token::NewLine => "NEWLINE",
|
||||||
Token::As => "as",
|
Token::As => "as",
|
||||||
Token::Assert => "assert",
|
Token::Assert => "assert",
|
||||||
Token::Check => "check",
|
|
||||||
Token::When => "when",
|
Token::When => "when",
|
||||||
Token::Is => "is",
|
Token::Is => "is",
|
||||||
Token::Const => "const",
|
Token::Const => "const",
|
||||||
|
|
|
@ -513,7 +513,6 @@ fn str_to_keyword(word: &str) -> Option<Token> {
|
||||||
match word {
|
match word {
|
||||||
"as" => Some(Token::As),
|
"as" => Some(Token::As),
|
||||||
"assert" => Some(Token::Assert),
|
"assert" => Some(Token::Assert),
|
||||||
"check" => Some(Token::Check),
|
|
||||||
"when" => Some(Token::When),
|
"when" => Some(Token::When),
|
||||||
"const" => Some(Token::Const),
|
"const" => Some(Token::Const),
|
||||||
"fn" => Some(Token::Fn),
|
"fn" => Some(Token::Fn),
|
||||||
|
|
Loading…
Reference in New Issue