pub fn push(&mut self, node: Node, span: Span) -> Result<AstIndex, ParserError> {
        // We could potentially achieve some compression by
        // using a set for the spans, for now a Vec will do.
        self.spans.push(span);
        let span_index = AstIndex::try_from(self.spans.len() - 1)
            .map_err(|_| ParserError::new(InternalError::AstCapacityOverflow.into(), span))?;

        self.nodes.push(AstNode {
            node,
            span: span_index,
        });
        AstIndex::try_from(self.nodes.len() - 1)
            .map_err(|_| ParserError::new(InternalError::AstCapacityOverflow.into(), span))
    }
/// Pushes a node and corresponding span onto the tree
Pushes a node and corresponding span onto the tree
Pushes a node and corresponding span onto the tree
pub fn push(&mut self, node: Node, span: Span) -> Result<AstIndex, ParserError> {
        // We could potentially achieve some compression by
        // using a set for the spans, for now a Vec will do.
        self.spans.push(span);
        let span_index = AstIndex::try_from(self.spans.len() - 1)
            .map_err(|_| ParserError::new(InternalError::AstCapacityOverflow.into(), span))?;
        self.nodes.push(AstNode {
            node,
            span: span_index,
        });
        AstIndex::try_from(self.nodes.len() - 1)
            .map_err(|_| ParserError::new(InternalError::AstCapacityOverflow.into(), span))
    }
pub fn push ( & mut self , node : Node , span : Span ) -> Result < AstIndex , ParserError > { // We could potentially achieve some compression by // using a set for the spans, for now a Vec will do. self . spans . push ( span ) ; let span_index = AstIndex :: try_from ( self . spans . len ( ) - 1 ) . map_err ( | _ | ParserError :: new ( InternalError :: AstCapacityOverflow . into ( ) , span ) ) ? ; self . nodes . push ( AstNode { node , span : span_index , } ) ; AstIndex :: try_from ( self . nodes . len ( ) - 1 ) . map_err ( | _ | ParserError :: new ( InternalError :: AstCapacityOverflow . into ( ) , span ) ) }
Pushes a node and corresponding span onto the tree
Pushes a node and corresponding span onto the tree
&mut self
node
Node
span
Span
&mut self
node
Node
span
Span