Allow leading space before head of pipeline

This commit is contained in:
George Pollard 2019-09-05 04:13:07 +12:00
parent 6034de641a
commit 60212611e5
No known key found for this signature in database
GPG Key ID: 6694D898AEB73984

View File

@ -552,7 +552,7 @@ pub fn node(input: NomSpan) -> IResult<NomSpan, TokenNode> {
pub fn pipeline(input: NomSpan) -> IResult<NomSpan, TokenNode> { pub fn pipeline(input: NomSpan) -> IResult<NomSpan, TokenNode> {
trace_step(input, "pipeline", |input| { trace_step(input, "pipeline", |input| {
let start = input.offset; let start = input.offset;
let (input, head) = opt(tuple((raw_call, opt(space1))))(input)?; let (input, head) = opt(tuple((opt(space1), raw_call, opt(space1))))(input)?;
let (input, items) = trace_step( let (input, items) = trace_step(
input, input,
"many0", "many0",
@ -582,7 +582,11 @@ pub fn pipeline(input: NomSpan) -> IResult<NomSpan, TokenNode> {
} }
fn make_call_list( fn make_call_list(
head: Option<(Tagged<CallNode>, Option<NomSpan>)>, head: Option<(
Option<NomSpan>,
Tagged<CallNode>,
Option<NomSpan>
)>,
items: Vec<( items: Vec<(
NomSpan, NomSpan,
Option<NomSpan>, Option<NomSpan>,
@ -593,7 +597,12 @@ fn make_call_list(
let mut out = vec![]; let mut out = vec![];
if let Some(head) = head { if let Some(head) = head {
let el = PipelineElement::new(None, None, head.0, head.1.map(Span::from)); let el = PipelineElement::new(
None,
head.0.map(Span::from),
head.1,
head.2.map(Span::from));
out.push(el); out.push(el);
} }