f544798c8367968fdfd56bfb268f6e5e75882536
[alioth/jupp.git] / syntax / perl.jsf.in
1 # $MirOS: contrib/code/jupp/syntax/perl.jsf.in,v 1.3 2012/09/02 14:46:52 tg Exp $
2 #-
3 # JOE syntax highlight file for Perl
4
5 # Still need:
6
7 # _ in numbers
8 # 0b for binary
9 # \cC for Ctrl-C
10 # \x{hex} unicode
11 # no escapes in single quotes (except \\ and \')
12 # \N{NAME} named character
13
14 # / .. / regex
15 # s/ .. / .. /
16 # $name allowed in regex
17 # m//  same as //
18 # s///
19 # tr/// y///
20 # qr//
21
22 # can also do this: s(egg)<larva>
23 # s' ' ' - no interpolation
24
25
26 # Always reparse from beginning
27 -
28
29
30 # Define colors
31
32 =Idle
33 =Preproc blue
34 =Comment green
35 =Constant cyan
36 =Escape bold cyan
37 =Type bold
38 =Keyword bold
39 =Bad bold red
40
41 :idle Idle
42         *               idle
43         "#"             line_comment    recolor=-1
44         "\n"            idle
45         "0"             first_digit     recolor=-1
46         "1-9"           decimal recolor=-1
47         "."             maybe_float
48         "\""            string          recolor=-1
49         "\\"            not_string
50         "'"             char            recolor=-1
51         "`"             backtick        recolor=-1
52         "a-zA-Z_"       ident           buffer
53
54 :not_string Idle
55         *               idle noeat
56         "\"'`"          idle
57
58 :line_comment Comment
59         *               line_comment
60         "\n"            idle
61
62 :first_digit Constant
63         *               idle    noeat
64         "x"             hex
65         "b"             binary
66         "."             float
67         "eE"            epart
68         "0-7"           octal
69         "89"            bad_number      recolor=-1
70
71 :bad_number Bad
72         *               idle    noeat
73         "0-9"           bad_number
74
75 :octal Constant
76         *               idle    noeat
77         "0-7_"          octal
78         "89"            bad_number      recolor=-1
79
80 :binary Constant
81         *               idle    noeat
82         "01_"           binary
83         "2-9"           bad_number      recolor=-1
84
85 :hex Constant
86         *               idle    noeat
87         "0-9A-Fa-f_"    hex
88
89 :decimal Constant
90         *               idle    noeat
91         "0-9_"          decimal
92         "eE"            epart
93         "."             float
94
95 :maybe_float Constant
96         *               idle    recolor=-2      noeat
97         "0-9"           float           recolor=-2
98
99 :float Constant
100         *               idle    noeat
101         "eE"            epart
102         "0-9_"          float
103
104 :epart Constant
105         *               idle    noeat
106         "0-9+\-"        enum
107
108 :enum Constant
109         *               idle    noeat
110         "0-9_"          enum
111
112 :string Constant
113         *               string
114         "\""            idle
115         "\\"            string_escape   recolor=-1
116         "$@"            string_subst    recolor=-1
117
118 :string_subst Escape
119         *               string  noeat recolor=-1
120         "a-zA-Z_0-9"    string_subst
121
122 :string_escape Escape
123         *               string
124         "x"             string_hex1
125         "c"             string_ctrl
126         "N"             string_named
127         "0-7"           string_octal2
128         "\n"            string          recolor=-2
129
130 :string_named Escape
131         *               string
132         "{"             string_named_rest
133
134 :string_named_rest Escape
135         *               string_named_rest
136         "}"             string
137
138 :string_ctrl Escape
139         *               string
140
141 :string_hex1 Escape
142         *               string          noeat
143         "{"             string_unicode
144         "0-9a-fA-F"     string_hex2
145
146 :string_unicode Escape
147         *               string_unicode
148         "}"             string
149
150 :string_hex2 Escape
151         *               string          noeat
152         "0-9a-fA-F"     string
153
154 :string_octal2 Escape
155         *               string          noeat
156         "0-7"           string_octal3
157
158 :string_octal3 Escape
159         *               string          noeat
160         "0-7"           string
161
162 :char Constant
163         *               char
164         "\n"            reset
165         "'"             idle
166         "\\"            char_escape     recolor=-1
167
168 :char_escape    Escape
169         *               char            recolor=-2
170         "\\'"   char
171
172 :backtick       Constant
173         *               backtick
174         "`"             idle
175         "\\"            backtick_escape recolor=-1
176         "$@"            backtick_subst recolor=-1
177
178 :backtick_subst Escape
179         *               backtick        noeat recolor=-1
180         "a-zA-Z_0-9"    backtick_subst
181
182 :backtick_escape Escape
183         *               backtick
184         "x"             backtick_hex1
185         "c"             backtick_ctrl
186         "N"             backtick_named
187         "0-7"           backtick_octal2
188         "\n"            backtick                recolor=-2
189
190 :backtick_named Escape
191         *               backtick
192         "{"             backtick_named_rest
193
194 :backtick_named_rest Escape
195         *               backtick_named_rest
196         "}"             backtick
197
198 :backtick_ctrl Escape
199         *               backtick
200
201 :backtick_hex1 Escape
202         *               backtick                noeat
203         "{"             backtick_unicode
204         "0-9a-fA-F"     backtick_hex2
205
206 :backtick_unicode Escape
207         *               backtick_unicode
208         "}"             backtick
209
210 :backtick_hex2 Escape
211         *               backtick                noeat
212         "0-9a-fA-F"     backtick
213
214 :backtick_octal2 Escape
215         *               backtick                noeat
216         "0-7"           backtick_octal3
217
218 :backtick_octal3 Escape
219         *               backtick                noeat
220         "0-7"           backtick
221
222 :ident  Idle
223         *               idle            noeat strings
224         "if"            kw
225         "unless"        kw
226         "while"         kw
227         "until"         kw
228         "foreach"       kw
229         "sub"           kw
230         "my"            kw
231         "do"            kw
232         "if"            kw
233         "else"          kw
234         "elsif"         kw
235         "for"           kw
236         "continue"      kw
237         "last"          kw
238         "print"         kw
239         "reset"         kw
240         "die"           kw
241         "goto"          kw
242         "require"       kw
243         "use"           kw
244         "eval"          kw
245         "redo"          kw
246         "next"          kw
247         "warn"          kw
248 done
249         "a-zA-Z0-9_"    ident
250
251 :type Type
252         *       idle    noeat
253
254 :kw Keyword
255         *       idle    noeat