From 3fad899daaa0096826e426e4dacfe1e153fcb049 Mon Sep 17 00:00:00 2001 From: PaddiM8 Date: Thu, 11 Jun 2020 23:45:54 +0200 Subject: [PATCH] Extended parser::eval and parser::parse documentation by explaining when `None` is returned. --- kalk/src/parser.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kalk/src/parser.rs b/kalk/src/parser.rs index c8f82d0..74c2ced 100644 --- a/kalk/src/parser.rs +++ b/kalk/src/parser.rs @@ -63,6 +63,8 @@ pub enum CalcError { } /// Evaluate expressions/declarations and return the answer. +/// +/// `None` will be returned if the last statement is a declaration. pub fn eval( context: &mut Context, input: &str, @@ -76,6 +78,8 @@ pub fn eval( } /// 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, CalcError> { context.tokens = Lexer::lex(input); context.pos = 0;