pub trait SourceNode: Sized {
    fn to_error(&self) -> JSON;
    fn get_location(&self) -> Option<Location>;
    fn get_literal(&self, property: &str) -> ParseResult<Literal>;
    fn get_bool(&self, property: &str) -> ParseResult<bool>;
    fn get_str(&self, property: &str) -> ParseResult<JSString>;
    fn map_node<T, F>(&self, property: &str, action: F) -> ParseResult<T>
    where
        F: FnMut(&Self) -> ParseResult<T>
; fn map_array<T, F>(&self, property: &str, func: F) -> ParseResult<Vec<T>>
    where
        F: FnMut(&Self) -> ParseResult<T>
; fn expect_str(&self, property: &str, value: &'static str) -> ParseResult<()> { ... } fn map_opt_node<T, F>(
        &self,
        property: &str,
        action: F
    ) -> ParseResult<Option<T>>
    where
        F: FnMut(&Self) -> ParseResult<T>
, { ... } }
Expand description

SourceNode is how ParseFrom::parse_from sees AST nodes.

Required Methods

Location of the node where an error happened.

Try to get source mapping for self.

Use the node as a literal.

Get the boolean value of a child node with name property. It’s a ParseError if it does not exist or does not have a boolean meaning.

Get the string value of a child node with name property. It’s a ParseError if it does not exist or does not have a string meaning.

Get a child node with this name; if it does not exist, return None. Then transform it through action, propagating its Result out. A child node exis

Map the array of children of a child node with name property. It’s a ParseError if it does not exist or does not have an array meaning.

Provided Methods

Check that the value of property is a string equal to value. Depends on SourceNode::get_str.

Implementors