WIP: Add '>|' redirection to grammar (#75)
* Add '>|' redirection to grammar * add tests for >| * generate grammar
This commit is contained in:
parent
7478c62b24
commit
28e76c616d
|
@ -100,6 +100,23 @@ cat a b > /dev/null
|
|||
(file_redirect (file_descriptor) (word))
|
||||
(command_name (word))))
|
||||
|
||||
===============================
|
||||
File redirects (noclobber override)
|
||||
===============================
|
||||
|
||||
whoami >| /dev/null
|
||||
cat a b >| /dev/null
|
||||
|
||||
---
|
||||
|
||||
(program
|
||||
(redirected_statement
|
||||
(command (command_name (word)))
|
||||
(file_redirect (word)))
|
||||
(redirected_statement
|
||||
(command (command_name (word)) (word) (word))
|
||||
(file_redirect (word))))
|
||||
|
||||
===============================
|
||||
Heredoc redirects
|
||||
===============================
|
||||
|
|
|
@ -320,7 +320,7 @@ module.exports = grammar({
|
|||
|
||||
file_redirect: $ => prec.left(seq(
|
||||
field('descriptor', optional($.file_descriptor)),
|
||||
choice('<', '>', '>>', '&>', '&>>', '<&', '>&'),
|
||||
choice('<', '>', '>>', '&>', '&>>', '<&', '>&', '>|'),
|
||||
field('destination', $._literal)
|
||||
)),
|
||||
|
||||
|
|
|
@ -1371,6 +1371,10 @@
|
|||
{
|
||||
"type": "STRING",
|
||||
"value": ">&"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ">|"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -1419,6 +1419,10 @@
|
|||
"type": ">>",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": ">|",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "[",
|
||||
"named": false
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue