mirror of
https://github.com/nushell/nushell.git
synced 2025-01-03 04:50:28 +01:00
Allow leading space before head of pipeline
This commit is contained in:
parent
6034de641a
commit
60212611e5
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user