WIP: Add '>|' redirection to grammar (#75)

* Add '>|' redirection to grammar

* add tests for >|

* generate grammar
This commit is contained in:
Šimon Let 2020-05-15 00:48:18 +02:00 committed by GitHub
parent 7478c62b24
commit 28e76c616d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 58114 additions and 57154 deletions

View File

@ -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
===============================

View File

@ -320,7 +320,7 @@ module.exports = grammar({
file_redirect: $ => prec.left(seq(
field('descriptor', optional($.file_descriptor)),
choice('<', '>', '>>', '&>', '&>>', '<&', '>&'),
choice('<', '>', '>>', '&>', '&>>', '<&', '>&', '>|'),
field('destination', $._literal)
)),

4
src/grammar.json vendored
View File

@ -1371,6 +1371,10 @@
{
"type": "STRING",
"value": ">&"
},
{
"type": "STRING",
"value": ">|"
}
]
},

4
src/node-types.json vendored
View File

@ -1419,6 +1419,10 @@
"type": ">>",
"named": false
},
{
"type": ">|",
"named": false
},
{
"type": "[",
"named": false

115241
src/parser.c vendored

File diff suppressed because it is too large Load Diff