Skip to content

Commit

Permalink
Merge pull request #39 from kit494way/fix-pipe-end-of-line
Browse files Browse the repository at this point in the history
Fix parsing of pipe at the end of line
  • Loading branch information
fdncred authored Dec 23, 2023
2 parents a0b80b2 + a0345fb commit 7daffc6
Show file tree
Hide file tree
Showing 4 changed files with 119,954 additions and 119,808 deletions.
26 changes: 26 additions & 0 deletions corpus/pipe/pipe.nu
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,29 @@ echo this
(command
(cmd_identifier)
(val_variable)))))

=====
pipe-004-end-of-line
=====

echo this
| split row "i" |
str join

-----

(nu_script
(pipeline
(pipe_element
(command
(cmd_identifier)
(val_string)))
(pipe_element
(command
(cmd_identifier)
(val_string)
(val_string)))
(pipe_element
(command
(cmd_identifier)
(val_string)))))
1 change: 1 addition & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ module.exports = grammar({
),
// Allow for empty pipeline elements like `ls | | print`
repeat1(seq(optional("\n"), PUNC().pipe)),
optional("\n"),
),

pipe_element_last: ($) =>
Expand Down
12 changes: 12 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2658,6 +2658,18 @@
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "\n"
},
{
"type": "BLANK"
}
]
}
]
},
Expand Down
Loading

0 comments on commit 7daffc6

Please sign in to comment.