aboutsummaryrefslogtreecommitdiff
blob: e0b23ef340308ea6764f9ee401a27d1a56586d8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
   Please use git log for copyright holder and year information

   This file is part of libbash.

   libbash is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 2 of the License, or
   (at your option) any later version.

   libbash is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with libbash.  If not, see <http://www.gnu.org/licenses/>.
*/
gunit java_libbash;

command_atom:
"function quit {
	exit
}" -> (FUNCTION (STRING quit) (CURRENT_SHELL (LIST (COMMAND (STRING exit)))))

"function quit{ exit; }" FAIL
"function quit { exit }" FAIL
"function quit { exit; }" -> (FUNCTION (STRING quit) (CURRENT_SHELL (LIST (COMMAND (STRING exit)))))
"function foo()    { :; }" -> (FUNCTION (STRING foo) (CURRENT_SHELL (LIST (COMMAND (STRING :)))))
"function foo(){ :; }" -> (FUNCTION (STRING foo) (CURRENT_SHELL (LIST (COMMAND (STRING :)))))
"foo()   { :; }" -> (FUNCTION (STRING foo) (CURRENT_SHELL (LIST (COMMAND (STRING :)))))
"foo(){ :; }" -> (FUNCTION (STRING foo) (CURRENT_SHELL (LIST (COMMAND (STRING :)))))

"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 (COMMAND (FUNCTION (STRING inner) (CURRENT_SHELL (LIST (COMMAND (STRING :)))))))))

command:
"function quit { exit; } > /dev/null" -> (COMMAND (FUNCTION (STRING quit) (CURRENT_SHELL (LIST (COMMAND (STRING exit))))) (REDIR > (STRING / dev / null)))
"function quit {
    # comment
    exit; } > /dev/null" -> (COMMAND (FUNCTION (STRING quit) (CURRENT_SHELL (LIST (COMMAND (STRING exit))))) (REDIR > (STRING / dev / null)))
"function help { echo hi; } 2> /dev/null" -> (COMMAND (FUNCTION (STRING help) (CURRENT_SHELL (LIST (COMMAND (STRING echo) (STRING hi))))) (REDIR 2 > (STRING / dev / null)))
"function help { echo 3; } 2> /dev/null > output" OK