Skip to content

Commit

Permalink
chore: Use the common parser root check method
Browse files Browse the repository at this point in the history
Signed-off-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
  • Loading branch information
polarathene committed Oct 7, 2023
1 parent 60c1655 commit 3aea9e0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/file/format/gura.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::error::Error;

use gura::GuraType;

use crate::format;
use crate::map::Map;
use crate::value::{Value, ValueKind};

Expand All @@ -10,11 +11,7 @@ pub fn parse(
text: &str,
) -> Result<Map<String, Value>, Box<dyn Error + Send + Sync>> {
let value = from_gura_value(uri, gura::parse(text).unwrap());
match value.kind {
ValueKind::Table(map) => Ok(map),

_ => Ok(Map::new()),
}
format::extract_root_table(uri, value)
}

fn from_gura_value(uri: Option<&String>, value: GuraType) -> Value {
Expand Down

0 comments on commit 3aea9e0

Please sign in to comment.