Fix highlighting of escaped quotes in shell scripts.
[enscript.git] / states / hl / sh.st
1 /**
2  * Name: sh
3  * Description: Bourne shell programming language.
4  * Author: Juergen Kahrs <Juergen.Kahrs@t-online.de>
5  */
6
7 state sh 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   /\b(CDPATH|HOME|IFS|MAIL((CHECK)?|(PATH)?)|P(ATH|S(1|2))|SH(ACCT|ELL)|\
46 break|c(ase|d|ontinue)|do(ne)?|e(cho|lse|sac|val|x(ec|it|port))|f(i|or)|\
47 getopts|hash|i[fn]|limit|newgrp|pwd|re(ad(only)?|turn)|s(et|hift)|\
48 t(est|hen|imes|rap|ype)|u(limit|mask|n(limit|set))|w(ait|hile))\b/ {
49     keyword_face (true);
50     language_print ($0);
51     keyword_face (false);
52   }
53 }
54
55 \f
56 /*
57 Local variables:
58 mode: c
59 End:
60 */