blob: 65bb614cac90ac5514a896c4f34ab7c8112e0f58 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
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;
string_expr:
"+%Y%m%d" -> (STRING + % Y % m % d)
"/tmp/a?b*" -> (STRING / tmp / a ? b *)
"\"http://www.gnu.org/software/autoconf/autoconf.html\"" -> (STRING (DOUBLE_QUOTED_STRING http : / / www . gnu . org / software / autoconf / autoconf . html))
"\"http://dev.gentoo.org/~mpagano/genpatches\"" -> (STRING (DOUBLE_QUOTED_STRING http : / / dev . gentoo . org / ~ mpagano / genpatches))
"\"\"" -> (STRING DOUBLE_QUOTED_STRING)
"\"For more info on this patchset, and how to report problems, see:\"" -> (STRING (DOUBLE_QUOTED_STRING For more info on this patchset , and how to report problems , see :))
"\"asdf;!\"" -> (STRING (DOUBLE_QUOTED_STRING asdf ; !))
"\"$(whoami)\"" -> (STRING (DOUBLE_QUOTED_STRING (COMMAND_SUB $(whoami))))
"\"`whoami`\"" -> (STRING (DOUBLE_QUOTED_STRING (COMMAND_SUB `whoami`)))
"'`whoami`'" -> (STRING (SINGLE_QUOTED_STRING '`whoami`'))
"'$(whoami)'" -> (STRING (SINGLE_QUOTED_STRING '$(whoami)'))
"\"${P}\"" -> (STRING (DOUBLE_QUOTED_STRING (VAR_REF P)))
"'${P}'" -> (STRING (SINGLE_QUOTED_STRING '${P}'))
"asdf#" -> (STRING asdf #)
"'asdf'" -> (STRING (SINGLE_QUOTED_STRING 'asdf'))
"'asdf\"asdf'" -> (STRING (SINGLE_QUOTED_STRING 'asdf"asdf'))
"\"asdf'asdf\"" -> (STRING (DOUBLE_QUOTED_STRING asdf ' asdf))
"!/bin/bash" -> (STRING ! / bin / bash)
"\"abc\"\'\"\'\"def\"" -> (STRING (DOUBLE_QUOTED_STRING abc) (SINGLE_QUOTED_STRING '"') (DOUBLE_QUOTED_STRING def))
"my\ name\ is" -> (STRING my \ name \ is)
"octal\007" -> (STRING octal \ 007)
"hex\xaF" -> (STRING hex \ xaF)
"ctrlx\cx" -> (STRING ctrlx \ cx)
"tab\\ttab" -> "(STRING tab \\ \t tab)"
"a[]" -> (STRING a [ ])
"\"'foo'\"" -> (STRING (DOUBLE_QUOTED_STRING ' foo '))
"--preserve=timestamps,mode" -> (STRING - - preserve = timestamps , mode)
"$'asdf'" -> (STRING (ANSI_C_QUOTING 'asdf'))
"\"abc#$/\"" -> (STRING (DOUBLE_QUOTED_STRING abc # $ /))
"\`\(\)\$\>\<" -> (STRING \` \( \) \$ \> \<)
condition_expr:
// bracket patterns
"[[ x == abc[def] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING abc (MATCH_ANY def))))
"[[ x == abc[d${more}] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING abc (MATCH_ANY d (VAR_REF more)))))
"[[ x == abc[#d] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING abc (MATCH_ANY # d))))
"[[ x == abc[d#] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING abc (MATCH_ANY d #))))
"[[ x == ab[d-h] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY d - h))))
"[[ x == ab[!d-h] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY_EXCEPT d - h))))
"[[ x == ab[^d-h] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY_EXCEPT d - h))))
"[[ x == ab[:alpha:] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY : alpha :))))
"[[ x == ab[=c=] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY = c =))))
"[[ x == ab[.c.] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY . c .))))
"[[ x == ab[[:alpha:]] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY (CHARACTER_CLASS alpha)))))
"[[ x == ab[[:alpha:][:digit:]] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY (CHARACTER_CLASS alpha) (CHARACTER_CLASS digit)))))
"[[ x == ab[^[:alpha:]] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY_EXCEPT (CHARACTER_CLASS alpha)))))
"[[ x == ab[[=c=]] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY (EQUIVALENCE_CLASS c)))))
"[[ x == ab[[.backslash.]] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY (COLLATING_SYMBOL backslash)))))
"[[ x == ab[12[:alpha:]] ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (MATCH_ANY 12 (CHARACTER_CLASS alpha)))))
// extended patterns
"[[ x == ab?(g|h) ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (EXTENDED_MATCH_AT_MOST_ONE (BRANCH g) (BRANCH h)))))
"[[ x == ab*(gh|i) ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (EXTENDED_MATCH_ANY (BRANCH gh) (BRANCH i)))))
"[[ x == ab+(gh|i) ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (EXTENDED_MATCH_AT_LEAST_ONE (BRANCH gh) (BRANCH i)))))
"[[ x == ab@(gh|i) ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (EXTENDED_MATCH_EXACTLY_ONE (BRANCH gh) (BRANCH i)))))
"[[ x == ab!(gh|i) ]]" -> (KEYWORD_TEST (MATCH_PATTERN (STRING x) (STRING ab (EXTENDED_MATCH_NONE (BRANCH gh) (BRANCH i)))))
double_quoted_string:
"\"\\\\\"\$\`\"" -> (DOUBLE_QUOTED_STRING \ \" \$ \`)
|