1;; 2;; Copyright (c) 2002 by The XFree86 Project, Inc. 3;; 4;; Permission is hereby granted, free of charge, to any person obtaining a 5;; copy of this software and associated documentation files (the "Software"), 6;; to deal in the Software without restriction, including without limitation 7;; the rights to use, copy, modify, merge, publish, distribute, sublicense, 8;; and/or sell copies of the Software, and to permit persons to whom the 9;; Software is furnished to do so, subject to the following conditions: 10;; 11;; The above copyright notice and this permission notice shall be included in 12;; all copies or substantial portions of the Software. 13;; 14;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 19;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20;; SOFTWARE. 21;; 22;; Except as contained in this notice, the name of the XFree86 Project shall 23;; not be used in advertising or otherwise to promote the sale, use or other 24;; dealings in this Software without prior written authorization from the 25;; XFree86 Project. 26;; 27;; Author: Paulo César Pereira de Andrade 28;; 29;; 30;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/xrdb.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ 31;; 32 33(require "syntax") 34(in-package "XEDIT") 35 36(defsynprop *prop-xrdb-comment* 37 "xrdb-comment" 38 :font "*courier-medium-o*-12-*" 39 :foreground "sienna" 40) 41 42(defsynprop *prop-xrdb-special* 43 "format" 44 :font "*lucidatypewriter-medium-r*-12-*" 45 :foreground "RoyalBlue4" 46) 47 48(defsynprop *prop-xrdb-punctuation* 49 "punctuation" 50 :font "-*-courier-bold-r-*-*-14-*-*-*-*-*-*-1" 51 :foreground "OrangeRed4" 52) 53 54(defsyntax *xrdb-mode* :main nil nil nil 55 (syntoken "^\\s*!.*" 56 :property *prop-xrdb-comment*) 57 (syntoken "^\\s*#.*" 58 :property *prop-preprocessor*) 59 (syntoken "\\*|\\.|\\?" 60 :property *prop-xrdb-punctuation* 61 :begin :resource) 62 (syntoken "." 63 :nospec t 64 :begin :resource) 65 66 ;; Extra comments 67 (syntoken "/*" :nospec t :begin :comment :contained t) 68 (syntable :comment *prop-comment* nil 69 (syntoken "/*" :nospec t :property *prop-error*) 70 ;; Rule to finish a comment. 71 (syntoken "*/" :nospec t :switch -1) 72 ) 73 74 (syntable :resource nil nil 75 (syntoken "\\*|\\.|\\?" :property *prop-xrdb-punctuation*) 76 (syntoken ":\\s*" :property *prop-xrdb-punctuation* :begin :value) 77 ) 78 79 (syntable :value *prop-string* nil 80 (syntoken "\\\\$" :property *prop-constant*) 81 82 83 ;; If the pattern ends at a newline, must switch to the previous state. 84 ;; Not sure yet how to better handle this. The parser does not detect 85 ;; eol because it is a match to the empty string. A possible hack 86 ;; would be to check if the pattern string ends in a "$", but probably 87 ;; better in this case to have a syntoken option, to tell the parser 88 ;; an eol may exist. 89 (syntoken 90 (string-concat 91 "(" 92 "\\d+|" ;; numbers 93 "(#\\x+|rgb:\\x+/\\x+/\\x+)|" ;; color spec 94 "#\\w+" ;; translation table 95 ")$") 96 :property *prop-xrdb-special* :switch -2) 97 (syntoken "(\\\\n?|\")$" 98 :property *prop-constant* :switch -2) 99 100 ;; XXX Cut&paste of the above, only without the match to eol 101 (syntoken 102 (string-concat 103 "(" 104 "\\d+|" 105 "(#\\x+|rgb:\\x+/\\x+/\\x+)|" 106 "#\\w+" 107 ")") 108 :property *prop-xrdb-special*) 109 (syntoken "(\\\\n?|\")" 110 :property *prop-constant*) 111 112 (syntoken "/*" :nospec t :begin :comment :contained t) 113 (syntoken ".?$" :switch -2) 114 ) 115) 116