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/xrdb.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-xrdb-comment*
375dfecf96Smrg    "xrdb-comment"
385dfecf96Smrg    :font	"*courier-medium-o*-12-*"
395dfecf96Smrg    :foreground	"sienna"
405dfecf96Smrg)
415dfecf96Smrg
425dfecf96Smrg(defsynprop *prop-xrdb-special*
435dfecf96Smrg    "format"
445dfecf96Smrg    :font	"*lucidatypewriter-medium-r*-12-*"
455dfecf96Smrg    :foreground	"RoyalBlue4"
465dfecf96Smrg)
475dfecf96Smrg
485dfecf96Smrg(defsynprop *prop-xrdb-punctuation*
495dfecf96Smrg    "punctuation"
505dfecf96Smrg    :font	"-*-courier-bold-r-*-*-14-*-*-*-*-*-*-1"
515dfecf96Smrg    :foreground	"OrangeRed4"
525dfecf96Smrg)
535dfecf96Smrg
545dfecf96Smrg(defsyntax *xrdb-mode* :main nil nil nil
555dfecf96Smrg    (syntoken "^\\s*!.*"
565dfecf96Smrg	:property *prop-xrdb-comment*)
575dfecf96Smrg    (syntoken "^\\s*#.*"
585dfecf96Smrg	:property *prop-preprocessor*)
595dfecf96Smrg    (syntoken "\\*|\\.|\\?"
605dfecf96Smrg	:property *prop-xrdb-punctuation*
615dfecf96Smrg	:begin :resource)
625dfecf96Smrg    (syntoken "."
635dfecf96Smrg	:nospec t
645dfecf96Smrg	:begin :resource)
655dfecf96Smrg
665dfecf96Smrg    ;; Extra comments
675dfecf96Smrg    (syntoken "/*" :nospec t :begin :comment :contained t)
685dfecf96Smrg    (syntable :comment *prop-comment* nil
695dfecf96Smrg	(syntoken "/*" :nospec t :property *prop-error*)
705dfecf96Smrg	;;  Rule to finish a comment.
715dfecf96Smrg	(syntoken "*/" :nospec t :switch -1)
725dfecf96Smrg    )
735dfecf96Smrg
745dfecf96Smrg    (syntable :resource nil nil
755dfecf96Smrg	(syntoken "\\*|\\.|\\?" :property *prop-xrdb-punctuation*)
765dfecf96Smrg	(syntoken ":\\s*" :property *prop-xrdb-punctuation* :begin :value)
775dfecf96Smrg    )
785dfecf96Smrg
795dfecf96Smrg    (syntable :value *prop-string* nil
805dfecf96Smrg	(syntoken "\\\\$" :property *prop-constant*)
815dfecf96Smrg
825dfecf96Smrg
835dfecf96Smrg	;; If the pattern ends at a newline, must switch to the previous state.
845dfecf96Smrg	;; Not sure yet how to better handle this. The parser does not detect
855dfecf96Smrg	;; eol because it is a match to the empty string. A possible hack
865dfecf96Smrg	;; would be to check if the pattern string ends in a "$", but probably
875dfecf96Smrg	;; better in this case to have a syntoken option, to tell the parser
885dfecf96Smrg	;; an eol may exist.
895dfecf96Smrg	(syntoken
905dfecf96Smrg	    (string-concat
915dfecf96Smrg		"("
925dfecf96Smrg		"\\d+|"				;; numbers
935dfecf96Smrg		"(#\\x+|rgb:\\x+/\\x+/\\x+)|"	;; color spec
945dfecf96Smrg		"#\\w+"				;; translation table
955dfecf96Smrg		")$")
965dfecf96Smrg	    :property *prop-xrdb-special* :switch -2)
975dfecf96Smrg	(syntoken "(\\\\n?|\")$"
985dfecf96Smrg	    :property *prop-constant* :switch -2)
995dfecf96Smrg
1005dfecf96Smrg	;; XXX Cut&paste of the above, only without the match to eol
1015dfecf96Smrg	(syntoken
1025dfecf96Smrg	    (string-concat
1035dfecf96Smrg		"("
1045dfecf96Smrg		"\\d+|"
1055dfecf96Smrg		"(#\\x+|rgb:\\x+/\\x+/\\x+)|"
1065dfecf96Smrg		"#\\w+"
1075dfecf96Smrg		")")
1085dfecf96Smrg	    :property *prop-xrdb-special*)
1095dfecf96Smrg	(syntoken "(\\\\n?|\")"
1105dfecf96Smrg	    :property *prop-constant*)
1115dfecf96Smrg
1125dfecf96Smrg	(syntoken "/*" :nospec t :begin :comment :contained t)
1135dfecf96Smrg	(syntoken ".?$" :switch -2)
1145dfecf96Smrg    )
1155dfecf96Smrg)
116