mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-01-31 17:09:13 +01:00
Extended parser::eval and parser::parse documentation by explaining when None
is returned.
This commit is contained in:
parent
c42fcccabd
commit
3fad899daa
@ -63,6 +63,8 @@ pub enum CalcError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Evaluate expressions/declarations and return the answer.
|
/// Evaluate expressions/declarations and return the answer.
|
||||||
|
///
|
||||||
|
/// `None` will be returned if the last statement is a declaration.
|
||||||
pub fn eval(
|
pub fn eval(
|
||||||
context: &mut Context,
|
context: &mut Context,
|
||||||
input: &str,
|
input: &str,
|
||||||
@ -76,6 +78,8 @@ pub fn eval(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Parse expressions/declarations and return a syntax tree.
|
/// Parse expressions/declarations and return a syntax tree.
|
||||||
|
///
|
||||||
|
/// `None` will be returned if the last statement is a declaration.
|
||||||
pub fn parse(context: &mut Context, input: &str) -> Result<Vec<Stmt>, CalcError> {
|
pub fn parse(context: &mut Context, input: &str) -> Result<Vec<Stmt>, CalcError> {
|
||||||
context.tokens = Lexer::lex(input);
|
context.tokens = Lexer::lex(input);
|
||||||
context.pos = 0;
|
context.pos = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user