mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Introduce Bool and rename String to Str
This commit is contained in:
parent
46f281d399
commit
be7e65bc88
2 changed files with 5 additions and 3 deletions
|
@ -4,12 +4,12 @@ pub enum Expr {
|
||||||
// Literals
|
// Literals
|
||||||
Int(i64),
|
Int(i64),
|
||||||
Frac(i64, u64),
|
Frac(i64, u64),
|
||||||
String(String),
|
Str(String),
|
||||||
Char(char),
|
Char(char),
|
||||||
|
Bool(bool),
|
||||||
|
|
||||||
Var(String),
|
Var(String),
|
||||||
Let(Pattern, Box<Expr>, Box<Expr>),
|
Let(Pattern, Box<Expr>, Box<Expr>),
|
||||||
Pattern(Pattern),
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
Func(String, Box<Expr>),
|
Func(String, Box<Expr>),
|
||||||
|
|
|
@ -118,6 +118,8 @@ parser! {
|
||||||
|
|
||||||
choice((
|
choice((
|
||||||
parenthetical_expr(min_indent),
|
parenthetical_expr(min_indent),
|
||||||
|
string("True").with(value(Expr::Bool(true))),
|
||||||
|
string("False").with(value(Expr::Bool(false))),
|
||||||
string_literal(),
|
string_literal(),
|
||||||
number_literal(),
|
number_literal(),
|
||||||
char_literal(),
|
char_literal(),
|
||||||
|
@ -314,7 +316,7 @@ where I: Stream<Item = char, Position = IndentablePosition>,
|
||||||
I::Error: ParseError<I::Item, I::Range, I::Position>
|
I::Error: ParseError<I::Item, I::Range, I::Position>
|
||||||
{
|
{
|
||||||
between(char('"'), char('"'), many(string_body()))
|
between(char('"'), char('"'), many(string_body()))
|
||||||
.map(|str| Expr::String(str))
|
.map(|str| Expr::Str(str))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn char_literal<I>() -> impl Parser<Input = I, Output = Expr>
|
pub fn char_literal<I>() -> impl Parser<Input = I, Output = Expr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue