public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/libbash:master commit in: bashast/, test/, bashast/gunit/
Date: Wed,  1 Jun 2011 12:03:11 +0000 (UTC)	[thread overview]
Message-ID: <5f561a36bfefb24ad61f2848536317e62328301c.betelgeuse@gentoo> (raw)

commit:     5f561a36bfefb24ad61f2848536317e62328301c
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Mon May 30 08:42:14 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Wed Jun  1 06:12:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=5f561a36

Parser: support nested function definitions

---
 bashast/bashast.g                |    3 ++-
 bashast/gunit/function.gunit     |    2 ++
 test/verify_error_output_test.sh |    2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/bashast/bashast.g b/bashast/bashast.g
index c560644..88a44cf 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -111,7 +111,7 @@ flcomment
 clist
 	:	list_level_2 -> ^(LIST list_level_2);
 list_level_1
-	:	(function|pipeline) (BLANK!*(LOGICAND^|LOGICOR^)BLANK!* (function|pipeline))*;
+	:	pipeline (BLANK!*(LOGICAND^|LOGICOR^)BLANK!* pipeline)*;
 // ';' '&' and EOL have lower operator precedence than '&&' and '||' so we need level2 here
 list_level_2
 	:	list_level_1 (BLANK!? command_separator (BLANK!? EOL!)* BLANK!? list_level_1)*;
@@ -127,6 +127,7 @@ time_posix
 //The structure of a command in bash
 command
 	:	compound_command
+	|	function
 	|	simple_command;
 //Simple bash commands
 simple_command

diff --git a/bashast/gunit/function.gunit b/bashast/gunit/function.gunit
index 6ee6c68..612ff4a 100644
--- a/bashast/gunit/function.gunit
+++ b/bashast/gunit/function.gunit
@@ -40,6 +40,8 @@ function:
 "function help { echo 3; } 2> /dev/null > output" OK
 "xorg-2_reconf_source() { :; }" -> (function (STRING xorg - 2 _reconf_source) (CURRENT_SHELL (LIST (COMMAND (STRING :)))))
 
+"function out() { function inner() { :; }; }" -> (function (STRING out) (CURRENT_SHELL (LIST (function (STRING inner) (CURRENT_SHELL (LIST (COMMAND (STRING :))))))))
+
 function_name:
 "xemacs-packages_src_unpack" OK
 "while" OK

diff --git a/test/verify_error_output_test.sh b/test/verify_error_output_test.sh
index b3c2eed..e50252f 100755
--- a/test/verify_error_output_test.sh
+++ b/test/verify_error_output_test.sh
@@ -2,4 +2,4 @@
 
 illegal="${srcdir}/scripts/illegal_script.sh"
 output=$(./variable_printer "$illegal" 2>&1)
-[[ $output == "${illegal}(1)  : error 5 : Unexpected token, at offset 3"* ]]
+[[ $output == "${illegal}(1)  : error 3 : 128:1: command : ( compound_command | function | simple_command );, at offset 3"* ]]



             reply	other threads:[~2011-06-01 12:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 12:03 Petteri Räty [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-04 13:53 [gentoo-commits] proj/libbash:master commit in: bashast/, test/, bashast/gunit/ Petteri Räty
2011-06-16 16:53 Petteri Räty
2011-04-11  6:50 Petteri Räty
2011-04-09 13:08 Petteri Räty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f561a36bfefb24ad61f2848536317e62328301c.betelgeuse@gentoo \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox