summaryrefslogtreecommitdiffstats
path: root/parsing
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-20 02:40:00 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-20 02:40:00 (EST)
commitbd4ba6c81ddbeed2fdb5e6dc97cb3b2966b8873f (patch)
treec9802aa2ef288982e0f113efca52cbe8dd76bb7f /parsing
parenta872bf87e2949019e457242a3099a22087ef79e9 (diff)
downloadeggshell-bd4ba6c81ddbeed2fdb5e6dc97cb3b2966b8873f.zip
eggshell-bd4ba6c81ddbeed2fdb5e6dc97cb3b2966b8873f.tar.gz
eggshell-bd4ba6c81ddbeed2fdb5e6dc97cb3b2966b8873f.tar.bz2
Implement I/O operator parsing
Diffstat (limited to 'parsing')
-rw-r--r--parsing/parse.sh49
1 files changed, 40 insertions, 9 deletions
diff --git a/parsing/parse.sh b/parsing/parse.sh
index 5ac622d..e0852bb 100644
--- a/parsing/parse.sh
+++ b/parsing/parse.sh
@@ -367,49 +367,80 @@ cmd_word()
cmd_prefix()
{
- : TODO: Implement
+ if io_redirect || accept T_ASSIGNMENT_WORD; then
+ while io_redirect || accept T_ASSIGNMENT_WORD; do
+ :
+ done
+ return 0
+ fi
return 1
}
cmd_suffix()
{
- : TODO: Implement
+ if io_redirect || accept T_WORD; then
+ while io_redirect || accept T_WORD; do
+ :
+ done
+ return 0
+ fi
return 1
}
redirect_list()
{
- : TODO: Implement
+ if io_redirect; then
+ while io_redirect; do
+ :
+ done
+ return 0
+ fi
return 1
}
io_redirect()
{
- : TODO: Implement
+ if io_file || io_here; then
+ return 0
+ fi
return 1
}
io_file()
{
- : TODO: Implement
+ if accept T_LESS || accept T_LESSAND || accept T_GREAT || \
+ accept T_GREATAND || accept T_DGREAT || \
+ accept T_LESSGREAT || accept T_CLOBBER; then
+ if filename; then
+ return 0
+ fi
+ fi
return 1
}
filename()
{
- : TODO: Implement
+ if accept T_WORD; then
+ return 0
+ fi
return 1
}
io_here()
{
- : TODO: Implement
+ if accept T_DLESS || accept T_DLESSDASH; then
+ if here_end; then
+ return 0
+ fi
+ fi
return 1
}
here_end()
{
- : TODO: Implement
+ if accept T_WORD; then
+ return 0
+ fi
return 1
}
@@ -502,7 +533,7 @@ try()
}
#try '"foo bar" && $baz || qux' '${quux%uux quuux'
-#try '"foo bar" && $baz || qux' '${quux%uux } quuux'
+try '"foo bar" && $baz || qux' '${quux%uux } quuux'
#try 'foo ${bar}'
#try 'foo ${#bar}'
#try 'foo ${bar#baz}'