This commit is contained in:
greg 2020-02-13 03:01:48 -08:00
parent 6759640389
commit 54649246b0

View File

@ -70,20 +70,20 @@ fn parse_hex_literal(input: &str) -> IResult<&str, ExpressionKind> {
Ok((rest, expr))
}
fn parse_string_literal(input: &str) -> IResult<&str, ExpressionKind> {
let (rest, _) = nom::character::complete::char('"')(input)?;
let (rest, string_output) = nom::bytes::complete::take_until("\"")(rest)?;
let (rest, _) = nom::character::complete::char('"')(rest)?;
fn parse_string_literal(text: &str) -> IResult<&str, ExpressionKind> {
let (text, _) = nom::character::complete::char('"')(text)?;
let (text, string_output) = nom::bytes::complete::take_until("\"")(text)?;
let (text, _) = nom::character::complete::char('"')(text)?;
let expr = ExpressionKind::StringLiteral(Rc::new(string_output.to_string()));
Ok((rest, expr))
Ok((text, expr))
}
fn parse_literal(input: &str) -> IResult<&str, ExpressionKind> {
alt((
parse_string_literal,
parse_number_literal,
parse_hex_literal,
parse_binary_literal,
parse_number_literal,
parse_bool_literal
))(input)
}