aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2012-03-02 16:25:49 +0800
committerMu Qiao <qiaomuf@gentoo.org>2012-03-02 16:25:49 +0800
commit6b1bcb401a25727bea39066cfe7d16fe3536e981 (patch)
tree75c13e37018004842ec25f9e4d5d23a90e7a1729
parentParser&Walker: support literals in regular exp (diff)
downloadlibbash-6b1bcb401a25727bea39066cfe7d16fe3536e981.tar.gz
libbash-6b1bcb401a25727bea39066cfe7d16fe3536e981.tar.bz2
libbash-6b1bcb401a25727bea39066cfe7d16fe3536e981.zip
Walker: allow empty case command
-rw-r--r--bashast/libbashWalker.g3
-rw-r--r--scripts/compound_command.bash12
2 files changed, 14 insertions, 1 deletions
diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g
index f57f403..95f8a90 100644
--- a/bashast/libbashWalker.g
+++ b/bashast/libbashWalker.g
@@ -1068,7 +1068,8 @@ case_clause[const std::string& target] returns[bool matched]
else
{
$matched = false;
- seek_to_next_tree(ctx);
+ if(LA(1) == CASE_COMMAND)
+ seek_to_next_tree(ctx);
}
})
|CASE_PATTERN;
diff --git a/scripts/compound_command.bash b/scripts/compound_command.bash
index 0d3321e..36161fe 100644
--- a/scripts/compound_command.bash
+++ b/scripts/compound_command.bash
@@ -361,3 +361,15 @@ for ((i = "${#python_versions[@]}"; i >= 0; i--))
do
echo $i
done
+EAPI="4"
+case ${EAPI} in
+ 0|1)
+ echo "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;;
+ 2|3);;
+ 4)
+ # S is no longer automatically assigned when it doesn't exist.
+ S="${WORKDIR}"
+ ;;
+ *)
+ echo "Unknown EAPI=${EAPI} for ruby-ng.eclass"
+esac