1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
;;
;; Copyright (c) 2002 by The XFree86 Project, Inc.
;;
;; Permission is hereby granted, free of charge, to any person obtaining a
;; copy of this software and associated documentation files (the "Software"),
;; to deal in the Software without restriction, including without limitation
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
;; and/or sell copies of the Software, and to permit persons to whom the
;; Software is furnished to do so, subject to the following conditions:
;;
;; The above copyright notice and this permission notice shall be included in
;; all copies or substantial portions of the Software.
;;
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
;; SOFTWARE.
;;
;; Except as contained in this notice, the name of the XFree86 Project shall
;; not be used in advertising or otherwise to promote the sale, use or other
;; dealings in this Software without prior written authorization from the
;; XFree86 Project.
;;
;; Author: Paulo César Pereira de Andrade
;;
;;
;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/imake.lsp,v 1.3 2004/01/08 21:29:12 paulo Exp $
;;
(require "syntax")
(in-package "XEDIT")
(defsynprop *prop-shell*
"shell"
:font "*courier-bold-r*-12-*"
:foreground "Red4"
)
(defsynprop *prop-variable*
"variable"
:font "*courier-medium-r*-12-*"
:foreground "Red3"
)
;; The syntax-highlight definition does not try to flag errors, just show
;; tabs in the start of lines for better visualization.
(defsynprop *prop-tabulation*
"tabulation"
:font "*courier-medium-r*-12-*"
:background "Gray90"
)
(defsynprop *prop-xcomm*
"xcomm"
:font "*courier-medium-o*-12-*"
:foreground "SkyBlue4"
)
(defsyntax *imake-mode* :main nil nil nil
(syntoken "^\\s*XCOMM\\W?.*$"
:property *prop-xcomm*)
(syntoken "^\\t+"
:property *prop-tabulation*)
(syntoken "$("
:nospec t
:begin :shell
:property *prop-shell*)
(syntoken "[][(){};$<=>&@/\\,.:~!|*?'`+-]"
:property *prop-shell*)
;; Preprocessor start rule.
(syntoken "^\\s*#\\s*\\w+"
:begin :preprocessor
:contained t)
;; Comment start rule.
(syntoken "/*"
:nospec t
:begin :comment
:contained t)
;; String start rule.
(syntoken "\""
:begin :string
:nospec t
:contained t)
;; Quoted string start rule.
(syntoken "\\\""
:begin :quoted-string
:nospec t
:contained t)
(syntable :shell *prop-variable* nil
(syntoken ")"
:nospec t
:property *prop-shell*
:switch -1)
)
;; Rules for comments.
(syntable :comment *prop-comment* nil
;; Match nested comments as an error.
(syntoken "/*"
:nospec t
:property *prop-error*)
(syntoken "XXX|TODO|FIXME"
:property *prop-annotation*)
;; Rule to finish a comment.
(syntoken "*/"
:nospec t
:switch -1)
)
;; Rules for preprocessor.
(syntable :preprocessor *prop-preprocessor* nil
;; Preprocessor includes comments.
(syntoken "/*"
:nospec t
:begin :comment
:contained t)
;; Visualization help, show tabs in the start of lines.
(syntoken "^\\t+"
:property *prop-tabulation*)
;; Ignore lines finishing with a backslash.
(syntoken "\\\\$")
;; Return to previous state if end of line found.
(syntoken ".?$"
:switch -1)
)
;; Rules for strings.
(syntable :string *prop-string* nil
;; Ignore escaped characters, this includes \".
(syntoken "\\\\.")
;; Ignore continuation in the next line.
(syntoken "\\\\$")
;; Rule to finish a string.
(syntoken "\""
:nospec t
:switch -1)
;; Don't allow strings continuing in the next line.
(syntoken ".?$"
:begin :error)
)
;; Rules for quoted strings.
(syntable :quoted-string *prop-constant* nil
;; Rule to finish the quoted string.
(syntoken "\\\""
:nospec t
:switch -1)
;; Ignore escaped characters
(syntoken "\\\\.")
;; Ignore continuation in the next line.
(syntoken "\\\\$")
;; Don't allow strings continuing in the next line.
(syntoken ".?$"
:begin :error)
)
(syntable :error *prop-error* nil
(syntoken "^.*$"
:switch -2)
)
)
|