Small change to getopt stuff
[enscript.git] / states / hl / python.st
1 /**
2  * Name: python
3  * Description: Python programming language.
4  * Author: Andy Eskilsson <Andy.Eskilsson@telelogic.se>
5  */
6
7 state python_string extends Highlight
8 {
9   /\\\\./ {
10     language_print ($0);
11   }
12   python_string_end {
13     language_print ($0);
14     return;
15   }
16 }
17
18 state python extends HighlightEntry
19 {
20   /* Comments. */
21   /#/ {
22     comment_face (true);
23     language_print ($0);
24     call (eat_one_line);
25     comment_face (false);
26   }
27   /* Python strings */
28   /(\"\"\"|[\'][\'][\'])/ {
29     python_string_end = regexp($0);
30     string_face (true);
31     language_print ($0);
32     call (python_string);
33     string_face (false);
34   }
35
36   /(\"|[\'])/ {
37     python_string_end = regexp( $0 );
38     string_face (true);
39     language_print ($0);
40     call (python_string);
41     string_face (false);
42   }
43
44   /* Function */
45   /([ \t]*)(def)([ \t]+)([^(]*)/ {
46     /* indentation */
47     language_print ($1);
48
49     /* def */
50     keyword_face (true);
51     language_print ($2);
52     keyword_face (false);
53
54     /* middle */
55     language_print ($3);
56
57     /* Function name. */
58     function_name_face (true);
59     language_print ($4);
60     function_name_face (false);
61   }
62
63     /* Keywords
64        (build-re '(and assert break class continue def del elif else
65        else: except except: exec finally for from global if import in
66        is lambda not or pass print raise return try try: while
67        yield)) */
68   /\b(a(nd|ssert)|break|c(lass|ontinue)|de(f|l)\
69 |e(l(if|se(|:))|x(cept(|:)|ec))|f(inally|or|rom)|global|i(f|mport|n|s)\
70 |lambda|not|or|p(ass|rint)|r(aise|eturn)|try(|:)|while|yield)\b/ {
71     keyword_face (true);
72     language_print ($0);
73     keyword_face (false);
74   }
75 }
76
77 \f
78 /*
79 Local variables:
80 mode: c
81 End:
82 */