Skip to main content

convert

Function convert 

Source
pub fn convert<Operand, BinaryOp, I>(
    tokens: I,
) -> Result<Vec<PostfixToken<Operand, BinaryOp>>, ConvertError>
where I: IntoIterator<Item = InfixToken<Operand, BinaryOp>>, BinaryOp: BinaryOperator,
Expand description

Converts an iterator of InfixToken to a Vec of PostfixToken.

Note that the only error checking this function performs is to make sure that the number of group starts and finishes is equal. This is checked to avoid executing unreachable code.

Critically, this function will not check that the tokens argument is a valid infix token stream, particularly that each BinaryOp has two adjacent Operands.

Returns Ok(...) on success, otherwise returns a ConvertError.

ยงErrors

See ConvertError.