summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-20 03:04:02 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-20 03:04:02 (EST)
commitaf5676a88e2e4313070f5c57176c348881f5187d (patch)
tree091af0fa05ca061c4051b4a6df1b68a7615b7f62
parentbd4ba6c81ddbeed2fdb5e6dc97cb3b2966b8873f (diff)
downloadeggshell-af5676a88e2e4313070f5c57176c348881f5187d.zip
eggshell-af5676a88e2e4313070f5c57176c348881f5187d.tar.gz
eggshell-af5676a88e2e4313070f5c57176c348881f5187d.tar.bz2
Fix function definitions (almost)
-rw-r--r--parsing/parse.sh32
1 files changed, 12 insertions, 20 deletions
diff --git a/parsing/parse.sh b/parsing/parse.sh
index e0852bb..66506b4 100644
--- a/parsing/parse.sh
+++ b/parsing/parse.sh
@@ -85,8 +85,6 @@ command()
elif compound_command; then
redirect_list
return 0
- elif function_defn; then
- return 0
fi
return 1
}
@@ -291,19 +289,6 @@ until_clause()
return 1
}
-function_defn()
-{
- if accept T_FNAME; then
- if accept T_LPAREN; then
- expect T_RPAREN
- if linebreak && function_body; then
- return 0
- fi
- fi
- fi
- return 1
-}
-
function_body()
{
if compound_command; then
@@ -339,8 +324,15 @@ simple_command()
fi
return 0
elif cmd_name; then
- cmd_suffix
- return 0
+ if accept T_LPAREN; then
+ expect T_RPAREN
+ if linebreak && function_body; then
+ return 0
+ fi
+ else
+ cmd_suffix
+ return 0
+ fi
fi
return 1
}
@@ -533,7 +525,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}'
@@ -549,5 +541,5 @@ try '"foo bar" && $baz || qux' '${quux%uux } quuux'
#try 'if ; then ; fi'
#try 'while foo; do bar; done'
#try 'while ; do ; done'
-#try 'foo(){ bar; }'
-try 'case foo in bar) baz;; (qux) quux;; quux);; esac'
+try 'foo(){ bar; }'
+#try 'case foo in bar) baz;; (qux) quux;; quux);; esac'