Introduce Bool and rename String to Str

This commit is contained in:
Richard Feldman 2019-05-24 01:54:45 -04:00
parent 46f281d399
commit be7e65bc88
2 changed files with 5 additions and 3 deletions

View file

@ -4,12 +4,12 @@ pub enum Expr {
// Literals
Int(i64),
Frac(i64, u64),
String(String),
Str(String),
Char(char),
Bool(bool),
Var(String),
Let(Pattern, Box<Expr>, Box<Expr>),
Pattern(Pattern),
// Functions
Func(String, Box<Expr>),

View file

@ -118,6 +118,8 @@ parser! {
choice((
parenthetical_expr(min_indent),
string("True").with(value(Expr::Bool(true))),
string("False").with(value(Expr::Bool(false))),
string_literal(),
number_literal(),
char_literal(),
@ -314,7 +316,7 @@ where I: Stream<Item = char, Position = IndentablePosition>,
I::Error: ParseError<I::Item, I::Range, I::Position>
{
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>