summaryrefslogtreecommitdiffstats
path: root/src/cmd/rc/parse.c
diff options
context:
space:
mode:
authorlufia <lufia@lufia.org>2025-07-21 13:36:21 +0900
committerDan Cross <crossd@gmail.com>2025-07-27 09:55:45 -0400
commit8ff39da0623dbab13c00ce25a16dda168f6ec0a0 (patch)
tree7ad6a351cf9a0538ece73813da14872c6bd90785 /src/cmd/rc/parse.c
parentcc89d242358cc777a22beefe2456d11e12e94197 (diff)
downloadplan9port-8ff39da0623dbab13c00ce25a16dda168f6ec0a0.tar.gz
plan9port-8ff39da0623dbab13c00ce25a16dda168f6ec0a0.zip
src/cmd/rc: import rc syntax `delim{cmd} for splitting commands from 9atom
Co-authored-by: <ori@eigenstate.org>
Diffstat (limited to 'src/cmd/rc/parse.c')
-rw-r--r--src/cmd/rc/parse.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cmd/rc/parse.c b/src/cmd/rc/parse.c
index a9cf497a..2713c0d6 100644
--- a/src/cmd/rc/parse.c
+++ b/src/cmd/rc/parse.c
@@ -409,7 +409,8 @@ yyword(int tok, int *ptok, int eqok)
// | '"' word {$$=tree1('"', $2);}
// | COUNT word {$$=tree1(COUNT, $2);}
// | WORD
- // | '`' brace {$$=tree1('`', $2);}
+ // | '`' brace {$$=tree2('`', (struct tree*)0, $2);}
+ // | '`' word brace {$$=tree2('`', $2, $3);}
// | '(' words ')' {$$=tree1(PAREN, $2);}
// | REDIR brace {$$=mung1($1, $2); $$->type=PIPEFD;}
// keyword: FOR|IN|WHILE|IF|NOT|TWIDDLE|BANG|SUBSHELL|SWITCH|FN
@@ -499,8 +500,13 @@ word1(int tok, int *ptok)
return tree1(COUNT, word1(yylex(), ptok));
case '`':
- // | '`' brace {$$=tree1('`', $2);}
- t = tree1('`', brace(yylex()));
+ // | '`' brace {$$=tree2('`', (struct tree*)0, $2);}
+ // | '`' word brace {$$=tree2('`', $2, $3);}
+ w = nil;
+ tok = dropsp(yylex());
+ if(iswordtok(tok))
+ w = yyword(tok, &tok, 1);
+ t = tree2('`', w, brace(tok));
*ptok = yylex();
return t;