Handle shorthand file redirect command substitutions

Fixes #34
This commit is contained in:
Max Brunsfeld 2018-10-18 15:31:24 -07:00
parent 48f7e22475
commit a4fb636b2d
4 changed files with 109368 additions and 108095 deletions

View File

@ -159,6 +159,7 @@ Command substitutions
echo `echo hi`
echo `echo hi; echo there`
echo $(echo $(echo hi))
echo $(< some-file)
---
@ -175,7 +176,10 @@ echo $(echo $(echo hi))
(command_name (word))
(command_substitution (command
(command_name (word))
(word)))))))
(word))))))
(command
(command_name (word))
(command_substitution (file_redirect (word)))))
=============================
Process substitutions

View File

@ -472,6 +472,7 @@ module.exports = grammar({
command_substitution: $ => choice(
seq('$(', $._statements, ')'),
seq('$(', $.file_redirect, ')'),
prec(1, seq('`', $._statements, '`'))
),

17
src/grammar.json vendored
View File

@ -2000,6 +2000,23 @@
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "$("
},
{
"type": "SYMBOL",
"name": "file_redirect"
},
{
"type": "STRING",
"value": ")"
}
]
},
{
"type": "PREC",
"value": 1,

217439
src/parser.c vendored

File diff suppressed because it is too large Load Diff