From 0062e83d03d389f0f07e33e1e7929e77825d774f Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 12 Jun 2019 22:45:18 -0400 Subject: [PATCH] Revert "Attempt to genericize number_literal" This reverts commit cafc0dd4e8705eeaedf2b62cf87447fd3f38b738. --- src/parse.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/parse.rs b/src/parse.rs index 2d3b9f1c4a..06e0c37cc6 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -132,7 +132,7 @@ parser! { parenthetical_expr(min_indent), string("{}").with(value(Expr::EmptyRecord)), string_literal(), - number_literal(Expr::Int, Expr::Frac), + number_literal(), char_literal(), if_expr(min_indent), case_expr(min_indent), @@ -654,7 +654,7 @@ where }) } -pub fn number_literal(wrap_int: impl FnOnce(i64) -> T, wrap_frac: impl FnOnce(i64, u64) -> T) -> impl Parser +pub fn number_literal() -> impl Parser where I: Stream, I::Error: ParseError { @@ -695,9 +695,9 @@ where I: Stream, match ( int_str.parse::(), decimals ) { (Ok(int_val), None) => { if is_positive { - value(wrap_int(int_val as i64)).right() + value(Expr::Int(int_val as i64)).right() } else { - value(wrap_int(-int_val as i64)).right() + value(Expr::Int(-int_val as i64)).right() } }, (Ok(int_val), Some(nums)) => { @@ -711,9 +711,9 @@ where I: Stream, let numerator = (int_val * denom) + (decimal as i64); if is_positive { - value(wrap_frac(numerator, denom as u64)).right() + value(Expr::Frac(numerator, denom as u64)).right() } else { - value(wrap_frac(-numerator, denom as u64)).right() + value(Expr::Frac(-numerator, denom as u64)).right() } }, Err(_) => {