Struct nom_operator::operator::Operator
[−]
[src]
pub struct Operator<O> { pub op: O, pub associativity: Associativity, pub size: OperatorSize, pub precedence: usize, pub parser: Box<Fn(&[u8]) -> IResult<&[u8], &[u8]>>, }
An Operator wrapper with extra info for parsing
Fields
op: O
The underlying operator enum
associativity: Associativity
The associativity of the operator
size: OperatorSize
Size of the operator, Unary, Binary, etc...
precedence: usize
The precedence of the operator If * has precedence 10 and - has precedence 9 the following expression 1 * 2 - 3 would parse as (1 * 2) - 3
parser: Box<Fn(&[u8]) -> IResult<&[u8], &[u8]>>
The nom parser function
Methods
impl<O> Operator<O>
[src]
fn new(
op: O,
assoc: Associativity,
size: OperatorSize,
prec: usize,
parser: Box<Fn(&[u8]) -> IResult<&[u8], &[u8]>>
) -> Self
op: O,
assoc: Associativity,
size: OperatorSize,
prec: usize,
parser: Box<Fn(&[u8]) -> IResult<&[u8], &[u8]>>
) -> Self
Creates a new operator