rustfmt
This commit is contained in:
parent
93d106d7c3
commit
79e570dc60
|
@ -2,7 +2,7 @@ use nom::{
|
|||
branch::alt,
|
||||
bytes::complete::tag,
|
||||
character::complete::{alpha1, alphanumeric1, char, multispace0, multispace1, u64 as decimal},
|
||||
combinator::{map, opt, recognize, consumed},
|
||||
combinator::{consumed, map, opt, recognize},
|
||||
error::{context, ParseError, VerboseError},
|
||||
multi::{many0, many1, separated_list0},
|
||||
sequence::{delimited, pair, preceded, separated_pair, terminated, tuple},
|
||||
|
@ -117,16 +117,18 @@ fn declaration(i: Span) -> IResult<Span, NetDecl> {
|
|||
|
||||
fn port_decl(i: Span) -> IResult<Span, PortDecl> {
|
||||
map(
|
||||
consumed(
|
||||
tuple((
|
||||
alt((
|
||||
map(tag("input"), |_| PortDirection::Input),
|
||||
map(tag("output"), |_| PortDirection::Output),
|
||||
)),
|
||||
declaration,
|
||||
))
|
||||
),
|
||||
|(pos, (direction, net))| PortDecl { pos, direction, net },
|
||||
consumed(tuple((
|
||||
alt((
|
||||
map(tag("input"), |_| PortDirection::Input),
|
||||
map(tag("output"), |_| PortDirection::Output),
|
||||
)),
|
||||
declaration,
|
||||
))),
|
||||
|(pos, (direction, net))| PortDecl {
|
||||
pos,
|
||||
direction,
|
||||
net,
|
||||
},
|
||||
)(i)
|
||||
}
|
||||
|
||||
|
@ -139,11 +141,17 @@ fn operation(input: Span) -> IResult<Span, Operation> {
|
|||
alt((
|
||||
map(
|
||||
separated_pair(ws0(identifier), char('&'), ws0(expression)),
|
||||
|(a, b)| Operation::And { a: (*a.fragment()).into(), b },
|
||||
|(a, b)| Operation::And {
|
||||
a: (*a.fragment()).into(),
|
||||
b,
|
||||
},
|
||||
),
|
||||
map(
|
||||
separated_pair(ws0(identifier), char('|'), ws0(expression)),
|
||||
|(a, b)| Operation::Or { a: (*a.fragment()).into(), b },
|
||||
|(a, b)| Operation::Or {
|
||||
a: (*a.fragment()).into(),
|
||||
b,
|
||||
},
|
||||
),
|
||||
))(input)
|
||||
}
|
||||
|
@ -169,7 +177,9 @@ fn expression(input: Span) -> IResult<Span, Expression> {
|
|||
alt((
|
||||
map(ws0(operation), |op| Expression::Operation(Box::new(op))),
|
||||
map(ws0(call_item), |call| Expression::Call(Box::new(call))),
|
||||
map(ws0(identifier), |ident| Expression::Ident((*ident.fragment()).into())),
|
||||
map(ws0(identifier), |ident| {
|
||||
Expression::Ident((*ident.fragment()).into())
|
||||
}),
|
||||
))(input)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue