1 rizwank 1.1 /**
2 * Name: bash
3 * Description: Bourne-Again shell programming language.
4 * Author: Jean-Marc Calvez <jean-marc.calvez@st.com>
5 */
6
7 state bash extends HighlightEntry
8 {
9 /* Comments. */
10 /#/ {
11 comment_face (true);
12 language_print ($0);
13 call (eat_one_line);
14 comment_face (false);
15 }
16
17 /* String constants. */
18 /\"/ {
19 string_face (true);
20 language_print ($0);
21 call (c_string);
22 rizwank 1.1 string_face (false);
23 }
24
25 /* Excutable script. */
26 /^#!/ {
27 reference_face (true);
28 language_print ($0);
29 call (eat_one_line);
30 reference_face (false);
31 }
32
33 /* Keywords:
34 (build-re '(! case do done elif else esac fi for function if in select
35 then until while { } time))
36 */
37 /\b(!|case|do(|ne)|e(l(if|se)|sac)|f(i|or|unction)|i(f|n)|select\
38 |t(hen|ime)|until|while|{|})\b/ {
39 keyword_face (true);
40 language_print ($0);
41 keyword_face (false);
42 }
43 rizwank 1.1
44 /* shell built-in commands
45 (build-re '(: source alias bg bind break builtin cd command continue
46 declare typeset dirs disown echo enable eval exec exit export fc fg
47 getopts hash help history jobs kill let local logout popd pushd pwd read
48 readonly return set shift shopt suspend test times trap type ulimit umask
49 unalias unset wait))
50 */
51 /\b(:|alias|b(g|ind|reak|uiltin)|c(d|o(mmand|ntinue))\
52 |d(eclare|i(rs|sown))|e(cho|nable|val|x(ec|it|port))|f(c|g)|getopts\
53 |h(ash|elp|istory)|jobs|kill|l(et|o(cal|gout))|p(opd|ushd|wd)\
54 |re(ad(|only)|turn)|s(et|h(ift|opt)|ource|uspend)\
55 |t(est|imes|rap|ype(|set))|u(limit|mask|n(alias|set))|wait)\b/ {
56 builtin_face (true);
57 language_print ($0);
58 builtin_face (false);
59 }
60
61 /* shell variables (built-in)
62 (build-re '(PPID PWD OLDPWD REPLY UID EUID BASH BASH_VERSION BASH_VERSINFO
63 SHLVL RANDOM SECONDS LINENO HISTCMD DIRSTACK PIPESTATUS OPTARG OPTIND
64 rizwank 1.1 HOSTNAME HOSTTYPE OSTYPE MACHTYPE SHELLOPTS IFS PATH HOME CDPATH ENV MAIL
65 MAILCHECK MAILPATH PS1 PS2 PS3 PS4 TIMEFORMAT HISTSIZE HISTFILE
66 HISTFILESIZE OPTERR LANG LC_ALL LC_COLLATE LC_MESSAGES PROMPT_COMMAND
67 IGNOREEOF TMOUT FCEDIT FIGNORE GLOBIGNORE INPUTRC HISTCONTROL HISTIGNORE
68 histchars HOSTFILE auto_resume))
69 */
70 /\b(BASH(|_VERSI(NFO|ON))|CDPATH|DIRSTACK|E(NV|UID)|F(CEDIT|IGNORE)\
71 |GLOBIGNORE\
72 |H(IST(C(MD|ONTROL)|FILE(|SIZE)|IGNORE|SIZE)|O(ME|ST(FILE|NAME|TYPE)))\
73 |I(FS|GNOREEOF|NPUTRC)|L(ANG|C_(ALL|COLLATE|MESSAGES)|INENO)\
74 |MA(CHTYPE|IL(|CHECK|PATH))|O(LDPWD|PT(ARG|ERR|IND)|STYPE)\
75 |P(ATH|IPESTATUS|PID|ROMPT_COMMAND|S(1|2|3|4)|WD)|R(ANDOM|EPLY)\
76 |S(ECONDS|H(ELLOPTS|LVL))|T(IMEFORMAT|MOUT)|UID|auto_resume|histchars)\b/ {
77 variable_name_face (true);
78 language_print ($0);
79 variable_name_face (false);
80 }
81 }
82
83
84 /*
85 rizwank 1.1 Local variables:
86 mode: c
87 End:
88 */
|