15dfecf96Smrg;;
25dfecf96Smrg;; Copyright (c) 2002 by The XFree86 Project, Inc.
35dfecf96Smrg;;
45dfecf96Smrg;; Permission is hereby granted, free of charge, to any person obtaining a
55dfecf96Smrg;; copy of this software and associated documentation files (the "Software"),
65dfecf96Smrg;; to deal in the Software without restriction, including without limitation
75dfecf96Smrg;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
85dfecf96Smrg;; and/or sell copies of the Software, and to permit persons to whom the
95dfecf96Smrg;; Software is furnished to do so, subject to the following conditions:
105dfecf96Smrg;;
115dfecf96Smrg;; The above copyright notice and this permission notice shall be included in
125dfecf96Smrg;; all copies or substantial portions of the Software.
135dfecf96Smrg;;
145dfecf96Smrg;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
155dfecf96Smrg;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
165dfecf96Smrg;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
175dfecf96Smrg;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
185dfecf96Smrg;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
195dfecf96Smrg;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
205dfecf96Smrg;; SOFTWARE.
215dfecf96Smrg;;
225dfecf96Smrg;; Except as contained in this notice, the name of the XFree86 Project shall
235dfecf96Smrg;; not be used in advertising or otherwise to promote the sale, use or other
245dfecf96Smrg;; dealings in this Software without prior written authorization from the
255dfecf96Smrg;; XFree86 Project.
265dfecf96Smrg;;
275dfecf96Smrg;; Author: Paulo César Pereira de Andrade
285dfecf96Smrg;;
295dfecf96Smrg;;
305dfecf96Smrg;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/imake.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $
315dfecf96Smrg;;
325dfecf96Smrg
335dfecf96Smrg(require "syntax")
345dfecf96Smrg(in-package "XEDIT")
355dfecf96Smrg
365dfecf96Smrg(defsynprop *prop-shell*
375dfecf96Smrg    "shell"
385dfecf96Smrg    :font	"*courier-bold-r*-12-*"
395dfecf96Smrg    :foreground	"Red4"
405dfecf96Smrg)
415dfecf96Smrg
425dfecf96Smrg(defsynprop *prop-variable*
435dfecf96Smrg    "variable"
445dfecf96Smrg    :font	"*courier-medium-r*-12-*"
455dfecf96Smrg    :foreground	"Red3"
465dfecf96Smrg)
475dfecf96Smrg
485dfecf96Smrg;;  The syntax-highlight definition does not try to flag errors, just show
495dfecf96Smrg;; tabs in the start of lines for better visualization.
505dfecf96Smrg(defsynprop *prop-tabulation*
515dfecf96Smrg    "tabulation"
525dfecf96Smrg    :font	"*courier-medium-r*-12-*"
535dfecf96Smrg    :background	"Gray90"
545dfecf96Smrg)
555dfecf96Smrg
565dfecf96Smrg(defsynprop *prop-xcomm*
575dfecf96Smrg    "xcomm"
585dfecf96Smrg    :font	"*courier-medium-o*-12-*"
595dfecf96Smrg    :foreground	"SkyBlue4"
605dfecf96Smrg)
615dfecf96Smrg
625dfecf96Smrg
635dfecf96Smrg(defsyntax *imake-mode* :main nil nil nil
645dfecf96Smrg    (syntoken "^\\s*XCOMM\\W?.*$"
655dfecf96Smrg	:property *prop-xcomm*)
665dfecf96Smrg
675dfecf96Smrg    (syntoken "^\\t+"
685dfecf96Smrg	:property *prop-tabulation*)
695dfecf96Smrg
705dfecf96Smrg    (syntoken "$("
715dfecf96Smrg	:nospec t
725dfecf96Smrg	:begin :shell
735dfecf96Smrg	:property *prop-shell*)
745dfecf96Smrg
755dfecf96Smrg    (syntoken "[][(){};$<=>&@/\\,.:~!|*?'`+-]"
765dfecf96Smrg	:property *prop-shell*)
775dfecf96Smrg
785dfecf96Smrg    ;;  Preprocessor start rule.
795dfecf96Smrg    (syntoken "^\\s*#\\s*\\w+"
805dfecf96Smrg	:begin :preprocessor
815dfecf96Smrg	:contained t)
825dfecf96Smrg
835dfecf96Smrg    ;;  Comment start rule.
845dfecf96Smrg    (syntoken "/*"
855dfecf96Smrg	:nospec t
865dfecf96Smrg	:begin :comment
875dfecf96Smrg	:contained t)
885dfecf96Smrg
895dfecf96Smrg    ;;  String start rule.
905dfecf96Smrg    (syntoken "\""
915dfecf96Smrg	:begin :string
925dfecf96Smrg	:nospec t
935dfecf96Smrg	:contained t)
945dfecf96Smrg
955dfecf96Smrg    ;;  Quoted string start rule.
965dfecf96Smrg    (syntoken "\\\""
975dfecf96Smrg	:begin :quoted-string
985dfecf96Smrg	:nospec t
995dfecf96Smrg	:contained t)
1005dfecf96Smrg
1015dfecf96Smrg    (syntable :shell *prop-variable* nil
1025dfecf96Smrg	(syntoken ")"
1035dfecf96Smrg	    :nospec t
1045dfecf96Smrg	    :property *prop-shell*
1055dfecf96Smrg	    :switch -1)
1065dfecf96Smrg    )
1075dfecf96Smrg
1085dfecf96Smrg    ;;  Rules for comments.
1095dfecf96Smrg    (syntable :comment *prop-comment* nil
1105dfecf96Smrg
1115dfecf96Smrg	;;  Match nested comments as an error.
1125dfecf96Smrg	(syntoken "/*"
1135dfecf96Smrg	    :nospec t
1145dfecf96Smrg	    :property *prop-error*)
1155dfecf96Smrg
1165dfecf96Smrg	(syntoken "XXX|TODO|FIXME"
1175dfecf96Smrg	    :property *prop-annotation*)
1185dfecf96Smrg
1195dfecf96Smrg	;;  Rule to finish a comment.
1205dfecf96Smrg	(syntoken "*/"
1215dfecf96Smrg	    :nospec t
1225dfecf96Smrg	    :switch -1)
1235dfecf96Smrg    )
1245dfecf96Smrg
1255dfecf96Smrg    ;;  Rules for preprocessor.
1265dfecf96Smrg    (syntable :preprocessor *prop-preprocessor* nil
1275dfecf96Smrg
1285dfecf96Smrg	;;  Preprocessor includes comments.
1295dfecf96Smrg	(syntoken "/*"
1305dfecf96Smrg	    :nospec t
1315dfecf96Smrg	    :begin :comment
1325dfecf96Smrg	    :contained t)
1335dfecf96Smrg
1345dfecf96Smrg	;;  Visualization help, show tabs in the start of lines.
1355dfecf96Smrg	(syntoken "^\\t+"
1365dfecf96Smrg	    :property *prop-tabulation*)
1375dfecf96Smrg
1385dfecf96Smrg	;;  Ignore lines finishing with a backslash.
1395dfecf96Smrg	(syntoken "\\\\$")
1405dfecf96Smrg
1415dfecf96Smrg	;;  Return to previous state if end of line found.
1425dfecf96Smrg	(syntoken ".?$"
1435dfecf96Smrg	    :switch -1)
1445dfecf96Smrg    )
1455dfecf96Smrg
1465dfecf96Smrg    ;;  Rules for strings.
1475dfecf96Smrg    (syntable :string *prop-string* nil
1485dfecf96Smrg
1495dfecf96Smrg	;;  Ignore escaped characters, this includes \".
1505dfecf96Smrg	(syntoken "\\\\.")
1515dfecf96Smrg
1525dfecf96Smrg	;;  Ignore continuation in the next line.
1535dfecf96Smrg	(syntoken "\\\\$")
1545dfecf96Smrg
1555dfecf96Smrg	;;  Rule to finish a string.
1565dfecf96Smrg	(syntoken "\""
1575dfecf96Smrg	    :nospec t
1585dfecf96Smrg	    :switch -1)
1595dfecf96Smrg
1605dfecf96Smrg	;;  Don't allow strings continuing in the next line.
1615dfecf96Smrg	(syntoken ".?$"
1625dfecf96Smrg	    :begin :error)
1635dfecf96Smrg    )
1645dfecf96Smrg
1655dfecf96Smrg    ;;  Rules for quoted strings.
1665dfecf96Smrg    (syntable :quoted-string *prop-constant* nil
1675dfecf96Smrg
1685dfecf96Smrg	;;  Rule to finish the quoted string.
1695dfecf96Smrg	(syntoken "\\\""
1705dfecf96Smrg	    :nospec t
1715dfecf96Smrg	    :switch -1)
1725dfecf96Smrg
1735dfecf96Smrg	;;  Ignore escaped characters
1745dfecf96Smrg	(syntoken "\\\\.")
1755dfecf96Smrg
1765dfecf96Smrg	;;  Ignore continuation in the next line.
1775dfecf96Smrg	(syntoken "\\\\$")
1785dfecf96Smrg
1795dfecf96Smrg	;;  Don't allow strings continuing in the next line.
1805dfecf96Smrg	(syntoken ".?$"
1815dfecf96Smrg	    :begin :error)
1825dfecf96Smrg    )
1835dfecf96Smrg
1845dfecf96Smrg    (syntable :error *prop-error* nil
1855dfecf96Smrg	(syntoken "^.*$"
1865dfecf96Smrg	    :switch -2)
1875dfecf96Smrg    )
1885dfecf96Smrg)
189