aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/rc/syntax.y
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-11-16 12:08:59 -0800
committerNicholas Noll <nbnoll@eml.cc>2021-11-16 12:08:59 -0800
commit29138fff8643194ec49cb79304d2a878d46c378b (patch)
tree04f46762380d84994ec821cec13f1ff8288d46fc /src/cmd/rc/syntax.y
parente4f9b993e97b6e6e790810b6d261dc5bf61b0513 (diff)
Feat: added heredocs
Heredocs are simply strings written to tmp files. There was minimal bug testing here. Also, various bug fixes are included
Diffstat (limited to 'src/cmd/rc/syntax.y')
-rw-r--r--src/cmd/rc/syntax.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/rc/syntax.y b/src/cmd/rc/syntax.y
index 64ebb41..4acd92f 100644
--- a/src/cmd/rc/syntax.y
+++ b/src/cmd/rc/syntax.y
@@ -76,7 +76,7 @@ assign:
redir:
Tdup
-| Tredir word { $$ = hangchild1($1, $2, 0); }
+| Tredir word { $$ = hangchild1($1, ($1->redir.type == Rhere)?heredoc($2):$2, 0); }
epilog:
/* empty */ { $$ = nil; }
@@ -97,7 +97,7 @@ cmd:
| Tfor '(' word ')' nl cmd { $$ = hangchild3($1, $3, nil, $6); }
| Tfor '(' word Tin words ')' nl cmd { $$ = hangchild3($1, $3, $5, $8); }
| Twhile paren nl cmd { $$ = hangchild2($1, $2, 0, $4, 1); }
-| Tif paren nl ifbody { $$ = hangchild1($2, $2, 0); }
+| Tif paren nl ifbody { $$ = hangchild1($4, $2, 0); }
| Tswitch '(' word ')' nl '{' nl casebody '}' { $$ = hangchild2($1, $3, 0, $8, 1); }
| Tfunc words block { $$ = hangchild2($1, $2, 0, $3, 1); }