Function liva_parser::statement::parse_statement [−][src]
Expand description
Parse a single statement into a Statement
Example
use liva_parser::{
Span,
parse_statement,
statement::{
Statement,
declaration::assignment::LAssignment
},
expression::Expression,
literals::{Literal, Token}
};
let input = Span::new("let x = 3");
let (_, res) = parse_statement(input).unwrap();
assert_eq!(
res,
Statement::LAssignment(LAssignment {
variable: Token::new("x", Span::new("x")),
expression: Expression::Literal(Literal::Int(Token::new(3, Span::new("3"))))
})
);