mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
remove redundant token
This commit is contained in:
parent
fac86781dd
commit
a5f5725cdf
|
@ -335,7 +335,7 @@ fn expr_parser() -> impl Parser<Token, Vec<Spanned<Expr>>, Error = Simple<Token>
|
|||
)
|
||||
});
|
||||
|
||||
let match_ = just(Token::KwCase)
|
||||
let case = just(Token::KwCase)
|
||||
.ignore_then(expr.clone())
|
||||
.then_ignore(just(Token::KwOf))
|
||||
.then(
|
||||
|
@ -350,7 +350,6 @@ fn expr_parser() -> impl Parser<Token, Vec<Spanned<Expr>>, Error = Simple<Token>
|
|||
.ignore_then(just(Token::KwElse))
|
||||
.ignore_then(expr.clone())
|
||||
)
|
||||
.then_ignore(just(Token::KwEnd))
|
||||
.map(|((expr, cases), default)| {
|
||||
(
|
||||
Expr::Case {
|
||||
|
@ -370,7 +369,7 @@ fn expr_parser() -> impl Parser<Token, Vec<Spanned<Expr>>, Error = Simple<Token>
|
|||
.or(return_)
|
||||
.or(do_block)
|
||||
.or(if_block)
|
||||
.or(match_)
|
||||
.or(case)
|
||||
.or(pipeline)
|
||||
}).labelled("expression");
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ pub enum Typehint {
|
|||
Single(String), // e.g. `int`, `bool`, `string`
|
||||
Tuple(Vec<Spanned<Self>>), // e.g. `(int, bool)`
|
||||
Vector(Box<Spanned<Self>>), // e.g. `[int]`
|
||||
Function(Vec<Spanned<Self>>, Box<Spanned<Self>>), // e.g. `(a: int, b: bool) -> string`, `(b: int) -> [bool]`
|
||||
Function(Vec<Spanned<Self>>, Box<Spanned<Self>>), // e.g. `|A: int, B: bool| -> string`, `|A: int| -> [bool]`
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -2,7 +2,6 @@ fun factorial (n: int) : int = do
|
|||
case n of
|
||||
| 0 -> return 1
|
||||
| else return n * factorial(n - 1)
|
||||
end
|
||||
end
|
||||
|
||||
fun main : void = do
|
||||
|
|
|
@ -2,8 +2,7 @@ fun fib (n: int): int = do
|
|||
case n of
|
||||
| 1 -> return 1
|
||||
| 2 -> return 1
|
||||
| else -> return fib(n - 1) + fib(n - 2)
|
||||
end
|
||||
| else return fib(n - 1) + fib(n - 2)
|
||||
end
|
||||
|
||||
fun main: void = do
|
||||
|
|
|
@ -2,7 +2,6 @@ fun print_single (cell: bool): void = do
|
|||
case cell of
|
||||
| true -> @write("█")
|
||||
| else @write(" ")
|
||||
end
|
||||
end
|
||||
|
||||
fun print_vec (state: vec_bool) (length: int) (curr: int): void = do
|
||||
|
@ -82,7 +81,6 @@ fun next (state: vec_bool) (pointer: int): bool = do
|
|||
return true
|
||||
end
|
||||
| else return false
|
||||
end
|
||||
end
|
||||
|
||||
fun iter (state: vec_bool) (for: int) (curr: int): void = do
|
||||
|
|
Loading…
Reference in a new issue