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