Return Option<Parse<ast::Literal>> from ast::Literal::parse

This commit is contained in:
Victor Song 2024-02-12 23:57:42 -06:00
parent 1918f9b9e0
commit 4923b8a74b
3 changed files with 11 additions and 8 deletions

View file

@ -71,7 +71,7 @@ impl server::FreeFunctions for RaSpanServer {
&mut self,
s: &str,
) -> Result<bridge::Literal<Self::Span, Self::Symbol>, ()> {
let literal = ast::Literal::parse(s);
let literal = ast::Literal::parse(s).ok_or(())?;
let literal = literal.tree();
let kind = literal_to_external(literal.kind()).ok_or(())?;

View file

@ -63,7 +63,7 @@ impl server::FreeFunctions for TokenIdServer {
&mut self,
s: &str,
) -> Result<bridge::Literal<Self::Span, Self::Symbol>, ()> {
let literal = ast::Literal::parse(s);
let literal = ast::Literal::parse(s).ok_or(())?;
let literal = literal.tree();
let kind = literal_to_external(literal.kind()).ok_or(())?;