summaryrefslogtreecommitdiffstats
path: root/parsing
diff options
context:
space:
mode:
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}'